Пример #1
0
        /// <summary>
        /// Authenticates a user and returns a token Authenticates a user and returns a token
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authIn"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
        /// <returns>Task of ApiResponse (AuthOut)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <AuthOut> > AuthenticateUserWithHttpInfoAsync(AuthIn authIn = default(AuthIn), CancellationToken cancellationToken = default(CancellationToken))
        {
            var    localVarPath         = "/authenticate";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (authIn != null && authIn.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(authIn); // http body (model) parameter
            }
            else
            {
                localVarPostBody = authIn; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType, cancellationToken);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("AuthenticateUser", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <AuthOut>(localVarStatusCode,
                                             localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                             (AuthOut)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AuthOut))));
        }
Пример #2
0
        /// <summary>
        /// Authenticates a user and returns a token Authenticates a user and returns a token
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authIn"> (optional)</param>
        /// <returns>ApiResponse of AuthOut</returns>
        public BJR.Client.ApiResponse <AuthOut> AuthenticateUserWithHttpInfo(AuthIn authIn = default(AuthIn))
        {
            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 = authIn;


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

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

            return(localVarResponse);
        }
Пример #3
0
        /// <summary>
        /// Authenticates a user and returns a token Authenticates a user and returns a token
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authIn"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (AuthOut)</returns>
        public async System.Threading.Tasks.Task <BJR.Client.ApiResponse <AuthOut> > AuthenticateUserWithHttpInfoAsync(AuthIn authIn = default(AuthIn), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            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 = authIn;


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <AuthOut>("/authenticate", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return(localVarResponse);
        }
Пример #4
0
        /// <summary>
        /// Authenticates a user and returns a token Authenticates a user and returns a token
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authIn"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of AuthOut</returns>
        public async System.Threading.Tasks.Task <AuthOut> AuthenticateUserAsync(AuthIn authIn = default(AuthIn), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            BJR.Client.ApiResponse <AuthOut> localVarResponse = await AuthenticateUserWithHttpInfoAsync(authIn, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
Пример #5
0
 /// <summary>
 /// Authenticates a user and returns a token Authenticates a user and returns a token
 /// </summary>
 /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="authIn"> (optional)</param>
 /// <returns>AuthOut</returns>
 public AuthOut AuthenticateUser(AuthIn authIn = default(AuthIn))
 {
     BJR.Client.ApiResponse <AuthOut> localVarResponse = AuthenticateUserWithHttpInfo(authIn);
     return(localVarResponse.Data);
 }
Пример #6
0
        /// <summary>
        /// Authenticates a user and returns a token Authenticates a user and returns a token
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authIn"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
        /// <returns>Task of AuthOut</returns>
        public async System.Threading.Tasks.Task <AuthOut> AuthenticateUserAsync(AuthIn authIn = default(AuthIn), CancellationToken cancellationToken = default(CancellationToken))
        {
            ApiResponse <AuthOut> localVarResponse = await AuthenticateUserWithHttpInfoAsync(authIn, cancellationToken);

            return(localVarResponse.Data);
        }