예제 #1
0
        /// <summary>
        /// Retrieves users Get a list of users
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="perPage"> (optional)</param>
        /// <param name="page"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (UserArrayMessage)</returns>
        public async System.Threading.Tasks.Task <BJR.Client.ApiResponse <UserArrayMessage> > GetUsersWithHttpInfoAsync(int?perPage = default(int?), int?page = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            BJR.Client.RequestOptions localVarRequestOptions = new BJR.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // 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);
            }

            if (perPage != null)
            {
                localVarRequestOptions.QueryParameters.Add(BJR.Client.ClientUtils.ParameterToMultiMap("", "per_page", perPage));
            }
            if (page != null)
            {
                localVarRequestOptions.QueryParameters.Add(BJR.Client.ClientUtils.ParameterToMultiMap("", "page", page));
            }

            // 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 = await this.AsynchronousClient.GetAsync <UserArrayMessage>("/user_api", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return(localVarResponse);
        }
예제 #2
0
        /// <summary>
        /// Get tags Retrieves the list of tags that are currently in use for the authenticated user.
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="perPage"> (optional)</param>
        /// <param name="page"> (optional)</param>
        /// <returns>ApiResponse of TagMessage</returns>
        public BJR.Client.ApiResponse <TagMessage> GetTagsWithHttpInfo(int?perPage = default(int?), int?page = default(int?))
        {
            BJR.Client.RequestOptions localVarRequestOptions = new BJR.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // 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);
            }

            if (perPage != null)
            {
                localVarRequestOptions.QueryParameters.Add(BJR.Client.ClientUtils.ParameterToMultiMap("", "per_page", perPage));
            }
            if (page != null)
            {
                localVarRequestOptions.QueryParameters.Add(BJR.Client.ClientUtils.ParameterToMultiMap("", "page", page));
            }

            // 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.Get <TagMessage>("/tags", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
예제 #3
0
        /// <summary>
        /// Update a single user Update a single user. If you&#39;re a non-root users, then you can only update your own user.
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="userUpdateIn"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (SingleUserMessage)</returns>
        public async System.Threading.Tasks.Task <BJR.Client.ApiResponse <SingleUserMessage> > UpdateUserWithHttpInfoAsync(int id, UserUpdateIn userUpdateIn = default(UserUpdateIn), 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.PathParameters.Add("id", BJR.Client.ClientUtils.ParameterToString(id)); // path parameter
            localVarRequestOptions.Data = userUpdateIn;

            // 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 = await this.AsynchronousClient.PutAsync <SingleUserMessage>("/user_api/{id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return(localVarResponse);
        }
예제 #4
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);
        }
예제 #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>
        /// <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);
        }
예제 #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>
        /// <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);
        }
예제 #7
0
        /// <summary>
        /// Server version The BJR server version
        /// </summary>
        /// <exception cref="BJR.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>ApiResponse of ServerVersion</returns>
        public BJR.Client.ApiResponse <ServerVersion> GetVersionWithHttpInfo()
        {
            BJR.Client.RequestOptions localVarRequestOptions = new BJR.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // 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);
            }



            // make the HTTP request
            var localVarResponse = this.Client.Get <ServerVersion>("/version", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }