/// <summary> /// Create a Document Attachment /// </summary> /// <exception cref="SignRequest.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="data"></param> /// <returns>Task of ApiResponse (DocumentAttachment)</returns> public async System.Threading.Tasks.Task <ApiResponse <DocumentAttachment> > DocumentAttachmentsCreateAsyncWithHttpInfo(DocumentAttachment data) { // verify the required parameter 'data' is set if (data == null) { throw new ApiException(400, "Missing required parameter 'data' when calling DocumentAttachmentsApi->DocumentAttachmentsCreate"); } var localVarPath = "./document-attachments/"; 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 (data != null && data.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(data); // http body (model) parameter } else { localVarPostBody = data; // byte array } // authentication (Token) required if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { localVarHeaderParams["Authorization"] = this.Configuration.GetApiKeyWithPrefix("Authorization"); } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("DocumentAttachmentsCreate", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <DocumentAttachment>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (DocumentAttachment)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(DocumentAttachment)))); }