@doist/twist-sdk 2.0.2 → 2.1.1
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/batch-builder.js +9 -8
- package/dist/cjs/clients/comments-client.js +4 -3
- package/dist/cjs/types/requests.js +2 -1
- package/dist/esm/batch-builder.js +9 -8
- package/dist/esm/clients/comments-client.js +4 -3
- package/dist/esm/clients/search-client.js +1 -1
- package/dist/esm/types/requests.js +1 -0
- package/dist/types/clients/channels-client.d.ts +2 -18
- package/dist/types/clients/comments-client.d.ts +2 -6
- package/dist/types/clients/conversation-messages-client.d.ts +2 -20
- package/dist/types/clients/conversations-client.d.ts +2 -27
- package/dist/types/clients/groups-client.d.ts +2 -17
- package/dist/types/clients/inbox-client.d.ts +2 -15
- package/dist/types/clients/reactions-client.d.ts +2 -19
- package/dist/types/clients/search-client.d.ts +2 -37
- package/dist/types/clients/threads-client.d.ts +2 -22
- package/dist/types/clients/users-client.d.ts +2 -25
- package/dist/types/clients/workspace-users-client.d.ts +2 -21
- package/dist/types/types/entities.d.ts +17 -0
- package/dist/types/types/requests.d.ts +193 -0
- package/package.json +1 -1
|
@@ -61,6 +61,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
61
61
|
};
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
63
|
exports.BatchBuilder = void 0;
|
|
64
|
+
var zod_1 = require("zod");
|
|
64
65
|
var base_client_1 = require("./clients/base-client");
|
|
65
66
|
var rest_client_1 = require("./rest-client");
|
|
66
67
|
var case_conversion_1 = require("./utils/case-conversion");
|
|
@@ -201,13 +202,7 @@ var BatchBuilder = /** @class */ (function (_super) {
|
|
|
201
202
|
// Validate with schema if provided
|
|
202
203
|
var finalData = transformed;
|
|
203
204
|
if (descriptor.schema && apiResponse.code >= 200 && apiResponse.code < 300) {
|
|
204
|
-
|
|
205
|
-
finalData = descriptor.schema.parse(transformed);
|
|
206
|
-
}
|
|
207
|
-
catch (error) {
|
|
208
|
-
// If validation fails, include the error in the response
|
|
209
|
-
console.error('Batch response validation failed:', error);
|
|
210
|
-
}
|
|
205
|
+
finalData = descriptor.schema.parse(transformed);
|
|
211
206
|
}
|
|
212
207
|
// Parse headers string into object
|
|
213
208
|
var headers = {};
|
|
@@ -264,7 +259,13 @@ var BatchBuilder = /** @class */ (function (_super) {
|
|
|
264
259
|
chunks = this.chunkRequests(__spreadArray([], requests, true), BatchBuilder.CHUNK_SIZE);
|
|
265
260
|
chunkPromises = chunks.map(function (chunk) {
|
|
266
261
|
return _this.executeSingleBatch(chunk).catch(function (error) {
|
|
267
|
-
//
|
|
262
|
+
// Rethrow schema validation errors — they indicate a programming
|
|
263
|
+
// issue (wrong schema or unexpected API response shape) and should
|
|
264
|
+
// not be silently swallowed.
|
|
265
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
266
|
+
throw error;
|
|
267
|
+
}
|
|
268
|
+
// Collect network/request errors but don't fail fast - allow other chunks to complete
|
|
268
269
|
console.error('Batch chunk failed:', error);
|
|
269
270
|
// Return error responses for all requests in this chunk
|
|
270
271
|
return chunk.map(function () { return ({
|
|
@@ -55,9 +55,10 @@ var CommentsClient = /** @class */ (function (_super) {
|
|
|
55
55
|
var method = 'GET';
|
|
56
56
|
var url = "".concat(endpoints_1.ENDPOINT_COMMENTS, "/getone");
|
|
57
57
|
var params = { id: id };
|
|
58
|
-
|
|
58
|
+
// The API wraps the response in {"comment": {...}}, so we need to unwrap it
|
|
59
|
+
var wrappedSchema = zod_1.z.object({ comment: entities_1.CommentSchema }).transform(function (data) { return data.comment; });
|
|
59
60
|
if (options === null || options === void 0 ? void 0 : options.batch) {
|
|
60
|
-
return { method: method, url: url, params: params, schema:
|
|
61
|
+
return { method: method, url: url, params: params, schema: wrappedSchema };
|
|
61
62
|
}
|
|
62
63
|
return (0, rest_client_1.request)({
|
|
63
64
|
httpMethod: method,
|
|
@@ -66,7 +67,7 @@ var CommentsClient = /** @class */ (function (_super) {
|
|
|
66
67
|
apiToken: this.apiToken,
|
|
67
68
|
payload: params,
|
|
68
69
|
customFetch: this.customFetch,
|
|
69
|
-
}).then(function (response) { return
|
|
70
|
+
}).then(function (response) { return wrappedSchema.parse(response.data); });
|
|
70
71
|
};
|
|
71
72
|
CommentsClient.prototype.createComment = function (args, options) {
|
|
72
73
|
var method = 'POST';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetOrCreateConversationArgsSchema = exports.GetConversationsArgsSchema = exports.GetCommentsArgsSchema = exports.GetThreadsArgsSchema = exports.GetChannelsArgsSchema = exports.CreateMessageArgsSchema = exports.CreateConversationArgsSchema = exports.UpdateCommentArgsSchema = exports.CreateCommentArgsSchema = exports.UpdateThreadArgsSchema = exports.CreateThreadArgsSchema = exports.UpdateChannelArgsSchema = exports.CreateChannelArgsSchema = void 0;
|
|
3
|
+
exports.AWAY_MODE_TYPES = exports.GetOrCreateConversationArgsSchema = exports.GetConversationsArgsSchema = exports.GetCommentsArgsSchema = exports.GetThreadsArgsSchema = exports.GetChannelsArgsSchema = exports.CreateMessageArgsSchema = exports.CreateConversationArgsSchema = exports.UpdateCommentArgsSchema = exports.CreateCommentArgsSchema = exports.UpdateThreadArgsSchema = exports.CreateThreadArgsSchema = exports.UpdateChannelArgsSchema = exports.CreateChannelArgsSchema = void 0;
|
|
4
4
|
var zod_1 = require("zod");
|
|
5
5
|
exports.CreateChannelArgsSchema = zod_1.z.object({
|
|
6
6
|
workspaceId: zod_1.z.number(),
|
|
@@ -90,3 +90,4 @@ exports.GetOrCreateConversationArgsSchema = zod_1.z.object({
|
|
|
90
90
|
workspaceId: zod_1.z.number(),
|
|
91
91
|
userIds: zod_1.z.array(zod_1.z.number()),
|
|
92
92
|
});
|
|
93
|
+
exports.AWAY_MODE_TYPES = ['parental', 'vacation', 'sickleave', 'other'];
|
|
@@ -58,6 +58,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
58
58
|
}
|
|
59
59
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
60
60
|
};
|
|
61
|
+
import { z } from 'zod';
|
|
61
62
|
import { BaseClient } from './clients/base-client.js';
|
|
62
63
|
import { fetchWithRetry } from './rest-client.js';
|
|
63
64
|
import { camelCaseKeys, snakeCaseKeys } from './utils/case-conversion.js';
|
|
@@ -198,13 +199,7 @@ var BatchBuilder = /** @class */ (function (_super) {
|
|
|
198
199
|
// Validate with schema if provided
|
|
199
200
|
var finalData = transformed;
|
|
200
201
|
if (descriptor.schema && apiResponse.code >= 200 && apiResponse.code < 300) {
|
|
201
|
-
|
|
202
|
-
finalData = descriptor.schema.parse(transformed);
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
// If validation fails, include the error in the response
|
|
206
|
-
console.error('Batch response validation failed:', error);
|
|
207
|
-
}
|
|
202
|
+
finalData = descriptor.schema.parse(transformed);
|
|
208
203
|
}
|
|
209
204
|
// Parse headers string into object
|
|
210
205
|
var headers = {};
|
|
@@ -261,7 +256,13 @@ var BatchBuilder = /** @class */ (function (_super) {
|
|
|
261
256
|
chunks = this.chunkRequests(__spreadArray([], requests, true), BatchBuilder.CHUNK_SIZE);
|
|
262
257
|
chunkPromises = chunks.map(function (chunk) {
|
|
263
258
|
return _this.executeSingleBatch(chunk).catch(function (error) {
|
|
264
|
-
//
|
|
259
|
+
// Rethrow schema validation errors — they indicate a programming
|
|
260
|
+
// issue (wrong schema or unexpected API response shape) and should
|
|
261
|
+
// not be silently swallowed.
|
|
262
|
+
if (error instanceof z.ZodError) {
|
|
263
|
+
throw error;
|
|
264
|
+
}
|
|
265
|
+
// Collect network/request errors but don't fail fast - allow other chunks to complete
|
|
265
266
|
console.error('Batch chunk failed:', error);
|
|
266
267
|
// Return error responses for all requests in this chunk
|
|
267
268
|
return chunk.map(function () { return ({
|
|
@@ -52,9 +52,10 @@ var CommentsClient = /** @class */ (function (_super) {
|
|
|
52
52
|
var method = 'GET';
|
|
53
53
|
var url = "".concat(ENDPOINT_COMMENTS, "/getone");
|
|
54
54
|
var params = { id: id };
|
|
55
|
-
|
|
55
|
+
// The API wraps the response in {"comment": {...}}, so we need to unwrap it
|
|
56
|
+
var wrappedSchema = z.object({ comment: CommentSchema }).transform(function (data) { return data.comment; });
|
|
56
57
|
if (options === null || options === void 0 ? void 0 : options.batch) {
|
|
57
|
-
return { method: method, url: url, params: params, schema:
|
|
58
|
+
return { method: method, url: url, params: params, schema: wrappedSchema };
|
|
58
59
|
}
|
|
59
60
|
return request({
|
|
60
61
|
httpMethod: method,
|
|
@@ -63,7 +64,7 @@ var CommentsClient = /** @class */ (function (_super) {
|
|
|
63
64
|
apiToken: this.apiToken,
|
|
64
65
|
payload: params,
|
|
65
66
|
customFetch: this.customFetch,
|
|
66
|
-
}).then(function (response) { return
|
|
67
|
+
}).then(function (response) { return wrappedSchema.parse(response.data); });
|
|
67
68
|
};
|
|
68
69
|
CommentsClient.prototype.createComment = function (args, options) {
|
|
69
70
|
var method = 'POST';
|
|
@@ -26,7 +26,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
26
26
|
};
|
|
27
27
|
import { ENDPOINT_SEARCH } from '../consts/endpoints.js';
|
|
28
28
|
import { request } from '../rest-client.js';
|
|
29
|
-
import { SearchResultSchema } from '../types/entities.js';
|
|
29
|
+
import { SearchResultSchema, } from '../types/entities.js';
|
|
30
30
|
import { BaseClient } from './base-client.js';
|
|
31
31
|
/**
|
|
32
32
|
* Client for interacting with Twist search endpoints.
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { Channel } from '../types/entities.js';
|
|
3
|
-
import { CreateChannelArgs, GetChannelsArgs, UpdateChannelArgs } from '../types/requests.js';
|
|
2
|
+
import { type Channel } from '../types/entities.js';
|
|
3
|
+
import { type AddChannelUserArgs, type AddChannelUsersArgs, type CreateChannelArgs, type GetChannelsArgs, type RemoveChannelUserArgs, type RemoveChannelUsersArgs, type UpdateChannelArgs } from '../types/requests.js';
|
|
4
4
|
import { BaseClient } from './base-client.js';
|
|
5
|
-
export type AddChannelUserArgs = {
|
|
6
|
-
id: number;
|
|
7
|
-
userId: number;
|
|
8
|
-
};
|
|
9
|
-
export type AddChannelUsersArgs = {
|
|
10
|
-
id: number;
|
|
11
|
-
userIds: number[];
|
|
12
|
-
};
|
|
13
|
-
export type RemoveChannelUserArgs = {
|
|
14
|
-
id: number;
|
|
15
|
-
userId: number;
|
|
16
|
-
};
|
|
17
|
-
export type RemoveChannelUsersArgs = {
|
|
18
|
-
id: number;
|
|
19
|
-
userIds: number[];
|
|
20
|
-
};
|
|
21
5
|
/**
|
|
22
6
|
* Client for interacting with Twist channel endpoints.
|
|
23
7
|
*/
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { Comment } from '../types/entities.js';
|
|
3
|
-
import { CreateCommentArgs, GetCommentsArgs, UpdateCommentArgs } from '../types/requests.js';
|
|
2
|
+
import { type Comment } from '../types/entities.js';
|
|
3
|
+
import { type CreateCommentArgs, type GetCommentsArgs, type MarkCommentPositionArgs, type UpdateCommentArgs } from '../types/requests.js';
|
|
4
4
|
import { BaseClient } from './base-client.js';
|
|
5
|
-
export type MarkCommentPositionArgs = {
|
|
6
|
-
threadId: number;
|
|
7
|
-
commentId: number;
|
|
8
|
-
};
|
|
9
5
|
/**
|
|
10
6
|
* Client for interacting with Twist comment endpoints.
|
|
11
7
|
*/
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { ConversationMessage } from '../types/entities.js';
|
|
2
|
+
import { type ConversationMessage } from '../types/entities.js';
|
|
3
|
+
import type { CreateConversationMessageArgs, GetConversationMessagesArgs, UpdateConversationMessageArgs } from '../types/requests.js';
|
|
3
4
|
import { BaseClient } from './base-client.js';
|
|
4
|
-
type GetConversationMessagesArgs = {
|
|
5
|
-
conversationId: number;
|
|
6
|
-
newerThan?: Date;
|
|
7
|
-
olderThan?: Date;
|
|
8
|
-
limit?: number;
|
|
9
|
-
cursor?: string;
|
|
10
|
-
};
|
|
11
|
-
type CreateConversationMessageArgs = {
|
|
12
|
-
conversationId: number;
|
|
13
|
-
content: string;
|
|
14
|
-
attachments?: unknown[];
|
|
15
|
-
actions?: unknown[];
|
|
16
|
-
};
|
|
17
|
-
type UpdateConversationMessageArgs = {
|
|
18
|
-
id: number;
|
|
19
|
-
content: string;
|
|
20
|
-
attachments?: unknown[];
|
|
21
|
-
};
|
|
22
5
|
/**
|
|
23
6
|
* Client for interacting with Twist conversation message endpoints.
|
|
24
7
|
*/
|
|
@@ -134,4 +117,3 @@ export declare class ConversationMessagesClient extends BaseClient {
|
|
|
134
117
|
batch?: false;
|
|
135
118
|
}): Promise<void>;
|
|
136
119
|
}
|
|
137
|
-
export {};
|
|
@@ -1,32 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { Conversation, UnreadConversation } from '../types/entities.js';
|
|
3
|
-
import { GetConversationsArgs, GetOrCreateConversationArgs } from '../types/requests.js';
|
|
2
|
+
import { type Conversation, type UnreadConversation } from '../types/entities.js';
|
|
3
|
+
import { type AddConversationUserArgs, type AddConversationUsersArgs, type GetConversationsArgs, type GetOrCreateConversationArgs, type MuteConversationArgs, type RemoveConversationUserArgs, type RemoveConversationUsersArgs, type UpdateConversationArgs } from '../types/requests.js';
|
|
4
4
|
import { BaseClient } from './base-client.js';
|
|
5
|
-
export type UpdateConversationArgs = {
|
|
6
|
-
id: number;
|
|
7
|
-
title: string;
|
|
8
|
-
archived?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type AddConversationUserArgs = {
|
|
11
|
-
id: number;
|
|
12
|
-
userId: number;
|
|
13
|
-
};
|
|
14
|
-
export type AddConversationUsersArgs = {
|
|
15
|
-
id: number;
|
|
16
|
-
userIds: number[];
|
|
17
|
-
};
|
|
18
|
-
export type RemoveConversationUserArgs = {
|
|
19
|
-
id: number;
|
|
20
|
-
userId: number;
|
|
21
|
-
};
|
|
22
|
-
export type RemoveConversationUsersArgs = {
|
|
23
|
-
id: number;
|
|
24
|
-
userIds: number[];
|
|
25
|
-
};
|
|
26
|
-
export type MuteConversationArgs = {
|
|
27
|
-
id: number;
|
|
28
|
-
minutes: number;
|
|
29
|
-
};
|
|
30
5
|
/**
|
|
31
6
|
* Client for interacting with Twist conversation endpoints.
|
|
32
7
|
*/
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { Group } from '../types/entities.js';
|
|
2
|
+
import { type Group } from '../types/entities.js';
|
|
3
|
+
import type { AddGroupUserArgs, AddGroupUsersArgs, RemoveGroupUserArgs, RemoveGroupUsersArgs } from '../types/requests.js';
|
|
3
4
|
import { BaseClient } from './base-client.js';
|
|
4
|
-
export type AddGroupUserArgs = {
|
|
5
|
-
id: number;
|
|
6
|
-
userId: number;
|
|
7
|
-
};
|
|
8
|
-
export type AddGroupUsersArgs = {
|
|
9
|
-
id: number;
|
|
10
|
-
userIds: number[];
|
|
11
|
-
};
|
|
12
|
-
export type RemoveGroupUserArgs = {
|
|
13
|
-
id: number;
|
|
14
|
-
userId: number;
|
|
15
|
-
};
|
|
16
|
-
export type RemoveGroupUsersArgs = {
|
|
17
|
-
id: number;
|
|
18
|
-
userIds: number[];
|
|
19
|
-
};
|
|
20
5
|
/**
|
|
21
6
|
* Client for interacting with Twist group endpoints.
|
|
22
7
|
*/
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { InboxThread } from '../types/entities.js';
|
|
2
|
+
import { type InboxThread } from '../types/entities.js';
|
|
3
|
+
import type { ArchiveAllArgs, GetInboxArgs } from '../types/requests.js';
|
|
3
4
|
import { BaseClient } from './base-client.js';
|
|
4
|
-
type GetInboxArgs = {
|
|
5
|
-
workspaceId: number;
|
|
6
|
-
since?: Date;
|
|
7
|
-
until?: Date;
|
|
8
|
-
limit?: number;
|
|
9
|
-
cursor?: string;
|
|
10
|
-
};
|
|
11
|
-
type ArchiveAllArgs = {
|
|
12
|
-
workspaceId: number;
|
|
13
|
-
channelIds?: number[];
|
|
14
|
-
since?: Date;
|
|
15
|
-
until?: Date;
|
|
16
|
-
};
|
|
17
5
|
/**
|
|
18
6
|
* Client for interacting with Twist inbox endpoints.
|
|
19
7
|
*/
|
|
@@ -139,4 +127,3 @@ export declare class InboxClient extends BaseClient {
|
|
|
139
127
|
batch?: false;
|
|
140
128
|
}): Promise<void>;
|
|
141
129
|
}
|
|
142
|
-
export {};
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
+
import type { ReactionObject } from '../types/entities.js';
|
|
3
|
+
import type { AddReactionArgs, GetReactionsArgs, RemoveReactionArgs } from '../types/requests.js';
|
|
2
4
|
import { BaseClient } from './base-client.js';
|
|
3
|
-
type AddReactionArgs = {
|
|
4
|
-
threadId?: number;
|
|
5
|
-
commentId?: number;
|
|
6
|
-
messageId?: number;
|
|
7
|
-
reaction: string;
|
|
8
|
-
};
|
|
9
|
-
type RemoveReactionArgs = {
|
|
10
|
-
threadId?: number;
|
|
11
|
-
commentId?: number;
|
|
12
|
-
messageId?: number;
|
|
13
|
-
reaction: string;
|
|
14
|
-
};
|
|
15
|
-
type GetReactionsArgs = {
|
|
16
|
-
threadId?: number;
|
|
17
|
-
commentId?: number;
|
|
18
|
-
messageId?: number;
|
|
19
|
-
};
|
|
20
|
-
type ReactionObject = Record<string, number[]> | null;
|
|
21
5
|
/**
|
|
22
6
|
* Client for interacting with Twist reaction endpoints.
|
|
23
7
|
*/
|
|
@@ -91,4 +75,3 @@ export declare class ReactionsClient extends BaseClient {
|
|
|
91
75
|
batch?: false;
|
|
92
76
|
}): Promise<void>;
|
|
93
77
|
}
|
|
94
|
-
export {};
|
|
@@ -1,41 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import {
|
|
2
|
+
import { type SearchConversationResponse, type SearchResponse, type SearchThreadResponse } from '../types/entities.js';
|
|
3
|
+
import type { SearchArgs, SearchConversationArgs, SearchThreadArgs } from '../types/requests.js';
|
|
3
4
|
import { BaseClient } from './base-client.js';
|
|
4
|
-
type SearchArgs = {
|
|
5
|
-
query: string;
|
|
6
|
-
workspaceId: number;
|
|
7
|
-
channelIds?: number[];
|
|
8
|
-
authorIds?: number[];
|
|
9
|
-
mentionSelf?: boolean;
|
|
10
|
-
dateFrom?: string;
|
|
11
|
-
dateTo?: string;
|
|
12
|
-
limit?: number;
|
|
13
|
-
cursor?: string;
|
|
14
|
-
};
|
|
15
|
-
type SearchThreadArgs = {
|
|
16
|
-
query: string;
|
|
17
|
-
threadId: number;
|
|
18
|
-
limit?: number;
|
|
19
|
-
cursor?: string;
|
|
20
|
-
};
|
|
21
|
-
type SearchConversationArgs = {
|
|
22
|
-
query: string;
|
|
23
|
-
conversationId: number;
|
|
24
|
-
limit?: number;
|
|
25
|
-
cursor?: string;
|
|
26
|
-
};
|
|
27
|
-
type SearchResponse = {
|
|
28
|
-
items: SearchResult[];
|
|
29
|
-
nextCursorMark?: string;
|
|
30
|
-
hasMore: boolean;
|
|
31
|
-
isPlanRestricted: boolean;
|
|
32
|
-
};
|
|
33
|
-
type SearchThreadResponse = {
|
|
34
|
-
commentIds: number[];
|
|
35
|
-
};
|
|
36
|
-
type SearchConversationResponse = {
|
|
37
|
-
messageIds: number[];
|
|
38
|
-
};
|
|
39
5
|
/**
|
|
40
6
|
* Client for interacting with Twist search endpoints.
|
|
41
7
|
*/
|
|
@@ -122,4 +88,3 @@ import { BaseClient, type ClientConfig } from './base-client.js'
|
|
|
122
88
|
batch?: false;
|
|
123
89
|
}): Promise<SearchConversationResponse>;
|
|
124
90
|
}
|
|
125
|
-
export {};
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { Thread, UnreadThread } from '../types/entities.js';
|
|
3
|
-
import { CreateThreadArgs, GetThreadsArgs, UpdateThreadArgs } from '../types/requests.js';
|
|
2
|
+
import { type Thread, type UnreadThread } from '../types/entities.js';
|
|
3
|
+
import { type CreateThreadArgs, type GetThreadsArgs, type MarkThreadReadArgs, type MarkThreadUnreadArgs, type MarkThreadUnreadForOthersArgs, type MoveThreadToChannelArgs, type MuteThreadArgs, type UpdateThreadArgs } from '../types/requests.js';
|
|
4
4
|
import { BaseClient } from './base-client.js';
|
|
5
|
-
export type MoveThreadToChannelArgs = {
|
|
6
|
-
id: number;
|
|
7
|
-
toChannel: number;
|
|
8
|
-
};
|
|
9
|
-
export type MarkThreadReadArgs = {
|
|
10
|
-
id: number;
|
|
11
|
-
objIndex: number;
|
|
12
|
-
};
|
|
13
|
-
export type MarkThreadUnreadArgs = {
|
|
14
|
-
id: number;
|
|
15
|
-
objIndex: number;
|
|
16
|
-
};
|
|
17
|
-
export type MarkThreadUnreadForOthersArgs = {
|
|
18
|
-
id: number;
|
|
19
|
-
objIndex: number;
|
|
20
|
-
};
|
|
21
|
-
export type MuteThreadArgs = {
|
|
22
|
-
id: number;
|
|
23
|
-
minutes: number;
|
|
24
|
-
};
|
|
25
5
|
/**
|
|
26
6
|
* Client for interacting with Twist thread endpoints.
|
|
27
7
|
*/
|
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
import type { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { User } from '../types/entities.js';
|
|
2
|
+
import { type GoogleConnectionStatus, type User } from '../types/entities.js';
|
|
3
|
+
import type { UpdateUserArgs } from '../types/requests.js';
|
|
3
4
|
import { BaseClient } from './base-client.js';
|
|
4
|
-
type AwayMode = {
|
|
5
|
-
type: 'parental' | 'vacation' | 'sickleave' | 'other';
|
|
6
|
-
dateFrom?: string;
|
|
7
|
-
dateTo: string;
|
|
8
|
-
};
|
|
9
|
-
type UpdateUserArgs = {
|
|
10
|
-
name?: string;
|
|
11
|
-
email?: string;
|
|
12
|
-
password?: string;
|
|
13
|
-
defaultWorkspace?: number;
|
|
14
|
-
profession?: string;
|
|
15
|
-
contactInfo?: string;
|
|
16
|
-
timezone?: string;
|
|
17
|
-
snoozeUntil?: number;
|
|
18
|
-
snoozeDndStart?: string;
|
|
19
|
-
snoozeDndEnd?: string;
|
|
20
|
-
awayMode?: AwayMode;
|
|
21
|
-
offDays?: number[];
|
|
22
|
-
};
|
|
23
|
-
type GoogleConnectionStatus = {
|
|
24
|
-
googleConnection: boolean;
|
|
25
|
-
googleEmail?: string;
|
|
26
|
-
};
|
|
27
5
|
/**
|
|
28
6
|
* Client for interacting with Twist user endpoints.
|
|
29
7
|
*/
|
|
@@ -247,4 +225,3 @@ export declare class UsersClient extends BaseClient {
|
|
|
247
225
|
status: string;
|
|
248
226
|
}>;
|
|
249
227
|
}
|
|
250
|
-
export {};
|
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
import { BatchRequestDescriptor } from '../types/batch.js';
|
|
2
|
-
import { WorkspaceUser } from '../types/entities.js';
|
|
2
|
+
import { type WorkspaceUser } from '../types/entities.js';
|
|
3
3
|
import { UserType } from '../types/enums.js';
|
|
4
|
+
import type { GetUserByEmailArgs, GetUserByIdArgs, GetUserInfoArgs, GetUserLocalTimeArgs, GetWorkspaceUsersArgs } from '../types/requests.js';
|
|
4
5
|
import { BaseClient } from './base-client.js';
|
|
5
|
-
export type GetWorkspaceUsersArgs = {
|
|
6
|
-
workspaceId: number;
|
|
7
|
-
archived?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type GetUserByIdArgs = {
|
|
10
|
-
workspaceId: number;
|
|
11
|
-
userId: number;
|
|
12
|
-
};
|
|
13
|
-
export type GetUserByEmailArgs = {
|
|
14
|
-
workspaceId: number;
|
|
15
|
-
email: string;
|
|
16
|
-
};
|
|
17
|
-
export type GetUserInfoArgs = {
|
|
18
|
-
workspaceId: number;
|
|
19
|
-
userId: number;
|
|
20
|
-
};
|
|
21
|
-
export type GetUserLocalTimeArgs = {
|
|
22
|
-
workspaceId: number;
|
|
23
|
-
userId: number;
|
|
24
|
-
};
|
|
25
6
|
/**
|
|
26
7
|
* Client for interacting with Twist workspace users endpoints (v4 API).
|
|
27
8
|
*/
|
|
@@ -849,3 +849,20 @@ export declare const SearchResultSchema: z.ZodObject<{
|
|
|
849
849
|
closed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
850
850
|
}, z.core.$strip>;
|
|
851
851
|
export type SearchResult = z.infer<typeof SearchResultSchema>;
|
|
852
|
+
export type GoogleConnectionStatus = {
|
|
853
|
+
googleConnection: boolean;
|
|
854
|
+
googleEmail?: string;
|
|
855
|
+
};
|
|
856
|
+
export type SearchResponse = {
|
|
857
|
+
items: SearchResult[];
|
|
858
|
+
nextCursorMark?: string;
|
|
859
|
+
hasMore: boolean;
|
|
860
|
+
isPlanRestricted: boolean;
|
|
861
|
+
};
|
|
862
|
+
export type SearchThreadResponse = {
|
|
863
|
+
commentIds: number[];
|
|
864
|
+
};
|
|
865
|
+
export type SearchConversationResponse = {
|
|
866
|
+
messageIds: number[];
|
|
867
|
+
};
|
|
868
|
+
export type ReactionObject = Record<string, number[]> | null;
|
|
@@ -94,3 +94,196 @@ export declare const GetOrCreateConversationArgsSchema: z.ZodObject<{
|
|
|
94
94
|
userIds: z.ZodArray<z.ZodNumber>;
|
|
95
95
|
}, z.core.$strip>;
|
|
96
96
|
export type GetOrCreateConversationArgs = z.infer<typeof GetOrCreateConversationArgsSchema>;
|
|
97
|
+
export declare const AWAY_MODE_TYPES: readonly ["parental", "vacation", "sickleave", "other"];
|
|
98
|
+
export type AwayModeType = (typeof AWAY_MODE_TYPES)[number];
|
|
99
|
+
export type AwayMode = {
|
|
100
|
+
type: AwayModeType;
|
|
101
|
+
dateFrom?: string;
|
|
102
|
+
dateTo: string;
|
|
103
|
+
};
|
|
104
|
+
export type UpdateUserArgs = {
|
|
105
|
+
name?: string;
|
|
106
|
+
email?: string;
|
|
107
|
+
password?: string;
|
|
108
|
+
defaultWorkspace?: number;
|
|
109
|
+
profession?: string;
|
|
110
|
+
contactInfo?: string;
|
|
111
|
+
timezone?: string;
|
|
112
|
+
snoozeUntil?: number;
|
|
113
|
+
snoozeDndStart?: string;
|
|
114
|
+
snoozeDndEnd?: string;
|
|
115
|
+
awayMode?: AwayMode;
|
|
116
|
+
offDays?: number[];
|
|
117
|
+
};
|
|
118
|
+
export type SearchArgs = {
|
|
119
|
+
query: string;
|
|
120
|
+
workspaceId: number;
|
|
121
|
+
channelIds?: number[];
|
|
122
|
+
authorIds?: number[];
|
|
123
|
+
mentionSelf?: boolean;
|
|
124
|
+
dateFrom?: string;
|
|
125
|
+
dateTo?: string;
|
|
126
|
+
limit?: number;
|
|
127
|
+
cursor?: string;
|
|
128
|
+
};
|
|
129
|
+
export type SearchThreadArgs = {
|
|
130
|
+
query: string;
|
|
131
|
+
threadId: number;
|
|
132
|
+
limit?: number;
|
|
133
|
+
cursor?: string;
|
|
134
|
+
};
|
|
135
|
+
export type SearchConversationArgs = {
|
|
136
|
+
query: string;
|
|
137
|
+
conversationId: number;
|
|
138
|
+
limit?: number;
|
|
139
|
+
cursor?: string;
|
|
140
|
+
};
|
|
141
|
+
export type GetConversationMessagesArgs = {
|
|
142
|
+
conversationId: number;
|
|
143
|
+
newerThan?: Date;
|
|
144
|
+
olderThan?: Date;
|
|
145
|
+
limit?: number;
|
|
146
|
+
cursor?: string;
|
|
147
|
+
};
|
|
148
|
+
export type CreateConversationMessageArgs = {
|
|
149
|
+
conversationId: number;
|
|
150
|
+
content: string;
|
|
151
|
+
attachments?: unknown[];
|
|
152
|
+
actions?: unknown[];
|
|
153
|
+
};
|
|
154
|
+
export type UpdateConversationMessageArgs = {
|
|
155
|
+
id: number;
|
|
156
|
+
content: string;
|
|
157
|
+
attachments?: unknown[];
|
|
158
|
+
};
|
|
159
|
+
export type GetInboxArgs = {
|
|
160
|
+
workspaceId: number;
|
|
161
|
+
since?: Date;
|
|
162
|
+
until?: Date;
|
|
163
|
+
limit?: number;
|
|
164
|
+
cursor?: string;
|
|
165
|
+
};
|
|
166
|
+
export type ArchiveAllArgs = {
|
|
167
|
+
workspaceId: number;
|
|
168
|
+
channelIds?: number[];
|
|
169
|
+
since?: Date;
|
|
170
|
+
until?: Date;
|
|
171
|
+
};
|
|
172
|
+
export type AddReactionArgs = {
|
|
173
|
+
threadId?: number;
|
|
174
|
+
commentId?: number;
|
|
175
|
+
messageId?: number;
|
|
176
|
+
reaction: string;
|
|
177
|
+
};
|
|
178
|
+
export type RemoveReactionArgs = {
|
|
179
|
+
threadId?: number;
|
|
180
|
+
commentId?: number;
|
|
181
|
+
messageId?: number;
|
|
182
|
+
reaction: string;
|
|
183
|
+
};
|
|
184
|
+
export type GetReactionsArgs = {
|
|
185
|
+
threadId?: number;
|
|
186
|
+
commentId?: number;
|
|
187
|
+
messageId?: number;
|
|
188
|
+
};
|
|
189
|
+
export type AddChannelUserArgs = {
|
|
190
|
+
id: number;
|
|
191
|
+
userId: number;
|
|
192
|
+
};
|
|
193
|
+
export type AddChannelUsersArgs = {
|
|
194
|
+
id: number;
|
|
195
|
+
userIds: number[];
|
|
196
|
+
};
|
|
197
|
+
export type RemoveChannelUserArgs = {
|
|
198
|
+
id: number;
|
|
199
|
+
userId: number;
|
|
200
|
+
};
|
|
201
|
+
export type RemoveChannelUsersArgs = {
|
|
202
|
+
id: number;
|
|
203
|
+
userIds: number[];
|
|
204
|
+
};
|
|
205
|
+
export type MoveThreadToChannelArgs = {
|
|
206
|
+
id: number;
|
|
207
|
+
toChannel: number;
|
|
208
|
+
};
|
|
209
|
+
export type MarkThreadReadArgs = {
|
|
210
|
+
id: number;
|
|
211
|
+
objIndex: number;
|
|
212
|
+
};
|
|
213
|
+
export type MarkThreadUnreadArgs = {
|
|
214
|
+
id: number;
|
|
215
|
+
objIndex: number;
|
|
216
|
+
};
|
|
217
|
+
export type MarkThreadUnreadForOthersArgs = {
|
|
218
|
+
id: number;
|
|
219
|
+
objIndex: number;
|
|
220
|
+
};
|
|
221
|
+
export type MuteThreadArgs = {
|
|
222
|
+
id: number;
|
|
223
|
+
minutes: number;
|
|
224
|
+
};
|
|
225
|
+
export type MarkCommentPositionArgs = {
|
|
226
|
+
threadId: number;
|
|
227
|
+
commentId: number;
|
|
228
|
+
};
|
|
229
|
+
export type UpdateConversationArgs = {
|
|
230
|
+
id: number;
|
|
231
|
+
title: string;
|
|
232
|
+
archived?: boolean;
|
|
233
|
+
};
|
|
234
|
+
export type AddConversationUserArgs = {
|
|
235
|
+
id: number;
|
|
236
|
+
userId: number;
|
|
237
|
+
};
|
|
238
|
+
export type AddConversationUsersArgs = {
|
|
239
|
+
id: number;
|
|
240
|
+
userIds: number[];
|
|
241
|
+
};
|
|
242
|
+
export type RemoveConversationUserArgs = {
|
|
243
|
+
id: number;
|
|
244
|
+
userId: number;
|
|
245
|
+
};
|
|
246
|
+
export type RemoveConversationUsersArgs = {
|
|
247
|
+
id: number;
|
|
248
|
+
userIds: number[];
|
|
249
|
+
};
|
|
250
|
+
export type MuteConversationArgs = {
|
|
251
|
+
id: number;
|
|
252
|
+
minutes: number;
|
|
253
|
+
};
|
|
254
|
+
export type AddGroupUserArgs = {
|
|
255
|
+
id: number;
|
|
256
|
+
userId: number;
|
|
257
|
+
};
|
|
258
|
+
export type AddGroupUsersArgs = {
|
|
259
|
+
id: number;
|
|
260
|
+
userIds: number[];
|
|
261
|
+
};
|
|
262
|
+
export type RemoveGroupUserArgs = {
|
|
263
|
+
id: number;
|
|
264
|
+
userId: number;
|
|
265
|
+
};
|
|
266
|
+
export type RemoveGroupUsersArgs = {
|
|
267
|
+
id: number;
|
|
268
|
+
userIds: number[];
|
|
269
|
+
};
|
|
270
|
+
export type GetWorkspaceUsersArgs = {
|
|
271
|
+
workspaceId: number;
|
|
272
|
+
archived?: boolean;
|
|
273
|
+
};
|
|
274
|
+
export type GetUserByIdArgs = {
|
|
275
|
+
workspaceId: number;
|
|
276
|
+
userId: number;
|
|
277
|
+
};
|
|
278
|
+
export type GetUserByEmailArgs = {
|
|
279
|
+
workspaceId: number;
|
|
280
|
+
email: string;
|
|
281
|
+
};
|
|
282
|
+
export type GetUserInfoArgs = {
|
|
283
|
+
workspaceId: number;
|
|
284
|
+
userId: number;
|
|
285
|
+
};
|
|
286
|
+
export type GetUserLocalTimeArgs = {
|
|
287
|
+
workspaceId: number;
|
|
288
|
+
userId: number;
|
|
289
|
+
};
|