/// <summary> /// \u7B7E\u7F72\u6587\u4EF6 \u7B7E\u7F72\u6587\u4EF6 /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="clientId"></param> /// <param name="body"> (optional)</param> /// <returns>Task of ApiResponse (DocumentSummary)</returns> public async System.Threading.Tasks.Task <ApiResponse <DocumentSummary> > CreateDocumentAsyncWithHttpInfo(string clientId, DocumentDefinition body = null) { // verify the required parameter 'clientId' is set if (clientId == null) { throw new ApiException(400, "Missing required parameter 'clientId' when calling CreateDocument"); } var localVarPath = "/clients/{clientId}/documents"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <String, String>(); var localVarHeaderParams = new Dictionary <String, String>(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 = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (clientId != null) { localVarPathParams.Add("clientId", Configuration.ApiClient.ParameterToString(clientId)); // path parameter } if (body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } else { localVarPostBody = body; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (localVarStatusCode >= 400) { throw new ApiException(localVarStatusCode, "Error calling CreateDocument: " + localVarResponse.Content, localVarResponse.Content); } else if (localVarStatusCode == 0) { throw new ApiException(localVarStatusCode, "Error calling CreateDocument: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); } return(new ApiResponse <DocumentSummary>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (DocumentSummary)Configuration.ApiClient.Deserialize(localVarResponse, typeof(DocumentSummary)))); }