@foru-ms/sdk 1.1.1 → 1.2.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 (47) hide show
  1. package/README.md +286 -11
  2. package/dist/Client.d.ts +63 -4
  3. package/dist/Client.js +124 -22
  4. package/dist/errors.d.ts +52 -0
  5. package/dist/errors.js +95 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.js +3 -0
  8. package/dist/resources/Integrations.d.ts +7 -0
  9. package/dist/resources/Integrations.js +6 -0
  10. package/dist/resources/Posts.d.ts +12 -0
  11. package/dist/resources/Posts.js +44 -0
  12. package/dist/resources/PrivateMessages.d.ts +4 -0
  13. package/dist/resources/PrivateMessages.js +6 -0
  14. package/dist/resources/SSO.d.ts +10 -0
  15. package/dist/resources/SSO.js +11 -0
  16. package/dist/resources/Tags.d.ts +8 -0
  17. package/dist/resources/Tags.js +24 -0
  18. package/dist/resources/Threads.d.ts +20 -0
  19. package/dist/resources/Threads.js +85 -0
  20. package/dist/resources/Users.d.ts +10 -0
  21. package/dist/resources/Users.js +26 -0
  22. package/dist/resources/Webhooks.d.ts +69 -0
  23. package/dist/resources/Webhooks.js +115 -0
  24. package/dist/response-types.d.ts +105 -0
  25. package/dist/response-types.js +2 -0
  26. package/dist/utils.d.ts +80 -0
  27. package/dist/utils.js +138 -0
  28. package/examples/README.md +38 -0
  29. package/examples/authentication.ts +79 -0
  30. package/examples/error-handling.ts +133 -0
  31. package/examples/managing-threads.ts +130 -0
  32. package/examples/pagination.ts +81 -0
  33. package/examples/webhooks.ts +176 -0
  34. package/package.json +1 -1
  35. package/src/Client.ts +165 -25
  36. package/src/errors.ts +95 -0
  37. package/src/index.ts +3 -0
  38. package/src/resources/Integrations.ts +11 -0
  39. package/src/resources/Posts.ts +56 -0
  40. package/src/resources/PrivateMessages.ts +10 -0
  41. package/src/resources/SSO.ts +17 -0
  42. package/src/resources/Tags.ts +32 -0
  43. package/src/resources/Threads.ts +109 -0
  44. package/src/resources/Users.ts +36 -0
  45. package/src/resources/Webhooks.ts +131 -0
  46. package/src/response-types.ts +113 -0
  47. package/src/utils.ts +182 -0
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Base error class for all Foru.ms API errors
3
+ */
4
+ export declare class ForumAPIError extends Error {
5
+ statusCode: number;
6
+ response?: any;
7
+ constructor(message: string, statusCode: number, response?: any);
8
+ }
9
+ /**
10
+ * Error thrown when authentication fails or token is invalid
11
+ */
12
+ export declare class AuthenticationError extends ForumAPIError {
13
+ constructor(message?: string, response?: any);
14
+ }
15
+ /**
16
+ * Error thrown when user doesn't have permission for an action
17
+ */
18
+ export declare class AuthorizationError extends ForumAPIError {
19
+ constructor(message?: string, response?: any);
20
+ }
21
+ /**
22
+ * Error thrown when a requested resource is not found
23
+ */
24
+ export declare class NotFoundError extends ForumAPIError {
25
+ constructor(message?: string, response?: any);
26
+ }
27
+ /**
28
+ * Error thrown when request validation fails
29
+ */
30
+ export declare class ValidationError extends ForumAPIError {
31
+ constructor(message?: string, response?: any);
32
+ }
33
+ /**
34
+ * Error thrown when rate limit is exceeded
35
+ */
36
+ export declare class RateLimitError extends ForumAPIError {
37
+ retryAfter?: number | undefined;
38
+ constructor(message?: string, retryAfter?: number | undefined, response?: any);
39
+ }
40
+ /**
41
+ * Error thrown when server encounters an error
42
+ */
43
+ export declare class ServerError extends ForumAPIError {
44
+ constructor(message?: string, statusCode?: number, response?: any);
45
+ }
46
+ /**
47
+ * Error thrown when network request fails
48
+ */
49
+ export declare class NetworkError extends Error {
50
+ cause?: Error | undefined;
51
+ constructor(message?: string, cause?: Error | undefined);
52
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NetworkError = exports.ServerError = exports.RateLimitError = exports.ValidationError = exports.NotFoundError = exports.AuthorizationError = exports.AuthenticationError = exports.ForumAPIError = void 0;
4
+ /**
5
+ * Base error class for all Foru.ms API errors
6
+ */
7
+ class ForumAPIError extends Error {
8
+ constructor(message, statusCode, response) {
9
+ super(message);
10
+ this.statusCode = statusCode;
11
+ this.response = response;
12
+ this.name = 'ForumAPIError';
13
+ Object.setPrototypeOf(this, ForumAPIError.prototype);
14
+ }
15
+ }
16
+ exports.ForumAPIError = ForumAPIError;
17
+ /**
18
+ * Error thrown when authentication fails or token is invalid
19
+ */
20
+ class AuthenticationError extends ForumAPIError {
21
+ constructor(message = 'Authentication failed', response) {
22
+ super(message, 401, response);
23
+ this.name = 'AuthenticationError';
24
+ Object.setPrototypeOf(this, AuthenticationError.prototype);
25
+ }
26
+ }
27
+ exports.AuthenticationError = AuthenticationError;
28
+ /**
29
+ * Error thrown when user doesn't have permission for an action
30
+ */
31
+ class AuthorizationError extends ForumAPIError {
32
+ constructor(message = 'Permission denied', response) {
33
+ super(message, 403, response);
34
+ this.name = 'AuthorizationError';
35
+ Object.setPrototypeOf(this, AuthorizationError.prototype);
36
+ }
37
+ }
38
+ exports.AuthorizationError = AuthorizationError;
39
+ /**
40
+ * Error thrown when a requested resource is not found
41
+ */
42
+ class NotFoundError extends ForumAPIError {
43
+ constructor(message = 'Resource not found', response) {
44
+ super(message, 404, response);
45
+ this.name = 'NotFoundError';
46
+ Object.setPrototypeOf(this, NotFoundError.prototype);
47
+ }
48
+ }
49
+ exports.NotFoundError = NotFoundError;
50
+ /**
51
+ * Error thrown when request validation fails
52
+ */
53
+ class ValidationError extends ForumAPIError {
54
+ constructor(message = 'Validation failed', response) {
55
+ super(message, 422, response);
56
+ this.name = 'ValidationError';
57
+ Object.setPrototypeOf(this, ValidationError.prototype);
58
+ }
59
+ }
60
+ exports.ValidationError = ValidationError;
61
+ /**
62
+ * Error thrown when rate limit is exceeded
63
+ */
64
+ class RateLimitError extends ForumAPIError {
65
+ constructor(message = 'Rate limit exceeded', retryAfter, response) {
66
+ super(message, 429, response);
67
+ this.retryAfter = retryAfter;
68
+ this.name = 'RateLimitError';
69
+ Object.setPrototypeOf(this, RateLimitError.prototype);
70
+ }
71
+ }
72
+ exports.RateLimitError = RateLimitError;
73
+ /**
74
+ * Error thrown when server encounters an error
75
+ */
76
+ class ServerError extends ForumAPIError {
77
+ constructor(message = 'Server error', statusCode = 500, response) {
78
+ super(message, statusCode, response);
79
+ this.name = 'ServerError';
80
+ Object.setPrototypeOf(this, ServerError.prototype);
81
+ }
82
+ }
83
+ exports.ServerError = ServerError;
84
+ /**
85
+ * Error thrown when network request fails
86
+ */
87
+ class NetworkError extends Error {
88
+ constructor(message = 'Network request failed', cause) {
89
+ super(message);
90
+ this.cause = cause;
91
+ this.name = 'NetworkError';
92
+ Object.setPrototypeOf(this, NetworkError.prototype);
93
+ }
94
+ }
95
+ exports.NetworkError = NetworkError;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  export * from './Client';
2
2
  export * from './types';
3
+ export * from './errors';
4
+ export * from './response-types';
5
+ export * from './utils';
3
6
  export * from './resources/Auth';
4
7
  export * from './resources/Threads';
5
8
  export * from './resources/Posts';
package/dist/index.js CHANGED
@@ -16,6 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Client"), exports);
18
18
  __exportStar(require("./types"), exports);
19
+ __exportStar(require("./errors"), exports);
20
+ __exportStar(require("./response-types"), exports);
21
+ __exportStar(require("./utils"), exports);
19
22
  __exportStar(require("./resources/Auth"), exports);
20
23
  __exportStar(require("./resources/Threads"), exports);
21
24
  __exportStar(require("./resources/Posts"), exports);
@@ -14,6 +14,13 @@ export declare class IntegrationsResource {
14
14
  retrieve(id: string): Promise<{
15
15
  integration: Integration;
16
16
  }>;
17
+ update(id: string, payload: {
18
+ name?: string;
19
+ config?: any;
20
+ active?: boolean;
21
+ }): Promise<{
22
+ integration: Integration;
23
+ }>;
17
24
  delete(id: string): Promise<{
18
25
  success: boolean;
19
26
  }>;
@@ -21,6 +21,12 @@ class IntegrationsResource {
21
21
  method: 'GET',
22
22
  });
23
23
  }
24
+ async update(id, payload) {
25
+ return this.client.request(`/integrations/${id}`, {
26
+ method: 'PATCH',
27
+ body: JSON.stringify(payload),
28
+ });
29
+ }
24
30
  async delete(id) {
25
31
  return this.client.request(`/integrations/${id}`, {
26
32
  method: 'DELETE',
@@ -25,10 +25,22 @@ export declare class PostsResource {
25
25
  }): Promise<any>;
26
26
  like(id: string, userId?: string, extendedData?: any): Promise<any>;
27
27
  unlike(id: string, userId: string): Promise<any>;
28
+ getLikes(id: string, params?: {
29
+ cursor?: string;
30
+ }): Promise<any>;
28
31
  dislike(id: string, userId?: string, extendedData?: any): Promise<any>;
29
32
  undislike(id: string, userId: string): Promise<any>;
33
+ getDislikes(id: string, params?: {
34
+ cursor?: string;
35
+ }): Promise<any>;
30
36
  upvote(id: string, userId?: string, extendedData?: any): Promise<any>;
31
37
  unupvote(id: string, userId: string): Promise<any>;
38
+ getUpvotes(id: string, params?: {
39
+ cursor?: string;
40
+ }): Promise<any>;
32
41
  downvote(id: string, userId?: string, extendedData?: any): Promise<any>;
33
42
  undownvote(id: string, userId: string): Promise<any>;
43
+ getDownvotes(id: string, params?: {
44
+ cursor?: string;
45
+ }): Promise<any>;
34
46
  }
@@ -63,6 +63,17 @@ class PostsResource {
63
63
  method: 'DELETE',
64
64
  });
65
65
  }
66
+ async getLikes(id, params) {
67
+ const searchParams = new URLSearchParams();
68
+ if (params) {
69
+ Object.entries(params).forEach(([key, value]) => {
70
+ if (value !== undefined) {
71
+ searchParams.append(key, value);
72
+ }
73
+ });
74
+ }
75
+ return this.client.request(`/post/${id}/likes?${searchParams.toString()}`, { method: 'GET' });
76
+ }
66
77
  async dislike(id, userId, extendedData) {
67
78
  return this.client.request(`/post/${id}/dislikes`, {
68
79
  method: 'POST',
@@ -74,6 +85,17 @@ class PostsResource {
74
85
  method: 'DELETE',
75
86
  });
76
87
  }
88
+ async getDislikes(id, params) {
89
+ const searchParams = new URLSearchParams();
90
+ if (params) {
91
+ Object.entries(params).forEach(([key, value]) => {
92
+ if (value !== undefined) {
93
+ searchParams.append(key, value);
94
+ }
95
+ });
96
+ }
97
+ return this.client.request(`/post/${id}/dislikes?${searchParams.toString()}`, { method: 'GET' });
98
+ }
77
99
  async upvote(id, userId, extendedData) {
78
100
  return this.client.request(`/post/${id}/upvotes`, {
79
101
  method: 'POST',
@@ -85,6 +107,17 @@ class PostsResource {
85
107
  method: 'DELETE',
86
108
  });
87
109
  }
110
+ async getUpvotes(id, params) {
111
+ const searchParams = new URLSearchParams();
112
+ if (params) {
113
+ Object.entries(params).forEach(([key, value]) => {
114
+ if (value !== undefined) {
115
+ searchParams.append(key, value);
116
+ }
117
+ });
118
+ }
119
+ return this.client.request(`/post/${id}/upvotes?${searchParams.toString()}`, { method: 'GET' });
120
+ }
88
121
  async downvote(id, userId, extendedData) {
89
122
  return this.client.request(`/post/${id}/downvotes`, {
90
123
  method: 'POST',
@@ -96,5 +129,16 @@ class PostsResource {
96
129
  method: 'DELETE',
97
130
  });
98
131
  }
132
+ async getDownvotes(id, params) {
133
+ const searchParams = new URLSearchParams();
134
+ if (params) {
135
+ Object.entries(params).forEach(([key, value]) => {
136
+ if (value !== undefined) {
137
+ searchParams.append(key, value);
138
+ }
139
+ });
140
+ }
141
+ return this.client.request(`/post/${id}/downvotes?${searchParams.toString()}`, { method: 'GET' });
142
+ }
99
143
  }
100
144
  exports.PostsResource = PostsResource;
@@ -23,6 +23,10 @@ export declare class PrivateMessagesResource {
23
23
  recipientId: string;
24
24
  extendedData?: Record<string, any>;
25
25
  }): Promise<PrivateMessage>;
26
+ update(id: string, payload: {
27
+ read?: boolean;
28
+ extendedData?: Record<string, any>;
29
+ }): Promise<PrivateMessage>;
26
30
  delete(id: string): Promise<PrivateMessage & {
27
31
  deleted: boolean;
28
32
  }>;
@@ -35,6 +35,12 @@ class PrivateMessagesResource {
35
35
  body: JSON.stringify(payload),
36
36
  });
37
37
  }
38
+ async update(id, payload) {
39
+ return this.client.request(`/private-message/${id}`, {
40
+ method: 'PATCH',
41
+ body: JSON.stringify(payload),
42
+ });
43
+ }
38
44
  async delete(id) {
39
45
  return this.client.request(`/private-message/${id}`, {
40
46
  method: 'DELETE',
@@ -11,6 +11,16 @@ export declare class SSOResource {
11
11
  }): Promise<{
12
12
  ssoProvider: SSOProvider;
13
13
  }>;
14
+ retrieve(id: string): Promise<{
15
+ ssoProvider: SSOProvider;
16
+ }>;
17
+ update(id: string, payload: {
18
+ domain?: string;
19
+ config?: any;
20
+ active?: boolean;
21
+ }): Promise<{
22
+ ssoProvider: SSOProvider;
23
+ }>;
14
24
  delete(id: string): Promise<{
15
25
  success: boolean;
16
26
  }>;
@@ -16,6 +16,17 @@ class SSOResource {
16
16
  body: JSON.stringify(payload),
17
17
  });
18
18
  }
19
+ async retrieve(id) {
20
+ return this.client.request(`/sso/${id}`, {
21
+ method: 'GET',
22
+ });
23
+ }
24
+ async update(id, payload) {
25
+ return this.client.request(`/sso/${id}`, {
26
+ method: 'PATCH',
27
+ body: JSON.stringify(payload),
28
+ });
29
+ }
19
30
  async delete(id) {
20
31
  return this.client.request(`/sso/${id}`, {
21
32
  method: 'DELETE',
@@ -27,8 +27,16 @@ export declare class TagsResource {
27
27
  delete(id: string): Promise<import('../types').Tag & {
28
28
  deleted: boolean;
29
29
  }>;
30
+ getThreads(id: string, params?: {
31
+ query?: string;
32
+ cursor?: string;
33
+ filter?: 'newest' | 'oldest';
34
+ }): Promise<import('../types').ThreadListResponse>;
30
35
  subscribe(id: string, userId: string): Promise<any>;
31
36
  unsubscribe(id: string, userId: string): Promise<any>;
37
+ getSubscribers(id: string, params?: {
38
+ cursor?: string;
39
+ }): Promise<any>;
32
40
  listSubscribed(params: {
33
41
  userId: string;
34
42
  query?: string;
@@ -43,6 +43,19 @@ class TagsResource {
43
43
  method: 'DELETE',
44
44
  });
45
45
  }
46
+ async getThreads(id, params) {
47
+ const searchParams = new URLSearchParams();
48
+ if (params) {
49
+ Object.entries(params).forEach(([key, value]) => {
50
+ if (value !== undefined) {
51
+ searchParams.append(key, value);
52
+ }
53
+ });
54
+ }
55
+ return this.client.request(`/tag/${id}/threads?${searchParams.toString()}`, {
56
+ method: 'GET',
57
+ });
58
+ }
46
59
  async subscribe(id, userId) {
47
60
  return this.client.request(`/tag/${id}/subscribers`, {
48
61
  method: 'POST',
@@ -54,6 +67,17 @@ class TagsResource {
54
67
  method: 'DELETE',
55
68
  });
56
69
  }
70
+ async getSubscribers(id, params) {
71
+ const searchParams = new URLSearchParams();
72
+ if (params) {
73
+ Object.entries(params).forEach(([key, value]) => {
74
+ if (value !== undefined) {
75
+ searchParams.append(key, value);
76
+ }
77
+ });
78
+ }
79
+ return this.client.request(`/tag/${id}/subscribers?${searchParams.toString()}`, { method: 'GET' });
80
+ }
57
81
  async listSubscribed(params) {
58
82
  const searchParams = new URLSearchParams();
59
83
  Object.entries(params).forEach(([key, value]) => {
@@ -26,10 +26,30 @@ export declare class ThreadsResource {
26
26
  }): Promise<any>;
27
27
  like(id: string, userId?: string, extendedData?: any): Promise<any>;
28
28
  unlike(id: string, userId: string): Promise<any>;
29
+ getLikes(id: string, params?: {
30
+ cursor?: string;
31
+ }): Promise<any>;
29
32
  dislike(id: string, userId?: string, extendedData?: any): Promise<any>;
30
33
  undislike(id: string, userId: string): Promise<any>;
34
+ getDislikes(id: string, params?: {
35
+ cursor?: string;
36
+ }): Promise<any>;
31
37
  subscribe(id: string, userId: string, extendedData?: any): Promise<any>;
32
38
  unsubscribe(id: string, userId: string): Promise<any>;
39
+ getSubscribers(id: string, params?: {
40
+ cursor?: string;
41
+ }): Promise<any>;
42
+ upvote(id: string, userId?: string, extendedData?: any): Promise<any>;
43
+ unupvote(id: string, userId: string): Promise<any>;
44
+ getUpvotes(id: string, params?: {
45
+ cursor?: string;
46
+ }): Promise<any>;
47
+ downvote(id: string, userId?: string, extendedData?: any): Promise<any>;
48
+ undownvote(id: string, userId: string): Promise<any>;
49
+ getDownvotes(id: string, params?: {
50
+ cursor?: string;
51
+ }): Promise<any>;
52
+ getPoll(threadId: string, userId?: string): Promise<any>;
33
53
  vote(id: string, optionId: string, userId: string): Promise<any>;
34
54
  voteUpdate(id: string, optionId: string, userId: string): Promise<any>;
35
55
  unvote(id: string, userId: string): Promise<any>;
@@ -63,6 +63,17 @@ class ThreadsResource {
63
63
  method: 'DELETE',
64
64
  });
65
65
  }
66
+ async getLikes(id, params) {
67
+ const searchParams = new URLSearchParams();
68
+ if (params) {
69
+ Object.entries(params).forEach(([key, value]) => {
70
+ if (value !== undefined) {
71
+ searchParams.append(key, value);
72
+ }
73
+ });
74
+ }
75
+ return this.client.request(`/thread/${id}/likes?${searchParams.toString()}`, { method: 'GET' });
76
+ }
66
77
  async dislike(id, userId, extendedData) {
67
78
  return this.client.request(`/thread/${id}/dislikes`, {
68
79
  method: 'POST',
@@ -74,6 +85,17 @@ class ThreadsResource {
74
85
  method: 'DELETE',
75
86
  });
76
87
  }
88
+ async getDislikes(id, params) {
89
+ const searchParams = new URLSearchParams();
90
+ if (params) {
91
+ Object.entries(params).forEach(([key, value]) => {
92
+ if (value !== undefined) {
93
+ searchParams.append(key, value);
94
+ }
95
+ });
96
+ }
97
+ return this.client.request(`/thread/${id}/dislikes?${searchParams.toString()}`, { method: 'GET' });
98
+ }
77
99
  async subscribe(id, userId, extendedData) {
78
100
  return this.client.request(`/thread/${id}/subscribers`, {
79
101
  method: 'POST',
@@ -85,6 +107,69 @@ class ThreadsResource {
85
107
  method: 'DELETE',
86
108
  });
87
109
  }
110
+ async getSubscribers(id, params) {
111
+ const searchParams = new URLSearchParams();
112
+ if (params) {
113
+ Object.entries(params).forEach(([key, value]) => {
114
+ if (value !== undefined) {
115
+ searchParams.append(key, value);
116
+ }
117
+ });
118
+ }
119
+ return this.client.request(`/thread/${id}/subscribers?${searchParams.toString()}`, { method: 'GET' });
120
+ }
121
+ async upvote(id, userId, extendedData) {
122
+ return this.client.request(`/thread/${id}/upvotes`, {
123
+ method: 'POST',
124
+ body: JSON.stringify({ userId, extendedData }),
125
+ });
126
+ }
127
+ async unupvote(id, userId) {
128
+ return this.client.request(`/thread/${id}/upvotes?userId=${userId}`, {
129
+ method: 'DELETE',
130
+ });
131
+ }
132
+ async getUpvotes(id, params) {
133
+ const searchParams = new URLSearchParams();
134
+ if (params) {
135
+ Object.entries(params).forEach(([key, value]) => {
136
+ if (value !== undefined) {
137
+ searchParams.append(key, value);
138
+ }
139
+ });
140
+ }
141
+ return this.client.request(`/thread/${id}/upvotes?${searchParams.toString()}`, { method: 'GET' });
142
+ }
143
+ async downvote(id, userId, extendedData) {
144
+ return this.client.request(`/thread/${id}/downvotes`, {
145
+ method: 'POST',
146
+ body: JSON.stringify({ userId, extendedData }),
147
+ });
148
+ }
149
+ async undownvote(id, userId) {
150
+ return this.client.request(`/thread/${id}/downvotes?userId=${userId}`, {
151
+ method: 'DELETE',
152
+ });
153
+ }
154
+ async getDownvotes(id, params) {
155
+ const searchParams = new URLSearchParams();
156
+ if (params) {
157
+ Object.entries(params).forEach(([key, value]) => {
158
+ if (value !== undefined) {
159
+ searchParams.append(key, value);
160
+ }
161
+ });
162
+ }
163
+ return this.client.request(`/thread/${id}/downvotes?${searchParams.toString()}`, { method: 'GET' });
164
+ }
165
+ async getPoll(threadId, userId) {
166
+ const searchParams = new URLSearchParams();
167
+ if (userId) {
168
+ searchParams.append('userId', userId);
169
+ }
170
+ const query = searchParams.toString();
171
+ return this.client.request(`/thread/${threadId}/poll${query ? `?${query}` : ''}`, { method: 'GET' });
172
+ }
88
173
  async vote(id, optionId, userId) {
89
174
  return this.client.request(`/thread/${id}/poll/votes`, {
90
175
  method: 'POST',
@@ -36,6 +36,16 @@ export declare class UsersResource {
36
36
  delete(id: string): Promise<User & {
37
37
  deleted: boolean;
38
38
  }>;
39
+ getThreads(id: string, params?: {
40
+ query?: string;
41
+ cursor?: string;
42
+ filter?: 'newest' | 'oldest';
43
+ }): Promise<import('../types').ThreadListResponse>;
44
+ getPosts(id: string, params?: {
45
+ query?: string;
46
+ cursor?: string;
47
+ filter?: 'newest' | 'oldest';
48
+ }): Promise<import('../types').PostListResponse>;
39
49
  getFollowers(id: string, params?: {
40
50
  query?: string;
41
51
  cursor?: string;
@@ -40,6 +40,32 @@ class UsersResource {
40
40
  method: 'DELETE',
41
41
  });
42
42
  }
43
+ async getThreads(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}/threads?${searchParams.toString()}`, {
53
+ method: 'GET',
54
+ });
55
+ }
56
+ async getPosts(id, params) {
57
+ const searchParams = new URLSearchParams();
58
+ if (params) {
59
+ Object.entries(params).forEach(([key, value]) => {
60
+ if (value !== undefined) {
61
+ searchParams.append(key, value);
62
+ }
63
+ });
64
+ }
65
+ return this.client.request(`/user/${id}/posts?${searchParams.toString()}`, {
66
+ method: 'GET',
67
+ });
68
+ }
43
69
  async getFollowers(id, params) {
44
70
  const searchParams = new URLSearchParams();
45
71
  if (params) {