register method

Registers a user for an application. If you provide the User and the UserRegistration object on this request, it will create the user as well as register them for the application. This is called a Full Registration. However, if you only provide the UserRegistration object, then the user must already exist and they will be registered for the application. The user id can also be provided and it will either be used to look up an existing user or it will be used for the newly created User.

@param {String} userId (Optional) The Id of the user being registered for the application and optionally created. @param {RegistrationRequest} request The request that optionally contains the User and must contain the UserRegistration. @returns {Promise<ClientResponse

Implementation

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