Skip to content

Commit e7c3ea3

Browse files
authored
Merge pull request #125 from Smartling/DEVORTEX-5439
DEVORTEX-5439 add webhooks api
2 parents e9180d3 + da27b77 commit e7c3ea3

25 files changed

+1098
-17
lines changed

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

api/base/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ export class SmartlingBaseApi {
162162
"dueDate",
163163
"actionTime",
164164
"publishDate",
165-
"lastModified"
165+
"lastModified",
166+
"attemptDate"
166167
];
167168

168169
if (dateProperties.includes(key) && value) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
interface ScrollableResponse<T> {
2+
items: Array<T>;
3+
hasMore: boolean;
4+
scrollId: string | null;
5+
}
6+
7+
export { ScrollableResponse };
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { SubscriptionEventAttemptStatus } from "./subscription-event-attempt-status";
2+
3+
interface SubscriptionAttemptedEventDto {
4+
eventId: string;
5+
eventType: string;
6+
createdDate: Date;
7+
lastAttemptStatus: SubscriptionEventAttemptStatus
8+
}
9+
10+
export { SubscriptionAttemptedEventDto };

api/webhooks/dto/subscription-dto.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { SubscriptionEvent } from "../params/subscription-event";
2+
import { SubscriptionRequestHeader } from "../params/subscription-request-header";
3+
4+
interface SubscriptionDto {
5+
subscriptionUid: string;
6+
subscriptionName: string;
7+
subscriptionUrl: string;
8+
accountUid: string;
9+
enabled: boolean;
10+
userUid: string;
11+
description: string | null;
12+
createdDate: string;
13+
requestHeaders: SubscriptionRequestHeader[];
14+
events: SubscriptionEvent[];
15+
projectUids: string[];
16+
}
17+
18+
export { SubscriptionDto };
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { SubscriptionEventAttemptStatus } from "./subscription-event-attempt-status";
2+
import { SubscriptionEventTriggerType } from "./subscription-event-trigger-type";
3+
4+
interface SubscriptionEventAttemptDto {
5+
attemptId: string;
6+
eventId: string;
7+
response: string | null;
8+
responseDurationMs: number;
9+
responseStatusCode: number;
10+
attemptStatus: SubscriptionEventAttemptStatus;
11+
attemptDate: Date;
12+
url: string;
13+
triggerType: SubscriptionEventTriggerType;
14+
}
15+
16+
export { SubscriptionEventAttemptDto };
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
enum SubscriptionEventAttemptStatus {
2+
SUCCESS = "SUCCESS",
3+
PENDING = "PENDING",
4+
FAIL = "FAIL",
5+
SENDING = "SENDING"
6+
}
7+
8+
export { SubscriptionEventAttemptStatus };
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
interface SubscriptionEventDto {
2+
eventId: string;
3+
eventType: string;
4+
createdDate: Date;
5+
payload: Record<string, unknown>;
6+
}
7+
8+
export { SubscriptionEventDto };
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
enum SubscriptionEventTriggerType {
2+
SCHEDULED = "SCHEDULED",
3+
MANUAL = "MANUAL"
4+
}
5+
6+
export { SubscriptionEventTriggerType };
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
interface SubscriptionSecretDto {
2+
payloadSecret: string;
3+
}
4+
5+
export { SubscriptionSecretDto };

0 commit comments

Comments
 (0)