/// <summary>
        /// Create a new account Creates a new account
        /// </summary>
        /// <exception cref="YNAB.SDK.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="budgetId">The id of the budget (\&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)</param>
        /// <param name="data">The account to create.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of AccountResponse</returns>
        public async System.Threading.Tasks.Task <AccountResponse> CreateAccountAsync(string budgetId, SaveAccountWrapper data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            YNAB.SDK.Client.ApiResponse <AccountResponse> localVarResponse = await CreateAccountWithHttpInfoAsync(budgetId, data, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Create a new account Creates a new account
        /// </summary>
        /// <exception cref="YNAB.SDK.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="budgetId">The id of the budget (\&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)</param>
        /// <param name="data">The account to create.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (AccountResponse)</returns>
        public async System.Threading.Tasks.Task <YNAB.SDK.Client.ApiResponse <AccountResponse> > CreateAccountWithHttpInfoAsync(string budgetId, SaveAccountWrapper data, 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 AccountsApi->CreateAccount");
            }

            // verify the required parameter 'data' is set
            if (data == null)
            {
                throw new YNAB.SDK.Client.ApiException(400, "Missing required parameter 'data' when calling AccountsApi->CreateAccount");
            }


            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 = data;

            // 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 <AccountResponse>("/budgets/{budget_id}/accounts", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return(localVarResponse);
        }
 /// <summary>
 /// Create a new account Creates a new account
 /// </summary>
 /// <exception cref="YNAB.SDK.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="budgetId">The id of the budget (\&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)</param>
 /// <param name="data">The account to create.</param>
 /// <returns>AccountResponse</returns>
 public AccountResponse CreateAccount(string budgetId, SaveAccountWrapper data)
 {
     YNAB.SDK.Client.ApiResponse <AccountResponse> localVarResponse = CreateAccountWithHttpInfo(budgetId, data);
     return(localVarResponse.Data);
 }