@slmdevs/celeraone
Version:
This is a NPM Package to use for all the CeleraOne interactions.
111 lines (110 loc) • 4.71 kB
TypeScript
import UserInterface from '../API/Internal/UserInterface';
import UserResponse from './UserResponse';
import MasterDataInterface from '../API/Internal/MasterDataInterface';
import ServiceId from '../ServiceId';
import SearchUserOptions from '../API/Internal/SearchUserOptions';
import SearchUserResponse from './SearchUserResponse';
import PasswordType from './PasswordType';
/**
* Import a new user into CeleraOne
*
* @param { UserInterface } user The user object that should be imported
* @returns { Promise<ImportUserResponse> }
*/
export declare const importUser: (user: UserInterface) => Promise<string>;
/**
* Add a property to the user in CeleraOne
*
* @param { string } userId The userId of the CeleraOne user
* @param { string } name The name of the property
* @param { string } value The value of the property
* @throws { InternalErrorResponse[] }
* @returns { Promise<UserPropertyResponse> } a boolean if the operation was successfull or not
*/
export declare const addUserProperty: (userId: string, name: string, value: string) => Promise<boolean>;
/**
* Delete a property from the user in CeleraOne
*
* @param { string } userId The userId of the CeleraOne user
* @param { string } name The name of the property
* @returns { Promise<boolean> } a boolean if the operation was successfull or not
*/
export declare const deleteUserProperty: (userId: string, name: string) => Promise<boolean>;
/**
* Find and return a user object from CeleraOne
*
* @param { string } contractorId The contractorId of the user
* @throws { InternalErrorResponse[] }
* @returns { Promise<UserResponse> } Promise object of UserResponse type
*/
export declare const findUser: (contractorId: string) => Promise<UserResponse>;
/**
* Update the users password with a new bcrypt hash in CeleraOne
*
* @param userId The userId of the CeleraOne user
* @param passwordHash The bcrypt password hash
* @throws { InternalErrorResponse[] }
* @returns { Promise<boolean> } a boolean if the operation as successfull or not
*/
export declare const updateUserPassword: (userId: string, passwordType: PasswordType, password: string) => Promise<boolean>;
/**
* Update the users login
*
* @param { string } userId The userId of the CeleraOne user
* @param { string } newLogin The new login for the user
* @throws { InternalErrorResponse[] }
* @returns { Promise<boolean> } a boolean if the operation was successfull or not
*/
export declare const updateUserLogin: (userId: string, newLogin: string) => Promise<boolean>;
/**
* Update the MasterData for the selected CeleraOne user
*
* @param { string } userId The userId of the CeleraOne user
* @param { MasterDataInterface } data The data that will be updated for the user
* @throws { InternalErrorResponse[] }
* @returns { Promise<boolean> } a boolean if the operation was successfull or not
*/
export declare const updateUserMasterData: (userId: string, data: MasterDataInterface) => Promise<boolean>;
/**
* Purge/Delete the user from CeleraOne
*
* @param { string } userId The userId of the CeleraOne user
* @throws { InternalErrorResponse[] }
* @returns { Promise<boolean> } a boolean if the operation was successfull or not
*/
export declare const purgeUser: (userId: string) => Promise<boolean>;
/**
* Get the userId via the users session_id value
*
* @param { string } sessionId The users CeleraOne session_id
* @param { ServiceId } serviceId CeleraOne's service_id
* @throws { InternalErrorResponse[] }
* @returns { Promise<string> } the userId for the user
*/
export declare const getUserIdFromSessionId: (sessionId: string, serviceId: ServiceId) => Promise<string>;
/**
* Search for users in CeleraOne
*
* @param { SearchUserOptions } query Query parameters
* @throws { InternalErrorResponse[] }
* @returns { Promise<SearchUserResponse> } a object of the users and total found
*/
export declare const searchUser: (query: SearchUserOptions) => Promise<SearchUserResponse>;
/**
* Get a single User Property of a CeleraOne User
*
* @param { string } userId The CelereaOne userId
* @param { string } property The User Propety
* @throws { InternalErrorResponse[] }
* @returns { Promise<string> } a string of the User Property value
*/
export declare const getUserSingleProperty: (userId: string, property: string) => Promise<string>;
/**
* Change the Login Alias for the CeleraOne User
*
* @param userId The CeleraOne userID
* @param loginAlias The Login Alias that the user will change to
* @throws { InternalErrorResponse[] }
* @returns { Promise<string> } a string if the operation was successfull
*/
export declare const changeUserLoginAlias: (userId: string, login_alias: string) => Promise<string>;