예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="GhostNetwork.Publications.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="createPublicationModel"> (optional)</param>
        /// <returns>Task of ApiResponse (Publication)</returns>
        public async System.Threading.Tasks.Task <GhostNetwork.Publications.Client.ApiResponse <Publication> > PublicationsCreateAsyncWithHttpInfo(CreatePublicationModel createPublicationModel = default(CreatePublicationModel))
        {
            GhostNetwork.Publications.Client.RequestOptions localVarRequestOptions = new GhostNetwork.Publications.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json",
                "text/json",
                "application/_*+json"
            };

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

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            localVarRequestOptions.Data = createPublicationModel;


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <Publication>("/Publications", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }