/// <summary> /// Bulk create transactions Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. /// </summary> /// <param name="budgetId">The id of the budget (\"last-used\" can also be used to specify the last used budget)</param> /// <param name="transactions">The list of transactions to create</param> /// <returns>BulkResponse</returns> public BulkResponse BulkCreateTransactions(Guid?budgetId, BulkTransactions transactions) { // verify the required parameter 'budgetId' is set if (budgetId == null) { throw new ApiException(400, "Missing required parameter 'budgetId' when calling BulkCreateTransactions"); } // verify the required parameter 'transactions' is set if (transactions == null) { throw new ApiException(400, "Missing required parameter 'transactions' when calling BulkCreateTransactions"); } var path = "/budgets/{budget_id}/transactions/bulk"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "budget_id" + "}", ApiClient.ParameterToString(budgetId)); var queryParams = new Dictionary <String, String>(); var headerParams = new Dictionary <String, String>(); var formParams = new Dictionary <String, String>(); var fileParams = new Dictionary <String, FileParameter>(); String postBody = null; postBody = ApiClient.Serialize(transactions); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "bearer" }; // make the HTTP request IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException((int)response.StatusCode, "Error calling BulkCreateTransactions: " + response.Content, response.Content); } else if (((int)response.StatusCode) == 0) { throw new ApiException((int)response.StatusCode, "Error calling BulkCreateTransactions: " + response.ErrorMessage, response.ErrorMessage); } return((BulkResponse)ApiClient.Deserialize(response.Content, typeof(BulkResponse), response.Headers)); }
/// <summary> /// Bulk create transactions Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. /// </summary> /// <exception cref="YNAB.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="budgetId">The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget).</param> /// <param name="transactions">The list of transactions to create</param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of ApiResponse (BulkResponse)</returns> public async System.Threading.Tasks.Task <YNAB.SDK.Client.ApiResponse <BulkResponse> > BulkCreateTransactionsWithHttpInfoAsync(string budgetId, BulkTransactions transactions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'budgetId' is set if (budgetId == null) { throw new YNAB.SDK.Client.ApiException(400, "Missing required parameter 'budgetId' when calling DeprecatedApi->BulkCreateTransactions"); } // verify the required parameter 'transactions' is set if (transactions == null) { throw new YNAB.SDK.Client.ApiException(400, "Missing required parameter 'transactions' when calling DeprecatedApi->BulkCreateTransactions"); } YNAB.SDK.Client.RequestOptions localVarRequestOptions = new YNAB.SDK.Client.RequestOptions(); String[] _contentTypes = new String[] { }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; var localVarContentType = YNAB.SDK.Client.ClientUtils.SelectHeaderContentType(_contentTypes); if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); } var localVarAccept = YNAB.SDK.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } localVarRequestOptions.PathParameters.Add("budget_id", YNAB.SDK.Client.ClientUtils.ParameterToString(budgetId)); // path parameter localVarRequestOptions.Data = transactions; // authentication (bearer) required if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.PostAsync <BulkResponse>("/budgets/{budget_id}/transactions/bulk", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("BulkCreateTransactions", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// Bulk create transactions Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. /// </summary> /// <exception cref="YNAB.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="budgetId">The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget).</param> /// <param name="transactions">The list of transactions to create</param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of BulkResponse</returns> public async System.Threading.Tasks.Task <BulkResponse> BulkCreateTransactionsAsync(string budgetId, BulkTransactions transactions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { YNAB.SDK.Client.ApiResponse <BulkResponse> localVarResponse = await BulkCreateTransactionsWithHttpInfoAsync(budgetId, transactions, cancellationToken).ConfigureAwait(false); return(localVarResponse.Data); }
/// <summary> /// Bulk create transactions Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. /// </summary> /// <exception cref="YNAB.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="budgetId">The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget).</param> /// <param name="transactions">The list of transactions to create</param> /// <returns>BulkResponse</returns> public BulkResponse BulkCreateTransactions(string budgetId, BulkTransactions transactions) { YNAB.SDK.Client.ApiResponse <BulkResponse> localVarResponse = BulkCreateTransactionsWithHttpInfo(budgetId, transactions); return(localVarResponse.Data); }
/// <summary> /// Bulk create transactions Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. /// </summary> /// <exception cref="YNAB.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="budgetId">The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)</param> /// <param name="transactions">The list of transactions to create</param> /// <returns>Task of ApiResponse (BulkResponse)</returns> public async System.Threading.Tasks.Task <YNAB.SDK.Client.ApiResponse <BulkResponse> > BulkCreateTransactionsAsyncWithHttpInfo(string budgetId, BulkTransactions transactions) { // verify the required parameter 'budgetId' is set if (budgetId == null) { throw new YNAB.SDK.Client.ApiException(400, "Missing required parameter 'budgetId' when calling DeprecatedApi->BulkCreateTransactions"); } // verify the required parameter 'transactions' is set if (transactions == null) { throw new YNAB.SDK.Client.ApiException(400, "Missing required parameter 'transactions' when calling DeprecatedApi->BulkCreateTransactions"); } YNAB.SDK.Client.RequestOptions requestOptions = new YNAB.SDK.Client.RequestOptions(); String[] @contentTypes = new String[] { }; // 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); } if (budgetId != null) { requestOptions.PathParameters.Add("budget_id", YNAB.SDK.Client.ClientUtils.ParameterToString(budgetId)); // path parameter } requestOptions.Data = transactions; // authentication (bearer) required if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { requestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var response = await this.AsynchronousClient.PostAsync <BulkResponse>("/budgets/{budget_id}/transactions/bulk", requestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception exception = this.ExceptionFactory("BulkCreateTransactions", response); if (exception != null) { throw exception; } } return(response); }
/// <summary> /// Bulk create transactions Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. /// </summary> /// <exception cref="YNAB.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="budgetId">The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)</param> /// <param name="transactions">The list of transactions to create</param> /// <returns>Task of BulkResponse</returns> public async System.Threading.Tasks.Task <BulkResponse> BulkCreateTransactionsAsync(string budgetId, BulkTransactions transactions) { YNAB.SDK.Client.ApiResponse <BulkResponse> localVarResponse = await BulkCreateTransactionsAsyncWithHttpInfo(budgetId, transactions); return(localVarResponse.Data); }