createOrganizationUserRole method
      
Future<Response<SuccessResponse> > 
createOrganizationUserRole({ 
    
- required String orgCode,
- required String userId,
- required CreateOrganizationUserRoleRequest createOrganizationUserRoleRequest,
- CancelToken? cancelToken,
- Map<String, dynamic> ? headers,
- Map<String, dynamic> ? extra,
- ValidateStatus? validateStatus,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
Add Organization User Role Add role to an organization user.
Parameters:
- orgCode- The organization's code.
- userId- The user's id.
- createOrganizationUserRoleRequest- Role details.
- cancelToken- A- CancelTokenthat can be used to cancel the operation
- headers- Can be used to add additional headers to the request
- extras- Can be used to add flags to the request
- validateStatus- A- ValidateStatuscallback that can be used to determine request success based on the HTTP status of the response
- onSendProgress- A- ProgressCallbackthat can be used to get the send progress
- onReceiveProgress- A- ProgressCallbackthat can be used to get the receive progress
Returns a Future containing a Response with a SuccessResponse as data
Throws DioException if API call or serialization fails
Implementation
Future<Response<SuccessResponse>> createOrganizationUserRole({
  required String orgCode,
  required String userId,
  required CreateOrganizationUserRoleRequest
  createOrganizationUserRoleRequest,
  CancelToken? cancelToken,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? extra,
  ValidateStatus? validateStatus,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  final path = r'/api/v1/organizations/{org_code}/users/{user_id}/roles'
      .replaceAll(
        '{'
        r'org_code'
        '}',
        encodeQueryParameter(
          _serializers,
          orgCode,
          const FullType(String),
        ).toString(),
      )
      .replaceAll(
        '{'
        r'user_id'
        '}',
        encodeQueryParameter(
          _serializers,
          userId,
          const FullType(String),
        ).toString(),
      );
  final options = Options(
    method: r'POST',
    headers: <String, dynamic>{...?headers},
    extra: <String, dynamic>{
      'secure': <Map<String, String>>[
        {'type': 'http', 'scheme': 'bearer', 'name': 'kindeBearerAuth'},
      ],
      ...?extra,
    },
    contentType: 'application/json',
    validateStatus: validateStatus,
  );
  dynamic bodyData;
  try {
    const type = FullType(CreateOrganizationUserRoleRequest);
    bodyData = _serializers.serialize(
      createOrganizationUserRoleRequest,
      specifiedType: type,
    );
  } catch (error, stackTrace) {
    throw DioException(
      requestOptions: options.compose(_dio.options, path),
      type: DioExceptionType.unknown,
      error: error,
      stackTrace: stackTrace,
    );
  }
  final response = await _dio.request<Object>(
    path,
    data: bodyData,
    options: options,
    cancelToken: cancelToken,
    onSendProgress: onSendProgress,
    onReceiveProgress: onReceiveProgress,
  );
  SuccessResponse? responseData;
  try {
    final rawResponse = response.data;
    responseData =
        rawResponse == null
            ? null
            : _serializers.deserialize(
                  rawResponse,
                  specifiedType: const FullType(SuccessResponse),
                )
                as SuccessResponse;
  } catch (error, stackTrace) {
    throw DioException(
      requestOptions: response.requestOptions,
      response: response,
      type: DioExceptionType.unknown,
      error: error,
      stackTrace: stackTrace,
    );
  }
  return Response<SuccessResponse>(
    data: responseData,
    headers: response.headers,
    isRedirect: response.isRedirect,
    requestOptions: response.requestOptions,
    redirects: response.redirects,
    statusCode: response.statusCode,
    statusMessage: response.statusMessage,
    extra: response.extra,
  );
}