@foru-ms/sdk 1.1.0 → 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 +375 -38
  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
package/dist/Client.js CHANGED
@@ -15,13 +15,34 @@ const PrivateMessages_1 = require("./resources/PrivateMessages");
15
15
  const Reports_1 = require("./resources/Reports");
16
16
  const Roles_1 = require("./resources/Roles");
17
17
  const SSO_1 = require("./resources/SSO");
18
+ const errors_1 = require("./errors");
19
+ const utils_1 = require("./utils");
18
20
  // Polyfill fetch if needed (e.g. older Node versions)
19
21
  const fetch = globalThis.fetch || require('cross-fetch');
22
+ /**
23
+ * Main client for interacting with the Foru.ms API
24
+ * @example
25
+ * ```typescript
26
+ * const client = new ForumClient({
27
+ * apiKey: 'your_api_key',
28
+ * baseUrl: 'https://api.foru.ms/v1'
29
+ * });
30
+ *
31
+ * // Set user token
32
+ * client.setToken('user_jwt_token');
33
+ *
34
+ * // Use resources
35
+ * const threads = await client.threads.list();
36
+ * ```
37
+ */
20
38
  class ForumClient {
21
39
  constructor(options) {
40
+ var _a, _b;
22
41
  this.token = null;
23
42
  this.apiKey = options.apiKey;
24
43
  this.baseUrl = options.baseUrl || 'https://api.foru.ms/v1';
44
+ this.maxRetries = (_a = options.maxRetries) !== null && _a !== void 0 ? _a : 3;
45
+ this.enableRetry = (_b = options.enableRetry) !== null && _b !== void 0 ? _b : true;
25
46
  this.auth = new Auth_1.AuthResource(this);
26
47
  this.threads = new Threads_1.ThreadsResource(this);
27
48
  this.posts = new Posts_1.PostsResource(this);
@@ -36,35 +57,116 @@ class ForumClient {
36
57
  this.reports = new Reports_1.ReportsResource(this);
37
58
  this.roles = new Roles_1.RolesResource(this);
38
59
  this.sso = new SSO_1.SSOResource(this);
60
+ this.pagination = new utils_1.PaginationHelper();
39
61
  }
62
+ /**
63
+ * Make an HTTP request to the API
64
+ * @param path - API endpoint path
65
+ * @param options - Fetch options
66
+ * @returns Promise resolving to the response data
67
+ * @throws {ForumAPIError} When the API returns an error
68
+ * @throws {NetworkError} When the network request fails
69
+ */
40
70
  async request(path, options = {}) {
41
- const headers = {
42
- 'Content-Type': 'application/json',
43
- 'x-api-key': this.apiKey,
44
- ...options.headers,
71
+ const makeRequest = async () => {
72
+ const headers = {
73
+ 'Content-Type': 'application/json',
74
+ 'x-api-key': this.apiKey,
75
+ ...options.headers,
76
+ };
77
+ if (this.token) {
78
+ headers['Authorization'] = `Bearer ${this.token}`;
79
+ }
80
+ let response;
81
+ try {
82
+ response = await fetch(`${this.baseUrl}${path}`, {
83
+ ...options,
84
+ headers,
85
+ });
86
+ }
87
+ catch (error) {
88
+ throw new errors_1.NetworkError('Network request failed', error);
89
+ }
90
+ // Extract rate limit info
91
+ this.extractRateLimitInfo(response);
92
+ const contentType = response.headers.get('content-type');
93
+ let data;
94
+ if (contentType && contentType.includes('application/json')) {
95
+ data = await response.json();
96
+ }
97
+ else {
98
+ data = await response.text();
99
+ }
100
+ if (!response.ok) {
101
+ this.handleErrorResponse(response.status, data);
102
+ }
103
+ return data;
45
104
  };
46
- if (this.token) {
47
- headers['Authorization'] = `Bearer ${this.token}`;
105
+ // Apply retry logic if enabled
106
+ if (this.enableRetry) {
107
+ return utils_1.RetryHelper.withRetry(makeRequest, this.maxRetries);
48
108
  }
49
- const response = await fetch(`${this.baseUrl}${path}`, {
50
- ...options,
51
- headers,
52
- });
53
- const contentType = response.headers.get('content-type');
54
- let data;
55
- if (contentType && contentType.includes('application/json')) {
56
- data = await response.json();
57
- }
58
- else {
59
- data = await response.text();
60
- }
61
- if (!response.ok) {
62
- throw new Error((data && data.message) || data.error || 'API Error');
63
- }
64
- return data;
109
+ return makeRequest();
65
110
  }
111
+ /**
112
+ * Set the authentication token for user-scoped requests
113
+ * @param token - JWT token
114
+ */
66
115
  setToken(token) {
67
116
  this.token = token;
68
117
  }
118
+ /**
119
+ * Clear the authentication token
120
+ */
121
+ clearToken() {
122
+ this.token = null;
123
+ }
124
+ /**
125
+ * Check if client is authenticated
126
+ */
127
+ isAuthenticated() {
128
+ return this.token !== null;
129
+ }
130
+ /**
131
+ * Extract and store rate limit information from response headers
132
+ */
133
+ extractRateLimitInfo(response) {
134
+ const limit = response.headers.get('x-ratelimit-limit');
135
+ const remaining = response.headers.get('x-ratelimit-remaining');
136
+ const reset = response.headers.get('x-ratelimit-reset');
137
+ if (limit && remaining && reset) {
138
+ this.lastRateLimitInfo = {
139
+ limit: parseInt(limit, 10),
140
+ remaining: parseInt(remaining, 10),
141
+ reset: parseInt(reset, 10),
142
+ };
143
+ }
144
+ }
145
+ /**
146
+ * Handle error responses by throwing appropriate error types
147
+ */
148
+ handleErrorResponse(status, data) {
149
+ const message = (data && data.message) || data.error || 'API Error';
150
+ switch (status) {
151
+ case 401:
152
+ throw new errors_1.AuthenticationError(message, data);
153
+ case 403:
154
+ throw new errors_1.AuthorizationError(message, data);
155
+ case 404:
156
+ throw new errors_1.NotFoundError(message, data);
157
+ case 422:
158
+ throw new errors_1.ValidationError(message, data);
159
+ case 429:
160
+ const retryAfter = data.retryAfter || 60;
161
+ throw new errors_1.RateLimitError(message, retryAfter, data);
162
+ case 500:
163
+ case 502:
164
+ case 503:
165
+ case 504:
166
+ throw new errors_1.ServerError(message, status, data);
167
+ default:
168
+ throw new errors_1.ForumAPIError(message, status, data);
169
+ }
170
+ }
69
171
  }
70
172
  exports.ForumClient = ForumClient;
@@ -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>;