|
| 1 | +/* |
| 2 | + * The version of the OpenAPI document: v2 |
| 3 | + * |
| 4 | + * |
| 5 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 6 | + * https://openapi-generator.tech |
| 7 | + * Do not edit this class manually. |
| 8 | + */ |
| 9 | + |
| 10 | + |
| 11 | +import getJsonResponse from "../../helpers/getJsonResponse"; |
| 12 | +import Service from "../../service"; |
| 13 | +import Client from "../../client"; |
| 14 | +import { IRequest } from "../../typings/requestOptions"; |
| 15 | +import Resource from "../resource"; |
| 16 | + |
| 17 | +import { ObjectSerializer } from "../../typings/balancePlatform/objectSerializer"; |
| 18 | +import { AuthorisedCardUsers } from "../../typings/balancePlatform/models"; |
| 19 | + |
| 20 | +/** |
| 21 | + * API handler for AuthorizedCardUsersApi |
| 22 | + */ |
| 23 | +export class AuthorizedCardUsersApi extends Service { |
| 24 | + |
| 25 | + private readonly API_BASEPATH: string = "https://balanceplatform-api-test.adyen.com/bcl/v2"; |
| 26 | + private baseUrl: string; |
| 27 | + |
| 28 | + public constructor(client: Client){ |
| 29 | + super(client); |
| 30 | + this.baseUrl = this.createBaseUrl(this.API_BASEPATH); |
| 31 | + } |
| 32 | + |
| 33 | + /** |
| 34 | + * @summary Create authorized users for a card. |
| 35 | + * @param paymentInstrumentId {@link string } |
| 36 | + * @param authorisedCardUsers {@link AuthorisedCardUsers } |
| 37 | + * @param requestOptions {@link IRequest.Options } |
| 38 | + * @return {@link void } |
| 39 | + */ |
| 40 | + public async createAuthorisedCardUsers(paymentInstrumentId: string, authorisedCardUsers: AuthorisedCardUsers, requestOptions?: IRequest.Options): Promise<void> { |
| 41 | + const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers` |
| 42 | + .replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId))); |
| 43 | + const resource = new Resource(this, endpoint); |
| 44 | + |
| 45 | + const request: AuthorisedCardUsers = ObjectSerializer.serialize(authorisedCardUsers, "AuthorisedCardUsers"); |
| 46 | + await getJsonResponse<AuthorisedCardUsers, void>( |
| 47 | + resource, |
| 48 | + request, |
| 49 | + { ...requestOptions, method: "POST" } |
| 50 | + ); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * @summary Delete the authorized users for a card. |
| 55 | + * @param paymentInstrumentId {@link string } |
| 56 | + * @param requestOptions {@link IRequest.Options } |
| 57 | + * @return {@link void } |
| 58 | + */ |
| 59 | + public async deleteAuthorisedCardUsers(paymentInstrumentId: string, requestOptions?: IRequest.Options): Promise<void> { |
| 60 | + const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers` |
| 61 | + .replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId))); |
| 62 | + const resource = new Resource(this, endpoint); |
| 63 | + |
| 64 | + await getJsonResponse<string, void>( |
| 65 | + resource, |
| 66 | + "", |
| 67 | + { ...requestOptions, method: "DELETE" } |
| 68 | + ); |
| 69 | + } |
| 70 | + |
| 71 | + /** |
| 72 | + * @summary Get authorized users for a card. |
| 73 | + * @param paymentInstrumentId {@link string } |
| 74 | + * @param requestOptions {@link IRequest.Options } |
| 75 | + * @return {@link AuthorisedCardUsers } |
| 76 | + */ |
| 77 | + public async getAllAuthorisedCardUsers(paymentInstrumentId: string, requestOptions?: IRequest.Options): Promise<AuthorisedCardUsers> { |
| 78 | + const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers` |
| 79 | + .replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId))); |
| 80 | + const resource = new Resource(this, endpoint); |
| 81 | + |
| 82 | + const response = await getJsonResponse<string, AuthorisedCardUsers>( |
| 83 | + resource, |
| 84 | + "", |
| 85 | + { ...requestOptions, method: "GET" } |
| 86 | + ); |
| 87 | + |
| 88 | + return ObjectSerializer.deserialize(response, "AuthorisedCardUsers"); |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * @summary Update the authorized users for a card. |
| 93 | + * @param paymentInstrumentId {@link string } |
| 94 | + * @param authorisedCardUsers {@link AuthorisedCardUsers } |
| 95 | + * @param requestOptions {@link IRequest.Options } |
| 96 | + * @return {@link void } |
| 97 | + */ |
| 98 | + public async updateAuthorisedCardUsers(paymentInstrumentId: string, authorisedCardUsers: AuthorisedCardUsers, requestOptions?: IRequest.Options): Promise<void> { |
| 99 | + const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers` |
| 100 | + .replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId))); |
| 101 | + const resource = new Resource(this, endpoint); |
| 102 | + |
| 103 | + const request: AuthorisedCardUsers = ObjectSerializer.serialize(authorisedCardUsers, "AuthorisedCardUsers"); |
| 104 | + await getJsonResponse<AuthorisedCardUsers, void>( |
| 105 | + resource, |
| 106 | + request, |
| 107 | + { ...requestOptions, method: "PATCH" } |
| 108 | + ); |
| 109 | + } |
| 110 | + |
| 111 | +} |
0 commit comments