示例#1
0
        /// <summary>
        /// Create a new job. Create a new job. __Minimum server version: 4.1__ ##### Permissions Must have &#x60;manage_jobs&#x60; permission.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"></param>
        /// <returns>ApiResponse of Job</returns>
        public ApiResponse <Job> JobsPostWithHttpInfo(InlineObject46 body)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling JobsApi->JobsPost");
            }

            var requestOptions = new RequestOptions();

            string[] @contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] @accepts = new string[] {
                "application/json"
            };

            var localVarContentType = Sdcb.Mattermost.DotNetSdk.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

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

            var localVarAccept = Sdcb.Mattermost.DotNetSdk.Client.ClientUtils.SelectHeaderAccept(@accepts);

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

            requestOptions.Data = body;


            // make the HTTP request

            var response = this.Client.Post <Job>("/jobs", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("JobsPost", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
示例#2
0
        /// <summary>
        /// Create a new job. Create a new job. __Minimum server version: 4.1__ ##### Permissions Must have &#x60;manage_jobs&#x60; permission.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"></param>
        /// <returns>Task of ApiResponse (Job)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Job> > JobsPostAsyncWithHttpInfo(InlineObject46 body)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling JobsApi->JobsPost");
            }


            var requestOptions = new RequestOptions();

            string[] @contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] @accepts = new string[] {
                "application/json"
            };

            foreach (var contentType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", contentType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            requestOptions.Data = body;


            // make the HTTP request

            var response = await this.AsynchronousClient.PostAsync <Job>("/jobs", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("JobsPost", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
示例#3
0
        /// <summary>
        /// Create a new job. Create a new job. __Minimum server version: 4.1__ ##### Permissions Must have &#x60;manage_jobs&#x60; permission.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"></param>
        /// <returns>Task of Job</returns>
        public async System.Threading.Tasks.Task <Job> JobsPostAsync(InlineObject46 body)
        {
            ApiResponse <Job> localVarResponse = await JobsPostAsyncWithHttpInfo(body);

            return(localVarResponse.Data);
        }
示例#4
0
        /// <summary>
        /// Create a new job. Create a new job. __Minimum server version: 4.1__ ##### Permissions Must have &#x60;manage_jobs&#x60; permission.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"></param>
        /// <returns>Job</returns>
        public Job JobsPost(InlineObject46 body)
        {
            ApiResponse <Job> localVarResponse = JobsPostWithHttpInfo(body);

            return(localVarResponse.Data);
        }