@doist/twist-sdk 2.1.1 → 2.1.3
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/authentication.js +85 -0
- package/dist/cjs/clients/base-client.js +2 -1
- package/dist/cjs/consts/endpoints.js +3 -2
- package/dist/cjs/types/api-version.js +6 -0
- package/dist/cjs/types/entities.js +6 -5
- package/dist/cjs/types/http.js +2 -0
- package/dist/cjs/types/index.js +1 -0
- package/dist/esm/authentication.js +84 -0
- package/dist/esm/clients/base-client.js +2 -1
- package/dist/esm/consts/endpoints.js +3 -2
- package/dist/esm/types/api-version.js +5 -1
- package/dist/esm/types/entities.js +3 -2
- package/dist/esm/types/http.js +1 -1
- package/dist/esm/types/index.js +1 -0
- package/dist/types/authentication.d.ts +5 -1
- package/dist/types/consts/endpoints.d.ts +2 -2
- package/dist/types/types/api-version.d.ts +3 -1
- package/dist/types/types/entities.d.ts +28 -0
- package/dist/types/types/http.d.ts +2 -1
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -47,6 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.TWIST_SCOPES = void 0;
|
|
50
51
|
exports.getAuthStateParameter = getAuthStateParameter;
|
|
51
52
|
exports.getAuthorizationUrl = getAuthorizationUrl;
|
|
52
53
|
exports.getAuthToken = getAuthToken;
|
|
@@ -54,6 +55,90 @@ exports.revokeAuthToken = revokeAuthToken;
|
|
|
54
55
|
var uuid_1 = require("uuid");
|
|
55
56
|
var rest_client_1 = require("./rest-client");
|
|
56
57
|
var errors_1 = require("./types/errors");
|
|
58
|
+
/**
|
|
59
|
+
* OAuth scopes for the Twist API.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* Request only the scopes your application needs:
|
|
63
|
+
*
|
|
64
|
+
* **User Scopes:**
|
|
65
|
+
* - `user:read` - Access user's personal settings
|
|
66
|
+
* - `user:write` - Access and update user's personal settings
|
|
67
|
+
*
|
|
68
|
+
* **Workspace Scopes:**
|
|
69
|
+
* - `workspaces:read` - Access teams the user is part of
|
|
70
|
+
* - `workspaces:write` - Access and update teams the user is part of
|
|
71
|
+
*
|
|
72
|
+
* **Channel Scopes:**
|
|
73
|
+
* - `channels:read` - Access channels
|
|
74
|
+
* - `channels:write` - Access and update channels
|
|
75
|
+
* - `channels:remove` - Access, update, and delete channels
|
|
76
|
+
*
|
|
77
|
+
* **Thread Scopes:**
|
|
78
|
+
* - `threads:read` - Access threads
|
|
79
|
+
* - `threads:write` - Access and update threads
|
|
80
|
+
* - `threads:remove` - Access, update, and delete threads
|
|
81
|
+
*
|
|
82
|
+
* **Comment Scopes:**
|
|
83
|
+
* - `comments:read` - Access comments
|
|
84
|
+
* - `comments:write` - Access and update comments
|
|
85
|
+
* - `comments:remove` - Access, update, and delete comments
|
|
86
|
+
*
|
|
87
|
+
* **Group Scopes:**
|
|
88
|
+
* - `groups:read` - Access groups
|
|
89
|
+
* - `groups:write` - Access and update groups
|
|
90
|
+
* - `groups:remove` - Access, update, and delete groups
|
|
91
|
+
*
|
|
92
|
+
* **Message Scopes:**
|
|
93
|
+
* - `messages:read` - Access messages
|
|
94
|
+
* - `messages:write` - Access and update messages
|
|
95
|
+
* - `messages:remove` - Access, update, and delete messages
|
|
96
|
+
*
|
|
97
|
+
* **Reaction Scopes:**
|
|
98
|
+
* - `reactions:read` - Access reactions
|
|
99
|
+
* - `reactions:write` - Access and update reactions
|
|
100
|
+
* - `reactions:remove` - Access, update, and delete reactions
|
|
101
|
+
*
|
|
102
|
+
* **Search Scopes:**
|
|
103
|
+
* - `search:read` - Search
|
|
104
|
+
*
|
|
105
|
+
* **Attachment Scopes:**
|
|
106
|
+
* - `attachments:read` - Access attachments
|
|
107
|
+
* - `attachments:write` - Access and update attachments
|
|
108
|
+
*
|
|
109
|
+
* **Notification Scopes:**
|
|
110
|
+
* - `notifications:read` - Read user's notifications settings
|
|
111
|
+
* - `notifications:write` - Read and update user's notifications settings
|
|
112
|
+
*/
|
|
113
|
+
exports.TWIST_SCOPES = [
|
|
114
|
+
'user:read',
|
|
115
|
+
'user:write',
|
|
116
|
+
'workspaces:read',
|
|
117
|
+
'workspaces:write',
|
|
118
|
+
'channels:read',
|
|
119
|
+
'channels:write',
|
|
120
|
+
'channels:remove',
|
|
121
|
+
'threads:read',
|
|
122
|
+
'threads:write',
|
|
123
|
+
'threads:remove',
|
|
124
|
+
'comments:read',
|
|
125
|
+
'comments:write',
|
|
126
|
+
'comments:remove',
|
|
127
|
+
'groups:read',
|
|
128
|
+
'groups:write',
|
|
129
|
+
'groups:remove',
|
|
130
|
+
'messages:read',
|
|
131
|
+
'messages:write',
|
|
132
|
+
'messages:remove',
|
|
133
|
+
'reactions:read',
|
|
134
|
+
'reactions:write',
|
|
135
|
+
'reactions:remove',
|
|
136
|
+
'search:read',
|
|
137
|
+
'attachments:read',
|
|
138
|
+
'attachments:write',
|
|
139
|
+
'notifications:read',
|
|
140
|
+
'notifications:write',
|
|
141
|
+
];
|
|
57
142
|
function getAuthStateParameter() {
|
|
58
143
|
return (0, uuid_1.v4)();
|
|
59
144
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseClient = void 0;
|
|
4
4
|
var endpoints_1 = require("../consts/endpoints");
|
|
5
|
+
var api_version_1 = require("../types/api-version");
|
|
5
6
|
/**
|
|
6
7
|
* Base client class that provides centralized URL management and configuration
|
|
7
8
|
* for all Twist API clients. Fixes the trailing slash bug and eliminates code duplication.
|
|
@@ -10,7 +11,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
10
11
|
function BaseClient(config) {
|
|
11
12
|
this.apiToken = config.apiToken;
|
|
12
13
|
this.baseUrl = config.baseUrl;
|
|
13
|
-
this.defaultVersion = config.version ||
|
|
14
|
+
this.defaultVersion = config.version || api_version_1.DEFAULT_API_VERSION;
|
|
14
15
|
this.customFetch = config.customFetch;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ENDPOINT_CONVERSATION_MESSAGES = exports.ENDPOINT_SEARCH = exports.ENDPOINT_REACTIONS = exports.ENDPOINT_INBOX = exports.ENDPOINT_NOTIFICATIONS = exports.ENDPOINT_COMMENTS = exports.ENDPOINT_CONVERSATIONS = exports.ENDPOINT_GROUPS = exports.ENDPOINT_THREADS = exports.ENDPOINT_CHANNELS = exports.ENDPOINT_WORKSPACES = exports.ENDPOINT_USERS = exports.API_BASE_URI = exports.API_VERSION = void 0;
|
|
4
4
|
exports.getTwistBaseUri = getTwistBaseUri;
|
|
5
|
+
var api_version_1 = require("../types/api-version");
|
|
5
6
|
var BASE_URI = 'https://api.twist.com';
|
|
6
|
-
exports.API_VERSION =
|
|
7
|
+
exports.API_VERSION = api_version_1.DEFAULT_API_VERSION;
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use getTwistBaseUri() instead. This constant is kept for backward compatibility.
|
|
9
10
|
*/
|
|
@@ -16,7 +17,7 @@ exports.API_BASE_URI = "/api/".concat(exports.API_VERSION, "/");
|
|
|
16
17
|
* @returns Complete base URI with trailing slash (e.g., 'https://api.twist.com/api/v3/')
|
|
17
18
|
*/
|
|
18
19
|
function getTwistBaseUri(version, domainBase) {
|
|
19
|
-
if (version === void 0) { version =
|
|
20
|
+
if (version === void 0) { version = api_version_1.DEFAULT_API_VERSION; }
|
|
20
21
|
if (domainBase === void 0) { domainBase = BASE_URI; }
|
|
21
22
|
return new URL("/api/".concat(version, "/"), domainBase).toString();
|
|
22
23
|
}
|
|
@@ -11,14 +11,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.SearchResultSchema = exports.UnreadConversationSchema = exports.UnreadThreadSchema = exports.InboxThreadSchema = exports.ConversationMessageSchema = exports.WorkspaceUserSchema = exports.CommentSchema = exports.ConversationSchema = exports.GroupSchema = exports.ThreadSchema = exports.ChannelSchema = exports.WorkspaceSchema = exports.UserSchema = exports.SystemMessageSchema = void 0;
|
|
14
|
+
exports.SearchResultSchema = exports.SEARCH_RESULT_TYPES = exports.UnreadConversationSchema = exports.UnreadThreadSchema = exports.InboxThreadSchema = exports.ConversationMessageSchema = exports.WorkspaceUserSchema = exports.CommentSchema = exports.ConversationSchema = exports.GroupSchema = exports.ThreadSchema = exports.ChannelSchema = exports.WorkspaceSchema = exports.UserSchema = exports.BaseUserSchema = exports.SystemMessageSchema = void 0;
|
|
15
15
|
var zod_1 = require("zod");
|
|
16
16
|
var url_helpers_1 = require("../utils/url-helpers");
|
|
17
17
|
var enums_1 = require("./enums");
|
|
18
18
|
// Reusable schema for system messages that can be either a string or an object
|
|
19
19
|
exports.SystemMessageSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.unknown()]).nullable().optional();
|
|
20
20
|
// Base user schema with common fields shared between User and WorkspaceUser
|
|
21
|
-
|
|
21
|
+
exports.BaseUserSchema = zod_1.z.object({
|
|
22
22
|
id: zod_1.z.number(),
|
|
23
23
|
name: zod_1.z.string(),
|
|
24
24
|
shortName: zod_1.z.string(),
|
|
@@ -50,7 +50,7 @@ var BaseUserSchema = zod_1.z.object({
|
|
|
50
50
|
setupPending: zod_1.z.union([zod_1.z.boolean(), zod_1.z.number()]).nullable().optional(),
|
|
51
51
|
});
|
|
52
52
|
// User entity from API
|
|
53
|
-
exports.UserSchema = BaseUserSchema.extend({
|
|
53
|
+
exports.UserSchema = exports.BaseUserSchema.extend({
|
|
54
54
|
email: zod_1.z.email(),
|
|
55
55
|
snoozeDndStart: zod_1.z.string().nullable().optional(),
|
|
56
56
|
clientId: zod_1.z.string().nullable().optional(),
|
|
@@ -262,7 +262,7 @@ exports.CommentSchema = zod_1.z
|
|
|
262
262
|
commentId: data.id,
|
|
263
263
|
}) })); });
|
|
264
264
|
// WorkspaceUser entity from v4 API
|
|
265
|
-
exports.WorkspaceUserSchema = BaseUserSchema.extend({
|
|
265
|
+
exports.WorkspaceUserSchema = exports.BaseUserSchema.extend({
|
|
266
266
|
email: zod_1.z.string().nullable().optional(),
|
|
267
267
|
userType: zod_1.z.enum(enums_1.USER_TYPES),
|
|
268
268
|
dateFormat: zod_1.z.string().nullable().optional(),
|
|
@@ -356,9 +356,10 @@ exports.UnreadConversationSchema = zod_1.z.object({
|
|
|
356
356
|
directMention: zod_1.z.boolean(),
|
|
357
357
|
});
|
|
358
358
|
// SearchResult entity from API
|
|
359
|
+
exports.SEARCH_RESULT_TYPES = ['thread', 'comment', 'message', 'conversation'];
|
|
359
360
|
exports.SearchResultSchema = zod_1.z.object({
|
|
360
361
|
id: zod_1.z.string(),
|
|
361
|
-
type: zod_1.z.enum(
|
|
362
|
+
type: zod_1.z.enum(exports.SEARCH_RESULT_TYPES),
|
|
362
363
|
snippet: zod_1.z.string(),
|
|
363
364
|
snippetCreatorId: zod_1.z.number(),
|
|
364
365
|
snippetLastUpdated: zod_1.z.date(),
|
package/dist/cjs/types/http.js
CHANGED
package/dist/cjs/types/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api-version"), exports);
|
|
17
18
|
__exportStar(require("./batch"), exports);
|
|
18
19
|
__exportStar(require("./entities"), exports);
|
|
19
20
|
__exportStar(require("./enums"), exports);
|
|
@@ -48,6 +48,90 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
import { v4 as uuid } from 'uuid';
|
|
49
49
|
import { isSuccess, request } from './rest-client.js';
|
|
50
50
|
import { TwistRequestError } from './types/errors.js';
|
|
51
|
+
/**
|
|
52
|
+
* OAuth scopes for the Twist API.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Request only the scopes your application needs:
|
|
56
|
+
*
|
|
57
|
+
* **User Scopes:**
|
|
58
|
+
* - `user:read` - Access user's personal settings
|
|
59
|
+
* - `user:write` - Access and update user's personal settings
|
|
60
|
+
*
|
|
61
|
+
* **Workspace Scopes:**
|
|
62
|
+
* - `workspaces:read` - Access teams the user is part of
|
|
63
|
+
* - `workspaces:write` - Access and update teams the user is part of
|
|
64
|
+
*
|
|
65
|
+
* **Channel Scopes:**
|
|
66
|
+
* - `channels:read` - Access channels
|
|
67
|
+
* - `channels:write` - Access and update channels
|
|
68
|
+
* - `channels:remove` - Access, update, and delete channels
|
|
69
|
+
*
|
|
70
|
+
* **Thread Scopes:**
|
|
71
|
+
* - `threads:read` - Access threads
|
|
72
|
+
* - `threads:write` - Access and update threads
|
|
73
|
+
* - `threads:remove` - Access, update, and delete threads
|
|
74
|
+
*
|
|
75
|
+
* **Comment Scopes:**
|
|
76
|
+
* - `comments:read` - Access comments
|
|
77
|
+
* - `comments:write` - Access and update comments
|
|
78
|
+
* - `comments:remove` - Access, update, and delete comments
|
|
79
|
+
*
|
|
80
|
+
* **Group Scopes:**
|
|
81
|
+
* - `groups:read` - Access groups
|
|
82
|
+
* - `groups:write` - Access and update groups
|
|
83
|
+
* - `groups:remove` - Access, update, and delete groups
|
|
84
|
+
*
|
|
85
|
+
* **Message Scopes:**
|
|
86
|
+
* - `messages:read` - Access messages
|
|
87
|
+
* - `messages:write` - Access and update messages
|
|
88
|
+
* - `messages:remove` - Access, update, and delete messages
|
|
89
|
+
*
|
|
90
|
+
* **Reaction Scopes:**
|
|
91
|
+
* - `reactions:read` - Access reactions
|
|
92
|
+
* - `reactions:write` - Access and update reactions
|
|
93
|
+
* - `reactions:remove` - Access, update, and delete reactions
|
|
94
|
+
*
|
|
95
|
+
* **Search Scopes:**
|
|
96
|
+
* - `search:read` - Search
|
|
97
|
+
*
|
|
98
|
+
* **Attachment Scopes:**
|
|
99
|
+
* - `attachments:read` - Access attachments
|
|
100
|
+
* - `attachments:write` - Access and update attachments
|
|
101
|
+
*
|
|
102
|
+
* **Notification Scopes:**
|
|
103
|
+
* - `notifications:read` - Read user's notifications settings
|
|
104
|
+
* - `notifications:write` - Read and update user's notifications settings
|
|
105
|
+
*/
|
|
106
|
+
export var TWIST_SCOPES = [
|
|
107
|
+
'user:read',
|
|
108
|
+
'user:write',
|
|
109
|
+
'workspaces:read',
|
|
110
|
+
'workspaces:write',
|
|
111
|
+
'channels:read',
|
|
112
|
+
'channels:write',
|
|
113
|
+
'channels:remove',
|
|
114
|
+
'threads:read',
|
|
115
|
+
'threads:write',
|
|
116
|
+
'threads:remove',
|
|
117
|
+
'comments:read',
|
|
118
|
+
'comments:write',
|
|
119
|
+
'comments:remove',
|
|
120
|
+
'groups:read',
|
|
121
|
+
'groups:write',
|
|
122
|
+
'groups:remove',
|
|
123
|
+
'messages:read',
|
|
124
|
+
'messages:write',
|
|
125
|
+
'messages:remove',
|
|
126
|
+
'reactions:read',
|
|
127
|
+
'reactions:write',
|
|
128
|
+
'reactions:remove',
|
|
129
|
+
'search:read',
|
|
130
|
+
'attachments:read',
|
|
131
|
+
'attachments:write',
|
|
132
|
+
'notifications:read',
|
|
133
|
+
'notifications:write',
|
|
134
|
+
];
|
|
51
135
|
export function getAuthStateParameter() {
|
|
52
136
|
return uuid();
|
|
53
137
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getTwistBaseUri } from '../consts/endpoints.js';
|
|
2
|
+
import { DEFAULT_API_VERSION } from '../types/api-version.js';
|
|
2
3
|
/**
|
|
3
4
|
* Base client class that provides centralized URL management and configuration
|
|
4
5
|
* for all Twist API clients. Fixes the trailing slash bug and eliminates code duplication.
|
|
@@ -7,7 +8,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
7
8
|
function BaseClient(config) {
|
|
8
9
|
this.apiToken = config.apiToken;
|
|
9
10
|
this.baseUrl = config.baseUrl;
|
|
10
|
-
this.defaultVersion = config.version ||
|
|
11
|
+
this.defaultVersion = config.version || DEFAULT_API_VERSION;
|
|
11
12
|
this.customFetch = config.customFetch;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DEFAULT_API_VERSION } from '../types/api-version.js';
|
|
1
2
|
var BASE_URI = 'https://api.twist.com';
|
|
2
|
-
export var API_VERSION =
|
|
3
|
+
export var API_VERSION = DEFAULT_API_VERSION;
|
|
3
4
|
/**
|
|
4
5
|
* @deprecated Use getTwistBaseUri() instead. This constant is kept for backward compatibility.
|
|
5
6
|
*/
|
|
@@ -12,7 +13,7 @@ export var API_BASE_URI = "/api/".concat(API_VERSION, "/");
|
|
|
12
13
|
* @returns Complete base URI with trailing slash (e.g., 'https://api.twist.com/api/v3/')
|
|
13
14
|
*/
|
|
14
15
|
export function getTwistBaseUri(version, domainBase) {
|
|
15
|
-
if (version === void 0) { version =
|
|
16
|
+
if (version === void 0) { version = DEFAULT_API_VERSION; }
|
|
16
17
|
if (domainBase === void 0) { domainBase = BASE_URI; }
|
|
17
18
|
return new URL("/api/".concat(version, "/"), domainBase).toString();
|
|
18
19
|
}
|
|
@@ -15,7 +15,7 @@ import { USER_TYPES, WORKSPACE_PLANS } from './enums.js';
|
|
|
15
15
|
// Reusable schema for system messages that can be either a string or an object
|
|
16
16
|
export var SystemMessageSchema = z.union([z.string(), z.unknown()]).nullable().optional();
|
|
17
17
|
// Base user schema with common fields shared between User and WorkspaceUser
|
|
18
|
-
var BaseUserSchema = z.object({
|
|
18
|
+
export var BaseUserSchema = z.object({
|
|
19
19
|
id: z.number(),
|
|
20
20
|
name: z.string(),
|
|
21
21
|
shortName: z.string(),
|
|
@@ -353,9 +353,10 @@ export var UnreadConversationSchema = z.object({
|
|
|
353
353
|
directMention: z.boolean(),
|
|
354
354
|
});
|
|
355
355
|
// SearchResult entity from API
|
|
356
|
+
export var SEARCH_RESULT_TYPES = ['thread', 'comment', 'message', 'conversation'];
|
|
356
357
|
export var SearchResultSchema = z.object({
|
|
357
358
|
id: z.string(),
|
|
358
|
-
type: z.enum(
|
|
359
|
+
type: z.enum(SEARCH_RESULT_TYPES),
|
|
359
360
|
snippet: z.string(),
|
|
360
361
|
snippetCreatorId: z.number(),
|
|
361
362
|
snippetLastUpdated: z.date(),
|
package/dist/esm/types/http.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var HTTP_METHODS = ['POST', 'GET', 'PUT', 'PATCH', 'DELETE'];
|
package/dist/esm/types/index.js
CHANGED
|
@@ -60,7 +60,11 @@ export type AuthOptions = {
|
|
|
60
60
|
* - `notifications:read` - Read user's notifications settings
|
|
61
61
|
* - `notifications:write` - Read and update user's notifications settings
|
|
62
62
|
*/
|
|
63
|
-
export
|
|
63
|
+
export declare const TWIST_SCOPES: readonly ["user:read", "user:write", "workspaces:read", "workspaces:write", "channels:read", "channels:write", "channels:remove", "threads:read", "threads:write", "threads:remove", "comments:read", "comments:write", "comments:remove", "groups:read", "groups:write", "groups:remove", "messages:read", "messages:write", "messages:remove", "reactions:read", "reactions:write", "reactions:remove", "search:read", "attachments:read", "attachments:write", "notifications:read", "notifications:write"];
|
|
64
|
+
/**
|
|
65
|
+
* Scopes determine what access a token has to the Twist API.
|
|
66
|
+
*/
|
|
67
|
+
export type TwistScope = (typeof TWIST_SCOPES)[number];
|
|
64
68
|
export type AuthTokenRequestArgs = {
|
|
65
69
|
clientId: string;
|
|
66
70
|
clientSecret: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ApiVersion } from '../types/api-version.js';
|
|
2
|
-
export declare const API_VERSION
|
|
2
|
+
export declare const API_VERSION: "v3" | "v4";
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use getTwistBaseUri() instead. This constant is kept for backward compatibility.
|
|
5
5
|
*/
|
|
6
|
-
export declare const API_BASE_URI
|
|
6
|
+
export declare const API_BASE_URI: string;
|
|
7
7
|
/**
|
|
8
8
|
* Gets the base URI for Twist API requests.
|
|
9
9
|
*
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const SystemMessageSchema: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
|
|
3
|
+
export declare const BaseUserSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodNumber;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
shortName: z.ZodString;
|
|
7
|
+
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
contactInfo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
bot: z.ZodBoolean;
|
|
10
|
+
profession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
timezone: z.ZodString;
|
|
12
|
+
removed: z.ZodBoolean;
|
|
13
|
+
avatarId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
avatarUrls: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
15
|
+
s35: z.ZodString;
|
|
16
|
+
s60: z.ZodString;
|
|
17
|
+
s195: z.ZodString;
|
|
18
|
+
s640: z.ZodString;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
awayMode: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
21
|
+
dateFrom: z.ZodString;
|
|
22
|
+
type: z.ZodString;
|
|
23
|
+
dateTo: z.ZodString;
|
|
24
|
+
}, z.core.$strip>>>;
|
|
25
|
+
restricted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
26
|
+
setupPending: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
3
28
|
export declare const UserSchema: z.ZodObject<{
|
|
4
29
|
id: z.ZodNumber;
|
|
5
30
|
name: z.ZodString;
|
|
@@ -829,12 +854,15 @@ export declare const UnreadConversationSchema: z.ZodObject<{
|
|
|
829
854
|
directMention: z.ZodBoolean;
|
|
830
855
|
}, z.core.$strip>;
|
|
831
856
|
export type UnreadConversation = z.infer<typeof UnreadConversationSchema>;
|
|
857
|
+
export declare const SEARCH_RESULT_TYPES: readonly ["thread", "comment", "message", "conversation"];
|
|
858
|
+
export type SearchResultType = (typeof SEARCH_RESULT_TYPES)[number];
|
|
832
859
|
export declare const SearchResultSchema: z.ZodObject<{
|
|
833
860
|
id: z.ZodString;
|
|
834
861
|
type: z.ZodEnum<{
|
|
835
862
|
thread: "thread";
|
|
836
863
|
comment: "comment";
|
|
837
864
|
message: "message";
|
|
865
|
+
conversation: "conversation";
|
|
838
866
|
}>;
|
|
839
867
|
snippet: z.ZodString;
|
|
840
868
|
snippetCreatorId: z.ZodNumber;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const HTTP_METHODS: readonly ["POST", "GET", "PUT", "PATCH", "DELETE"];
|
|
2
|
+
export type HttpMethod = (typeof HTTP_METHODS)[number];
|
|
2
3
|
export type HttpResponse<T = unknown> = {
|
|
3
4
|
data: T;
|
|
4
5
|
status: number;
|