@doist/twist-sdk 2.0.1 → 2.1.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/types/entities.js +2 -2
- package/dist/cjs/types/requests.js +2 -1
- package/dist/cjs/utils/timestamp-conversion.js +4 -1
- package/dist/esm/clients/search-client.js +1 -1
- package/dist/esm/types/entities.js +2 -2
- package/dist/esm/types/requests.js +1 -0
- package/dist/esm/utils/timestamp-conversion.js +4 -1
- 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 +23 -6
- package/dist/types/types/requests.d.ts +193 -0
- package/package.json +1 -1
|
@@ -138,7 +138,7 @@ exports.ThreadSchema = zod_1.z
|
|
|
138
138
|
snippet: zod_1.z.string(),
|
|
139
139
|
snippetCreator: zod_1.z.number(),
|
|
140
140
|
snippetMaskAvatarUrl: zod_1.z.string().nullable().optional(),
|
|
141
|
-
snippetMaskPoster: zod_1.z.
|
|
141
|
+
snippetMaskPoster: zod_1.z.string().nullable().optional(),
|
|
142
142
|
starred: zod_1.z.boolean(),
|
|
143
143
|
systemMessage: exports.SystemMessageSchema,
|
|
144
144
|
toEmails: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
@@ -325,7 +325,7 @@ exports.InboxThreadSchema = zod_1.z
|
|
|
325
325
|
snippet: zod_1.z.string(),
|
|
326
326
|
snippetCreator: zod_1.z.number(),
|
|
327
327
|
snippetMaskAvatarUrl: zod_1.z.string().nullable().optional(),
|
|
328
|
-
snippetMaskPoster: zod_1.z.
|
|
328
|
+
snippetMaskPoster: zod_1.z.string().nullable().optional(),
|
|
329
329
|
starred: zod_1.z.boolean(),
|
|
330
330
|
systemMessage: exports.SystemMessageSchema,
|
|
331
331
|
isArchived: zod_1.z.boolean(),
|
|
@@ -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'];
|
|
@@ -31,7 +31,10 @@ function transformTimestamps(obj) {
|
|
|
31
31
|
if (key.endsWith('Ts') && typeof value === 'number') {
|
|
32
32
|
// Remove 'Ts' suffix and convert to Date
|
|
33
33
|
var newKey = key.slice(0, -2);
|
|
34
|
-
|
|
34
|
+
// If the base key already exists in the original object, use *Date suffix
|
|
35
|
+
// to avoid overwriting it (e.g. pinned + pinnedTs → pinned + pinnedDate)
|
|
36
|
+
var targetKey = newKey in obj ? "".concat(newKey, "Date") : newKey;
|
|
37
|
+
result[targetKey] = timestampToDate(value);
|
|
35
38
|
}
|
|
36
39
|
else if (typeof value === 'object' && value !== null) {
|
|
37
40
|
// Recursively transform nested objects
|
|
@@ -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.
|
|
@@ -135,7 +135,7 @@ export var ThreadSchema = z
|
|
|
135
135
|
snippet: z.string(),
|
|
136
136
|
snippetCreator: z.number(),
|
|
137
137
|
snippetMaskAvatarUrl: z.string().nullable().optional(),
|
|
138
|
-
snippetMaskPoster: z.
|
|
138
|
+
snippetMaskPoster: z.string().nullable().optional(),
|
|
139
139
|
starred: z.boolean(),
|
|
140
140
|
systemMessage: SystemMessageSchema,
|
|
141
141
|
toEmails: z.array(z.string()).nullable().optional(),
|
|
@@ -322,7 +322,7 @@ export var InboxThreadSchema = z
|
|
|
322
322
|
snippet: z.string(),
|
|
323
323
|
snippetCreator: z.number(),
|
|
324
324
|
snippetMaskAvatarUrl: z.string().nullable().optional(),
|
|
325
|
-
snippetMaskPoster: z.
|
|
325
|
+
snippetMaskPoster: z.string().nullable().optional(),
|
|
326
326
|
starred: z.boolean(),
|
|
327
327
|
systemMessage: SystemMessageSchema,
|
|
328
328
|
isArchived: z.boolean(),
|
|
@@ -27,7 +27,10 @@ export function transformTimestamps(obj) {
|
|
|
27
27
|
if (key.endsWith('Ts') && typeof value === 'number') {
|
|
28
28
|
// Remove 'Ts' suffix and convert to Date
|
|
29
29
|
var newKey = key.slice(0, -2);
|
|
30
|
-
|
|
30
|
+
// If the base key already exists in the original object, use *Date suffix
|
|
31
|
+
// to avoid overwriting it (e.g. pinned + pinnedTs → pinned + pinnedDate)
|
|
32
|
+
var targetKey = newKey in obj ? "".concat(newKey, "Date") : newKey;
|
|
33
|
+
result[targetKey] = timestampToDate(value);
|
|
31
34
|
}
|
|
32
35
|
else if (typeof value === 'object' && value !== null) {
|
|
33
36
|
// Recursively transform nested objects
|
|
@@ -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
|
*/
|
|
@@ -145,7 +145,7 @@ export declare const ThreadSchema: z.ZodPipe<z.ZodObject<{
|
|
|
145
145
|
snippet: z.ZodString;
|
|
146
146
|
snippetCreator: z.ZodNumber;
|
|
147
147
|
snippetMaskAvatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
148
|
-
snippetMaskPoster: z.ZodOptional<z.ZodNullable<z.
|
|
148
|
+
snippetMaskPoster: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
149
149
|
starred: z.ZodBoolean;
|
|
150
150
|
systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
|
|
151
151
|
toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
@@ -208,7 +208,7 @@ export declare const ThreadSchema: z.ZodPipe<z.ZodObject<{
|
|
|
208
208
|
recipients?: number[] | null | undefined;
|
|
209
209
|
responders?: number[] | null | undefined;
|
|
210
210
|
snippetMaskAvatarUrl?: string | null | undefined;
|
|
211
|
-
snippetMaskPoster?: string |
|
|
211
|
+
snippetMaskPoster?: string | null | undefined;
|
|
212
212
|
systemMessage?: unknown;
|
|
213
213
|
toEmails?: string[] | null | undefined;
|
|
214
214
|
isSaved?: boolean | null | undefined;
|
|
@@ -268,7 +268,7 @@ export declare const ThreadSchema: z.ZodPipe<z.ZodObject<{
|
|
|
268
268
|
recipients?: number[] | null | undefined;
|
|
269
269
|
responders?: number[] | null | undefined;
|
|
270
270
|
snippetMaskAvatarUrl?: string | null | undefined;
|
|
271
|
-
snippetMaskPoster?: string |
|
|
271
|
+
snippetMaskPoster?: string | null | undefined;
|
|
272
272
|
systemMessage?: unknown;
|
|
273
273
|
toEmails?: string[] | null | undefined;
|
|
274
274
|
isSaved?: boolean | null | undefined;
|
|
@@ -603,7 +603,7 @@ export declare const InboxThreadSchema: z.ZodPipe<z.ZodObject<{
|
|
|
603
603
|
snippet: z.ZodString;
|
|
604
604
|
snippetCreator: z.ZodNumber;
|
|
605
605
|
snippetMaskAvatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
606
|
-
snippetMaskPoster: z.ZodOptional<z.ZodNullable<z.
|
|
606
|
+
snippetMaskPoster: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
607
607
|
starred: z.ZodBoolean;
|
|
608
608
|
systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
|
|
609
609
|
isArchived: z.ZodBoolean;
|
|
@@ -719,7 +719,7 @@ export declare const InboxThreadSchema: z.ZodPipe<z.ZodObject<{
|
|
|
719
719
|
reactions?: Record<string, number[]> | null | undefined;
|
|
720
720
|
recipients?: number[] | null | undefined;
|
|
721
721
|
snippetMaskAvatarUrl?: string | null | undefined;
|
|
722
|
-
snippetMaskPoster?:
|
|
722
|
+
snippetMaskPoster?: string | null | undefined;
|
|
723
723
|
systemMessage?: unknown;
|
|
724
724
|
isSaved?: boolean | null | undefined;
|
|
725
725
|
responders?: number[] | null | undefined;
|
|
@@ -782,7 +782,7 @@ export declare const InboxThreadSchema: z.ZodPipe<z.ZodObject<{
|
|
|
782
782
|
reactions?: Record<string, number[]> | null | undefined;
|
|
783
783
|
recipients?: number[] | null | undefined;
|
|
784
784
|
snippetMaskAvatarUrl?: string | null | undefined;
|
|
785
|
-
snippetMaskPoster?:
|
|
785
|
+
snippetMaskPoster?: string | null | undefined;
|
|
786
786
|
systemMessage?: unknown;
|
|
787
787
|
isSaved?: boolean | null | undefined;
|
|
788
788
|
responders?: number[] | null | undefined;
|
|
@@ -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
|
+
};
|