/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { ApiResponse, RequestOptions } from '../core';
import {
  AC1110Retrieveaccountstatements,
  aC1110RetrieveaccountstatementsSchema,
} from '../models/aC1110Retrieveaccountstatements';
import {
  AC111Retrieveanaccount,
  aC111RetrieveanaccountSchema,
} from '../models/aC111Retrieveanaccount';
import {
  AC112Retrieveaccountbalance,
  aC112RetrieveaccountbalanceSchema,
} from '../models/aC112Retrieveaccountbalance';
import {
  AC113Retrieveaccountbeneficiaries,
  aC113RetrieveaccountbeneficiariesSchema,
} from '../models/aC113Retrieveaccountbeneficiaries';
import {
  AC114Retrieveaccountdirectdebits,
  aC114RetrieveaccountdirectdebitsSchema,
} from '../models/aC114Retrieveaccountdirectdebits';
import {
  AC115Retrieveaccountoffers,
  aC115RetrieveaccountoffersSchema,
} from '../models/aC115Retrieveaccountoffers';
import {
  AC116Retrieveaccountparty,
  aC116RetrieveaccountpartySchema,
} from '../models/aC116Retrieveaccountparty';
import {
  AC117Retrieveaccountscheduledpayments,
  aC117RetrieveaccountscheduledpaymentsSchema,
} from '../models/aC117Retrieveaccountscheduledpayments';
import {
  AC118Retrieveaccountstandingorders,
  aC118RetrieveaccountstandingordersSchema,
} from '../models/aC118Retrieveaccountstandingorders';
import {
  AC119Retrieveaccounttransactions,
  aC119RetrieveaccounttransactionsSchema,
} from '../models/aC119Retrieveaccounttransactions';
import {
  AC121Retrieveastatement,
  aC121RetrieveastatementSchema,
} from '../models/aC121Retrieveastatement';
import {
  AC123Retrievetransactionsforaspecificstatement,
  aC123RetrievetransactionsforaspecificstatementSchema,
} from '../models/aC123Retrievetransactionsforaspecificstatement';
import { string } from '../schema';
import { BaseController } from './baseController';

export class SpecificAccountEndpointsController extends BaseController {
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information.
   *
   *
   * Response:
   *
   * *   The response should be a single account resource, whose id is PNZ-T-AC-AccountId.
   * *   The balance of the accounts resource is dynamic so the balance returned may vary.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAnAccount(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC111Retrieveanaccount>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}`;
    return req.callAsJson(aC111RetrieveanaccountSchema, requestOptions);
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a single balance resource for the account whose id is PNZ-T-AC-AccountId.
   * *   The balance of the accounts is dynamic so the balance returned may vary.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountBalance(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC112Retrieveaccountbalance>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/balances`;
    return req.callAsJson(aC112RetrieveaccountbalanceSchema, requestOptions);
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of beneficiary resources for the account whose id is PNZ-T-
   * AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountBeneficiaries(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC113Retrieveaccountbeneficiaries>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/beneficiaries`;
    return req.callAsJson(
      aC113RetrieveaccountbeneficiariesSchema,
      requestOptions
    );
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of direct-debit resources for the account whose id is PNZ-T-
   * AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountDirectDebits(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC114Retrieveaccountdirectdebits>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/direct-debits`;
    return req.callAsJson(
      aC114RetrieveaccountdirectdebitsSchema,
      requestOptions
    );
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of offer resources for the account whose id is PNZ-T-AC-
   * AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountOffers(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC115Retrieveaccountoffers>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/offers`;
    return req.callAsJson(aC115RetrieveaccountoffersSchema, requestOptions);
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a single party resource for the owner of the account whose id is PNZ-T-AC-
   * AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountParty(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC116Retrieveaccountparty>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/party`;
    return req.callAsJson(aC116RetrieveaccountpartySchema, requestOptions);
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of scheduled-payment resources for the account whose id is
   * PNZ-T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountScheduledPayments(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC117Retrieveaccountscheduledpayments>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/scheduled-payments`;
    return req.callAsJson(
      aC117RetrieveaccountscheduledpaymentsSchema,
      requestOptions
    );
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of standing-order resources for the account whose id is PNZ-
   * T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountStandingOrders(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC118Retrieveaccountstandingorders>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/standing-orders`;
    return req.callAsJson(
      aC118RetrieveaccountstandingordersSchema,
      requestOptions
    );
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of transaction resources for the account whose id is PNZ-T-
   * AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountTransactions(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC119Retrieveaccounttransactions>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/transactions`;
    return req.callAsJson(
      aC119RetrieveaccounttransactionsSchema,
      requestOptions
    );
  }

  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of statement resources for the account whose id is PNZ-T-AC-
   * AccountId.
   *
   *
   * Postconditions:
   *
   * *   The StatementId for the first statement in the collection is saved in the PNZ-T-AC-StatementId
   * environment variable in preparation for subsequent statement-related steps, such as Step AC12.1 -
   * Retrieve a statement
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveAccountStatements(
    pNZTACAccountId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC1110Retrieveaccountstatements>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/statements`;
    return req.callAsJson(
      aC1110RetrieveaccountstatementsSchema,
      requestOptions
    );
  }

  /**
   * This request queries the statement whose id is specified in the PNZ-T-AC-StatementId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   * *   This step also relies on the PNZ-T-AC-StatementId environment variable, which is set from Step
   * AC11.10 - Retrieve account statements
   *
   *
   * Response:
   *
   * *   The response should be a single statement resource whose id is PNZ-T-AC-StatementId for the
   * account whose id is PNZ-T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC11.10 - Retrieve account statements has not been
   * completed prior to making this request. Complete Step AC11.10 - Retrieve account statements before
   * trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param pNZTACStatementId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveStatement(
    pNZTACAccountId: string,
    pNZTACStatementId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC121Retrieveastatement>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      pNZTACStatementId: [pNZTACStatementId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/statements/${mapped.pNZTACStatementId}`;
    return req.callAsJson(aC121RetrieveastatementSchema, requestOptions);
  }

  /**
   * This request queries the statement whose id is specified in the PNZ-T-AC-StatementId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   * *   This step also relies on the PNZ-T-AC-StatementId environment variable, which is set from Step
   * AC11.10 - Retrieve account statements
   *
   *
   * Response:
   *
   * *   The response should be a single statement resource whose id is PNZ-T-AC-StatementId for the
   * account whose id is PNZ-T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC11.10 - Retrieve account statements has not been
   * completed prior to making this request. Complete Step AC11.10 - Retrieve account statements before
   * trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param accept
   * @param pNZTACAccountId
   * @param pNZTACStatementId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveStatementFile(
    accept: string,
    pNZTACAccountId: string,
    pNZTACStatementId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<string>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      accept: [accept, string()],
      pNZTACAccountId: [pNZTACAccountId, string()],
      pNZTACStatementId: [pNZTACStatementId, string()],
      authorization: [authorization, string()],
    });
    req.header('Accept', mapped.accept);
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/statements/${mapped.pNZTACStatementId}/file`;
    return req.callAsText(requestOptions);
  }

  /**
   * This request queries the statement whose id is specified in the PNZ-T-AC-StatementId environment
   * variable.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful
   * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange
   * auth_req_id for access token.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   * *   This step also relies on the PNZ-T-AC-StatementId environment variable, which is set from Step
   * AC11.10 - Retrieve account statements
   *
   *
   * Response:
   *
   * *   The response should be a collection of transaction resources for the statement whose id is PNZ-T-
   * AC-StatementId for the account whose id is PNZ-T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC11.10 - Retrieve account statements has not been
   * completed prior to making this request. Complete Step AC11.10 - Retrieve account statements before
   * trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param pNZTACStatementId
   * @param authorization
   * @return Response from the API call
   */
  async retrieveTransactionsForSpecificStatement(
    pNZTACAccountId: string,
    pNZTACStatementId: string,
    authorization: string,
    requestOptions?: RequestOptions
  ): Promise<ApiResponse<AC123Retrievetransactionsforaspecificstatement>> {
    const req = this.createRequest('GET');
    const mapped = req.prepareArgs({
      pNZTACAccountId: [pNZTACAccountId, string()],
      pNZTACStatementId: [pNZTACStatementId, string()],
      authorization: [authorization, string()],
    });
    req.header('Authorization', mapped.authorization);
    req.appendTemplatePath`/open-banking-nz/v2.3/accounts/${mapped.pNZTACAccountId}/statements/${mapped.pNZTACStatementId}/transactions`;
    return req.callAsJson(
      aC123RetrievetransactionsforaspecificstatementSchema,
      requestOptions
    );
  }
}
