@foru-ms/sdk 0.1.0 → 1.1.0

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.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +189 -0
  3. package/dist/Client.d.ts +18 -0
  4. package/dist/Client.js +18 -0
  5. package/dist/index.d.ts +9 -0
  6. package/dist/index.js +9 -0
  7. package/dist/resources/Auth.d.ts +12 -0
  8. package/dist/resources/Auth.js +19 -0
  9. package/dist/resources/Integrations.d.ts +20 -0
  10. package/dist/resources/Integrations.js +30 -0
  11. package/dist/resources/Notifications.d.ts +32 -0
  12. package/dist/resources/Notifications.js +48 -0
  13. package/dist/resources/Posts.d.ts +13 -0
  14. package/dist/resources/Posts.js +55 -0
  15. package/dist/resources/PrivateMessages.d.ts +29 -0
  16. package/dist/resources/PrivateMessages.js +44 -0
  17. package/dist/resources/Reports.d.ts +46 -0
  18. package/dist/resources/Reports.js +56 -0
  19. package/dist/resources/Roles.d.ts +26 -0
  20. package/dist/resources/Roles.js +44 -0
  21. package/dist/resources/SSO.d.ts +17 -0
  22. package/dist/resources/SSO.js +25 -0
  23. package/dist/resources/Search.d.ts +11 -0
  24. package/dist/resources/Search.js +20 -0
  25. package/dist/resources/Stats.d.ts +13 -0
  26. package/dist/resources/Stats.js +22 -0
  27. package/dist/resources/Tags.d.ts +27 -0
  28. package/dist/resources/Tags.js +47 -0
  29. package/dist/resources/Threads.d.ts +14 -0
  30. package/dist/resources/Threads.js +61 -0
  31. package/dist/resources/Users.d.ts +47 -0
  32. package/dist/resources/Users.js +54 -0
  33. package/dist/resources/Webhooks.d.ts +35 -0
  34. package/dist/resources/Webhooks.js +44 -0
  35. package/dist/types.d.ts +149 -0
  36. package/package.json +17 -4
  37. package/src/Client.ts +27 -0
  38. package/src/index.ts +9 -0
  39. package/src/resources/Auth.ts +28 -0
  40. package/src/resources/Integrations.ts +39 -0
  41. package/src/resources/Notifications.ts +69 -0
  42. package/src/resources/Posts.ts +67 -0
  43. package/src/resources/PrivateMessages.ts +67 -0
  44. package/src/resources/Reports.ts +93 -0
  45. package/src/resources/Roles.ts +64 -0
  46. package/src/resources/SSO.ts +33 -0
  47. package/src/resources/Search.ts +27 -0
  48. package/src/resources/Stats.ts +31 -0
  49. package/src/resources/Tags.ts +68 -0
  50. package/src/resources/Threads.ts +74 -0
  51. package/src/resources/Users.ts +91 -0
  52. package/src/resources/Webhooks.ts +60 -0
  53. package/src/types.ts +165 -0
@@ -0,0 +1,46 @@
1
+ import { ForumClient } from '../Client';
2
+ import { Report, ReportListResponse } from '../types';
3
+ export declare class ReportsResource {
4
+ private client;
5
+ constructor(client: ForumClient);
6
+ list(params?: {
7
+ reporterId?: string;
8
+ reportedId?: string;
9
+ read?: boolean;
10
+ cursor?: string;
11
+ filter?: 'newest' | 'oldest';
12
+ }): Promise<ReportListResponse>;
13
+ create(payload: {
14
+ reporterId: string;
15
+ reportedId?: string;
16
+ threadId?: string;
17
+ postId?: string;
18
+ privateMessageId?: string;
19
+ type?: string;
20
+ description?: string;
21
+ extendedData?: Record<string, any>;
22
+ }): Promise<Report>;
23
+ batchUpdate(payload: {
24
+ reportIds: string[];
25
+ read: boolean;
26
+ }): Promise<{
27
+ count?: number;
28
+ message?: string;
29
+ }>;
30
+ retrieve(id: string): Promise<Report>;
31
+ update(id: string, payload: {
32
+ threadId?: string;
33
+ postId?: string;
34
+ privateMessageId?: string;
35
+ reportedId?: string;
36
+ reporterId?: string;
37
+ type?: string;
38
+ description?: string;
39
+ read?: boolean;
40
+ extendedData?: Record<string, any>;
41
+ }): Promise<Report>;
42
+ delete(id: string): Promise<Report & {
43
+ deleted: boolean;
44
+ }>;
45
+ updateStatus(id: string, read: boolean): Promise<Report>;
46
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportsResource = void 0;
4
+ class ReportsResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async list(params) {
9
+ const searchParams = new URLSearchParams();
10
+ if (params) {
11
+ Object.entries(params).forEach(([key, value]) => {
12
+ if (value !== undefined) {
13
+ searchParams.append(key, String(value));
14
+ }
15
+ });
16
+ }
17
+ return this.client.request(`/reports?${searchParams.toString()}`, {
18
+ method: 'GET',
19
+ });
20
+ }
21
+ async create(payload) {
22
+ return this.client.request('/report', {
23
+ method: 'POST',
24
+ body: JSON.stringify(payload),
25
+ });
26
+ }
27
+ async batchUpdate(payload) {
28
+ return this.client.request('/reports', {
29
+ method: 'PATCH',
30
+ body: JSON.stringify(payload),
31
+ });
32
+ }
33
+ async retrieve(id) {
34
+ return this.client.request(`/report/${id}`, {
35
+ method: 'GET',
36
+ });
37
+ }
38
+ async update(id, payload) {
39
+ return this.client.request(`/report/${id}`, {
40
+ method: 'PUT',
41
+ body: JSON.stringify(payload),
42
+ });
43
+ }
44
+ async delete(id) {
45
+ return this.client.request(`/report/${id}`, {
46
+ method: 'DELETE',
47
+ });
48
+ }
49
+ async updateStatus(id, read) {
50
+ return this.client.request(`/report/${id}`, {
51
+ method: 'PATCH',
52
+ body: JSON.stringify({ read }),
53
+ });
54
+ }
55
+ }
56
+ exports.ReportsResource = ReportsResource;
@@ -0,0 +1,26 @@
1
+ import { ForumClient } from '../Client';
2
+ import { Role, RoleListResponse } from '../types';
3
+ export declare class RolesResource {
4
+ private client;
5
+ constructor(client: ForumClient);
6
+ list(params?: {
7
+ filter?: 'newest' | 'oldest';
8
+ cursor?: string;
9
+ }): Promise<RoleListResponse>;
10
+ create(payload: {
11
+ name: string;
12
+ description?: string;
13
+ color?: string;
14
+ extendedData?: Record<string, any>;
15
+ }): Promise<Role>;
16
+ retrieve(id: string): Promise<Role>;
17
+ update(id: string, payload: {
18
+ name?: string;
19
+ description?: string;
20
+ color?: string;
21
+ extendedData?: Record<string, any>;
22
+ }): Promise<Role>;
23
+ delete(id: string): Promise<Role & {
24
+ deleted: boolean;
25
+ }>;
26
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RolesResource = void 0;
4
+ class RolesResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async list(params) {
9
+ const searchParams = new URLSearchParams();
10
+ if (params) {
11
+ Object.entries(params).forEach(([key, value]) => {
12
+ if (value !== undefined) {
13
+ searchParams.append(key, value);
14
+ }
15
+ });
16
+ }
17
+ return this.client.request(`/roles?${searchParams.toString()}`, {
18
+ method: 'GET',
19
+ });
20
+ }
21
+ async create(payload) {
22
+ return this.client.request('/role', {
23
+ method: 'POST',
24
+ body: JSON.stringify(payload),
25
+ });
26
+ }
27
+ async retrieve(id) {
28
+ return this.client.request(`/role/${id}`, {
29
+ method: 'GET',
30
+ });
31
+ }
32
+ async update(id, payload) {
33
+ return this.client.request(`/role/${id}`, {
34
+ method: 'PUT',
35
+ body: JSON.stringify(payload),
36
+ });
37
+ }
38
+ async delete(id) {
39
+ return this.client.request(`/role/${id}`, {
40
+ method: 'DELETE',
41
+ });
42
+ }
43
+ }
44
+ exports.RolesResource = RolesResource;
@@ -0,0 +1,17 @@
1
+ import { ForumClient } from '../Client';
2
+ import { SSOProvider, SSOProviderListResponse } from '../types';
3
+ export declare class SSOResource {
4
+ private client;
5
+ constructor(client: ForumClient);
6
+ list(): Promise<SSOProviderListResponse>;
7
+ create(payload: {
8
+ provider: 'OKTA' | 'AUTH0' | 'SAML';
9
+ domain: string;
10
+ config: any;
11
+ }): Promise<{
12
+ ssoProvider: SSOProvider;
13
+ }>;
14
+ delete(id: string): Promise<{
15
+ success: boolean;
16
+ }>;
17
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SSOResource = void 0;
4
+ class SSOResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async list() {
9
+ return this.client.request('/sso', {
10
+ method: 'GET',
11
+ });
12
+ }
13
+ async create(payload) {
14
+ return this.client.request('/sso', {
15
+ method: 'POST',
16
+ body: JSON.stringify(payload),
17
+ });
18
+ }
19
+ async delete(id) {
20
+ return this.client.request(`/sso/${id}`, {
21
+ method: 'DELETE',
22
+ });
23
+ }
24
+ }
25
+ exports.SSOResource = SSOResource;
@@ -0,0 +1,11 @@
1
+ import { ForumClient } from '../Client';
2
+ import { SearchResponse } from '../types';
3
+ export declare class SearchResource {
4
+ private client;
5
+ constructor(client: ForumClient);
6
+ search(params: {
7
+ query: string;
8
+ type: 'threads' | 'posts' | 'users' | 'tags';
9
+ cursor?: string;
10
+ }): Promise<SearchResponse>;
11
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchResource = void 0;
4
+ class SearchResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async search(params) {
9
+ const searchParams = new URLSearchParams();
10
+ Object.entries(params).forEach(([key, value]) => {
11
+ if (value !== undefined) {
12
+ searchParams.append(key, value);
13
+ }
14
+ });
15
+ return this.client.request(`/search?${searchParams.toString()}`, {
16
+ method: 'GET',
17
+ });
18
+ }
19
+ }
20
+ exports.SearchResource = SearchResource;
@@ -0,0 +1,13 @@
1
+ import { ForumClient } from '../Client';
2
+ import { StatsResponse } from '../types';
3
+ export declare class StatsResource {
4
+ private client;
5
+ constructor(client: ForumClient);
6
+ get(params?: {
7
+ filter?: 'newest' | 'oldest';
8
+ threadCursor?: string;
9
+ postCursor?: string;
10
+ userCursor?: string;
11
+ reportCursor?: string;
12
+ }): Promise<StatsResponse>;
13
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatsResource = void 0;
4
+ class StatsResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async get(params) {
9
+ const searchParams = new URLSearchParams();
10
+ if (params) {
11
+ Object.entries(params).forEach(([key, value]) => {
12
+ if (value !== undefined) {
13
+ searchParams.append(key, value);
14
+ }
15
+ });
16
+ }
17
+ return this.client.request(`/stats?${searchParams.toString()}`, {
18
+ method: 'GET',
19
+ });
20
+ }
21
+ }
22
+ exports.StatsResource = StatsResource;
@@ -7,4 +7,31 @@ export declare class TagsResource {
7
7
  query?: string;
8
8
  cursor?: string;
9
9
  }): Promise<TagListResponse>;
10
+ create(payload: {
11
+ name: string;
12
+ description?: string;
13
+ color?: string;
14
+ extendedData?: Record<string, any>;
15
+ }): Promise<import('../types').Tag>;
16
+ retrieve(id: string, params?: {
17
+ userId?: string;
18
+ }): Promise<import('../types').Tag & {
19
+ isSubscribed?: boolean;
20
+ }>;
21
+ update(id: string, payload: {
22
+ name?: string;
23
+ description?: string;
24
+ color?: string;
25
+ extendedData?: Record<string, any>;
26
+ }): Promise<import('../types').Tag>;
27
+ delete(id: string): Promise<import('../types').Tag & {
28
+ deleted: boolean;
29
+ }>;
30
+ subscribe(id: string, userId: string): Promise<any>;
31
+ unsubscribe(id: string, userId: string): Promise<any>;
32
+ listSubscribed(params: {
33
+ userId: string;
34
+ query?: string;
35
+ cursor?: string;
36
+ }): Promise<TagListResponse>;
10
37
  }
@@ -18,5 +18,52 @@ class TagsResource {
18
18
  method: 'GET',
19
19
  });
20
20
  }
21
+ async create(payload) {
22
+ return this.client.request('/tag', {
23
+ method: 'POST',
24
+ body: JSON.stringify(payload),
25
+ });
26
+ }
27
+ async retrieve(id, params) {
28
+ const searchParams = new URLSearchParams();
29
+ if (params === null || params === void 0 ? void 0 : params.userId)
30
+ searchParams.append('userId', params.userId);
31
+ return this.client.request(`/tag/${id}?${searchParams.toString()}`, {
32
+ method: 'GET',
33
+ });
34
+ }
35
+ async update(id, payload) {
36
+ return this.client.request(`/tag/${id}`, {
37
+ method: 'PUT',
38
+ body: JSON.stringify(payload),
39
+ });
40
+ }
41
+ async delete(id) {
42
+ return this.client.request(`/tag/${id}`, {
43
+ method: 'DELETE',
44
+ });
45
+ }
46
+ async subscribe(id, userId) {
47
+ return this.client.request(`/tag/${id}/subscribers`, {
48
+ method: 'POST',
49
+ body: JSON.stringify({ userId }),
50
+ });
51
+ }
52
+ async unsubscribe(id, userId) {
53
+ return this.client.request(`/tag/${id}/subscribers?userId=${userId}`, {
54
+ method: 'DELETE',
55
+ });
56
+ }
57
+ async listSubscribed(params) {
58
+ const searchParams = new URLSearchParams();
59
+ Object.entries(params).forEach(([key, value]) => {
60
+ if (value !== undefined) {
61
+ searchParams.append(key, value);
62
+ }
63
+ });
64
+ return this.client.request(`/tags/subscribed?${searchParams.toString()}`, {
65
+ method: 'GET',
66
+ });
67
+ }
21
68
  }
22
69
  exports.TagsResource = TagsResource;
@@ -19,4 +19,18 @@ export declare class ThreadsResource {
19
19
  }): Promise<import('../types').Thread & {
20
20
  deleted: boolean;
21
21
  }>;
22
+ getPosts(id: string, params?: {
23
+ query?: string;
24
+ cursor?: string;
25
+ filter?: 'newest' | 'oldest';
26
+ }): Promise<any>;
27
+ like(id: string, userId?: string, extendedData?: any): Promise<any>;
28
+ unlike(id: string, userId: string): Promise<any>;
29
+ dislike(id: string, userId?: string, extendedData?: any): Promise<any>;
30
+ undislike(id: string, userId: string): Promise<any>;
31
+ subscribe(id: string, userId: string, extendedData?: any): Promise<any>;
32
+ unsubscribe(id: string, userId: string): Promise<any>;
33
+ vote(id: string, optionId: string, userId: string): Promise<any>;
34
+ voteUpdate(id: string, optionId: string, userId: string): Promise<any>;
35
+ unvote(id: string, userId: string): Promise<any>;
22
36
  }
@@ -41,5 +41,66 @@ class ThreadsResource {
41
41
  body: payload ? JSON.stringify(payload) : undefined,
42
42
  });
43
43
  }
44
+ async getPosts(id, params) {
45
+ const searchParams = new URLSearchParams();
46
+ if (params) {
47
+ Object.entries(params).forEach(([key, value]) => {
48
+ if (value !== undefined) {
49
+ searchParams.append(key, value);
50
+ }
51
+ });
52
+ }
53
+ return this.client.request(`/thread/${id}/posts?${searchParams.toString()}`, { method: 'GET' });
54
+ }
55
+ async like(id, userId, extendedData) {
56
+ return this.client.request(`/thread/${id}/likes`, {
57
+ method: 'POST',
58
+ body: JSON.stringify({ userId, extendedData }),
59
+ });
60
+ }
61
+ async unlike(id, userId) {
62
+ return this.client.request(`/thread/${id}/likes?userId=${userId}`, {
63
+ method: 'DELETE',
64
+ });
65
+ }
66
+ async dislike(id, userId, extendedData) {
67
+ return this.client.request(`/thread/${id}/dislikes`, {
68
+ method: 'POST',
69
+ body: JSON.stringify({ userId, extendedData }),
70
+ });
71
+ }
72
+ async undislike(id, userId) {
73
+ return this.client.request(`/thread/${id}/dislikes?userId=${userId}`, {
74
+ method: 'DELETE',
75
+ });
76
+ }
77
+ async subscribe(id, userId, extendedData) {
78
+ return this.client.request(`/thread/${id}/subscribers`, {
79
+ method: 'POST',
80
+ body: JSON.stringify({ userId, extendedData }),
81
+ });
82
+ }
83
+ async unsubscribe(id, userId) {
84
+ return this.client.request(`/thread/${id}/subscribers?userId=${userId}`, {
85
+ method: 'DELETE',
86
+ });
87
+ }
88
+ async vote(id, optionId, userId) {
89
+ return this.client.request(`/thread/${id}/poll/votes`, {
90
+ method: 'POST',
91
+ body: JSON.stringify({ optionId, userId }),
92
+ });
93
+ }
94
+ async voteUpdate(id, optionId, userId) {
95
+ return this.client.request(`/thread/${id}/poll/votes`, {
96
+ method: 'PUT',
97
+ body: JSON.stringify({ optionId, userId }),
98
+ });
99
+ }
100
+ async unvote(id, userId) {
101
+ return this.client.request(`/thread/${id}/poll/votes?userId=${userId}`, {
102
+ method: 'DELETE',
103
+ });
104
+ }
44
105
  }
45
106
  exports.ThreadsResource = ThreadsResource;
@@ -9,4 +9,51 @@ export declare class UsersResource {
9
9
  cursor?: string;
10
10
  }): Promise<UserListResponse>;
11
11
  retrieve(userId: string): Promise<User>;
12
+ create(payload: {
13
+ username: string;
14
+ email: string;
15
+ password: string;
16
+ displayName?: string;
17
+ emailVerified?: boolean;
18
+ roles?: string[];
19
+ bio?: string;
20
+ signature?: string;
21
+ url?: string;
22
+ extendedData?: Record<string, any>;
23
+ }): Promise<User>;
24
+ update(id: string, payload: {
25
+ username?: string;
26
+ email?: string;
27
+ password?: string;
28
+ displayName?: string;
29
+ emailVerified?: boolean;
30
+ roles?: string[];
31
+ bio?: string;
32
+ signature?: string;
33
+ url?: string;
34
+ extendedData?: Record<string, any>;
35
+ }): Promise<User>;
36
+ delete(id: string): Promise<User & {
37
+ deleted: boolean;
38
+ }>;
39
+ getFollowers(id: string, params?: {
40
+ query?: string;
41
+ cursor?: string;
42
+ filter?: 'newest' | 'oldest';
43
+ }): Promise<{
44
+ followers: User[];
45
+ nextUserCursor?: string;
46
+ count: number;
47
+ }>;
48
+ follow(id: string, followerId: string, extendedData?: any): Promise<any>;
49
+ unfollow(id: string, followerId: string): Promise<any>;
50
+ getFollowing(id: string, params?: {
51
+ query?: string;
52
+ cursor?: string;
53
+ filter?: 'newest' | 'oldest';
54
+ }): Promise<{
55
+ following: any[];
56
+ nextUserCursor?: string;
57
+ count: number;
58
+ }>;
12
59
  }
@@ -23,5 +23,59 @@ class UsersResource {
23
23
  method: 'GET',
24
24
  });
25
25
  }
26
+ async create(payload) {
27
+ return this.client.request('/user', {
28
+ method: 'POST',
29
+ body: JSON.stringify(payload),
30
+ });
31
+ }
32
+ async update(id, payload) {
33
+ return this.client.request(`/user/${id}`, {
34
+ method: 'PUT',
35
+ body: JSON.stringify(payload),
36
+ });
37
+ }
38
+ async delete(id) {
39
+ return this.client.request(`/user/${id}`, {
40
+ method: 'DELETE',
41
+ });
42
+ }
43
+ async getFollowers(id, params) {
44
+ const searchParams = new URLSearchParams();
45
+ if (params) {
46
+ Object.entries(params).forEach(([key, value]) => {
47
+ if (value !== undefined) {
48
+ searchParams.append(key, value);
49
+ }
50
+ });
51
+ }
52
+ return this.client.request(`/user/${id}/followers?${searchParams.toString()}`, {
53
+ method: 'GET',
54
+ });
55
+ }
56
+ async follow(id, followerId, extendedData) {
57
+ return this.client.request(`/user/${id}/followers`, {
58
+ method: 'POST',
59
+ body: JSON.stringify({ followerId, extendedData }),
60
+ });
61
+ }
62
+ async unfollow(id, followerId) {
63
+ return this.client.request(`/user/${id}/followers?followerId=${followerId}`, {
64
+ method: 'DELETE',
65
+ });
66
+ }
67
+ async getFollowing(id, params) {
68
+ const searchParams = new URLSearchParams();
69
+ if (params) {
70
+ Object.entries(params).forEach(([key, value]) => {
71
+ if (value !== undefined) {
72
+ searchParams.append(key, value);
73
+ }
74
+ });
75
+ }
76
+ return this.client.request(`/user/${id}/following?${searchParams.toString()}`, {
77
+ method: 'GET',
78
+ });
79
+ }
26
80
  }
27
81
  exports.UsersResource = UsersResource;
@@ -0,0 +1,35 @@
1
+ import { ForumClient } from '../Client';
2
+ import { Webhook, WebhookListResponse } from '../types';
3
+ export declare class WebhooksResource {
4
+ private client;
5
+ constructor(client: ForumClient);
6
+ list(): Promise<WebhookListResponse>;
7
+ create(payload: {
8
+ name: string;
9
+ url: string;
10
+ events: string[];
11
+ }): Promise<{
12
+ webhook: Webhook;
13
+ }>;
14
+ retrieve(id: string): Promise<{
15
+ webhook: Webhook;
16
+ }>;
17
+ update(id: string, payload: {
18
+ name?: string;
19
+ url?: string;
20
+ events?: string[];
21
+ active?: boolean;
22
+ }): Promise<{
23
+ webhook: Webhook;
24
+ }>;
25
+ delete(id: string): Promise<{
26
+ success: boolean;
27
+ }>;
28
+ getDeliveries(id: string, params?: {
29
+ cursor?: string;
30
+ }): Promise<{
31
+ deliveries: any[];
32
+ total: number;
33
+ nextCursor?: string;
34
+ }>;
35
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebhooksResource = void 0;
4
+ class WebhooksResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async list() {
9
+ return this.client.request('/webhooks', {
10
+ method: 'GET',
11
+ });
12
+ }
13
+ async create(payload) {
14
+ return this.client.request('/webhooks', {
15
+ method: 'POST',
16
+ body: JSON.stringify(payload),
17
+ });
18
+ }
19
+ async retrieve(id) {
20
+ return this.client.request(`/webhooks/${id}`, {
21
+ method: 'GET',
22
+ });
23
+ }
24
+ async update(id, payload) {
25
+ return this.client.request(`/webhooks/${id}`, {
26
+ method: 'PATCH',
27
+ body: JSON.stringify(payload),
28
+ });
29
+ }
30
+ async delete(id) {
31
+ return this.client.request(`/webhooks/${id}`, {
32
+ method: 'DELETE',
33
+ });
34
+ }
35
+ async getDeliveries(id, params) {
36
+ const searchParams = new URLSearchParams();
37
+ if (params === null || params === void 0 ? void 0 : params.cursor)
38
+ searchParams.append('cursor', params.cursor);
39
+ return this.client.request(`/webhooks/${id}/deliveries?${searchParams.toString()}`, {
40
+ method: 'GET',
41
+ });
42
+ }
43
+ }
44
+ exports.WebhooksResource = WebhooksResource;