示例#1
0
        /// <summary>
        /// Creates a user Create a new user. Only root users are allowed to create new users.
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userNewIn"> (optional)</param>
        /// <returns>ApiResponse of SingleUserMessage</returns>
        public BJR.Client.ApiResponse <SingleUserMessage> CreateUserWithHttpInfo(UserNewIn userNewIn = default(UserNewIn))
        {
            BJR.Client.RequestOptions localVarRequestOptions = new BJR.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            var localVarContentType = BJR.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = BJR.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = userNewIn;

            // authentication (bearerAuth) required
            // bearer authentication required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
            }

            // make the HTTP request
            var localVarResponse = this.Client.Post <SingleUserMessage>("/user_api", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
示例#2
0
        /// <summary>
        /// Creates a user Create a new user. Only root users are allowed to create new users.
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userNewIn"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of SingleUserMessage</returns>
        public async System.Threading.Tasks.Task <SingleUserMessage> CreateUserAsync(UserNewIn userNewIn = default(UserNewIn), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            BJR.Client.ApiResponse <SingleUserMessage> localVarResponse = await CreateUserWithHttpInfoAsync(userNewIn, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
示例#3
0
 /// <summary>
 /// Creates a user Create a new user. Only root users are allowed to create new users.
 /// </summary>
 /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="userNewIn"> (optional)</param>
 /// <returns>SingleUserMessage</returns>
 public SingleUserMessage CreateUser(UserNewIn userNewIn = default(UserNewIn))
 {
     BJR.Client.ApiResponse <SingleUserMessage> localVarResponse = CreateUserWithHttpInfo(userNewIn);
     return(localVarResponse.Data);
 }