@scryme/chat 2.91.29 → 2.91.61

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/src/sdk.ts CHANGED
@@ -560,7 +560,7 @@ export interface AssignSupportTicketDto {
560
560
  /**
561
561
  * Options for starting a new live chat session.
562
562
  */
563
- export interface StartLiveChatDto {
563
+ export interface SupportStartLiveChatDto {
564
564
  /** Unique workspace identifier where live chat is initialized. */
565
565
  workspaceId: string;
566
566
  /** Optional metadata associated with the live chat session. */
@@ -570,7 +570,7 @@ export interface StartLiveChatDto {
570
570
  /**
571
571
  * Options for creating or updating a customer profile.
572
572
  */
573
- export interface CreateCustomerProfileDto {
573
+ export interface SupportCreateCustomerProfileDto {
574
574
  /** Associated workspace identifier. */
575
575
  workspaceId: string;
576
576
  /** User ID of the customer. */
@@ -1135,98 +1135,143 @@ export class ScrymeSDK {
1135
1135
  */
1136
1136
  message: {
1137
1137
  /**
1138
- * Lists messages in a channel with cursor pagination support.
1138
+ * Lists messages in a channel with cursor pagination support via V3 API.
1139
+ * @param slug The unique workspace slug.
1139
1140
  * @param channelId Unique identifier of the channel.
1140
1141
  * @param params Query parameters for limiting, sorting, or pagination cursors.
1141
1142
  * @param options Optional request config override.
1142
- * @returns Object containing the messages array and next pagination cursor exactly from the endpoint.
1143
1143
  */
1144
1144
  list: async (
1145
+ slug: string,
1145
1146
  channelId: string,
1146
- params?: ChannelsControllerGetMessagesParams,
1147
+ params?: { cursor?: string; limit?: string },
1147
1148
  options?: AxiosRequestConfig
1148
1149
  ): Promise<{ messages: ChannelMessage[]; nextCursor?: string }> => {
1149
- return this.raw.channelsControllerGetMessages(channelId, params, options) as unknown as { messages: ChannelMessage[]; nextCursor?: string };
1150
+ const queryParams: any = {};
1151
+ if (params?.cursor) queryParams.cursor = params.cursor;
1152
+ if (params?.limit) queryParams.limit = params.limit;
1153
+
1154
+ const res = (await this.raw.v3WorkspacesControllerGetChannelMessages(
1155
+ slug,
1156
+ channelId,
1157
+ queryParams,
1158
+ options
1159
+ )) as unknown as { success: boolean; data: { messages: ChannelMessage[]; nextCursor?: string } };
1160
+ return res?.data ?? (res as unknown as { messages: ChannelMessage[]; nextCursor?: string });
1150
1161
  },
1151
1162
  /**
1152
- * Sends a new message to a channel.
1163
+ * Sends a new message to a channel via V3 API.
1164
+ * @param slug The unique workspace slug.
1153
1165
  * @param channelId Unique identifier of the target channel.
1154
- * @param data The message content string or structured CreateMessageDto object.
1166
+ * @param data The message content string or structured payload object.
1155
1167
  * @param options Optional request config override.
1156
- * @returns The created message exactly from the endpoint.
1157
1168
  */
1158
1169
  create: async (
1170
+ slug: string,
1159
1171
  channelId: string,
1160
1172
  data: CreateMessageDto | string,
1161
1173
  options?: AxiosRequestConfig
1162
1174
  ): Promise<ChannelMessage> => {
1163
1175
  const payload = typeof data === 'string' ? { content: data } : data;
1164
- return this.raw.channelsControllerCreateMessage(channelId, {
1165
- ...options,
1166
- data: payload,
1167
- }) as unknown as ChannelMessage;
1176
+ const mergedConfig = { ...options, data: payload };
1177
+ const res = (await this.raw.v3WorkspacesControllerCreateChannelMessage(slug, channelId, mergedConfig)) as unknown as {
1178
+ success: boolean;
1179
+ data: { message: ChannelMessage };
1180
+ };
1181
+ return res?.data?.message ?? (res as unknown as ChannelMessage);
1168
1182
  },
1169
1183
  /**
1170
- * Updates the content of a previously sent message in a channel.
1184
+ * Updates the content of a previously sent message in a channel via V3 API.
1185
+ * @param slug The unique workspace slug.
1171
1186
  * @param channelId Unique identifier of the channel containing the message.
1172
1187
  * @param messageId Unique identifier of the message to update.
1173
1188
  * @param data The new content payload.
1174
1189
  * @param options Optional request config override.
1175
- * @returns The updated message details exactly from the endpoint.
1176
1190
  */
1177
1191
  update: async (
1192
+ slug: string,
1178
1193
  channelId: string,
1179
1194
  messageId: string,
1180
1195
  data: ChannelsControllerUpdateMessageBody,
1181
1196
  options?: AxiosRequestConfig
1182
1197
  ): Promise<ChannelMessage> => {
1183
- return this.raw.channelsControllerUpdateMessage(channelId, messageId, data, options) as unknown as ChannelMessage;
1198
+ const mergedConfig = { ...options, data };
1199
+ const res = (await this.raw.v3WorkspacesControllerUpdateChannelMessage(
1200
+ slug,
1201
+ channelId,
1202
+ messageId,
1203
+ mergedConfig
1204
+ )) as unknown as { success: boolean; data: { message: ChannelMessage } };
1205
+ return res?.data?.message ?? (res as unknown as ChannelMessage);
1184
1206
  },
1185
1207
  /**
1186
- * Permanently deletes a message in a channel.
1208
+ * Permanently deletes a message in a channel via V3 API.
1209
+ * @param slug The unique workspace slug.
1187
1210
  * @param channelId Unique identifier of the channel containing the message.
1188
1211
  * @param messageId Unique identifier of the message to delete.
1189
1212
  * @param options Optional request config override.
1190
- * @returns Success status indicating that the message was deleted exactly from the endpoint.
1191
1213
  */
1192
1214
  delete: async (
1215
+ slug: string,
1193
1216
  channelId: string,
1194
1217
  messageId: string,
1195
1218
  options?: AxiosRequestConfig
1196
1219
  ): Promise<{ success: boolean }> => {
1197
- return this.raw.channelsControllerDeleteMessage(channelId, messageId, options) as unknown as { success: boolean };
1220
+ const res = (await this.raw.v3WorkspacesControllerDeleteChannelMessage(
1221
+ slug,
1222
+ channelId,
1223
+ messageId,
1224
+ options
1225
+ )) as unknown as { success: boolean; data?: { success: boolean } };
1226
+ return res?.data ?? res;
1198
1227
  },
1199
1228
  /**
1200
- * Adds a reaction (emoji) to a message in a channel.
1229
+ * Adds a reaction (emoji) to a message in a channel via V3 API.
1230
+ * @param slug The unique workspace slug.
1201
1231
  * @param channelId Unique identifier of the channel containing the message.
1202
1232
  * @param messageId Unique identifier of the message.
1203
1233
  * @param data Object containing the target emoji character.
1204
1234
  * @param options Optional request config override.
1205
- * @returns The reaction response returned exactly from the endpoint.
1206
1235
  */
1207
1236
  addReaction: async (
1237
+ slug: string,
1208
1238
  channelId: string,
1209
1239
  messageId: string,
1210
1240
  data: ChannelsControllerAddReactionBody,
1211
1241
  options?: AxiosRequestConfig
1212
- ): Promise<ChannelsControllerAddReactionResult> => {
1213
- return this.raw.channelsControllerAddReaction(channelId, messageId, data, options) as unknown as ChannelsControllerAddReactionResult;
1242
+ ): Promise<any> => {
1243
+ const mergedConfig = { ...options, data };
1244
+ const res = (await this.raw.v3WorkspacesControllerAddChannelMessageReaction(
1245
+ slug,
1246
+ channelId,
1247
+ messageId,
1248
+ mergedConfig
1249
+ )) as unknown as { success: boolean; data: { reaction: any } };
1250
+ return res?.data?.reaction ?? res;
1214
1251
  },
1215
1252
  /**
1216
- * Removes a reaction (emoji) from a message in a channel.
1253
+ * Removes a reaction (emoji) from a message in a channel via V3 API.
1254
+ * @param slug The unique workspace slug.
1217
1255
  * @param channelId Unique identifier of the channel containing the message.
1218
1256
  * @param messageId Unique identifier of the message.
1219
1257
  * @param emoji The emoji character to remove.
1220
1258
  * @param options Optional request config override.
1221
- * @returns The reaction removal response returned exactly from the endpoint.
1222
1259
  */
1223
1260
  removeReaction: async (
1261
+ slug: string,
1224
1262
  channelId: string,
1225
1263
  messageId: string,
1226
1264
  emoji: string,
1227
1265
  options?: AxiosRequestConfig
1228
- ): Promise<ChannelsControllerRemoveReactionResult> => {
1229
- return this.raw.channelsControllerRemoveReaction(channelId, messageId, emoji, options) as unknown as ChannelsControllerRemoveReactionResult;
1266
+ ): Promise<{ success: boolean }> => {
1267
+ const res = (await this.raw.v3WorkspacesControllerRemoveChannelMessageReaction(
1268
+ slug,
1269
+ channelId,
1270
+ messageId,
1271
+ emoji,
1272
+ options
1273
+ )) as unknown as { success: boolean; data?: { success: boolean } };
1274
+ return res?.data ?? res;
1230
1275
  },
1231
1276
  },
1232
1277
  };
@@ -1316,69 +1361,83 @@ export class ScrymeSDK {
1316
1361
  }
1317
1362
 
1318
1363
  /**
1319
- * Operations for managing direct messages (DMs) and direct message conversations.
1364
+ * Operations for managing direct messages (DMs) and direct message conversations via V3 API.
1320
1365
  */
1321
1366
  public get dm() {
1322
1367
  return {
1323
1368
  /**
1324
- * Lists all active direct message conversations for the authenticated user.
1369
+ * Lists all active direct message conversations for the authenticated user/bot via V3 API.
1325
1370
  * @param options Optional request config override.
1326
- * @returns List of active DM conversations returned exactly from the endpoint.
1327
1371
  */
1328
1372
  list: async (options?: AxiosRequestConfig): Promise<DmConversation[]> => {
1329
- return this.raw.dmsControllerGetDms(options) as unknown as DmConversation[];
1373
+ const res = (await this.raw.v3DmsControllerGetDms(options)) as unknown as {
1374
+ success: boolean;
1375
+ data: { conversations: DmConversation[] };
1376
+ };
1377
+ return res?.data?.conversations ?? (res as unknown as DmConversation[]);
1330
1378
  },
1331
1379
  /**
1332
- * Creates/initiates a direct message conversation with specified users.
1380
+ * Creates/initiates a direct message conversation via V3 API.
1333
1381
  * @param data Create direct message details containing target participant IDs.
1334
1382
  * @param options Optional request config override.
1335
- * @returns Details of the created DM conversation exactly from the endpoint.
1336
1383
  */
1337
- create: async (data: CreateDmDto, options?: AxiosRequestConfig): Promise<DmConversation> => {
1338
- return this.raw.dmsControllerCreateDm(data, options) as unknown as DmConversation;
1384
+ create: async (data: CreateDmDto | { targetUserId?: string; userId?: string }, options?: AxiosRequestConfig): Promise<DmConversation> => {
1385
+ const res = (await this.raw.v3DmsControllerCreateDm(data as any, options)) as unknown as {
1386
+ success: boolean;
1387
+ data: { conversation: DmConversation };
1388
+ };
1389
+ return res?.data?.conversation ?? (res as unknown as DmConversation);
1339
1390
  },
1340
1391
  /**
1341
- * Retrieves details of a specific direct message conversation.
1392
+ * Retrieves details of a specific direct message conversation via V3 API.
1342
1393
  * @param dmId Unique identifier of the direct message conversation.
1343
1394
  * @param options Optional request config override.
1344
- * @returns Detailed direct message conversation object exactly from the endpoint.
1345
1395
  */
1346
1396
  get: async (dmId: string, options?: AxiosRequestConfig): Promise<DmConversation> => {
1347
- return this.raw.dmsControllerGetDm(dmId, options) as unknown as DmConversation;
1397
+ const res = (await this.raw.v3DmsControllerGetDm(dmId, options)) as unknown as {
1398
+ success: boolean;
1399
+ data: { conversation: DmConversation };
1400
+ };
1401
+ return res?.data?.conversation ?? (res as unknown as DmConversation);
1348
1402
  },
1349
1403
  /**
1350
- * Deletes/closes an active direct message conversation.
1404
+ * Deletes/closes an active direct message conversation via V3 API.
1351
1405
  * @param dmId Unique identifier of the direct message conversation to close.
1352
1406
  * @param options Optional request config override.
1353
- * @returns Success status indicating that the DM conversation was deleted exactly from the endpoint.
1354
1407
  */
1355
1408
  delete: async (dmId: string, options?: AxiosRequestConfig): Promise<{ success: boolean }> => {
1356
- return this.raw.dmsControllerDeleteDm(dmId, options) as unknown as { success: boolean };
1409
+ const res = (await this.raw.v3DmsControllerDeleteDm(dmId, options)) as unknown as {
1410
+ success: boolean;
1411
+ data?: { success: boolean };
1412
+ };
1413
+ return res?.data ?? res;
1357
1414
  },
1358
1415
  /**
1359
- * Sub-namespace for managing direct messages in a specific DM conversation.
1416
+ * Sub-namespace for managing direct messages in a specific DM conversation via V3 API.
1360
1417
  */
1361
1418
  message: {
1362
1419
  /**
1363
- * Lists messages in a direct message conversation with cursor pagination.
1420
+ * Lists messages in a direct message conversation with cursor pagination via V3 API.
1364
1421
  * @param dmId Unique identifier of the direct message conversation.
1365
1422
  * @param params Query parameters for pagination limits, cursors or search filters.
1366
1423
  * @param options Optional request config override.
1367
- * @returns List of direct messages and next pagination cursor exactly from the endpoint.
1368
1424
  */
1369
1425
  list: async (
1370
1426
  dmId: string,
1371
1427
  params?: DmsControllerGetMessagesParams,
1372
1428
  options?: AxiosRequestConfig
1373
1429
  ): Promise<{ messages: ChannelMessage[]; nextCursor?: string }> => {
1374
- return this.raw.dmsControllerGetMessages(dmId, params, options) as unknown as { messages: ChannelMessage[]; nextCursor?: string };
1430
+ const res = (await this.raw.v3DmsControllerGetMessages(dmId, params, options)) as unknown as {
1431
+ success: boolean;
1432
+ data: { messages: ChannelMessage[]; nextCursor?: string };
1433
+ };
1434
+ return res?.data ?? (res as unknown as { messages: ChannelMessage[]; nextCursor?: string });
1375
1435
  },
1376
1436
  /**
1377
- * Sends a new message in a direct message conversation.
1437
+ * Sends a new message in a direct message conversation via V3 API.
1378
1438
  * @param dmId Unique identifier of the direct message conversation.
1379
1439
  * @param data The message content string or structured CreateMessageDto object.
1380
1440
  * @param options Optional request config override.
1381
- * @returns The sent message exactly from the endpoint.
1382
1441
  */
1383
1442
  create: async (
1384
1443
  dmId: string,
@@ -1386,18 +1445,19 @@ export class ScrymeSDK {
1386
1445
  options?: AxiosRequestConfig
1387
1446
  ): Promise<ChannelMessage> => {
1388
1447
  const payload = typeof data === 'string' ? { content: data } : data;
1389
- return this.raw.dmsControllerCreateMessage(dmId, {
1390
- ...options,
1391
- data: payload,
1392
- }) as unknown as ChannelMessage;
1448
+ const mergedConfig = { ...options, data: payload };
1449
+ const res = (await this.raw.v3DmsControllerCreateMessage(dmId, mergedConfig)) as unknown as {
1450
+ success: boolean;
1451
+ data: { message: ChannelMessage };
1452
+ };
1453
+ return res?.data?.message ?? (res as unknown as ChannelMessage);
1393
1454
  },
1394
1455
  /**
1395
- * Updates the content of a previously sent direct message.
1456
+ * Updates the content of a previously sent direct message via V3 API.
1396
1457
  * @param dmId Unique identifier of the direct message conversation.
1397
1458
  * @param messageId Unique identifier of the message to update.
1398
1459
  * @param data The new content payload.
1399
1460
  * @param options Optional request config override.
1400
- * @returns The updated message details exactly from the endpoint.
1401
1461
  */
1402
1462
  update: async (
1403
1463
  dmId: string,
@@ -1405,53 +1465,68 @@ export class ScrymeSDK {
1405
1465
  data: UpdateDmMessageDto,
1406
1466
  options?: AxiosRequestConfig
1407
1467
  ): Promise<ChannelMessage> => {
1408
- return this.raw.dmsControllerUpdateMessage(dmId, messageId, data, options) as unknown as ChannelMessage;
1468
+ const mergedConfig = { ...options, data };
1469
+ const res = (await this.raw.v3DmsControllerUpdateMessage(dmId, messageId, mergedConfig)) as unknown as {
1470
+ success: boolean;
1471
+ data: { message: ChannelMessage };
1472
+ };
1473
+ return res?.data?.message ?? (res as unknown as ChannelMessage);
1409
1474
  },
1410
1475
  /**
1411
- * Permanently deletes a direct message.
1476
+ * Permanently deletes a direct message via V3 API.
1412
1477
  * @param dmId Unique identifier of the direct message conversation.
1413
1478
  * @param messageId Unique identifier of the message to delete.
1414
1479
  * @param options Optional request config override.
1415
- * @returns Success status indicating that the message was deleted exactly from the endpoint.
1416
1480
  */
1417
1481
  delete: async (
1418
1482
  dmId: string,
1419
1483
  messageId: string,
1420
1484
  options?: AxiosRequestConfig
1421
1485
  ): Promise<{ success: boolean }> => {
1422
- return this.raw.dmsControllerDeleteMessage(dmId, messageId, options) as unknown as { success: boolean };
1486
+ const res = (await this.raw.v3DmsControllerDeleteMessage(dmId, messageId, options)) as unknown as {
1487
+ success: boolean;
1488
+ data?: { success: boolean };
1489
+ };
1490
+ return res?.data ?? res;
1423
1491
  },
1424
1492
  /**
1425
- * Adds a reaction (emoji) to a direct message.
1493
+ * Adds a reaction (emoji) to a direct message via V3 API.
1426
1494
  * @param dmId Unique identifier of the direct message conversation.
1427
1495
  * @param messageId Unique identifier of the message.
1428
1496
  * @param data Object containing the target emoji character.
1429
1497
  * @param options Optional request config override.
1430
- * @returns The reaction response returned exactly from the endpoint.
1431
1498
  */
1432
1499
  addReaction: async (
1433
1500
  dmId: string,
1434
1501
  messageId: string,
1435
1502
  data: DmsControllerAddReactionBody,
1436
1503
  options?: AxiosRequestConfig
1437
- ): Promise<DmsControllerAddReactionResult> => {
1438
- return this.raw.dmsControllerAddReaction(dmId, messageId, data, options) as unknown as DmsControllerAddReactionResult;
1504
+ ): Promise<any> => {
1505
+ const mergedConfig = { ...options, data };
1506
+ const res = (await this.raw.v3DmsControllerAddReaction(dmId, messageId, mergedConfig)) as unknown as {
1507
+ success: boolean;
1508
+ data: { reaction: any };
1509
+ };
1510
+ return res?.data?.reaction ?? res;
1439
1511
  },
1440
1512
  /**
1441
- * Removes a reaction (emoji) from a direct message.
1513
+ * Removes a reaction (emoji) from a direct message via V3 API.
1442
1514
  * @param dmId Unique identifier of the direct message conversation.
1443
1515
  * @param messageId Unique identifier of the message.
1444
1516
  * @param emoji The emoji character to remove.
1445
1517
  * @param options Optional request config override.
1446
- * @returns The reaction removal response returned exactly from the endpoint.
1447
1518
  */
1448
1519
  removeReaction: async (
1449
1520
  dmId: string,
1450
1521
  messageId: string,
1451
1522
  emoji: string,
1452
1523
  options?: AxiosRequestConfig
1453
- ): Promise<DmsControllerRemoveReactionResult> => {
1454
- return this.raw.dmsControllerRemoveReaction(dmId, messageId, emoji, options) as unknown as DmsControllerRemoveReactionResult;
1524
+ ): Promise<{ success: boolean }> => {
1525
+ const res = (await this.raw.v3DmsControllerRemoveReaction(dmId, messageId, emoji, options)) as unknown as {
1526
+ success: boolean;
1527
+ data?: { success: boolean };
1528
+ };
1529
+ return res?.data ?? res;
1455
1530
  },
1456
1531
  },
1457
1532
  };
@@ -1797,7 +1872,7 @@ export class ScrymeSDK {
1797
1872
  * @param options Optional request config override.
1798
1873
  */
1799
1874
  start: async (
1800
- data: StartLiveChatDto,
1875
+ data: SupportStartLiveChatDto,
1801
1876
  options?: AxiosRequestConfig
1802
1877
  ): Promise<LiveChatSession> => {
1803
1878
  return this.raw.supportControllerStartLiveChat({
@@ -1828,7 +1903,7 @@ export class ScrymeSDK {
1828
1903
  * @param options Optional request config override.
1829
1904
  */
1830
1905
  createProfile: async (
1831
- data: CreateCustomerProfileDto,
1906
+ data: SupportCreateCustomerProfileDto,
1832
1907
  options?: AxiosRequestConfig
1833
1908
  ): Promise<CustomerProfile> => {
1834
1909
  return this.raw.supportControllerCreateCustomerProfile({