/** * PagarmeApiSDKLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { ApiResponse, RequestOptions } from '../core'; import { CreateTransfer, createTransferSchema } from '../models/createTransfer'; import { GetTransfer, getTransferSchema } from '../models/getTransfer'; import { ListTransfers, listTransfersSchema } from '../models/listTransfers'; import { string } from '../schema'; import { BaseController } from './baseController'; export class TransfersController extends BaseController { /** * @param transferId * @return Response from the API call */ async getTransferById( transferId: string, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('GET'); const mapped = req.prepareArgs({ transferId: [transferId, string()] }); req.appendTemplatePath`/transfers/${mapped.transferId}`; req.authenticate([{ httpBasic: true }]); return req.callAsJson(getTransferSchema, requestOptions); } /** * @param request * @return Response from the API call */ async createTransfer( request: CreateTransfer, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/transfers/recipients'); const mapped = req.prepareArgs({ request: [request, createTransferSchema], }); req.json(mapped.request); req.authenticate([{ httpBasic: true }]); return req.callAsJson(getTransferSchema, requestOptions); } /** * Gets all transfers * * @return Response from the API call */ async getTransfers( requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('GET', '/transfers'); req.authenticate([{ httpBasic: true }]); return req.callAsJson(listTransfersSchema, requestOptions); } }