@agenus-io/webhook-centralizer 1.0.7 → 1.0.8
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.
- package/dist/Class/index.d.ts +2 -1
- package/dist/Class/index.js +26 -0
- package/dist/Class/interface.d.ts +28 -0
- package/package.json +1 -1
package/dist/Class/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICreatePlatformDTO, IDeletePlatformDTO, IGetPlatformByTitleDTO, IGetPlatformDTO, IGetPlatformWebhooksDTO, IUpdatePlatformDTO, IWebhookCentralizeSDK } from './interface';
|
|
1
|
+
import { ICreatePlatformDTO, IDeletePlatformDTO, IGetPlatformByIdDTO, IGetPlatformByTitleDTO, IGetPlatformDTO, 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
|
*/
|
|
@@ -18,4 +18,5 @@ export declare class WebhookCentralizerSDK implements IWebhookCentralizeSDK {
|
|
|
18
18
|
Get({ page, pageSize, filter, workSpaceId }: IGetPlatformDTO.Params): Promise<IGetPlatformDTO.Result>;
|
|
19
19
|
GetByTitle({ title, workSpaceId }: IGetPlatformByTitleDTO.Params): Promise<IGetPlatformByTitleDTO.Result>;
|
|
20
20
|
GetWebhooks({ id, page, pageSize, filter, workSpaceId }: IGetPlatformWebhooksDTO.Params): Promise<IGetPlatformWebhooksDTO.Result>;
|
|
21
|
+
GetById({ id, workSpaceId }: IGetPlatformByIdDTO.Params): Promise<IGetPlatformByIdDTO.Result>;
|
|
21
22
|
}
|
package/dist/Class/index.js
CHANGED
|
@@ -199,5 +199,31 @@ class WebhookCentralizerSDK {
|
|
|
199
199
|
throw "Erro ao listar webhooks";
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
+
async GetById({ id, workSpaceId }) {
|
|
203
|
+
try {
|
|
204
|
+
const token = {
|
|
205
|
+
appId: this.appId,
|
|
206
|
+
secretToken: this.appToken,
|
|
207
|
+
workSpaceId,
|
|
208
|
+
};
|
|
209
|
+
const response = await axios_1.default.get(`${this.apiUrl}/platform/${id}`, {
|
|
210
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
211
|
+
});
|
|
212
|
+
return { data: response.data };
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
let errorMapped = error;
|
|
216
|
+
if (error instanceof axios_1.AxiosError) {
|
|
217
|
+
errorMapped = error.response?.data;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
errorMapped = error;
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
isError: true,
|
|
224
|
+
error: errorMapped,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
202
228
|
}
|
|
203
229
|
exports.WebhookCentralizerSDK = WebhookCentralizerSDK;
|
|
@@ -124,6 +124,33 @@ export declare namespace IGetPlatformByTitleDTO {
|
|
|
124
124
|
isDeleted: boolean;
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
+
export declare namespace IGetPlatformByIdDTO {
|
|
128
|
+
type Params = {
|
|
129
|
+
id: string;
|
|
130
|
+
workSpaceId: string;
|
|
131
|
+
};
|
|
132
|
+
type Result = {
|
|
133
|
+
data?: {
|
|
134
|
+
id: string;
|
|
135
|
+
title: string;
|
|
136
|
+
status: boolean;
|
|
137
|
+
dispatchType: webhookCentralizerDispatchType;
|
|
138
|
+
type: webhookCentralizerPlatform;
|
|
139
|
+
apiToken: string | null;
|
|
140
|
+
slug: string | null;
|
|
141
|
+
url: string;
|
|
142
|
+
platformSettingId: string;
|
|
143
|
+
appId: string;
|
|
144
|
+
workSpaceId: string;
|
|
145
|
+
meta: JsonValue | null;
|
|
146
|
+
createdAt: Date;
|
|
147
|
+
updatedAt: Date;
|
|
148
|
+
isDeleted: boolean;
|
|
149
|
+
};
|
|
150
|
+
isError?: boolean;
|
|
151
|
+
error?: any;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
127
154
|
export interface IWebhookCentralizeSDK {
|
|
128
155
|
Create(data: ICreatePlatformDTO.Params): Promise<ICreatePlatformDTO.Result>;
|
|
129
156
|
Update(data: IUpdatePlatformDTO.Params): Promise<IUpdatePlatformDTO.Result>;
|
|
@@ -131,5 +158,6 @@ export interface IWebhookCentralizeSDK {
|
|
|
131
158
|
Get(data: IGetPlatformDTO.Params): Promise<IGetPlatformDTO.Result>;
|
|
132
159
|
GetWebhooks(data: IGetPlatformWebhooksDTO.Params): Promise<IGetPlatformWebhooksDTO.Result>;
|
|
133
160
|
GetByTitle(data: IGetPlatformByTitleDTO.Params): Promise<IGetPlatformByTitleDTO.Result>;
|
|
161
|
+
GetById(data: IGetPlatformByIdDTO.Params): Promise<IGetPlatformByIdDTO.Result>;
|
|
134
162
|
}
|
|
135
163
|
export {};
|
package/package.json
CHANGED