/// <summary> /// Create Create a Transaction template.<br /> You MUST provide either sellerExternalId or sellerTripartieId but not both /// </summary> /// <exception cref="TripartieWebAPI.CSharpClient.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="requestCreateTransactionTemplate"></param> /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param> /// <returns>Task of ModelTransactionTemplate</returns> public async System.Threading.Tasks.Task <ModelTransactionTemplate> CreateAsync(RequestCreateTransactionTemplate requestCreateTransactionTemplate, CancellationToken cancellationToken = default(CancellationToken)) { ApiResponse <ModelTransactionTemplate> localVarResponse = await CreateWithHttpInfoAsync(requestCreateTransactionTemplate, cancellationToken); return(localVarResponse.Data); }
/// <summary> /// Create Create a Transaction template.<br /> You MUST provide either sellerExternalId or sellerTripartieId but not both /// </summary> /// <exception cref="TripartieWebAPI.CSharpClient.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="requestCreateTransactionTemplate"></param> /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param> /// <returns>Task of ApiResponse (ModelTransactionTemplate)</returns> public async System.Threading.Tasks.Task <ApiResponse <ModelTransactionTemplate> > CreateWithHttpInfoAsync(RequestCreateTransactionTemplate requestCreateTransactionTemplate, CancellationToken cancellationToken = default(CancellationToken)) { // verify the required parameter 'requestCreateTransactionTemplate' is set if (requestCreateTransactionTemplate == null) { throw new ApiException(400, "Missing required parameter 'requestCreateTransactionTemplate' when calling TransactionTemplatesApi->Create"); } var localVarPath = "/api/web/transaction-templates/"; 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 (requestCreateTransactionTemplate != null && requestCreateTransactionTemplate.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(requestCreateTransactionTemplate); // http body (model) parameter } else { localVarPostBody = requestCreateTransactionTemplate; // byte array } // authentication (ClientIdAuth) required if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("client-id"))) { localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "client-id", this.Configuration.GetApiKeyWithPrefix("client-id"))); } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType, cancellationToken); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("Create", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <ModelTransactionTemplate>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (ModelTransactionTemplate)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelTransactionTemplate)))); }
/// <summary> /// Create Create a Transaction template.<br /> You MUST provide either sellerExternalId or sellerTripartieId but not both /// </summary> /// <exception cref="TripartieWebAPI.CSharpClient.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="requestCreateTransactionTemplate"></param> /// <returns>ModelTransactionTemplate</returns> public ModelTransactionTemplate Create(RequestCreateTransactionTemplate requestCreateTransactionTemplate) { ApiResponse <ModelTransactionTemplate> localVarResponse = CreateWithHttpInfo(requestCreateTransactionTemplate); return(localVarResponse.Data); }