createUser method

Future<ClientResponse<UserResponse, Errors>> createUser(
  1. String userId,
  2. UserRequest request
)

Creates a user. You can optionally specify an Id for the user, if not provided one will be generated.

@param {String} userId (Optional) The Id for the user. If not provided a secure random UUID will be generated. @param {UserRequest} request The request object that contains all the information used to create the user. @returns {Promise<ClientResponse

Implementation

Future<ClientResponse<UserResponse, Errors>> createUser(
    String userId, UserRequest request) {
  return _start<UserResponse, Errors>()
      .withUri('/api/user')
      .withUriSegment(userId)
      .withJSONBody(request)
      .withMethod('POST')
      .withResponseHandler(
          defaultResponseHandlerBuilder((d) => UserResponse.fromJson(d)))
      .go();
}