Skip to content

Commit d69eb4f

Browse files
committed
DEVORTEX-5439 add webhooks api
1 parent 9f08a0c commit d69eb4f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

api/webhooks/smartling-webhooks-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class SmartlingWebhooksApi extends SmartlingBaseApi {
139139

140140
// getSubscriptionEventAttempts() {}
141141

142-
getAvailableEventTypes(accountUid: string): Promise<WebhookEventTypeDto> {
142+
getAvailableEventTypes(accountUid: string): Promise<WebhookEventTypeDto[]> {
143143
return this.makeRequest(
144144
"get",
145145
`${this.entrypoint}/accounts/${accountUid}/available-event-types`

test/webhooks.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,4 +457,22 @@ describe("SmartlingWebhooksApi class tests.", () => {
457457
}
458458
);
459459
});
460+
461+
it("gets available event types", async () => {
462+
await webhooksApi.getAvailableEventTypes(accountUid);
463+
464+
sinon.assert.calledOnce(webhooksApiFetchStub);
465+
sinon.assert.calledWithExactly(
466+
webhooksApiFetchStub,
467+
`https://test.com/webhooks-api/v2/accounts/${accountUid}/available-event-types`,
468+
{
469+
headers: {
470+
Authorization: "test_token_type test_access_token",
471+
"Content-Type": "application/json",
472+
"User-Agent": "test_user_agent"
473+
},
474+
method: "get"
475+
}
476+
);
477+
});
460478
});

0 commit comments

Comments
 (0)