@agenus-io/webhook-centralizer 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { ICreatePlatformDTO, IDeletePlatformDTO, IGetPlatformByIdDTO, IGetPlatformByTitleDTO, IGetPlatformDTO, IGetPlatformWebhookByIdDTO, IGetPlatformWebhooksDTO, IUpdatePlatformDTO, IWebhookCentralizeSDK } from './interface';
1
+ import { ICreatePlatformDTO, IDeletePlatformDTO, IGetPlatformByIdDTO, IGetPlatformByTitleDTO, IGetPlatformDTO, IGetPlatformSettingsDTO, IGetPlatformWebhookByIdDTO, IGetPlatformWebhooksDTO, IUpdatePlatformDTO, IWebhookCentralizeSDK } from './interface';
2
2
  /**
3
3
  * Classe responsável pela centralização de webhooks de plataformas de pagamento e envio de webhooks para o microserviço de webhooks
4
4
  */
@@ -20,4 +20,5 @@ export declare class WebhookCentralizerSDK implements IWebhookCentralizeSDK {
20
20
  GetWebhooks({ id, page, pageSize, filter, workSpaceId }: IGetPlatformWebhooksDTO.Params): Promise<IGetPlatformWebhooksDTO.Result>;
21
21
  GetById({ id, workSpaceId }: IGetPlatformByIdDTO.Params): Promise<IGetPlatformByIdDTO.Result>;
22
22
  GetWebhookById({ id, workSpaceId }: IGetPlatformWebhookByIdDTO.Params): Promise<IGetPlatformWebhookByIdDTO.Result>;
23
+ GetPlatformSettings(): Promise<IGetPlatformSettingsDTO.Result>;
23
24
  }
@@ -251,5 +251,29 @@ class WebhookCentralizerSDK {
251
251
  };
252
252
  }
253
253
  }
254
+ async GetPlatformSettings() {
255
+ try {
256
+ const token = {
257
+ appId: this.appId,
258
+ secretToken: this.appToken,
259
+ };
260
+ const response = await axios_1.default.get(`${this.apiUrl}/platform/settings`, {
261
+ headers: { "app-id": token.appId, "app-secret-token": token.secretToken },
262
+ });
263
+ return response.data;
264
+ }
265
+ catch (error) {
266
+ let errorMapped = error;
267
+ if (error instanceof axios_1.AxiosError) {
268
+ errorMapped = error.response?.data;
269
+ }
270
+ else {
271
+ errorMapped = error;
272
+ }
273
+ return {
274
+ data: []
275
+ };
276
+ }
277
+ }
254
278
  }
255
279
  exports.WebhookCentralizerSDK = WebhookCentralizerSDK;
@@ -87,12 +87,13 @@ export declare namespace IGetPlatformWebhooksDTO {
87
87
  type Result = {
88
88
  data: {
89
89
  id: string;
90
+ code: string;
90
91
  status: webhookCentralizerOrderStatus;
91
92
  event: webhookCentralizerEvent;
92
93
  createdAt: Date;
93
94
  updatedAt: Date;
94
95
  data: any;
95
- };
96
+ }[];
96
97
  meta: {
97
98
  total: number;
98
99
  totalPages: number;
@@ -171,6 +172,30 @@ export declare namespace IGetPlatformWebhookByIdDTO {
171
172
  error?: any;
172
173
  };
173
174
  }
175
+ export declare namespace IGetPlatformSettingsDTO {
176
+ type Result = {
177
+ data: {
178
+ id: string;
179
+ title: string;
180
+ affiliateType: webhookCentralizerDispatchType;
181
+ type: webhookCentralizerPlatform;
182
+ inPreparation: boolean;
183
+ hasPostBack: boolean;
184
+ hasToken: boolean;
185
+ hasSlug: boolean;
186
+ hasApi: boolean;
187
+ meta: Record<string, any> | null;
188
+ createdAt: Date;
189
+ updatedAt: Date;
190
+ icon: {
191
+ id: string;
192
+ url: string;
193
+ size: number;
194
+ mimeType: string;
195
+ } | null;
196
+ }[];
197
+ };
198
+ }
174
199
  export interface IWebhookCentralizeSDK {
175
200
  Create(data: ICreatePlatformDTO.Params): Promise<ICreatePlatformDTO.Result>;
176
201
  Update(data: IUpdatePlatformDTO.Params): Promise<IUpdatePlatformDTO.Result>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenus-io/webhook-centralizer",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "SDK para centralização de webhooks focado atualmente em plataformas de pagamentos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",