import { ApiResponse , RequestOptions } from '../core' ; import { GetBankAccountByV1IdResponse , getBankAccountByV1IdResponseSchema , } from '../models/getBankAccountByV1IdResponse' ; import { GetBankAccountResponse , getBankAccountResponseSchema , } from '../models/getBankAccountResponse' ; import { ListBankAccountsResponse , listBankAccountsResponseSchema , } from '../models/listBankAccountsResponse' ; import { number , optional , string } from '../schema' ; import { BaseApi } from './baseApi' ; export class BankAccountsApi extends BaseApi { param cursor param limit param locationId return async listBankAccounts ( cursor ? , limit ? , locationId ? , requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/bank-accounts' ) ; const mapped = req . prepareArgs ( { cursor : [ cursor , optional ( string ( ) ) ] , limit : [ limit , optional ( number ( ) ) ] , locationId : [ locationId , optional ( string ( ) ) ] , } ) ; req . query ( 'cursor' , mapped . cursor ) ; req . query ( 'limit' , mapped . limit ) ; req . query ( 'location_id' , mapped . locationId ) ; return req . callAsJson ( listBankAccountsResponseSchema , requestOptions ) ; } param v1BankAccountId return async getBankAccountByV1Id ( v1BankAccountId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { v1BankAccountId : [ v1BankAccountId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/bank-accounts/by-v1-id/${ mapped . v1BankAccountId }` ; return req . callAsJson ( getBankAccountByV1IdResponseSchema , requestOptions ) ; } param bankAccountId return async getBankAccount ( bankAccountId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { bankAccountId : [ bankAccountId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/bank-accounts/${ mapped . bankAccountId }` ; return req . callAsJson ( getBankAccountResponseSchema , requestOptions ) ; } }