@hasna/connectors 1.3.44 → 1.3.46
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/README.md +25 -0
- package/bin/index.js +792 -130
- package/bin/mcp.js +438 -52
- package/bin/serve.js +438 -52
- package/connectors/cloudflare-workers/.env.example +5 -0
- package/connectors/cloudflare-workers/AGENTS.md +11 -0
- package/connectors/cloudflare-workers/CLAUDE.md +11 -0
- package/connectors/cloudflare-workers/README.md +45 -0
- package/connectors/cloudflare-workers/package.json +47 -0
- package/connectors/cloudflare-workers/src/api/client.test.ts +144 -0
- package/connectors/cloudflare-workers/src/api/client.ts +386 -0
- package/connectors/cloudflare-workers/src/api/index.ts +1 -0
- package/connectors/cloudflare-workers/src/cli/index.ts +206 -0
- package/connectors/cloudflare-workers/src/index.ts +16 -0
- package/connectors/cloudflare-workers/src/types/index.ts +53 -0
- package/connectors/cloudflare-workers/src/utils/config.ts +61 -0
- package/connectors/cloudflare-workers/src/utils/output.ts +26 -0
- package/connectors/cloudflare-workers/tsconfig.build.json +4 -0
- package/connectors/cloudflare-workers/tsconfig.json +14 -0
- package/connectors/tidio/.env.example +3 -2
- package/connectors/tidio/CLAUDE.md +21 -96
- package/connectors/tidio/README.md +22 -18
- package/connectors/tidio/package.json +4 -2
- package/connectors/tidio/src/api/client.ts +26 -15
- package/connectors/tidio/src/api/index.ts +185 -128
- package/connectors/tidio/src/api/tidio.test.ts +175 -44
- package/connectors/tidio/src/cli/index.ts +154 -388
- package/connectors/tidio/src/index.ts +5 -3
- package/connectors/tidio/src/types/index.ts +135 -82
- package/connectors/tidio/src/utils/config.ts +90 -44
- package/connectors/wandb/.env.example +7 -0
- package/connectors/wandb/AGENTS.md +43 -0
- package/connectors/wandb/CLAUDE.md +67 -0
- package/connectors/wandb/README.md +65 -0
- package/connectors/wandb/package.json +52 -0
- package/connectors/wandb/src/api/client.test.ts +116 -0
- package/connectors/wandb/src/api/client.ts +83 -0
- package/connectors/wandb/src/api/graphql.ts +9 -0
- package/connectors/wandb/src/api/index.ts +36 -0
- package/connectors/wandb/src/api/projects.ts +36 -0
- package/connectors/wandb/src/api/viewer.ts +20 -0
- package/connectors/wandb/src/cli/index.ts +265 -0
- package/connectors/wandb/src/index.ts +22 -0
- package/connectors/wandb/src/types/index.ts +75 -0
- package/connectors/wandb/src/utils/config.ts +164 -0
- package/connectors/wandb/src/utils/output.ts +119 -0
- package/connectors/wandb/tsconfig.json +16 -0
- package/connectors/weights-biases/.env.example +7 -0
- package/connectors/weights-biases/CLAUDE.md +65 -0
- package/connectors/weights-biases/README.md +62 -0
- package/connectors/weights-biases/package.json +53 -0
- package/connectors/weights-biases/src/api/client.test.ts +46 -0
- package/connectors/weights-biases/src/api/client.ts +119 -0
- package/connectors/weights-biases/src/api/events.ts +18 -0
- package/connectors/weights-biases/src/api/index.ts +56 -0
- package/connectors/weights-biases/src/api/runs.ts +28 -0
- package/connectors/weights-biases/src/api/search.ts +10 -0
- package/connectors/weights-biases/src/cli/index.ts +289 -0
- package/connectors/weights-biases/src/index.ts +19 -0
- package/connectors/weights-biases/src/types/index.ts +92 -0
- package/connectors/weights-biases/src/utils/config.ts +168 -0
- package/connectors/weights-biases/src/utils/output.ts +116 -0
- package/connectors/weights-biases/tsconfig.json +16 -0
- package/connectors/zoominfo/.env.example +4 -0
- package/connectors/zoominfo/AGENTS.md +26 -0
- package/connectors/zoominfo/CLAUDE.md +20 -0
- package/connectors/zoominfo/README.md +69 -0
- package/connectors/zoominfo/package.json +52 -0
- package/connectors/zoominfo/src/api/client.test.ts +140 -0
- package/connectors/zoominfo/src/api/client.ts +228 -0
- package/connectors/zoominfo/src/api/index.ts +1 -0
- package/connectors/zoominfo/src/cli/index.ts +179 -0
- package/connectors/zoominfo/src/index.ts +3 -0
- package/connectors/zoominfo/src/types/index.ts +39 -0
- package/connectors/zoominfo/src/utils/config.ts +61 -0
- package/connectors/zoominfo/src/utils/output.ts +27 -0
- package/connectors/zoominfo/tsconfig.json +20 -0
- package/connectors/zotero/.env.example +7 -0
- package/connectors/zotero/.npmrc.example +2 -0
- package/connectors/zotero/AGENTS.md +40 -0
- package/connectors/zotero/CLAUDE.md +69 -0
- package/connectors/zotero/README.md +91 -0
- package/connectors/zotero/package.json +43 -0
- package/connectors/zotero/src/api/attachments.ts +130 -0
- package/connectors/zotero/src/api/client.test.ts +166 -0
- package/connectors/zotero/src/api/client.ts +169 -0
- package/connectors/zotero/src/api/collections.ts +26 -0
- package/connectors/zotero/src/api/index.ts +45 -0
- package/connectors/zotero/src/api/items.ts +64 -0
- package/connectors/zotero/src/cli/index.ts +386 -0
- package/connectors/zotero/src/index.ts +28 -0
- package/connectors/zotero/src/types/index.ts +129 -0
- package/connectors/zotero/src/utils/config.ts +245 -0
- package/connectors/zotero/src/utils/output.ts +119 -0
- package/connectors/zotero/tsconfig.json +16 -0
- package/connectors/zymbly/.env.example +2 -0
- package/connectors/zymbly/AGENTS.md +11 -0
- package/connectors/zymbly/CLAUDE.md +5 -0
- package/connectors/zymbly/README.md +35 -0
- package/connectors/zymbly/package.json +52 -0
- package/connectors/zymbly/src/api/client.test.ts +110 -0
- package/connectors/zymbly/src/api/client.ts +166 -0
- package/connectors/zymbly/src/api/index.ts +1 -0
- package/connectors/zymbly/src/cli/index.ts +156 -0
- package/connectors/zymbly/src/index.ts +12 -0
- package/connectors/zymbly/src/types/index.ts +34 -0
- package/connectors/zymbly/src/utils/config.ts +52 -0
- package/connectors/zymbly/src/utils/output.ts +17 -0
- package/connectors/zymbly/tsconfig.json +13 -0
- package/dist/index.js +45 -2
- package/dist/lib/compact-output.d.ts +40 -0
- package/dist/mcp/tools/jobs.d.ts +32 -0
- package/dist/mcp/tools/jobs.test.d.ts +1 -0
- package/package.json +3 -2
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { TidioConfig } from '../types';
|
|
2
2
|
import { parseTidioError } from '../types';
|
|
3
3
|
|
|
4
|
-
const DEFAULT_BASE_URL = 'https://api.tidio.
|
|
4
|
+
export const DEFAULT_BASE_URL = 'https://api.tidio.com/';
|
|
5
|
+
export const TIDIO_ACCEPT_HEADER = 'application/json; version=1';
|
|
5
6
|
|
|
6
7
|
export interface RequestOptions {
|
|
7
|
-
method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
8
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
8
9
|
params?: Record<string, string | number | boolean | undefined>;
|
|
9
10
|
body?: Record<string, unknown> | unknown[] | string | null;
|
|
10
11
|
headers?: Record<string, string>;
|
|
@@ -12,19 +13,24 @@ export interface RequestOptions {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export class TidioClient {
|
|
15
|
-
private readonly
|
|
16
|
+
private readonly clientId: string;
|
|
17
|
+
private readonly clientSecret: string;
|
|
16
18
|
private readonly baseUrl: string;
|
|
17
19
|
|
|
18
20
|
constructor(config: TidioConfig) {
|
|
19
|
-
if (!config.
|
|
20
|
-
throw new Error('
|
|
21
|
+
if (!config.clientId) {
|
|
22
|
+
throw new Error('Client ID is required');
|
|
21
23
|
}
|
|
22
|
-
|
|
24
|
+
if (!config.clientSecret) {
|
|
25
|
+
throw new Error('Client secret is required');
|
|
26
|
+
}
|
|
27
|
+
this.clientId = config.clientId;
|
|
28
|
+
this.clientSecret = config.clientSecret;
|
|
23
29
|
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
private buildUrl(path: string, params?: Record<string, string | number | boolean | undefined>): string {
|
|
27
|
-
const url = new URL(
|
|
33
|
+
const url = new URL(path.replace(/^\//, ''), this.baseUrl);
|
|
28
34
|
|
|
29
35
|
if (params) {
|
|
30
36
|
Object.entries(params).forEach(([key, value]) => {
|
|
@@ -54,12 +60,13 @@ export class TidioClient {
|
|
|
54
60
|
const url = this.buildUrl(path, params);
|
|
55
61
|
|
|
56
62
|
const requestHeaders: Record<string, string> = {
|
|
57
|
-
'
|
|
58
|
-
'
|
|
63
|
+
'Accept': TIDIO_ACCEPT_HEADER,
|
|
64
|
+
'X-Tidio-Openapi-Client-Id': this.clientId,
|
|
65
|
+
'X-Tidio-Openapi-Client-Secret': this.clientSecret,
|
|
59
66
|
...headers,
|
|
60
67
|
};
|
|
61
68
|
|
|
62
|
-
if (body !== undefined && body !== null && ['POST', 'PATCH'].includes(method)) {
|
|
69
|
+
if (body !== undefined && body !== null && ['POST', 'PUT', 'PATCH'].includes(method)) {
|
|
63
70
|
requestHeaders['Content-Type'] = 'application/json';
|
|
64
71
|
}
|
|
65
72
|
|
|
@@ -68,7 +75,7 @@ export class TidioClient {
|
|
|
68
75
|
headers: requestHeaders,
|
|
69
76
|
};
|
|
70
77
|
|
|
71
|
-
if (body !== undefined && body !== null && ['POST', 'PATCH'].includes(method)) {
|
|
78
|
+
if (body !== undefined && body !== null && ['POST', 'PUT', 'PATCH'].includes(method)) {
|
|
72
79
|
fetchOptions.body = typeof body === 'string' ? body : JSON.stringify(body);
|
|
73
80
|
}
|
|
74
81
|
|
|
@@ -76,7 +83,7 @@ export class TidioClient {
|
|
|
76
83
|
const response = await fetch(url, fetchOptions);
|
|
77
84
|
|
|
78
85
|
if (response.status === 204) {
|
|
79
|
-
return
|
|
86
|
+
return undefined as T;
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
let data: unknown;
|
|
@@ -122,6 +129,10 @@ export class TidioClient {
|
|
|
122
129
|
return this.request<T>(path, { method: 'POST', body: body as Record<string, unknown>, params });
|
|
123
130
|
}
|
|
124
131
|
|
|
132
|
+
async put<T>(path: string, body?: Record<string, unknown> | object, params?: Record<string, string | number | boolean | undefined>): Promise<T> {
|
|
133
|
+
return this.request<T>(path, { method: 'PUT', body: body as Record<string, unknown>, params });
|
|
134
|
+
}
|
|
135
|
+
|
|
125
136
|
async patch<T>(path: string, body?: Record<string, unknown> | object, params?: Record<string, string | number | boolean | undefined>): Promise<T> {
|
|
126
137
|
return this.request<T>(path, { method: 'PATCH', body: body as Record<string, unknown>, params });
|
|
127
138
|
}
|
|
@@ -130,9 +141,9 @@ export class TidioClient {
|
|
|
130
141
|
return this.request<T>(path, { method: 'DELETE', params });
|
|
131
142
|
}
|
|
132
143
|
|
|
133
|
-
|
|
134
|
-
if (this.
|
|
135
|
-
return `${this.
|
|
144
|
+
getClientIdPreview(): string {
|
|
145
|
+
if (this.clientId.length > 10) {
|
|
146
|
+
return `${this.clientId.substring(0, 6)}...${this.clientId.substring(this.clientId.length - 4)}`;
|
|
136
147
|
}
|
|
137
148
|
return '***';
|
|
138
149
|
}
|
|
@@ -1,29 +1,53 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
BatchContactsParams,
|
|
3
|
+
AskLyroTicketParams,
|
|
3
4
|
Contact,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
ContactMessage,
|
|
6
|
+
ContactProperty,
|
|
7
|
+
CreateContactParams,
|
|
8
|
+
CreateLyroQaDataSourceParams,
|
|
9
|
+
CreateTicketAsContactParams,
|
|
7
10
|
Department,
|
|
8
|
-
|
|
9
|
-
Automation,
|
|
10
|
-
CannedResponse,
|
|
11
|
-
Webhook,
|
|
12
|
-
Project,
|
|
11
|
+
ListContactMessagesParams,
|
|
13
12
|
ListContactsParams,
|
|
14
|
-
|
|
13
|
+
ListLyroDataSourcesParams,
|
|
14
|
+
ListTicketsParams,
|
|
15
|
+
LyroDataSource,
|
|
16
|
+
MessageAccepted,
|
|
17
|
+
Operator,
|
|
18
|
+
PaginatedResponse,
|
|
19
|
+
Product,
|
|
20
|
+
Project,
|
|
21
|
+
ReplyTicketParams,
|
|
22
|
+
ScrapeLyroWebsiteParams,
|
|
23
|
+
SendContactMessageParams,
|
|
24
|
+
TidioConfig,
|
|
25
|
+
Ticket,
|
|
26
|
+
TicketCustomField,
|
|
27
|
+
TicketTag,
|
|
15
28
|
UpdateContactParams,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
SetConversationStatusParams,
|
|
20
|
-
AssignConversationParams,
|
|
21
|
-
CreateTagParams,
|
|
22
|
-
CreateCannedResponseParams,
|
|
23
|
-
CreateWebhookParams,
|
|
29
|
+
UpdateTicketParams,
|
|
30
|
+
UpsertLyroWebsiteDataSourceParams,
|
|
31
|
+
UuidResponse,
|
|
24
32
|
} from '../types';
|
|
25
33
|
import { TidioClient } from './client';
|
|
26
34
|
|
|
35
|
+
function compactRecord(input: Record<string, unknown>): Record<string, unknown> {
|
|
36
|
+
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function contactBody(params: CreateContactParams | UpdateContactParams): Record<string, unknown> {
|
|
40
|
+
return compactRecord({
|
|
41
|
+
email: params.email,
|
|
42
|
+
phone: params.phone,
|
|
43
|
+
first_name: params.firstName,
|
|
44
|
+
last_name: params.lastName,
|
|
45
|
+
distinct_id: params.distinctId,
|
|
46
|
+
properties: params.properties,
|
|
47
|
+
email_consent: params.emailConsent,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
27
51
|
export class Tidio {
|
|
28
52
|
private readonly client: TidioClient;
|
|
29
53
|
|
|
@@ -32,24 +56,24 @@ export class Tidio {
|
|
|
32
56
|
}
|
|
33
57
|
|
|
34
58
|
static fromEnv(): Tidio {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
59
|
+
const clientId = process.env.TIDIO_CLIENT_ID;
|
|
60
|
+
const clientSecret = process.env.TIDIO_CLIENT_SECRET;
|
|
61
|
+
if (!clientId || !clientSecret) {
|
|
62
|
+
throw new Error('TIDIO_CLIENT_ID and TIDIO_CLIENT_SECRET environment variables are required');
|
|
38
63
|
}
|
|
39
|
-
return new Tidio({
|
|
64
|
+
return new Tidio({ clientId, clientSecret });
|
|
40
65
|
}
|
|
41
66
|
|
|
42
|
-
|
|
43
|
-
return this.client.
|
|
67
|
+
getClientIdPreview(): string {
|
|
68
|
+
return this.client.getClientIdPreview();
|
|
44
69
|
}
|
|
45
70
|
|
|
46
71
|
getClient(): TidioClient {
|
|
47
72
|
return this.client;
|
|
48
73
|
}
|
|
49
74
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return this.client.get('/contacts', {
|
|
75
|
+
async listContacts(params: ListContactsParams = {}): Promise<PaginatedResponse<Contact>> {
|
|
76
|
+
return this.client.get<PaginatedResponse<Contact>>('/contacts', {
|
|
53
77
|
limit: params.limit,
|
|
54
78
|
cursor: params.cursor,
|
|
55
79
|
updated_after: params.updatedAfter,
|
|
@@ -57,161 +81,194 @@ export class Tidio {
|
|
|
57
81
|
});
|
|
58
82
|
}
|
|
59
83
|
|
|
60
|
-
async getContact(
|
|
61
|
-
return this.client.get<Contact>(`/contacts/${encodeURIComponent(
|
|
84
|
+
async getContact(contactId: string): Promise<Contact> {
|
|
85
|
+
return this.client.get<Contact>(`/contacts/${encodeURIComponent(contactId)}`);
|
|
62
86
|
}
|
|
63
87
|
|
|
64
|
-
async createContact(params: CreateContactParams): Promise<
|
|
65
|
-
if (!params.email && !params.phone && !params.
|
|
66
|
-
throw new Error('createContact requires email, phone, or
|
|
88
|
+
async createContact(params: CreateContactParams): Promise<UuidResponse> {
|
|
89
|
+
if (!params.email && !params.phone && !params.firstName && !params.lastName && !params.distinctId) {
|
|
90
|
+
throw new Error('createContact requires email, phone, firstName, lastName, or distinctId');
|
|
67
91
|
}
|
|
68
|
-
return this.client.post<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
properties: params.properties,
|
|
75
|
-
subscriber: params.subscriber,
|
|
76
|
-
consent: params.consent,
|
|
92
|
+
return this.client.post<UuidResponse>('/contacts', contactBody(params));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async createContactsBatch(params: BatchContactsParams<CreateContactParams>): Promise<unknown> {
|
|
96
|
+
return this.client.post('/contacts/batch', {
|
|
97
|
+
contacts: params.contacts.map(contactBody),
|
|
77
98
|
});
|
|
78
99
|
}
|
|
79
100
|
|
|
80
|
-
async updateContact(
|
|
81
|
-
const body =
|
|
82
|
-
|
|
83
|
-
phone: params.phone,
|
|
84
|
-
name: params.name,
|
|
85
|
-
external_id: params.externalId,
|
|
86
|
-
tags: params.tags,
|
|
87
|
-
properties: params.properties,
|
|
88
|
-
subscriber: params.subscriber,
|
|
89
|
-
consent: params.consent,
|
|
90
|
-
};
|
|
91
|
-
if (!Object.values(body).some(v => v !== undefined)) {
|
|
101
|
+
async updateContact(contactId: string, params: UpdateContactParams): Promise<void> {
|
|
102
|
+
const body = contactBody(params);
|
|
103
|
+
if (Object.keys(body).length === 0) {
|
|
92
104
|
throw new Error('updateContact requires at least one update field');
|
|
93
105
|
}
|
|
94
|
-
|
|
106
|
+
await this.client.patch(`/contacts/${encodeURIComponent(contactId)}`, body);
|
|
95
107
|
}
|
|
96
108
|
|
|
97
|
-
async
|
|
98
|
-
return this.client.
|
|
109
|
+
async updateContactsBatch(params: BatchContactsParams<UpdateContactParams>): Promise<unknown> {
|
|
110
|
+
return this.client.patch('/contacts/batch', {
|
|
111
|
+
contacts: params.contacts.map(contactBody),
|
|
112
|
+
});
|
|
99
113
|
}
|
|
100
114
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
async deleteContact(contactId: string): Promise<void> {
|
|
116
|
+
await this.client.delete(`/contacts/${encodeURIComponent(contactId)}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async getContactProperties(): Promise<PaginatedResponse<ContactProperty>> {
|
|
120
|
+
return this.client.get<PaginatedResponse<ContactProperty>>('/contact-properties');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async getContactViewedPages(contactId: string): Promise<unknown> {
|
|
124
|
+
return this.client.get(`/contacts/${encodeURIComponent(contactId)}/viewed-pages`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async listContactMessages(
|
|
128
|
+
contactId: string,
|
|
129
|
+
params: ListContactMessagesParams = {},
|
|
130
|
+
): Promise<PaginatedResponse<ContactMessage>> {
|
|
131
|
+
return this.client.get<PaginatedResponse<ContactMessage>>(
|
|
132
|
+
`/contacts/${encodeURIComponent(contactId)}/messages`,
|
|
133
|
+
{
|
|
134
|
+
cursor: params.cursor,
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async sendContactMessage(contactId: string, params: SendContactMessageParams): Promise<MessageAccepted> {
|
|
140
|
+
return this.client.post<MessageAccepted>(`/contacts/${encodeURIComponent(contactId)}/messages`, {
|
|
141
|
+
message: params.message,
|
|
109
142
|
});
|
|
110
143
|
}
|
|
111
144
|
|
|
112
|
-
async
|
|
113
|
-
return this.client.get<
|
|
145
|
+
async listOperators(): Promise<PaginatedResponse<Operator>> {
|
|
146
|
+
return this.client.get<PaginatedResponse<Operator>>('/operators');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async listDepartments(): Promise<PaginatedResponse<Department>> {
|
|
150
|
+
return this.client.get<PaginatedResponse<Department>>('/departments');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async getProject(): Promise<Project> {
|
|
154
|
+
return this.client.get<Project>('/project');
|
|
114
155
|
}
|
|
115
156
|
|
|
116
|
-
async
|
|
117
|
-
return this.client.get(
|
|
157
|
+
async listTickets(params: ListTicketsParams = {}): Promise<PaginatedResponse<Ticket>> {
|
|
158
|
+
return this.client.get<PaginatedResponse<Ticket>>('/tickets', {
|
|
118
159
|
limit: params.limit,
|
|
119
160
|
cursor: params.cursor,
|
|
161
|
+
status: params.status,
|
|
162
|
+
priority: params.priority,
|
|
120
163
|
});
|
|
121
164
|
}
|
|
122
165
|
|
|
123
|
-
async
|
|
124
|
-
return this.client.
|
|
125
|
-
type: params.type,
|
|
126
|
-
content: params.content,
|
|
127
|
-
media_url: params.mediaUrl,
|
|
128
|
-
private: params.private,
|
|
129
|
-
operator_id: params.operatorId,
|
|
130
|
-
});
|
|
166
|
+
async getTicket(ticketId: string): Promise<Ticket> {
|
|
167
|
+
return this.client.get<Ticket>(`/tickets/${encodeURIComponent(ticketId)}`);
|
|
131
168
|
}
|
|
132
169
|
|
|
133
|
-
async
|
|
134
|
-
return this.client.
|
|
135
|
-
|
|
136
|
-
|
|
170
|
+
async createTicketAsContact(params: CreateTicketAsContactParams): Promise<UuidResponse> {
|
|
171
|
+
return this.client.post<UuidResponse>('/tickets/as-contact', {
|
|
172
|
+
contact_id: params.contactId,
|
|
173
|
+
message: params.message,
|
|
174
|
+
subject: params.subject,
|
|
175
|
+
priority: params.priority,
|
|
137
176
|
});
|
|
138
177
|
}
|
|
139
178
|
|
|
140
|
-
async
|
|
141
|
-
return this.client.patch<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
179
|
+
async updateTicket(ticketId: string, params: UpdateTicketParams): Promise<Ticket> {
|
|
180
|
+
return this.client.patch<Ticket>(
|
|
181
|
+
`/tickets/${encodeURIComponent(ticketId)}`,
|
|
182
|
+
compactRecord({
|
|
183
|
+
status: params.status,
|
|
184
|
+
priority: params.priority,
|
|
185
|
+
assignee_id: params.assigneeId,
|
|
186
|
+
department_id: params.departmentId,
|
|
187
|
+
}),
|
|
188
|
+
);
|
|
145
189
|
}
|
|
146
190
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
191
|
+
async replyToTicket(ticketId: string, params: ReplyTicketParams): Promise<UuidResponse> {
|
|
192
|
+
return this.client.post<UuidResponse>(`/tickets/${encodeURIComponent(ticketId)}/reply`, {
|
|
193
|
+
message: params.message,
|
|
194
|
+
author_type: params.authorType,
|
|
195
|
+
});
|
|
150
196
|
}
|
|
151
197
|
|
|
152
|
-
async
|
|
153
|
-
|
|
198
|
+
async deleteTicket(ticketId: string): Promise<void> {
|
|
199
|
+
await this.client.delete(`/tickets/${encodeURIComponent(ticketId)}`);
|
|
154
200
|
}
|
|
155
201
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return this.client.get('/departments');
|
|
202
|
+
async getTicketTags(): Promise<TicketTag[]> {
|
|
203
|
+
return this.client.get<TicketTag[]>('/tickets/tags');
|
|
159
204
|
}
|
|
160
205
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return this.client.get('/tags');
|
|
206
|
+
async getTicketCustomFields(): Promise<TicketCustomField[]> {
|
|
207
|
+
return this.client.get<TicketCustomField[]>('/tickets/custom-fields');
|
|
164
208
|
}
|
|
165
209
|
|
|
166
|
-
async
|
|
167
|
-
return this.client.
|
|
168
|
-
name: params.name,
|
|
169
|
-
color: params.color,
|
|
170
|
-
});
|
|
210
|
+
async upsertProducts(products: Product[]): Promise<unknown> {
|
|
211
|
+
return this.client.put('/products/batch', { products });
|
|
171
212
|
}
|
|
172
213
|
|
|
173
|
-
async
|
|
174
|
-
|
|
214
|
+
async deleteProduct(productId: string): Promise<void> {
|
|
215
|
+
await this.client.delete(`/products/${encodeURIComponent(productId)}`);
|
|
175
216
|
}
|
|
176
217
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
218
|
+
async listLyroDataSources(params: ListLyroDataSourcesParams = {}): Promise<PaginatedResponse<LyroDataSource>> {
|
|
219
|
+
return this.client.get<PaginatedResponse<LyroDataSource>>('/lyro/data-sources', {
|
|
220
|
+
cursor: params.cursor,
|
|
221
|
+
limit: params.limit,
|
|
222
|
+
kind: params.kind,
|
|
223
|
+
parent_id: params.parentId ?? undefined,
|
|
224
|
+
});
|
|
180
225
|
}
|
|
181
226
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
227
|
+
async createLyroQaDataSource(params: CreateLyroQaDataSourceParams): Promise<UuidResponse> {
|
|
228
|
+
return this.client.post<UuidResponse>(
|
|
229
|
+
'/lyro/data-sources/qa',
|
|
230
|
+
compactRecord({
|
|
231
|
+
question: params.question,
|
|
232
|
+
answer: params.answer,
|
|
233
|
+
parent_id: params.parentId,
|
|
234
|
+
}),
|
|
235
|
+
);
|
|
185
236
|
}
|
|
186
237
|
|
|
187
|
-
async
|
|
188
|
-
return this.client.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
238
|
+
async updateLyroQaDataSource(dataSourceId: string, params: CreateLyroQaDataSourceParams): Promise<unknown> {
|
|
239
|
+
return this.client.put(`/lyro/data-sources/qa/${encodeURIComponent(dataSourceId)}`, {
|
|
240
|
+
question: params.question,
|
|
241
|
+
answer: params.answer,
|
|
242
|
+
parent_id: params.parentId,
|
|
192
243
|
});
|
|
193
244
|
}
|
|
194
245
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
246
|
+
async upsertLyroWebsiteDataSource(params: UpsertLyroWebsiteDataSourceParams): Promise<unknown> {
|
|
247
|
+
return this.client.put(
|
|
248
|
+
'/lyro/data-sources/website',
|
|
249
|
+
compactRecord({
|
|
250
|
+
url: params.url,
|
|
251
|
+
title: params.title,
|
|
252
|
+
content: params.content,
|
|
253
|
+
}),
|
|
254
|
+
);
|
|
198
255
|
}
|
|
199
256
|
|
|
200
|
-
async
|
|
201
|
-
return this.client.post<
|
|
257
|
+
async scrapeLyroWebsiteDataSource(params: ScrapeLyroWebsiteParams): Promise<UuidResponse> {
|
|
258
|
+
return this.client.post<UuidResponse>('/lyro/data-sources/website/scrape', {
|
|
202
259
|
url: params.url,
|
|
203
|
-
events: params.events,
|
|
204
|
-
secret: params.secret,
|
|
205
260
|
});
|
|
206
261
|
}
|
|
207
262
|
|
|
208
|
-
async
|
|
209
|
-
return this.client.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
263
|
+
async askLyroToAnswerTicket(params: AskLyroTicketParams): Promise<unknown> {
|
|
264
|
+
return this.client.post('/lyro/tickets', {
|
|
265
|
+
ticket_id: params.ticketId,
|
|
266
|
+
subject: params.subject,
|
|
267
|
+
contact_email: params.contactEmail,
|
|
268
|
+
contact_name: params.contactName,
|
|
269
|
+
recipient_email: params.recipientEmail,
|
|
270
|
+
messages: params.messages,
|
|
271
|
+
});
|
|
215
272
|
}
|
|
216
273
|
}
|
|
217
274
|
|