@hasna/connectors 1.3.45 → 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.
Files changed (114) hide show
  1. package/README.md +25 -0
  2. package/bin/index.js +792 -130
  3. package/bin/mcp.js +438 -52
  4. package/bin/serve.js +438 -52
  5. package/connectors/cloudflare-workers/.env.example +5 -0
  6. package/connectors/cloudflare-workers/AGENTS.md +11 -0
  7. package/connectors/cloudflare-workers/CLAUDE.md +11 -0
  8. package/connectors/cloudflare-workers/README.md +45 -0
  9. package/connectors/cloudflare-workers/package.json +47 -0
  10. package/connectors/cloudflare-workers/src/api/client.test.ts +144 -0
  11. package/connectors/cloudflare-workers/src/api/client.ts +386 -0
  12. package/connectors/cloudflare-workers/src/api/index.ts +1 -0
  13. package/connectors/cloudflare-workers/src/cli/index.ts +206 -0
  14. package/connectors/cloudflare-workers/src/index.ts +16 -0
  15. package/connectors/cloudflare-workers/src/types/index.ts +53 -0
  16. package/connectors/cloudflare-workers/src/utils/config.ts +61 -0
  17. package/connectors/cloudflare-workers/src/utils/output.ts +26 -0
  18. package/connectors/cloudflare-workers/tsconfig.build.json +4 -0
  19. package/connectors/cloudflare-workers/tsconfig.json +14 -0
  20. package/connectors/tidio/.env.example +3 -2
  21. package/connectors/tidio/CLAUDE.md +21 -96
  22. package/connectors/tidio/README.md +22 -18
  23. package/connectors/tidio/package.json +4 -2
  24. package/connectors/tidio/src/api/client.ts +26 -15
  25. package/connectors/tidio/src/api/index.ts +185 -128
  26. package/connectors/tidio/src/api/tidio.test.ts +175 -44
  27. package/connectors/tidio/src/cli/index.ts +154 -388
  28. package/connectors/tidio/src/index.ts +5 -3
  29. package/connectors/tidio/src/types/index.ts +135 -82
  30. package/connectors/tidio/src/utils/config.ts +90 -44
  31. package/connectors/wandb/.env.example +7 -0
  32. package/connectors/wandb/AGENTS.md +43 -0
  33. package/connectors/wandb/CLAUDE.md +67 -0
  34. package/connectors/wandb/README.md +65 -0
  35. package/connectors/wandb/package.json +52 -0
  36. package/connectors/wandb/src/api/client.test.ts +116 -0
  37. package/connectors/wandb/src/api/client.ts +83 -0
  38. package/connectors/wandb/src/api/graphql.ts +9 -0
  39. package/connectors/wandb/src/api/index.ts +36 -0
  40. package/connectors/wandb/src/api/projects.ts +36 -0
  41. package/connectors/wandb/src/api/viewer.ts +20 -0
  42. package/connectors/wandb/src/cli/index.ts +265 -0
  43. package/connectors/wandb/src/index.ts +22 -0
  44. package/connectors/wandb/src/types/index.ts +75 -0
  45. package/connectors/wandb/src/utils/config.ts +164 -0
  46. package/connectors/wandb/src/utils/output.ts +119 -0
  47. package/connectors/wandb/tsconfig.json +16 -0
  48. package/connectors/weights-biases/.env.example +7 -0
  49. package/connectors/weights-biases/CLAUDE.md +65 -0
  50. package/connectors/weights-biases/README.md +62 -0
  51. package/connectors/weights-biases/package.json +53 -0
  52. package/connectors/weights-biases/src/api/client.test.ts +46 -0
  53. package/connectors/weights-biases/src/api/client.ts +119 -0
  54. package/connectors/weights-biases/src/api/events.ts +18 -0
  55. package/connectors/weights-biases/src/api/index.ts +56 -0
  56. package/connectors/weights-biases/src/api/runs.ts +28 -0
  57. package/connectors/weights-biases/src/api/search.ts +10 -0
  58. package/connectors/weights-biases/src/cli/index.ts +289 -0
  59. package/connectors/weights-biases/src/index.ts +19 -0
  60. package/connectors/weights-biases/src/types/index.ts +92 -0
  61. package/connectors/weights-biases/src/utils/config.ts +168 -0
  62. package/connectors/weights-biases/src/utils/output.ts +116 -0
  63. package/connectors/weights-biases/tsconfig.json +16 -0
  64. package/connectors/zoominfo/.env.example +4 -0
  65. package/connectors/zoominfo/AGENTS.md +26 -0
  66. package/connectors/zoominfo/CLAUDE.md +20 -0
  67. package/connectors/zoominfo/README.md +69 -0
  68. package/connectors/zoominfo/package.json +52 -0
  69. package/connectors/zoominfo/src/api/client.test.ts +140 -0
  70. package/connectors/zoominfo/src/api/client.ts +228 -0
  71. package/connectors/zoominfo/src/api/index.ts +1 -0
  72. package/connectors/zoominfo/src/cli/index.ts +179 -0
  73. package/connectors/zoominfo/src/index.ts +3 -0
  74. package/connectors/zoominfo/src/types/index.ts +39 -0
  75. package/connectors/zoominfo/src/utils/config.ts +61 -0
  76. package/connectors/zoominfo/src/utils/output.ts +27 -0
  77. package/connectors/zoominfo/tsconfig.json +20 -0
  78. package/connectors/zotero/.env.example +7 -0
  79. package/connectors/zotero/.npmrc.example +2 -0
  80. package/connectors/zotero/AGENTS.md +40 -0
  81. package/connectors/zotero/CLAUDE.md +69 -0
  82. package/connectors/zotero/README.md +91 -0
  83. package/connectors/zotero/package.json +43 -0
  84. package/connectors/zotero/src/api/attachments.ts +130 -0
  85. package/connectors/zotero/src/api/client.test.ts +166 -0
  86. package/connectors/zotero/src/api/client.ts +169 -0
  87. package/connectors/zotero/src/api/collections.ts +26 -0
  88. package/connectors/zotero/src/api/index.ts +45 -0
  89. package/connectors/zotero/src/api/items.ts +64 -0
  90. package/connectors/zotero/src/cli/index.ts +386 -0
  91. package/connectors/zotero/src/index.ts +28 -0
  92. package/connectors/zotero/src/types/index.ts +129 -0
  93. package/connectors/zotero/src/utils/config.ts +245 -0
  94. package/connectors/zotero/src/utils/output.ts +119 -0
  95. package/connectors/zotero/tsconfig.json +16 -0
  96. package/connectors/zymbly/.env.example +2 -0
  97. package/connectors/zymbly/AGENTS.md +11 -0
  98. package/connectors/zymbly/CLAUDE.md +5 -0
  99. package/connectors/zymbly/README.md +35 -0
  100. package/connectors/zymbly/package.json +52 -0
  101. package/connectors/zymbly/src/api/client.test.ts +110 -0
  102. package/connectors/zymbly/src/api/client.ts +166 -0
  103. package/connectors/zymbly/src/api/index.ts +1 -0
  104. package/connectors/zymbly/src/cli/index.ts +156 -0
  105. package/connectors/zymbly/src/index.ts +12 -0
  106. package/connectors/zymbly/src/types/index.ts +34 -0
  107. package/connectors/zymbly/src/utils/config.ts +52 -0
  108. package/connectors/zymbly/src/utils/output.ts +17 -0
  109. package/connectors/zymbly/tsconfig.json +13 -0
  110. package/dist/index.js +45 -2
  111. package/dist/lib/compact-output.d.ts +40 -0
  112. package/dist/mcp/tools/jobs.d.ts +32 -0
  113. package/dist/mcp/tools/jobs.test.d.ts +1 -0
  114. 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.co/v1';
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 apiKey: string;
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.apiKey) {
20
- throw new Error('API key is required');
21
+ if (!config.clientId) {
22
+ throw new Error('Client ID is required');
21
23
  }
22
- this.apiKey = config.apiKey;
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(`${this.baseUrl}${path}`);
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
- 'X-Tidio-Openapi-Key': this.apiKey,
58
- 'Accept': 'application/json',
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 {} as T;
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
- getApiKeyPreview(): string {
134
- if (this.apiKey.length > 10) {
135
- return `${this.apiKey.substring(0, 6)}...${this.apiKey.substring(this.apiKey.length - 4)}`;
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
- TidioConfig,
2
+ BatchContactsParams,
3
+ AskLyroTicketParams,
3
4
  Contact,
4
- Conversation,
5
- Message,
6
- Operator,
5
+ ContactMessage,
6
+ ContactProperty,
7
+ CreateContactParams,
8
+ CreateLyroQaDataSourceParams,
9
+ CreateTicketAsContactParams,
7
10
  Department,
8
- Tag,
9
- Automation,
10
- CannedResponse,
11
- Webhook,
12
- Project,
11
+ ListContactMessagesParams,
13
12
  ListContactsParams,
14
- CreateContactParams,
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
- ListConversationsParams,
17
- ListMessagesParams,
18
- SendMessageParams,
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 apiKey = process.env.TIDIO_API_KEY;
36
- if (!apiKey) {
37
- throw new Error('TIDIO_API_KEY environment variable is required');
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({ apiKey });
64
+ return new Tidio({ clientId, clientSecret });
40
65
  }
41
66
 
42
- getApiKeyPreview(): string {
43
- return this.client.getApiKeyPreview();
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
- // Contacts
51
- async listContacts(params: ListContactsParams = {}): Promise<unknown> {
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(id: string): Promise<Contact> {
61
- return this.client.get<Contact>(`/contacts/${encodeURIComponent(id)}`);
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<Contact> {
65
- if (!params.email && !params.phone && !params.externalId) {
66
- throw new Error('createContact requires email, phone, or externalId');
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<Contact>('/contacts', {
69
- email: params.email,
70
- phone: params.phone,
71
- name: params.name,
72
- external_id: params.externalId,
73
- tags: params.tags,
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(id: string, params: UpdateContactParams): Promise<Contact> {
81
- const body = {
82
- email: params.email,
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
- return this.client.patch<Contact>(`/contacts/${encodeURIComponent(id)}`, body);
106
+ await this.client.patch(`/contacts/${encodeURIComponent(contactId)}`, body);
95
107
  }
96
108
 
97
- async deleteContact(id: string): Promise<unknown> {
98
- return this.client.delete(`/contacts/${encodeURIComponent(id)}`);
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
- // Conversations
102
- async listConversations(params: ListConversationsParams = {}): Promise<unknown> {
103
- return this.client.get('/conversations', {
104
- limit: params.limit,
105
- cursor: params.cursor,
106
- status: params.status,
107
- channel: params.channel,
108
- updated_after: params.updatedAfter,
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 getConversation(id: string): Promise<Conversation> {
113
- return this.client.get<Conversation>(`/conversations/${encodeURIComponent(id)}`);
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 listConversationMessages(id: string, params: ListMessagesParams = {}): Promise<unknown> {
117
- return this.client.get(`/conversations/${encodeURIComponent(id)}/messages`, {
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 sendConversationMessage(id: string, params: SendMessageParams): Promise<Message> {
124
- return this.client.post<Message>(`/conversations/${encodeURIComponent(id)}/messages`, {
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 setConversationStatus(id: string, params: SetConversationStatusParams): Promise<Conversation> {
134
- return this.client.patch<Conversation>(`/conversations/${encodeURIComponent(id)}/status`, {
135
- status: params.status,
136
- snoozed_until: params.snoozedUntil,
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 assignConversation(id: string, params: AssignConversationParams): Promise<Conversation> {
141
- return this.client.patch<Conversation>(`/conversations/${encodeURIComponent(id)}/assignment`, {
142
- operator_id: params.operatorId,
143
- department_id: params.departmentId,
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
- // Operators
148
- async listOperators(): Promise<unknown> {
149
- return this.client.get('/operators');
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 getOperator(id: string): Promise<Operator> {
153
- return this.client.get<Operator>(`/operators/${encodeURIComponent(id)}`);
198
+ async deleteTicket(ticketId: string): Promise<void> {
199
+ await this.client.delete(`/tickets/${encodeURIComponent(ticketId)}`);
154
200
  }
155
201
 
156
- // Departments
157
- async listDepartments(): Promise<unknown> {
158
- return this.client.get('/departments');
202
+ async getTicketTags(): Promise<TicketTag[]> {
203
+ return this.client.get<TicketTag[]>('/tickets/tags');
159
204
  }
160
205
 
161
- // Tags
162
- async listTags(): Promise<unknown> {
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 createTag(params: CreateTagParams): Promise<Tag> {
167
- return this.client.post<Tag>('/tags', {
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 deleteTag(id: string): Promise<unknown> {
174
- return this.client.delete(`/tags/${encodeURIComponent(id)}`);
214
+ async deleteProduct(productId: string): Promise<void> {
215
+ await this.client.delete(`/products/${encodeURIComponent(productId)}`);
175
216
  }
176
217
 
177
- // Automations
178
- async listAutomations(): Promise<unknown> {
179
- return this.client.get('/automations');
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
- // Canned responses
183
- async listCannedResponses(): Promise<unknown> {
184
- return this.client.get('/canned-responses');
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 createCannedResponse(params: CreateCannedResponseParams): Promise<CannedResponse> {
188
- return this.client.post<CannedResponse>('/canned-responses', {
189
- shortcut: params.shortcut,
190
- content: params.content,
191
- department_id: params.departmentId,
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
- // Webhooks
196
- async listWebhooks(): Promise<unknown> {
197
- return this.client.get('/webhooks');
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 createWebhook(params: CreateWebhookParams): Promise<Webhook> {
201
- return this.client.post<Webhook>('/webhooks', {
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 deleteWebhook(id: string): Promise<unknown> {
209
- return this.client.delete(`/webhooks/${encodeURIComponent(id)}`);
210
- }
211
-
212
- // Project
213
- async getProject(): Promise<Project> {
214
- return this.client.get<Project>('/project');
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