|
| 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 | +import getJsonResponse from "../../helpers/getJsonResponse"; |
| 11 | +import Service from "../../service"; |
| 12 | +import Client from "../../client"; |
| 13 | +import { |
| 14 | + BalanceWebhookSettingInfo, |
| 15 | + BalanceWebhookSettingInfoUpdate, |
| 16 | + DefaultErrorResponseEntity, |
| 17 | + WebhookSetting, |
| 18 | + WebhookSettings, |
| 19 | + ObjectSerializer |
| 20 | +} from "../../typings/balancePlatform/models"; |
| 21 | +import { IRequest } from "../../typings/requestOptions"; |
| 22 | +import Resource from "../resource"; |
| 23 | + |
| 24 | +export class BalancesApi extends Service { |
| 25 | + |
| 26 | + private readonly API_BASEPATH: string = "https://balanceplatform-api-test.adyen.com/bcl/v2"; |
| 27 | + private baseUrl: string; |
| 28 | + |
| 29 | + public constructor(client: Client){ |
| 30 | + super(client); |
| 31 | + this.baseUrl = this.createBaseUrl(this.API_BASEPATH); |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @summary Create a balance webhook setting |
| 36 | + * @param balancePlatformId {@link string } The unique identifier of the balance platform. |
| 37 | + * @param webhookId {@link string } The unique identifier of the balance webhook. |
| 38 | + * @param balanceWebhookSettingInfo {@link BalanceWebhookSettingInfo } |
| 39 | + * @param requestOptions {@link IRequest.Options } |
| 40 | + * @return {@link WebhookSetting } |
| 41 | + */ |
| 42 | + public async createWebhookSetting(balancePlatformId: string, webhookId: string, balanceWebhookSettingInfo: BalanceWebhookSettingInfo, requestOptions?: IRequest.Options): Promise<WebhookSetting> { |
| 43 | + const endpoint = `${this.baseUrl}/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings` |
| 44 | + .replace("{" + "balancePlatformId" + "}", encodeURIComponent(String(balancePlatformId))) |
| 45 | + .replace("{" + "webhookId" + "}", encodeURIComponent(String(webhookId))); |
| 46 | + const resource = new Resource(this, endpoint); |
| 47 | + const request: BalanceWebhookSettingInfo = ObjectSerializer.serialize(balanceWebhookSettingInfo, "BalanceWebhookSettingInfo"); |
| 48 | + const response = await getJsonResponse<BalanceWebhookSettingInfo, WebhookSetting>( |
| 49 | + resource, |
| 50 | + request, |
| 51 | + { ...requestOptions, method: "POST" } |
| 52 | + ); |
| 53 | + return ObjectSerializer.deserialize(response, "WebhookSetting"); |
| 54 | + } |
| 55 | + |
| 56 | + /** |
| 57 | + * @summary Delete a balance webhook setting by id |
| 58 | + * @param balancePlatformId {@link string } The unique identifier of the balance platform. |
| 59 | + * @param webhookId {@link string } The unique identifier of the balance webhook. |
| 60 | + * @param settingId {@link string } The unique identifier of the balance webhook setting. |
| 61 | + * @param requestOptions {@link IRequest.Options } |
| 62 | + */ |
| 63 | + public async deleteWebhookSetting(balancePlatformId: string, webhookId: string, settingId: string, requestOptions?: IRequest.Options): Promise<void> { |
| 64 | + const endpoint = `${this.baseUrl}/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings/{settingId}` |
| 65 | + .replace("{" + "balancePlatformId" + "}", encodeURIComponent(String(balancePlatformId))) |
| 66 | + .replace("{" + "webhookId" + "}", encodeURIComponent(String(webhookId))) |
| 67 | + .replace("{" + "settingId" + "}", encodeURIComponent(String(settingId))); |
| 68 | + const resource = new Resource(this, endpoint); |
| 69 | + await getJsonResponse<string, void>( |
| 70 | + resource, |
| 71 | + "", |
| 72 | + { ...requestOptions, method: "DELETE" } |
| 73 | + ); |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * @summary Get all balance webhook settings |
| 78 | + * @param balancePlatformId {@link string } The unique identifier of the balance platform. |
| 79 | + * @param webhookId {@link string } The unique identifier of the balance webhook. |
| 80 | + * @param requestOptions {@link IRequest.Options } |
| 81 | + * @return {@link WebhookSettings } |
| 82 | + */ |
| 83 | + public async getAllWebhookSettings(balancePlatformId: string, webhookId: string, requestOptions?: IRequest.Options): Promise<WebhookSettings> { |
| 84 | + const endpoint = `${this.baseUrl}/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings` |
| 85 | + .replace("{" + "balancePlatformId" + "}", encodeURIComponent(String(balancePlatformId))) |
| 86 | + .replace("{" + "webhookId" + "}", encodeURIComponent(String(webhookId))); |
| 87 | + const resource = new Resource(this, endpoint); |
| 88 | + const response = await getJsonResponse<string, WebhookSettings>( |
| 89 | + resource, |
| 90 | + "", |
| 91 | + { ...requestOptions, method: "GET" } |
| 92 | + ); |
| 93 | + return ObjectSerializer.deserialize(response, "WebhookSettings"); |
| 94 | + } |
| 95 | + |
| 96 | + /** |
| 97 | + * @summary Get a balance webhook setting by id |
| 98 | + * @param balancePlatformId {@link string } The unique identifier of the balance platform. |
| 99 | + * @param webhookId {@link string } The unique identifier of the balance webhook. |
| 100 | + * @param settingId {@link string } The unique identifier of the balance webhook setting. |
| 101 | + * @param requestOptions {@link IRequest.Options } |
| 102 | + * @return {@link WebhookSetting } |
| 103 | + */ |
| 104 | + public async getWebhookSetting(balancePlatformId: string, webhookId: string, settingId: string, requestOptions?: IRequest.Options): Promise<WebhookSetting> { |
| 105 | + const endpoint = `${this.baseUrl}/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings/{settingId}` |
| 106 | + .replace("{" + "balancePlatformId" + "}", encodeURIComponent(String(balancePlatformId))) |
| 107 | + .replace("{" + "webhookId" + "}", encodeURIComponent(String(webhookId))) |
| 108 | + .replace("{" + "settingId" + "}", encodeURIComponent(String(settingId))); |
| 109 | + const resource = new Resource(this, endpoint); |
| 110 | + const response = await getJsonResponse<string, WebhookSetting>( |
| 111 | + resource, |
| 112 | + "", |
| 113 | + { ...requestOptions, method: "GET" } |
| 114 | + ); |
| 115 | + return ObjectSerializer.deserialize(response, "WebhookSetting"); |
| 116 | + } |
| 117 | + |
| 118 | + /** |
| 119 | + * @summary Update a balance webhook setting by id |
| 120 | + * @param balancePlatformId {@link string } The unique identifier of the balance platform. |
| 121 | + * @param webhookId {@link string } The unique identifier of the balance webhook. |
| 122 | + * @param settingId {@link string } The unique identifier of the balance webhook setting. |
| 123 | + * @param balanceWebhookSettingInfoUpdate {@link BalanceWebhookSettingInfoUpdate } |
| 124 | + * @param requestOptions {@link IRequest.Options } |
| 125 | + * @return {@link WebhookSetting } |
| 126 | + */ |
| 127 | + public async updateWebhookSetting(balancePlatformId: string, webhookId: string, settingId: string, balanceWebhookSettingInfoUpdate: BalanceWebhookSettingInfoUpdate, requestOptions?: IRequest.Options): Promise<WebhookSetting> { |
| 128 | + const endpoint = `${this.baseUrl}/balancePlatforms/{balancePlatformId}/webhooks/{webhookId}/settings/{settingId}` |
| 129 | + .replace("{" + "balancePlatformId" + "}", encodeURIComponent(String(balancePlatformId))) |
| 130 | + .replace("{" + "webhookId" + "}", encodeURIComponent(String(webhookId))) |
| 131 | + .replace("{" + "settingId" + "}", encodeURIComponent(String(settingId))); |
| 132 | + const resource = new Resource(this, endpoint); |
| 133 | + const request: BalanceWebhookSettingInfoUpdate = ObjectSerializer.serialize(balanceWebhookSettingInfoUpdate, "BalanceWebhookSettingInfoUpdate"); |
| 134 | + const response = await getJsonResponse<BalanceWebhookSettingInfoUpdate, WebhookSetting>( |
| 135 | + resource, |
| 136 | + request, |
| 137 | + { ...requestOptions, method: "PATCH" } |
| 138 | + ); |
| 139 | + return ObjectSerializer.deserialize(response, "WebhookSetting"); |
| 140 | + } |
| 141 | +} |
0 commit comments