@cstar.help/js 0.5.0 → 0.5.1
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/chat/index.cjs +79 -0
- package/dist/chat/index.d.cts +77 -0
- package/dist/chat/index.d.ts +77 -0
- package/dist/chat/index.js +79 -0
- package/dist/community/index.cjs +149 -0
- package/dist/community/index.js +149 -0
- package/dist/index.cjs +217 -27
- package/dist/index.d.cts +360 -72
- package/dist/index.d.ts +360 -72
- package/dist/index.js +217 -27
- package/package.json +1 -1
- package/dist/community/index.d.cts +0 -115
- package/dist/community/index.d.ts +0 -115
package/dist/index.d.cts
CHANGED
|
@@ -419,6 +419,38 @@ interface WebhookTestResult {
|
|
|
419
419
|
responseTimeMs: number;
|
|
420
420
|
error: string | null;
|
|
421
421
|
}
|
|
422
|
+
/** Parameters for subscribing (REST Hooks / Zapier protocol). */
|
|
423
|
+
interface WebhookSubscribeParams {
|
|
424
|
+
targetUrl: string;
|
|
425
|
+
event: string;
|
|
426
|
+
}
|
|
427
|
+
/** A REST Hooks subscription. */
|
|
428
|
+
interface WebhookSubscription {
|
|
429
|
+
id: string;
|
|
430
|
+
object: 'webhook';
|
|
431
|
+
[key: string]: unknown;
|
|
432
|
+
}
|
|
433
|
+
/** Parameters for registering a CLI listener. */
|
|
434
|
+
interface WebhookListenerParams {
|
|
435
|
+
forwardUrl: string;
|
|
436
|
+
events?: string[];
|
|
437
|
+
}
|
|
438
|
+
/** A registered CLI listener. */
|
|
439
|
+
interface WebhookListener {
|
|
440
|
+
listenerId: string;
|
|
441
|
+
secret: string;
|
|
442
|
+
}
|
|
443
|
+
/** Parameters for triggering a test webhook event. */
|
|
444
|
+
interface WebhookTriggerTestParams {
|
|
445
|
+
event: string;
|
|
446
|
+
data?: Record<string, unknown>;
|
|
447
|
+
}
|
|
448
|
+
/** Result of triggering a test webhook event. */
|
|
449
|
+
interface WebhookTriggerTestResult {
|
|
450
|
+
event: string;
|
|
451
|
+
deliveredTo: number;
|
|
452
|
+
[key: string]: unknown;
|
|
453
|
+
}
|
|
422
454
|
|
|
423
455
|
/** Manage webhook endpoints. */
|
|
424
456
|
declare class WebhooksResource extends BaseResource<Webhook, WebhookListParams, WebhookCreateParams, WebhookUpdateParams> {
|
|
@@ -427,6 +459,21 @@ declare class WebhooksResource extends BaseResource<Webhook, WebhookListParams,
|
|
|
427
459
|
test(webhookId: string, params?: {
|
|
428
460
|
event?: WebhookEventType;
|
|
429
461
|
}): Promise<ApiResponse<WebhookTestResult>>;
|
|
462
|
+
/** Fire a test webhook event to all active webhooks and CLI listeners. */
|
|
463
|
+
triggerTest(params: WebhookTriggerTestParams, options?: RequestOptions): Promise<ApiResponse<WebhookTriggerTestResult>>;
|
|
464
|
+
/** Get a sample webhook payload for an event type (used by Zapier). */
|
|
465
|
+
sample(event: string): Promise<ApiResponse<unknown[]>>;
|
|
466
|
+
/** Subscribe to an event (REST Hooks / Zapier protocol). */
|
|
467
|
+
subscribe(params: WebhookSubscribeParams, options?: RequestOptions): Promise<ApiResponse<WebhookSubscription>>;
|
|
468
|
+
/** Unsubscribe from an event (REST Hooks / Zapier protocol). Returns void (204 No Content). */
|
|
469
|
+
unsubscribe(subscriptionId: string): Promise<void>;
|
|
470
|
+
/** Register a CLI listener (returns listenerId and signing secret). */
|
|
471
|
+
listen(params: WebhookListenerParams, options?: RequestOptions): Promise<ApiResponse<WebhookListener>>;
|
|
472
|
+
/** Deregister a CLI listener. */
|
|
473
|
+
unlisten(listenerId: string): Promise<ApiResponse<{
|
|
474
|
+
deleted: true;
|
|
475
|
+
listenerId: string;
|
|
476
|
+
}>>;
|
|
430
477
|
}
|
|
431
478
|
|
|
432
479
|
/** A condition in an automation rule. */
|
|
@@ -968,15 +1015,64 @@ interface UnreadCount {
|
|
|
968
1015
|
declare class NotificationsResource {
|
|
969
1016
|
private readonly client;
|
|
970
1017
|
constructor(client: HttpClient);
|
|
971
|
-
/** List notifications. */
|
|
972
|
-
list(params
|
|
973
|
-
|
|
974
|
-
|
|
1018
|
+
/** List notifications for a user. */
|
|
1019
|
+
list(params: NotificationListParams & {
|
|
1020
|
+
userId: string;
|
|
1021
|
+
}): Promise<ListResponse<Notification>>;
|
|
1022
|
+
/** Get unread notification count for a user. */
|
|
1023
|
+
unreadCount(userId: string): Promise<ApiResponse<UnreadCount>>;
|
|
975
1024
|
/** Mark a single notification as read. */
|
|
976
|
-
markRead(notificationId: string): Promise<ApiResponse<Notification>>;
|
|
1025
|
+
markRead(notificationId: string, userId: string): Promise<ApiResponse<Notification>>;
|
|
977
1026
|
/** Mark all notifications as read. */
|
|
978
|
-
markAllRead(): Promise<ApiResponse<{
|
|
979
|
-
|
|
1027
|
+
markAllRead(userId: string): Promise<ApiResponse<{
|
|
1028
|
+
markedRead: number;
|
|
1029
|
+
}>>;
|
|
1030
|
+
/** Delete (dismiss) a notification. For broadcast notifications, pass userId as a query param. */
|
|
1031
|
+
del(notificationId: string, params?: {
|
|
1032
|
+
userId?: string;
|
|
1033
|
+
}): Promise<ApiResponse<DeleteResponse>>;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/** A mention. */
|
|
1037
|
+
interface Mention {
|
|
1038
|
+
id: string;
|
|
1039
|
+
object: 'mention';
|
|
1040
|
+
senderId: string;
|
|
1041
|
+
senderName: string | null;
|
|
1042
|
+
recipientId: string;
|
|
1043
|
+
recipientName: string | null;
|
|
1044
|
+
ticketId: string | null;
|
|
1045
|
+
ticketTitle: string | null;
|
|
1046
|
+
isRead: boolean;
|
|
1047
|
+
createdAt: string;
|
|
1048
|
+
}
|
|
1049
|
+
/** Parameters for listing mentions. */
|
|
1050
|
+
interface MentionListParams extends PaginationParams {
|
|
1051
|
+
isRead?: string;
|
|
1052
|
+
}
|
|
1053
|
+
/** Unread mention count. */
|
|
1054
|
+
interface MentionUnreadCount {
|
|
1055
|
+
unreadCount: number;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/** Manage @mentions. */
|
|
1059
|
+
declare class MentionsResource {
|
|
1060
|
+
private readonly client;
|
|
1061
|
+
constructor(client: HttpClient);
|
|
1062
|
+
/** List mentions for a user. */
|
|
1063
|
+
list(params: MentionListParams & {
|
|
1064
|
+
userId: string;
|
|
1065
|
+
}): Promise<ListResponse<Mention>>;
|
|
1066
|
+
/** Get unread mention count for a user. */
|
|
1067
|
+
unreadCount(userId: string): Promise<ApiResponse<MentionUnreadCount>>;
|
|
1068
|
+
/** Mark a single mention as read. */
|
|
1069
|
+
markRead(mentionId: string): Promise<ApiResponse<{
|
|
1070
|
+
id: string;
|
|
1071
|
+
isRead: true;
|
|
1072
|
+
}>>;
|
|
1073
|
+
/** Mark all mentions as read for a user. */
|
|
1074
|
+
markAllRead(userId: string): Promise<ApiResponse<{
|
|
1075
|
+
markedRead: number;
|
|
980
1076
|
}>>;
|
|
981
1077
|
}
|
|
982
1078
|
|
|
@@ -1103,100 +1199,171 @@ interface SlaRuleUpdateParams {
|
|
|
1103
1199
|
businessHoursOnly?: boolean;
|
|
1104
1200
|
enabled?: boolean;
|
|
1105
1201
|
}
|
|
1202
|
+
/** Parameters for SLA metrics query. */
|
|
1203
|
+
interface SlaMetricsParams {
|
|
1204
|
+
period?: 'day' | 'week' | 'month' | 'quarter';
|
|
1205
|
+
startDate?: string;
|
|
1206
|
+
endDate?: string;
|
|
1207
|
+
agentId?: string;
|
|
1208
|
+
}
|
|
1209
|
+
/** SLA compliance metrics response. */
|
|
1210
|
+
interface SlaMetrics {
|
|
1211
|
+
object: 'sla_metrics';
|
|
1212
|
+
period: string;
|
|
1213
|
+
[key: string]: unknown;
|
|
1214
|
+
}
|
|
1106
1215
|
|
|
1107
|
-
/** Manage SLA rules. */
|
|
1216
|
+
/** Manage SLA rules and metrics. */
|
|
1108
1217
|
declare class SlaResource {
|
|
1109
1218
|
private readonly client;
|
|
1110
1219
|
constructor(client: HttpClient);
|
|
1111
1220
|
/** List SLA rules. */
|
|
1112
1221
|
list(params?: SlaRuleListParams): Promise<ListResponse<SlaRule>>;
|
|
1113
|
-
/** Get a single SLA rule. */
|
|
1114
|
-
get(ruleId: string): Promise<ApiResponse<SlaRule>>;
|
|
1115
1222
|
/** Create an SLA rule. */
|
|
1116
1223
|
create(params: SlaRuleCreateParams, options?: RequestOptions): Promise<ApiResponse<SlaRule>>;
|
|
1117
1224
|
/** Update an SLA rule. */
|
|
1118
1225
|
update(ruleId: string, params: SlaRuleUpdateParams): Promise<ApiResponse<SlaRule>>;
|
|
1119
1226
|
/** Delete an SLA rule. */
|
|
1120
1227
|
del(ruleId: string): Promise<ApiResponse<DeleteResponse>>;
|
|
1228
|
+
/** Reorder SLA rules by providing an ordered array of IDs. */
|
|
1229
|
+
reorder(orderedIds: string[]): Promise<ApiResponse<SlaRule[]>>;
|
|
1230
|
+
/** Get SLA compliance metrics. */
|
|
1231
|
+
metrics(params?: SlaMetricsParams): Promise<ApiResponse<SlaMetrics>>;
|
|
1121
1232
|
}
|
|
1122
1233
|
|
|
1123
|
-
/**
|
|
1234
|
+
/**
|
|
1235
|
+
* Analytics response. Shape varies by `type` parameter:
|
|
1236
|
+
* - overview/tickets: tickets, priorities, statusBreakdown, responseTime, resolutionTime
|
|
1237
|
+
* - performance: agents array
|
|
1238
|
+
* - library: totalArticles, publishedArticles, draftArticles
|
|
1239
|
+
*/
|
|
1124
1240
|
interface AnalyticsOverview {
|
|
1125
|
-
object: '
|
|
1241
|
+
object: 'analytics';
|
|
1242
|
+
type: string;
|
|
1126
1243
|
period: string;
|
|
1127
|
-
tickets
|
|
1244
|
+
/** Present for type=overview and type=tickets */
|
|
1245
|
+
tickets?: {
|
|
1128
1246
|
total: number;
|
|
1247
|
+
new: number;
|
|
1248
|
+
closed: number;
|
|
1129
1249
|
open: number;
|
|
1130
|
-
resolved: number;
|
|
1131
|
-
avgResponseTime: number | null;
|
|
1132
|
-
avgResolutionTime: number | null;
|
|
1133
1250
|
};
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1251
|
+
priorities?: Record<string, number>;
|
|
1252
|
+
statusBreakdown?: Record<string, number>;
|
|
1253
|
+
responseTime?: {
|
|
1254
|
+
avgSeconds: number | null;
|
|
1255
|
+
samplesCount: number;
|
|
1138
1256
|
};
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1257
|
+
resolutionTime?: {
|
|
1258
|
+
avgSeconds: number | null;
|
|
1259
|
+
samplesCount: number;
|
|
1142
1260
|
};
|
|
1261
|
+
/** Present for type=performance */
|
|
1262
|
+
agents?: Array<{
|
|
1263
|
+
agentId: string;
|
|
1264
|
+
ticketsClosed: number;
|
|
1265
|
+
avgResponseSeconds: number | null;
|
|
1266
|
+
goldTier: number;
|
|
1267
|
+
missedSla: number;
|
|
1268
|
+
}>;
|
|
1269
|
+
/** Present for type=library */
|
|
1270
|
+
totalArticles?: number;
|
|
1271
|
+
publishedArticles?: number;
|
|
1272
|
+
draftArticles?: number;
|
|
1143
1273
|
[key: string]: unknown;
|
|
1144
1274
|
}
|
|
1145
1275
|
/** Analytics query parameters. */
|
|
1146
1276
|
interface AnalyticsParams {
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}
|
|
1151
|
-
/** Agent performance stats. */
|
|
1152
|
-
interface AgentStats {
|
|
1153
|
-
object: 'agent_stats';
|
|
1154
|
-
userId: string;
|
|
1155
|
-
name: string;
|
|
1156
|
-
ticketsResolved: number;
|
|
1157
|
-
avgResponseTime: number | null;
|
|
1158
|
-
avgResolutionTime: number | null;
|
|
1159
|
-
csatAverage: number | null;
|
|
1160
|
-
[key: string]: unknown;
|
|
1277
|
+
type?: 'overview' | 'tickets' | 'performance' | 'library';
|
|
1278
|
+
period?: 'day' | 'week' | 'month' | 'quarter';
|
|
1279
|
+
agentId?: string;
|
|
1161
1280
|
}
|
|
1162
|
-
/** CSAT statistics. */
|
|
1281
|
+
/** CSAT statistics (from /csat/stats). */
|
|
1163
1282
|
interface CsatStats {
|
|
1164
1283
|
object: 'csat_stats';
|
|
1165
|
-
|
|
1166
|
-
|
|
1284
|
+
period: string;
|
|
1285
|
+
totalSent: number;
|
|
1286
|
+
totalCompleted: number;
|
|
1287
|
+
responseRate: number;
|
|
1288
|
+
averageRating: number | null;
|
|
1167
1289
|
distribution: Record<string, number>;
|
|
1168
|
-
|
|
1169
|
-
date: string;
|
|
1170
|
-
average: number;
|
|
1171
|
-
count: number;
|
|
1172
|
-
}>;
|
|
1290
|
+
positiveRate: number;
|
|
1173
1291
|
}
|
|
1174
|
-
/** A CSAT
|
|
1175
|
-
interface
|
|
1292
|
+
/** A CSAT survey (from /csat/surveys). */
|
|
1293
|
+
interface CsatSurvey {
|
|
1176
1294
|
id: string;
|
|
1177
|
-
object: '
|
|
1295
|
+
object: 'csat_survey';
|
|
1178
1296
|
ticketId: string;
|
|
1179
1297
|
customerId: string | null;
|
|
1180
|
-
|
|
1298
|
+
agentId: string | null;
|
|
1299
|
+
rating: number | null;
|
|
1181
1300
|
comment: string | null;
|
|
1301
|
+
sentAt: string | null;
|
|
1302
|
+
completedAt: string | null;
|
|
1303
|
+
expiresAt: string | null;
|
|
1182
1304
|
createdAt: string;
|
|
1183
1305
|
}
|
|
1306
|
+
/** Parameters for listing CSAT surveys. */
|
|
1307
|
+
interface CsatSurveyListParams extends PaginationParams {
|
|
1308
|
+
completed?: string;
|
|
1309
|
+
agentId?: string;
|
|
1310
|
+
}
|
|
1311
|
+
/** Parameters for creating a CSAT survey. */
|
|
1312
|
+
interface CsatSurveyCreateParams {
|
|
1313
|
+
ticketId: string;
|
|
1314
|
+
customerId?: string;
|
|
1315
|
+
agentId?: string;
|
|
1316
|
+
}
|
|
1317
|
+
/** CSAT settings. */
|
|
1318
|
+
interface CsatSettings {
|
|
1319
|
+
object: 'csat_settings';
|
|
1320
|
+
enabled: boolean;
|
|
1321
|
+
delayMinutes: number;
|
|
1322
|
+
expirationDays: number;
|
|
1323
|
+
}
|
|
1324
|
+
/** Parameters for updating CSAT settings. */
|
|
1325
|
+
interface CsatSettingsUpdateParams {
|
|
1326
|
+
enabled?: boolean;
|
|
1327
|
+
delayMinutes?: number;
|
|
1328
|
+
expirationDays?: number;
|
|
1329
|
+
}
|
|
1184
1330
|
|
|
1331
|
+
/** Manage CSAT surveys. */
|
|
1332
|
+
declare class CsatSurveysResource {
|
|
1333
|
+
private readonly client;
|
|
1334
|
+
constructor(client: HttpClient);
|
|
1335
|
+
/** List CSAT surveys. */
|
|
1336
|
+
list(params?: CsatSurveyListParams): Promise<ListResponse<CsatSurvey>>;
|
|
1337
|
+
/** Get a single CSAT survey. */
|
|
1338
|
+
get(surveyId: string): Promise<ApiResponse<CsatSurvey>>;
|
|
1339
|
+
/** Create and send a CSAT survey. */
|
|
1340
|
+
create(params: CsatSurveyCreateParams): Promise<ApiResponse<CsatSurvey>>;
|
|
1341
|
+
}
|
|
1185
1342
|
/** Access analytics and CSAT data. */
|
|
1186
1343
|
declare class AnalyticsResource {
|
|
1187
1344
|
private readonly client;
|
|
1345
|
+
/** CSAT surveys sub-resource. */
|
|
1346
|
+
readonly csatSurveys: CsatSurveysResource;
|
|
1188
1347
|
constructor(client: HttpClient);
|
|
1189
|
-
/** Get analytics
|
|
1190
|
-
|
|
1191
|
-
/** Get
|
|
1192
|
-
|
|
1348
|
+
/** Get analytics data. Specify type to control the response shape. */
|
|
1349
|
+
get(params?: AnalyticsParams): Promise<ApiResponse<AnalyticsOverview>>;
|
|
1350
|
+
/** Get analytics overview (shortcut for type=overview). */
|
|
1351
|
+
overview(params?: Omit<AnalyticsParams, 'type'>): Promise<ApiResponse<AnalyticsOverview>>;
|
|
1352
|
+
/** Get agent performance stats (shortcut for type=performance). */
|
|
1353
|
+
performance(params?: Omit<AnalyticsParams, 'type'> & {
|
|
1354
|
+
agentId?: string;
|
|
1355
|
+
}): Promise<ApiResponse<AnalyticsOverview>>;
|
|
1356
|
+
/** Get library analytics (shortcut for type=library). */
|
|
1357
|
+
library(params?: Omit<AnalyticsParams, 'type'>): Promise<ApiResponse<AnalyticsOverview>>;
|
|
1193
1358
|
/** Get CSAT statistics. */
|
|
1194
|
-
csatStats(params?:
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1359
|
+
csatStats(params?: {
|
|
1360
|
+
period?: string;
|
|
1361
|
+
agentId?: string;
|
|
1362
|
+
}): Promise<ApiResponse<CsatStats>>;
|
|
1363
|
+
/** Get CSAT settings. */
|
|
1364
|
+
csatSettings(): Promise<ApiResponse<CsatSettings>>;
|
|
1365
|
+
/** Update CSAT settings. */
|
|
1366
|
+
updateCsatSettings(params: CsatSettingsUpdateParams): Promise<ApiResponse<CsatSettings>>;
|
|
1200
1367
|
}
|
|
1201
1368
|
|
|
1202
1369
|
/** Bulk operation result. */
|
|
@@ -1338,14 +1505,16 @@ declare class AuditLogResource {
|
|
|
1338
1505
|
list(params?: AuditLogListParams): Promise<ListResponse<AuditLogEntry>>;
|
|
1339
1506
|
}
|
|
1340
1507
|
|
|
1341
|
-
/** Search result item. */
|
|
1508
|
+
/** Search result item. Shape varies by type. */
|
|
1342
1509
|
interface SearchResult {
|
|
1343
|
-
object: 'search_result';
|
|
1344
1510
|
type: 'ticket' | 'customer' | 'article';
|
|
1345
1511
|
id: string;
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1512
|
+
/** Title (tickets, articles) or name (customers). */
|
|
1513
|
+
title?: string;
|
|
1514
|
+
name?: string;
|
|
1515
|
+
email?: string;
|
|
1516
|
+
status?: string;
|
|
1517
|
+
priority?: string;
|
|
1349
1518
|
[key: string]: unknown;
|
|
1350
1519
|
}
|
|
1351
1520
|
/** Search parameters. */
|
|
@@ -1441,9 +1610,60 @@ interface CustomerGroupUpdateParams {
|
|
|
1441
1610
|
description?: string;
|
|
1442
1611
|
filters?: Record<string, unknown>;
|
|
1443
1612
|
}
|
|
1613
|
+
/** Parameters for listing group members. */
|
|
1614
|
+
interface CustomerGroupMemberListParams extends PaginationParams {
|
|
1615
|
+
}
|
|
1616
|
+
/** Parameters for adding members to a group. */
|
|
1617
|
+
interface CustomerGroupAddMembersParams {
|
|
1618
|
+
customerId?: string;
|
|
1619
|
+
customerIds?: string[];
|
|
1620
|
+
}
|
|
1621
|
+
/** Group members list result. */
|
|
1622
|
+
interface CustomerGroupMembersResult {
|
|
1623
|
+
data: Array<{
|
|
1624
|
+
id: string;
|
|
1625
|
+
object: 'customer';
|
|
1626
|
+
name: string | null;
|
|
1627
|
+
email: string | null;
|
|
1628
|
+
sentiment: string;
|
|
1629
|
+
tags: string[];
|
|
1630
|
+
joinedGroupAt: string;
|
|
1631
|
+
}>;
|
|
1632
|
+
pagination: {
|
|
1633
|
+
total: number;
|
|
1634
|
+
page: number;
|
|
1635
|
+
pageSize: number;
|
|
1636
|
+
hasMore: boolean;
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
/** Result of adding members to a group. */
|
|
1640
|
+
interface CustomerGroupAddResult {
|
|
1641
|
+
added: number;
|
|
1642
|
+
total: number;
|
|
1643
|
+
skipped: number;
|
|
1644
|
+
}
|
|
1645
|
+
/** Result of removing a member from a group. */
|
|
1646
|
+
interface CustomerGroupRemoveResult {
|
|
1647
|
+
removed: true;
|
|
1648
|
+
customerId: string;
|
|
1649
|
+
groupId: string;
|
|
1650
|
+
}
|
|
1444
1651
|
|
|
1652
|
+
/** Manage group memberships as a sub-resource. */
|
|
1653
|
+
declare class CustomerGroupMembersResource {
|
|
1654
|
+
private readonly client;
|
|
1655
|
+
constructor(client: HttpClient);
|
|
1656
|
+
/** List members in a group. */
|
|
1657
|
+
list(groupId: string, params?: CustomerGroupMemberListParams): Promise<ApiResponse<CustomerGroupMembersResult>>;
|
|
1658
|
+
/** Add member(s) to a group. */
|
|
1659
|
+
add(groupId: string, params: CustomerGroupAddMembersParams, options?: RequestOptions): Promise<ApiResponse<CustomerGroupAddResult>>;
|
|
1660
|
+
/** Remove a member from a group. */
|
|
1661
|
+
remove(groupId: string, customerId: string): Promise<ApiResponse<CustomerGroupRemoveResult>>;
|
|
1662
|
+
}
|
|
1445
1663
|
/** Manage customer groups/segments. */
|
|
1446
1664
|
declare class CustomerGroupsResource extends BaseResource<CustomerGroup, CustomerGroupListParams, CustomerGroupCreateParams, CustomerGroupUpdateParams> {
|
|
1665
|
+
/** Sub-resource for group memberships. */
|
|
1666
|
+
readonly members: CustomerGroupMembersResource;
|
|
1447
1667
|
constructor(client: HttpClient);
|
|
1448
1668
|
}
|
|
1449
1669
|
|
|
@@ -1714,6 +1934,17 @@ interface SkillAllocateResult {
|
|
|
1714
1934
|
newLevel: number;
|
|
1715
1935
|
remainingPoints: number;
|
|
1716
1936
|
}
|
|
1937
|
+
/** Game balance configuration (read-only constants from /game/config). */
|
|
1938
|
+
interface GameConfig {
|
|
1939
|
+
object: 'game_config';
|
|
1940
|
+
rewards: Record<string, unknown>;
|
|
1941
|
+
streaks: Record<string, unknown>;
|
|
1942
|
+
combo: Record<string, unknown>;
|
|
1943
|
+
boss: Record<string, unknown>;
|
|
1944
|
+
scoring: Record<string, unknown>;
|
|
1945
|
+
leveling: Record<string, unknown>;
|
|
1946
|
+
social: Record<string, unknown>;
|
|
1947
|
+
}
|
|
1717
1948
|
|
|
1718
1949
|
declare class BossResource {
|
|
1719
1950
|
private readonly client;
|
|
@@ -1738,9 +1969,22 @@ declare class AchievementsResource {
|
|
|
1738
1969
|
constructor(client: HttpClient);
|
|
1739
1970
|
/** List all achievements with progress. */
|
|
1740
1971
|
list(params?: AchievementListParams): Promise<ApiResponse<{
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1972
|
+
object: 'achievement_list';
|
|
1973
|
+
data: Achievement[];
|
|
1974
|
+
summary: {
|
|
1975
|
+
total: number;
|
|
1976
|
+
unlocked: number;
|
|
1977
|
+
totalXpEarned: number;
|
|
1978
|
+
totalGoldEarned: number;
|
|
1979
|
+
byCategory: Record<string, {
|
|
1980
|
+
total: number;
|
|
1981
|
+
unlocked: number;
|
|
1982
|
+
}>;
|
|
1983
|
+
byRarity: Record<string, {
|
|
1984
|
+
total: number;
|
|
1985
|
+
unlocked: number;
|
|
1986
|
+
}>;
|
|
1987
|
+
};
|
|
1744
1988
|
}>>;
|
|
1745
1989
|
/** List unlocked achievements only. */
|
|
1746
1990
|
unlocked(params?: {
|
|
@@ -1750,6 +1994,33 @@ declare class AchievementsResource {
|
|
|
1750
1994
|
get(achievementId: string, params?: {
|
|
1751
1995
|
userId?: string;
|
|
1752
1996
|
}): Promise<ApiResponse<Achievement>>;
|
|
1997
|
+
/** Get recently unlocked achievements across the team. */
|
|
1998
|
+
recent(params?: {
|
|
1999
|
+
limit?: number;
|
|
2000
|
+
}): Promise<ApiResponse<{
|
|
2001
|
+
object: 'list';
|
|
2002
|
+
data: Achievement[];
|
|
2003
|
+
}>>;
|
|
2004
|
+
}
|
|
2005
|
+
declare class GameActivityResource {
|
|
2006
|
+
private readonly client;
|
|
2007
|
+
constructor(client: HttpClient);
|
|
2008
|
+
/** Get the team activity feed. */
|
|
2009
|
+
list(params?: {
|
|
2010
|
+
limit?: number;
|
|
2011
|
+
before?: string;
|
|
2012
|
+
}): Promise<ApiResponse<{
|
|
2013
|
+
object: 'list';
|
|
2014
|
+
data: unknown[];
|
|
2015
|
+
cursor: string | null;
|
|
2016
|
+
}>>;
|
|
2017
|
+
/** Get activity for a specific member. */
|
|
2018
|
+
forMember(memberId: string, params?: {
|
|
2019
|
+
limit?: number;
|
|
2020
|
+
}): Promise<ApiResponse<{
|
|
2021
|
+
object: 'list';
|
|
2022
|
+
data: unknown[];
|
|
2023
|
+
}>>;
|
|
1753
2024
|
}
|
|
1754
2025
|
declare class QuestsResource {
|
|
1755
2026
|
private readonly client;
|
|
@@ -1869,6 +2140,8 @@ declare class GameResource {
|
|
|
1869
2140
|
readonly seasons: SeasonsResource;
|
|
1870
2141
|
/** Skill tree. */
|
|
1871
2142
|
readonly skills: SkillsResource;
|
|
2143
|
+
/** Game activity feed. */
|
|
2144
|
+
readonly activity: GameActivityResource;
|
|
1872
2145
|
constructor(client: HttpClient);
|
|
1873
2146
|
/** Get current player stats. */
|
|
1874
2147
|
player(params?: {
|
|
@@ -1883,6 +2156,8 @@ declare class GameResource {
|
|
|
1883
2156
|
userId?: string;
|
|
1884
2157
|
period?: string;
|
|
1885
2158
|
}): Promise<ApiResponse<LeaderboardEntry>>;
|
|
2159
|
+
/** Get game balance configuration (read-only constants). */
|
|
2160
|
+
config(): Promise<ApiResponse<GameConfig>>;
|
|
1886
2161
|
}
|
|
1887
2162
|
|
|
1888
2163
|
/** AI action types. */
|
|
@@ -1962,7 +2237,7 @@ interface ViewExecuteParams extends PaginationParams {
|
|
|
1962
2237
|
/** Manage saved views (saved filters). */
|
|
1963
2238
|
declare class ViewsResource extends BaseResource<SavedView, ViewListParams, ViewCreateParams, ViewUpdateParams> {
|
|
1964
2239
|
constructor(client: HttpClient);
|
|
1965
|
-
/** Execute a view — returns the filtered results. */
|
|
2240
|
+
/** Execute a view — returns the filtered results. The server uses the view's entity_type to determine which table to query. */
|
|
1966
2241
|
execute(viewId: string, params?: ViewExecuteParams): Promise<ListResponse<unknown>>;
|
|
1967
2242
|
}
|
|
1968
2243
|
|
|
@@ -2058,12 +2333,23 @@ interface CStarClientConfig {
|
|
|
2058
2333
|
timeout?: number;
|
|
2059
2334
|
}
|
|
2060
2335
|
/**
|
|
2061
|
-
* The cStar API client.
|
|
2336
|
+
* The cStar admin API client. **Server-side only.**
|
|
2337
|
+
*
|
|
2338
|
+
* Requires a secret API key (`sk_live_*` or `sk_test_*`). Never use this in
|
|
2339
|
+
* client-side / browser code — your secret key would be exposed to anyone
|
|
2340
|
+
* viewing your site.
|
|
2341
|
+
*
|
|
2342
|
+
* For client-side integrations, use:
|
|
2343
|
+
* - `@cstar.help/js/chat` — Customer chat widget (publishable key)
|
|
2344
|
+
* - `@cstar.help/js/library` — Public knowledge base (no auth)
|
|
2345
|
+
* - `@cstar.help/js/community` — Public community forum (no auth)
|
|
2062
2346
|
*
|
|
2063
2347
|
* ```typescript
|
|
2348
|
+
* import { CStarClient } from '@cstar.help/js';
|
|
2349
|
+
*
|
|
2064
2350
|
* const cstar = new CStarClient({
|
|
2065
|
-
* apiKey:
|
|
2066
|
-
* teamId:
|
|
2351
|
+
* apiKey: process.env.CSTAR_SECRET_KEY, // sk_live_... or sk_test_...
|
|
2352
|
+
* teamId: process.env.CSTAR_TEAM_ID,
|
|
2067
2353
|
* });
|
|
2068
2354
|
*
|
|
2069
2355
|
* const { data } = await cstar.tickets.list({ status: 'open' });
|
|
@@ -2093,6 +2379,8 @@ declare class CStarClient {
|
|
|
2093
2379
|
readonly settings: SettingsResource;
|
|
2094
2380
|
/** Manage notifications. */
|
|
2095
2381
|
readonly notifications: NotificationsResource;
|
|
2382
|
+
/** Manage @mentions. */
|
|
2383
|
+
readonly mentions: MentionsResource;
|
|
2096
2384
|
/** Manage file attachments. */
|
|
2097
2385
|
readonly attachments: AttachmentsResource;
|
|
2098
2386
|
/** Manage custom field definitions. */
|
|
@@ -2131,4 +2419,4 @@ declare class CStarClient {
|
|
|
2131
2419
|
get isTestMode(): boolean;
|
|
2132
2420
|
}
|
|
2133
2421
|
|
|
2134
|
-
export { type Achievement, type AchievementListParams, type ActivityEvent, type ActivityListParams, type
|
|
2422
|
+
export { type Achievement, type AchievementListParams, type ActivityEvent, type ActivityListParams, type AiAction, type AiActionParams, type AiActionResult, type AnalyticsOverview, type AnalyticsParams, type ApiErrorBody, type ApiResponse, type Article, type ArticleCreateParams, type ArticleListParams, type ArticleUpdateParams, type Attachment, type AttachmentListParams, type AuditLogEntry, type AuditLogListParams, type AutomationAction, type AutomationCondition, type AutomationConditions, type AutomationCreateParams, type AutomationExecution, type AutomationExecutionListParams, type AutomationListParams, type AutomationRule, type AutomationTestResult, type AutomationUpdateParams, type BillingPortal, type BillingPortalParams, type Boss, type BossDamageParams, type BossDamageResult, type BossDefeat, type BossDefeatListParams, type BossSpawnParams, type BulkDeleteParams, type BulkResult, type BulkUpdateParams, type BusinessHours, type BusinessHoursUpdateParams, CStarAuthenticationError, CStarClient, type CStarClientConfig, CStarError, CStarNotFoundError, CStarRateLimitError, CStarValidationError, type Category, type CategoryCreateParams, type CategoryListParams, type CategoryUpdateParams, type CommunityComment, type CommunityCommentCreateParams, type CommunityPost, type CommunityPostCreateParams, type CommunityPostListParams, type CommunityPostUpdateParams, type CommunityTopic, type Cosmetic, type CosmeticPreferences, type CsatSettings, type CsatSettingsUpdateParams, type CsatStats, type CsatSurvey, type CsatSurveyCreateParams, type CsatSurveyListParams, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerGroup, type CustomerGroupAddMembersParams, type CustomerGroupAddResult, type CustomerGroupCreateParams, type CustomerGroupListParams, type CustomerGroupMemberListParams, type CustomerGroupMembersResult, type CustomerGroupRemoveResult, type CustomerGroupUpdateParams, type CustomerListParams, type CustomerUpdateParams, type DeleteResponse, ErrorType, type ExportCreateParams, type ExportResult, type GameConfig, type HighFive, type HighFiveCanSend, type HighFiveCreateParams, type HighFiveListParams, type ImportCreateParams, type ImportLog, type ImportLogListParams, type ImportResult, type Invite, type InviteCreateParams, type InviteListParams, type LeaderboardEntry, type LeaderboardParams, type ListResponse, type Member, type MemberListParams, type MemberUpdateParams, type Mention, type MentionListParams, type MentionUnreadCount, type Message, type MessageCreateParams, type Metadata, type Notification, type NotificationListParams, type OneUp, type OneUpCreateParams, type OneUpListParams, type OneUpRemaining, type PaginationInfo, type PaginationParams, type Player, type Puzzle, type PuzzleCompleteParams, type PuzzleCompleteResult, type PuzzleStreak, type Quest, type QuickReply, type QuickReplyCreateParams, type QuickReplyUpdateParams, type RequestOptions, type SavedView, type SearchParams, type SearchResult, type Season, type SeasonStats, type SkillAllocateParams, type SkillAllocateResult, type SkillTree, type SlaMetrics, type SlaMetricsParams, type SlaRule, type SlaRuleCreateParams, type SlaRuleListParams, type SlaRuleUpdateParams, type StatusCreateParams, type StatusUpdateParams, type Subscription, type Tag, type TagListParams, type TeamSettings, type TeamSettingsUpdateParams, type Ticket, type TicketCreateParams, type TicketCustomerSummary, type TicketListParams, type TicketStatus, type TicketUpdateParams, type UnreadCount, type ViewCreateParams, type ViewExecuteParams, type ViewListParams, type ViewUpdateParams, type Webhook, type WebhookCreateParams, type WebhookEvent, type WebhookEventData, type WebhookEventType, type WebhookListParams, type WebhookListener, type WebhookListenerParams, type WebhookSubscribeParams, type WebhookSubscription, type WebhookTestResult, type WebhookTriggerTestParams, type WebhookTriggerTestResult, type WebhookUpdateParams, type WidgetSettings, type WidgetSettingsUpdateParams };
|