@doist/twist-sdk 2.4.1 → 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.
@@ -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)
@@ -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)
@@ -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.
@@ -130,17 +130,22 @@ export type UpdateUserArgs = {
130
130
  awayMode?: AwayMode;
131
131
  offDays?: number[];
132
132
  };
133
- export type SearchArgs = {
134
- query: string;
133
+ type SearchArgsCommon = {
135
134
  workspaceId: number;
136
135
  channelIds?: number[];
137
136
  authorIds?: number[];
138
- mentionSelf?: boolean;
139
137
  dateFrom?: string;
140
138
  dateTo?: string;
141
139
  limit?: number;
142
140
  cursor?: string;
143
141
  };
142
+ export type SearchArgs = (SearchArgsCommon & {
143
+ query: string;
144
+ mentionSelf?: boolean;
145
+ }) | (SearchArgsCommon & {
146
+ query?: string;
147
+ mentionSelf: true;
148
+ });
144
149
  export type SearchThreadArgs = {
145
150
  query: string;
146
151
  threadId: number;
@@ -330,3 +335,4 @@ export type GetUserLocalTimeArgs = {
330
335
  workspaceId: number;
331
336
  userId: number;
332
337
  };
338
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/twist-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "A TypeScript wrapper for the Twist REST API.",
5
5
  "author": "Doist developers",
6
6
  "homepage": "https://doist.github.io/twist-sdk-typescript/",