@doist/twist-sdk 2.4.0 → 2.5.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.
- package/dist/cjs/clients/inbox-client.js +11 -8
- package/dist/cjs/clients/search-client.js +2 -1
- package/dist/cjs/clients/threads-client.js +4 -1
- package/dist/cjs/types/requests.js +3 -0
- package/dist/esm/clients/inbox-client.js +11 -8
- package/dist/esm/clients/search-client.js +2 -1
- package/dist/esm/clients/threads-client.js +4 -1
- package/dist/esm/types/requests.js +3 -0
- package/dist/types/clients/inbox-client.d.ts +9 -6
- package/dist/types/clients/search-client.d.ts +2 -2
- package/dist/types/clients/threads-client.d.ts +4 -2
- package/dist/types/types/requests.d.ts +28 -5
- package/package.json +1 -1
|
@@ -30,13 +30,16 @@ var InboxClient = /** @class */ (function (_super) {
|
|
|
30
30
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
31
31
|
}
|
|
32
32
|
InboxClient.prototype.getInbox = function (args, options) {
|
|
33
|
+
var _a, _b;
|
|
33
34
|
var params = {
|
|
34
35
|
workspace_id: args.workspaceId,
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
var newerThan = (_a = args.newerThan) !== null && _a !== void 0 ? _a : args.since;
|
|
38
|
+
if (newerThan)
|
|
39
|
+
params.newer_than_ts = Math.floor(newerThan.getTime() / 1000);
|
|
40
|
+
var olderThan = (_b = args.olderThan) !== null && _b !== void 0 ? _b : args.until;
|
|
41
|
+
if (olderThan)
|
|
42
|
+
params.older_than_ts = Math.floor(olderThan.getTime() / 1000);
|
|
40
43
|
if (args.limit)
|
|
41
44
|
params.limit = args.limit;
|
|
42
45
|
if (args.cursor)
|
|
@@ -122,15 +125,15 @@ var InboxClient = /** @class */ (function (_super) {
|
|
|
122
125
|
}).then(function () { return undefined; });
|
|
123
126
|
};
|
|
124
127
|
InboxClient.prototype.archiveAll = function (args, options) {
|
|
128
|
+
var _a;
|
|
125
129
|
var params = {
|
|
126
130
|
workspace_id: args.workspaceId,
|
|
127
131
|
};
|
|
128
132
|
if (args.channelIds)
|
|
129
133
|
params.channel_ids = args.channelIds;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
params.until_ts_or_obj_idx = Math.floor(args.until.getTime() / 1000);
|
|
134
|
+
var olderThan = (_a = args.olderThan) !== null && _a !== void 0 ? _a : args.until;
|
|
135
|
+
if (olderThan)
|
|
136
|
+
params.older_than_ts = Math.floor(olderThan.getTime() / 1000);
|
|
134
137
|
var method = 'POST';
|
|
135
138
|
var url = "".concat(endpoints_1.ENDPOINT_INBOX, "/archive_all");
|
|
136
139
|
if (options === null || options === void 0 ? void 0 : options.batch) {
|
|
@@ -41,9 +41,10 @@ var SearchClient = /** @class */ (function (_super) {
|
|
|
41
41
|
}
|
|
42
42
|
SearchClient.prototype.search = function (args, options) {
|
|
43
43
|
var params = {
|
|
44
|
-
query: args.query,
|
|
45
44
|
workspace_id: args.workspaceId,
|
|
46
45
|
};
|
|
46
|
+
if (args.query !== undefined)
|
|
47
|
+
params.query = args.query;
|
|
47
48
|
if (args.channelIds)
|
|
48
49
|
params.channel_ids = args.channelIds;
|
|
49
50
|
if (args.authorIds)
|
|
@@ -55,7 +55,10 @@ var ThreadsClient = /** @class */ (function (_super) {
|
|
|
55
55
|
ThreadsClient.prototype.getThreads = function (args, options) {
|
|
56
56
|
var method = 'GET';
|
|
57
57
|
var url = "".concat(endpoints_1.ENDPOINT_THREADS, "/get");
|
|
58
|
-
var
|
|
58
|
+
var newerThan = args.newerThan, olderThan = args.olderThan, newer_than_ts = args.newer_than_ts, older_than_ts = args.older_than_ts, rest = __rest(args, ["newerThan", "olderThan", "newer_than_ts", "older_than_ts"]);
|
|
59
|
+
var resolvedNewerThan = newerThan ? Math.floor(newerThan.getTime() / 1000) : newer_than_ts;
|
|
60
|
+
var resolvedOlderThan = olderThan ? Math.floor(olderThan.getTime() / 1000) : older_than_ts;
|
|
61
|
+
var params = __assign(__assign(__assign({}, rest), (resolvedNewerThan != null ? { newer_than_ts: resolvedNewerThan } : {})), (resolvedOlderThan != null ? { older_than_ts: resolvedOlderThan } : {}));
|
|
59
62
|
if (options === null || options === void 0 ? void 0 : options.batch) {
|
|
60
63
|
return { method: method, url: url, params: params, schema: zod_1.z.array(entities_1.ThreadSchema) };
|
|
61
64
|
}
|
|
@@ -76,6 +76,9 @@ exports.GetThreadsArgsSchema = zod_1.z.object({
|
|
|
76
76
|
workspaceId: zod_1.z.number(),
|
|
77
77
|
channelId: zod_1.z.number().nullable().optional(),
|
|
78
78
|
archived: zod_1.z.boolean().nullable().optional(),
|
|
79
|
+
newerThan: zod_1.z.date().nullable().optional(),
|
|
80
|
+
olderThan: zod_1.z.date().nullable().optional(),
|
|
81
|
+
limit: zod_1.z.number().nullable().optional(),
|
|
79
82
|
});
|
|
80
83
|
exports.GetCommentsArgsSchema = zod_1.z.object({
|
|
81
84
|
threadId: zod_1.z.number(),
|
|
@@ -27,13 +27,16 @@ var InboxClient = /** @class */ (function (_super) {
|
|
|
27
27
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
28
|
}
|
|
29
29
|
InboxClient.prototype.getInbox = function (args, options) {
|
|
30
|
+
var _a, _b;
|
|
30
31
|
var params = {
|
|
31
32
|
workspace_id: args.workspaceId,
|
|
32
33
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
var newerThan = (_a = args.newerThan) !== null && _a !== void 0 ? _a : args.since;
|
|
35
|
+
if (newerThan)
|
|
36
|
+
params.newer_than_ts = Math.floor(newerThan.getTime() / 1000);
|
|
37
|
+
var olderThan = (_b = args.olderThan) !== null && _b !== void 0 ? _b : args.until;
|
|
38
|
+
if (olderThan)
|
|
39
|
+
params.older_than_ts = Math.floor(olderThan.getTime() / 1000);
|
|
37
40
|
if (args.limit)
|
|
38
41
|
params.limit = args.limit;
|
|
39
42
|
if (args.cursor)
|
|
@@ -119,15 +122,15 @@ var InboxClient = /** @class */ (function (_super) {
|
|
|
119
122
|
}).then(function () { return undefined; });
|
|
120
123
|
};
|
|
121
124
|
InboxClient.prototype.archiveAll = function (args, options) {
|
|
125
|
+
var _a;
|
|
122
126
|
var params = {
|
|
123
127
|
workspace_id: args.workspaceId,
|
|
124
128
|
};
|
|
125
129
|
if (args.channelIds)
|
|
126
130
|
params.channel_ids = args.channelIds;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
params.until_ts_or_obj_idx = Math.floor(args.until.getTime() / 1000);
|
|
131
|
+
var olderThan = (_a = args.olderThan) !== null && _a !== void 0 ? _a : args.until;
|
|
132
|
+
if (olderThan)
|
|
133
|
+
params.older_than_ts = Math.floor(olderThan.getTime() / 1000);
|
|
131
134
|
var method = 'POST';
|
|
132
135
|
var url = "".concat(ENDPOINT_INBOX, "/archive_all");
|
|
133
136
|
if (options === null || options === void 0 ? void 0 : options.batch) {
|
|
@@ -38,9 +38,10 @@ var SearchClient = /** @class */ (function (_super) {
|
|
|
38
38
|
}
|
|
39
39
|
SearchClient.prototype.search = function (args, options) {
|
|
40
40
|
var params = {
|
|
41
|
-
query: args.query,
|
|
42
41
|
workspace_id: args.workspaceId,
|
|
43
42
|
};
|
|
43
|
+
if (args.query !== undefined)
|
|
44
|
+
params.query = args.query;
|
|
44
45
|
if (args.channelIds)
|
|
45
46
|
params.channel_ids = args.channelIds;
|
|
46
47
|
if (args.authorIds)
|
|
@@ -52,7 +52,10 @@ var ThreadsClient = /** @class */ (function (_super) {
|
|
|
52
52
|
ThreadsClient.prototype.getThreads = function (args, options) {
|
|
53
53
|
var method = 'GET';
|
|
54
54
|
var url = "".concat(ENDPOINT_THREADS, "/get");
|
|
55
|
-
var
|
|
55
|
+
var newerThan = args.newerThan, olderThan = args.olderThan, newer_than_ts = args.newer_than_ts, older_than_ts = args.older_than_ts, rest = __rest(args, ["newerThan", "olderThan", "newer_than_ts", "older_than_ts"]);
|
|
56
|
+
var resolvedNewerThan = newerThan ? Math.floor(newerThan.getTime() / 1000) : newer_than_ts;
|
|
57
|
+
var resolvedOlderThan = olderThan ? Math.floor(olderThan.getTime() / 1000) : older_than_ts;
|
|
58
|
+
var params = __assign(__assign(__assign({}, rest), (resolvedNewerThan != null ? { newer_than_ts: resolvedNewerThan } : {})), (resolvedOlderThan != null ? { older_than_ts: resolvedOlderThan } : {}));
|
|
56
59
|
if (options === null || options === void 0 ? void 0 : options.batch) {
|
|
57
60
|
return { method: method, url: url, params: params, schema: z.array(ThreadSchema) };
|
|
58
61
|
}
|
|
@@ -73,6 +73,9 @@ export var GetThreadsArgsSchema = z.object({
|
|
|
73
73
|
workspaceId: z.number(),
|
|
74
74
|
channelId: z.number().nullable().optional(),
|
|
75
75
|
archived: z.boolean().nullable().optional(),
|
|
76
|
+
newerThan: z.date().nullable().optional(),
|
|
77
|
+
olderThan: z.date().nullable().optional(),
|
|
78
|
+
limit: z.number().nullable().optional(),
|
|
76
79
|
});
|
|
77
80
|
export var GetCommentsArgsSchema = z.object({
|
|
78
81
|
threadId: z.number(),
|
|
@@ -11,8 +11,10 @@ export declare class InboxClient extends BaseClient {
|
|
|
11
11
|
*
|
|
12
12
|
* @param args - The arguments for getting inbox.
|
|
13
13
|
* @param args.workspaceId - The workspace ID.
|
|
14
|
-
* @param args.
|
|
15
|
-
* @param args.
|
|
14
|
+
* @param args.newerThan - Optional date to get items newer than.
|
|
15
|
+
* @param args.olderThan - Optional date to get items older than.
|
|
16
|
+
* @param args.since - @deprecated Use `newerThan` instead.
|
|
17
|
+
* @param args.until - @deprecated Use `olderThan` instead.
|
|
16
18
|
* @param args.limit - Optional limit on number of items returned.
|
|
17
19
|
* @param args.cursor - Optional cursor for pagination.
|
|
18
20
|
* @param args.archiveFilter - Optional filter: 'active' (default), 'archived', or 'all'.
|
|
@@ -23,7 +25,7 @@ export declare class InboxClient extends BaseClient {
|
|
|
23
25
|
* ```typescript
|
|
24
26
|
* const inbox = await api.inbox.getInbox({
|
|
25
27
|
* workspaceId: 123,
|
|
26
|
-
*
|
|
28
|
+
* newerThan: new Date('2024-01-01')
|
|
27
29
|
* })
|
|
28
30
|
*
|
|
29
31
|
* // Include archived (done) items alongside active ones
|
|
@@ -115,15 +117,16 @@ export declare class InboxClient extends BaseClient {
|
|
|
115
117
|
* @param args - The arguments for archiving all.
|
|
116
118
|
* @param args.workspaceId - The workspace ID.
|
|
117
119
|
* @param args.channelIds - Optional array of channel IDs to filter by.
|
|
118
|
-
* @param args.
|
|
119
|
-
* @param args.until -
|
|
120
|
+
* @param args.olderThan - Optional date to filter items older than.
|
|
121
|
+
* @param args.until - @deprecated Use `olderThan` instead.
|
|
122
|
+
* @param args.since - @deprecated Not supported by the archive_all endpoint — this value is ignored.
|
|
120
123
|
* @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
|
|
121
124
|
*
|
|
122
125
|
* @example
|
|
123
126
|
* ```typescript
|
|
124
127
|
* await api.inbox.archiveAll({
|
|
125
128
|
* workspaceId: 123,
|
|
126
|
-
*
|
|
129
|
+
* olderThan: new Date('2024-01-01')
|
|
127
130
|
* })
|
|
128
131
|
* ```
|
|
129
132
|
*/
|
|
@@ -10,11 +10,11 @@ export declare class SearchClient extends BaseClient {
|
|
|
10
10
|
* Searches across all threads and conversations in a workspace.
|
|
11
11
|
*
|
|
12
12
|
* @param args - The arguments for searching.
|
|
13
|
-
* @param args.query - The search query string.
|
|
13
|
+
* @param args.query - The search query string. Optional when `mentionSelf: true` is set; required otherwise.
|
|
14
14
|
* @param args.workspaceId - The workspace ID to search in.
|
|
15
15
|
* @param args.channelIds - Optional array of channel IDs to filter by.
|
|
16
16
|
* @param args.authorIds - Optional array of author user IDs to filter by.
|
|
17
|
-
* @param args.mentionSelf - Optional flag to filter by mentions of the current user.
|
|
17
|
+
* @param args.mentionSelf - Optional flag to filter by mentions of the current user. When true, `query` may be omitted.
|
|
18
18
|
* @param args.dateFrom - Optional start date for filtering (YYYY-MM-DD).
|
|
19
19
|
* @param args.dateTo - Optional end date for filtering (YYYY-MM-DD).
|
|
20
20
|
* @param args.limit - Optional limit on number of results returned.
|
|
@@ -13,8 +13,10 @@ export declare class ThreadsClient extends BaseClient {
|
|
|
13
13
|
* @param args.channelId - The channel ID.
|
|
14
14
|
* @param args.workspaceId - Optional workspace ID.
|
|
15
15
|
* @param args.archived - Optional flag to include archived threads.
|
|
16
|
-
* @param args.
|
|
17
|
-
* @param args.
|
|
16
|
+
* @param args.newerThan - Optional date to get threads newer than.
|
|
17
|
+
* @param args.olderThan - Optional date to get threads older than.
|
|
18
|
+
* @param args.newer_than_ts - @deprecated Use `newerThan` instead.
|
|
19
|
+
* @param args.older_than_ts - @deprecated Use `olderThan` instead.
|
|
18
20
|
* @param args.limit - Optional limit on number of threads returned.
|
|
19
21
|
* @param options - Optional configuration. Set `batch: true` to return a descriptor for batch requests.
|
|
20
22
|
* @returns An array of thread objects.
|
|
@@ -76,8 +76,18 @@ export declare const GetThreadsArgsSchema: z.ZodObject<{
|
|
|
76
76
|
workspaceId: z.ZodNumber;
|
|
77
77
|
channelId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
archived: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
79
|
+
newerThan: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
80
|
+
olderThan: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
81
|
+
limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
79
82
|
}, z.core.$strip>;
|
|
80
|
-
export type GetThreadsArgs = z.infer<typeof GetThreadsArgsSchema
|
|
83
|
+
export type GetThreadsArgs = Omit<z.infer<typeof GetThreadsArgsSchema>, 'newerThan' | 'olderThan'> & {
|
|
84
|
+
newerThan?: Date | null;
|
|
85
|
+
olderThan?: Date | null;
|
|
86
|
+
/** @deprecated Use `newerThan` instead. */
|
|
87
|
+
newer_than_ts?: number | null;
|
|
88
|
+
/** @deprecated Use `olderThan` instead. */
|
|
89
|
+
older_than_ts?: number | null;
|
|
90
|
+
};
|
|
81
91
|
export declare const GetCommentsArgsSchema: z.ZodObject<{
|
|
82
92
|
threadId: z.ZodNumber;
|
|
83
93
|
from: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -120,17 +130,22 @@ export type UpdateUserArgs = {
|
|
|
120
130
|
awayMode?: AwayMode;
|
|
121
131
|
offDays?: number[];
|
|
122
132
|
};
|
|
123
|
-
|
|
124
|
-
query: string;
|
|
133
|
+
type SearchArgsCommon = {
|
|
125
134
|
workspaceId: number;
|
|
126
135
|
channelIds?: number[];
|
|
127
136
|
authorIds?: number[];
|
|
128
|
-
mentionSelf?: boolean;
|
|
129
137
|
dateFrom?: string;
|
|
130
138
|
dateTo?: string;
|
|
131
139
|
limit?: number;
|
|
132
140
|
cursor?: string;
|
|
133
141
|
};
|
|
142
|
+
export type SearchArgs = (SearchArgsCommon & {
|
|
143
|
+
query: string;
|
|
144
|
+
mentionSelf?: boolean;
|
|
145
|
+
}) | (SearchArgsCommon & {
|
|
146
|
+
query?: string;
|
|
147
|
+
mentionSelf: true;
|
|
148
|
+
});
|
|
134
149
|
export type SearchThreadArgs = {
|
|
135
150
|
query: string;
|
|
136
151
|
threadId: number;
|
|
@@ -165,7 +180,11 @@ export declare const ARCHIVE_FILTER_VALUES: readonly ["active", "archived", "all
|
|
|
165
180
|
export type ArchiveFilter = (typeof ARCHIVE_FILTER_VALUES)[number];
|
|
166
181
|
export type GetInboxArgs = {
|
|
167
182
|
workspaceId: number;
|
|
183
|
+
newerThan?: Date;
|
|
184
|
+
olderThan?: Date;
|
|
185
|
+
/** @deprecated Use `newerThan` instead. */
|
|
168
186
|
since?: Date;
|
|
187
|
+
/** @deprecated Use `olderThan` instead. */
|
|
169
188
|
until?: Date;
|
|
170
189
|
limit?: number;
|
|
171
190
|
cursor?: string;
|
|
@@ -174,8 +193,11 @@ export type GetInboxArgs = {
|
|
|
174
193
|
export type ArchiveAllArgs = {
|
|
175
194
|
workspaceId: number;
|
|
176
195
|
channelIds?: number[];
|
|
177
|
-
|
|
196
|
+
olderThan?: Date;
|
|
197
|
+
/** @deprecated Use `olderThan` instead. */
|
|
178
198
|
until?: Date;
|
|
199
|
+
/** @deprecated Not supported by the archive_all endpoint — this value is ignored. */
|
|
200
|
+
since?: Date;
|
|
179
201
|
};
|
|
180
202
|
export type AddReactionArgs = {
|
|
181
203
|
threadId?: number;
|
|
@@ -313,3 +335,4 @@ export type GetUserLocalTimeArgs = {
|
|
|
313
335
|
workspaceId: number;
|
|
314
336
|
userId: number;
|
|
315
337
|
};
|
|
338
|
+
export {};
|