Users

Defined in dfx/api/UserAPI.hpp

Create

virtual CloudStatus dfx::api::UserAPI::create(const CloudConfig &config, const std::string &email, const std::string &password, const std::string &role, const std::string &firstName, const std::string &lastName, const std::string &phoneNumber, const std::string &gender, const std::string &dateOfBirth, const uint16_t heightCM, const uint16_t weightKG, std::string &userID)

Create a user on the DFX Cloud.

A JWT User Token is required to perform operations with the DFX Cloud, to obtain a User Token a user must exist on the system and login using their username and password combination.

Only a user with the administrator role for an organization can create a user account.

Parameters
  • config – provides all the cloud configuration settings

  • email – the email address for the account being created

  • password – the password associated with the newly created account

  • role – the role the created user will have

  • firstName – (Optional)the firstName the created user will have

  • lastName – (Optional)the lastName the created user will have

  • phoneNumber – (Optional)user phoneNumber

  • gender – (Optional)user gender

  • dateOfBirth – (Optional)user dateOfBirth “YYYY-MM-DD”

  • heightCM – (Optional)user height

  • weightKG – (Optional)user weight

  • userID – the unique identifier for the created account

Returns

status of operation, CLOUD_OK on SUCCESS

Retrieve

virtual CloudStatus dfx::api::UserAPI::list(const CloudConfig &config, const std::unordered_map<UserFilter, std::string> &filters, uint16_t offset, std::vector<User> &users, int16_t &totalCount)

Retrieve the users visible to the logged in user on the DFX Cloud server.

Parameters
  • config – provides all the cloud configuration settings

  • filters

  • offset – to start the retrieval of records up to config.listLimit

  • users – the vector where the returned users will be added

  • totalCount – the total number of records on the server

Returns

status of operation, CLOUD_OK on SUCCESS

virtual CloudStatus dfx::api::UserAPI::retrieve(const CloudConfig &config, const std::string &userID, const std::string &email, User &user)

Retrieve a user from the server based on the userID and/or email.

Note

Only one of userID or email is required and the other can be left empty except in the case where the email is used across multiple organizations and the userID is required.

Parameters
  • config – provides all the cloud configuration settings

  • userID – unique ID of the user being retrieved

  • email – the associated email address of the account

  • user – the retrieved user account

Returns

status of operation, CLOUD_OK on SUCCESS

Update

virtual CloudStatus dfx::api::UserAPI::update(const CloudConfig &config, const User &user)

Update a user on the server.

Parameters
  • config – provides all the cloud configuration settings

  • user – account to update

Returns

status of operation, CLOUD_OK on SUCCESS

Delete

virtual CloudStatus dfx::api::UserAPI::remove(const CloudConfig &config, const std::string &userID, const std::string &email)

Remove a user from the server based on the userID and/or email.

Note

Only one of userID or email is required and the other can be left empty except in the case where the email is used across multiple organizations and the userID is required.

Parameters
  • config – provides all the cloud configuration settings

  • userID – unique ID of the user being retrieved

  • email – the associated email address of the account

Returns

status of operation, CLOUD_OK on SUCCESS

Other

virtual CloudStatus dfx::api::UserAPI::reqLoginCode(const CloudConfig &config, const std::string &sOrgKey, const std::string &sPhoNum)

get login verification code.

Use mobile phone number to get login verification code First of all, the mobile phone number is the number of the registered user The obtained code will be notified by SMS

Parameters
  • config – provides all the cloud configuration settings

  • sOrgKey – User organization name

  • sPhoNum – Phone number

Returns

status of operation, CLOUD_OK on SUCCESS

virtual CloudStatus dfx::api::UserAPI::loginWithPhoneCode(CloudConfig &config, const std::string &sOrgKey, const std::string &sPhoNum, const std::string &sPhoCode)

login with verification code

Parameters
  • config – provides all the cloud configuration settings

  • sOrgKey – User organization name

  • sPhoNum – Phone number

  • sPhoCode – verification code

Returns

status of operation, CLOUD_OK on SUCCESS

virtual CloudStatus dfx::api::UserAPI::retrieveUserRole(const CloudConfig &config, UserRole &userRole)

Get the current user role information.

Parameters
  • config – provides all the cloud configuration settings

  • userRole – the retrieved user role

Returns

status of operation, CLOUD_OK on SUCCESS

virtual CloudStatus dfx::api::UserAPI::sendPasswordReset(const CloudConfig &config, const std::string &sIdentifier, std::string &sResetToken)

Password reset request.

Dispatches a password reset request email to the user which contains a reset password token. Upon retrieving this value the token is used against the Reset Password endpoint

See

resetPassword

Parameters
  • config – provides all the cloud configuration settings

  • sIdentifier – Organization identification

  • sResetToken – the retrieved Reset Token

Returns

status of operation, CLOUD_OK on SUCCESS

virtual CloudStatus dfx::api::UserAPI::resetPassword(const CloudConfig &config, const std::string &sPassword, const std::string &sResetToken)

reset password

See

sendPasswordReset

Parameters
  • config – provides all the cloud configuration settings

  • sPassword – New password

  • sResetToken – Reset Token

Returns

status of operation, CLOUD_OK on SUCCESS

virtual CloudStatus dfx::api::UserAPI::sendVerificationCode(const CloudConfig &config, const std::string &sUserID, const std::string &sOrgKey)

Sends an account verification code to the user’s email address.

See

verifyAccount

Parameters
  • config – provides all the cloud configuration settings

  • sUserID – user id

  • sOrgKey – User organization id

Returns

status of operation, CLOUD_OK on SUCCESS

virtual CloudStatus dfx::api::UserAPI::verifyAccount(const CloudConfig &config, const std::string &sUserID, const std::string &sVerCode)

reset password

See

sendVerificationCode

Parameters
  • config – provides all the cloud configuration settings

  • sUserID – user id

  • sVerCode – Verification Code

Returns

status of operation, CLOUD_OK on SUCCESS