@cstar.help/js 0.4.0 → 0.5.0

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/index.d.ts CHANGED
@@ -429,6 +429,163 @@ declare class WebhooksResource extends BaseResource<Webhook, WebhookListParams,
429
429
  }): Promise<ApiResponse<WebhookTestResult>>;
430
430
  }
431
431
 
432
+ /** A condition in an automation rule. */
433
+ interface AutomationCondition {
434
+ field: string;
435
+ operator: string;
436
+ value?: unknown;
437
+ }
438
+ /** Condition groups (all must match AND at least one any must match). */
439
+ interface AutomationConditions {
440
+ all: AutomationCondition[];
441
+ any: AutomationCondition[];
442
+ }
443
+ /** An action in an automation rule. */
444
+ interface AutomationAction {
445
+ type: string;
446
+ [key: string]: unknown;
447
+ }
448
+ /** A cStar automation rule. */
449
+ interface AutomationRule {
450
+ id: string;
451
+ object: 'automation_rule';
452
+ name: string;
453
+ description: string;
454
+ triggerEvent: string;
455
+ triggerFilter: Record<string, unknown>;
456
+ conditions: AutomationConditions;
457
+ actions: AutomationAction[];
458
+ enabled: boolean;
459
+ position: number;
460
+ stopAfter: boolean;
461
+ maxExecutionsPerTicket: number;
462
+ cooldownSeconds: number;
463
+ executionCount: number;
464
+ lastExecutedAt: string | null;
465
+ createdBy: string | null;
466
+ createdAt: string;
467
+ updatedAt: string;
468
+ }
469
+ /** An automation execution log entry. */
470
+ interface AutomationExecution {
471
+ id: string;
472
+ object: 'automation_execution';
473
+ ruleId: string;
474
+ ruleName: string | null;
475
+ triggerEvent: string;
476
+ resourceType: string;
477
+ resourceId: string;
478
+ conditionsMatched: boolean;
479
+ actionsExecuted: Array<{
480
+ action: string;
481
+ success: boolean;
482
+ error?: string;
483
+ }>;
484
+ skippedReason: string | null;
485
+ dryRun: boolean;
486
+ executionMs: number;
487
+ createdAt: string;
488
+ }
489
+ /** Parameters for listing automation rules. */
490
+ interface AutomationListParams extends PaginationParams {
491
+ enabled?: boolean;
492
+ triggerEvent?: string;
493
+ }
494
+ /** Parameters for creating an automation rule. */
495
+ interface AutomationCreateParams {
496
+ name: string;
497
+ description?: string;
498
+ triggerEvent: string;
499
+ triggerFilter?: Record<string, unknown>;
500
+ conditions?: AutomationConditions;
501
+ actions?: AutomationAction[];
502
+ enabled?: boolean;
503
+ stopAfter?: boolean;
504
+ maxExecutionsPerTicket?: number;
505
+ cooldownSeconds?: number;
506
+ }
507
+ /** Parameters for updating an automation rule. */
508
+ interface AutomationUpdateParams {
509
+ name?: string;
510
+ description?: string;
511
+ triggerEvent?: string;
512
+ triggerFilter?: Record<string, unknown>;
513
+ conditions?: AutomationConditions;
514
+ actions?: AutomationAction[];
515
+ enabled?: boolean;
516
+ stopAfter?: boolean;
517
+ maxExecutionsPerTicket?: number;
518
+ cooldownSeconds?: number;
519
+ }
520
+ /** Parameters for listing executions. */
521
+ interface AutomationExecutionListParams extends PaginationParams {
522
+ triggerEvent?: string;
523
+ resourceId?: string;
524
+ }
525
+ /** Result of a dry-run test. */
526
+ interface AutomationTestResult {
527
+ wouldMatch: boolean;
528
+ conditionResults: {
529
+ all: Array<{
530
+ field: string;
531
+ operator: string;
532
+ value: unknown;
533
+ actual: unknown;
534
+ passed: boolean;
535
+ }>;
536
+ any: Array<{
537
+ field: string;
538
+ operator: string;
539
+ value: unknown;
540
+ actual: unknown;
541
+ passed: boolean;
542
+ }>;
543
+ };
544
+ actionsWouldExecute: Array<{
545
+ action: string;
546
+ success: boolean;
547
+ preview?: string;
548
+ }>;
549
+ }
550
+
551
+ /** Manage automation rules. */
552
+ declare class AutomationsResource extends BaseResource<AutomationRule, AutomationListParams, AutomationCreateParams, AutomationUpdateParams> {
553
+ constructor(client: HttpClient);
554
+ /** Toggle a rule's enabled state. */
555
+ toggle(ruleId: string, enabled?: boolean): Promise<ApiResponse<AutomationRule>>;
556
+ /** Reorder rules by providing an ordered array of IDs. */
557
+ reorder(orderedIds: string[]): Promise<ApiResponse<AutomationRule[]>>;
558
+ /** Dry-run a rule against a specific resource (no actions executed). */
559
+ test(ruleId: string, params: {
560
+ resourceType: string;
561
+ resourceId: string;
562
+ }): Promise<ApiResponse<AutomationTestResult>>;
563
+ /** Get execution history for a specific rule. */
564
+ executions(ruleId: string, params?: AutomationExecutionListParams): Promise<ListResponse<AutomationExecution>>;
565
+ /** Get all execution history for the team. */
566
+ allExecutions(params?: AutomationExecutionListParams): Promise<ListResponse<AutomationExecution>>;
567
+ /** Test conditions against sample data (without a rule). */
568
+ evaluate(params: {
569
+ conditions: {
570
+ all: Array<{
571
+ field: string;
572
+ operator: string;
573
+ value?: unknown;
574
+ }>;
575
+ any: Array<{
576
+ field: string;
577
+ operator: string;
578
+ value?: unknown;
579
+ }>;
580
+ };
581
+ data: Record<string, unknown>;
582
+ changes?: Record<string, unknown>;
583
+ }): Promise<ApiResponse<{
584
+ matched: boolean;
585
+ conditionResults: unknown;
586
+ }>>;
587
+ }
588
+
432
589
  /** A cStar article category. */
433
590
  interface Category {
434
591
  id: string;
@@ -572,6 +729,1274 @@ declare class CommunityTopicsResource extends BaseResource<CommunityTopic, Recor
572
729
  constructor(client: HttpClient);
573
730
  }
574
731
 
732
+ /** A team member (agent). */
733
+ interface Member {
734
+ id: string;
735
+ object: 'member';
736
+ userId: string;
737
+ name: string;
738
+ email: string;
739
+ avatarUrl: string | null;
740
+ role: string;
741
+ roleDisplayName: string;
742
+ permissions: string[];
743
+ level: number;
744
+ xp: number;
745
+ joinedAt: string;
746
+ }
747
+ /** Parameters for listing members. */
748
+ interface MemberListParams extends PaginationParams {
749
+ role?: string;
750
+ }
751
+ /** Parameters for updating a member. */
752
+ interface MemberUpdateParams {
753
+ role?: string;
754
+ }
755
+ /** A team invite. */
756
+ interface Invite {
757
+ id: string;
758
+ object: 'invite';
759
+ email: string;
760
+ role: string;
761
+ status: string;
762
+ inviterName: string | null;
763
+ inviterEmail: string | null;
764
+ createdAt: string;
765
+ expiresAt: string;
766
+ }
767
+ /** Parameters for listing invites. */
768
+ interface InviteListParams extends PaginationParams {
769
+ status?: string;
770
+ }
771
+ /** Parameters for creating an invite. */
772
+ interface InviteCreateParams {
773
+ email: string;
774
+ role?: string;
775
+ }
776
+
777
+ /** Manage team invites as a sub-resource. */
778
+ declare class InvitesResource {
779
+ private readonly client;
780
+ constructor(client: HttpClient);
781
+ /** List pending invites. */
782
+ list(params?: InviteListParams): Promise<ListResponse<Invite>>;
783
+ /** Create and send a new invite. */
784
+ create(params: InviteCreateParams, options?: RequestOptions): Promise<ApiResponse<Invite>>;
785
+ /** Revoke a pending invite. */
786
+ del(inviteId: string): Promise<ApiResponse<DeleteResponse>>;
787
+ }
788
+ /** Manage team members. */
789
+ declare class MembersResource {
790
+ private readonly client;
791
+ /** Sub-resource for team invites. */
792
+ readonly invites: InvitesResource;
793
+ constructor(client: HttpClient);
794
+ /** List all team members. */
795
+ list(params?: MemberListParams): Promise<ListResponse<Member>>;
796
+ /** Get a single member by membership ID. */
797
+ get(memberId: string): Promise<ApiResponse<Member>>;
798
+ /** Update a member's role. */
799
+ update(memberId: string, params: MemberUpdateParams): Promise<ApiResponse<Member>>;
800
+ /** Remove a member from the team. */
801
+ del(memberId: string): Promise<ApiResponse<DeleteResponse>>;
802
+ }
803
+
804
+ /** Team settings object. */
805
+ interface TeamSettings {
806
+ object: 'settings';
807
+ teamName: string;
808
+ teamSlug: string;
809
+ [key: string]: unknown;
810
+ }
811
+ /** Parameters for updating team settings. */
812
+ interface TeamSettingsUpdateParams {
813
+ [key: string]: unknown;
814
+ }
815
+ /** A ticket status configuration. */
816
+ interface TicketStatus {
817
+ key: string;
818
+ object: 'status';
819
+ label: string;
820
+ color: string;
821
+ position: number;
822
+ isDefault: boolean;
823
+ isProtected: boolean;
824
+ }
825
+ /** Parameters for creating a status. */
826
+ interface StatusCreateParams {
827
+ key: string;
828
+ label: string;
829
+ color?: string;
830
+ }
831
+ /** Parameters for updating a status. */
832
+ interface StatusUpdateParams {
833
+ label?: string;
834
+ color?: string;
835
+ }
836
+ /** A quick reply template. */
837
+ interface QuickReply {
838
+ id: string;
839
+ object: 'quick_reply';
840
+ title: string;
841
+ body: string;
842
+ category: string | null;
843
+ position: number;
844
+ createdAt: string;
845
+ updatedAt: string;
846
+ }
847
+ /** Parameters for creating a quick reply. */
848
+ interface QuickReplyCreateParams {
849
+ title: string;
850
+ body: string;
851
+ category?: string;
852
+ }
853
+ /** Parameters for updating a quick reply. */
854
+ interface QuickReplyUpdateParams {
855
+ title?: string;
856
+ body?: string;
857
+ category?: string;
858
+ }
859
+ /** Business hours configuration. */
860
+ interface BusinessHours {
861
+ object: 'business_hours';
862
+ enabled: boolean;
863
+ timezone: string;
864
+ schedule: Record<string, {
865
+ enabled: boolean;
866
+ start: string;
867
+ end: string;
868
+ }>;
869
+ }
870
+ /** Parameters for updating business hours. */
871
+ interface BusinessHoursUpdateParams {
872
+ enabled?: boolean;
873
+ timezone?: string;
874
+ schedule?: Record<string, {
875
+ enabled: boolean;
876
+ start: string;
877
+ end: string;
878
+ }>;
879
+ }
880
+ /** Widget configuration. */
881
+ interface WidgetSettings {
882
+ object: 'widget_settings';
883
+ [key: string]: unknown;
884
+ }
885
+ /** Parameters for updating widget settings. */
886
+ interface WidgetSettingsUpdateParams {
887
+ [key: string]: unknown;
888
+ }
889
+
890
+ /** Manage ticket status configurations. */
891
+ declare class StatusesResource {
892
+ private readonly client;
893
+ constructor(client: HttpClient);
894
+ /** List all statuses. */
895
+ list(): Promise<ApiResponse<TicketStatus[]>>;
896
+ /** Create a new status. */
897
+ create(params: StatusCreateParams, options?: RequestOptions): Promise<ApiResponse<TicketStatus>>;
898
+ /** Update a status. */
899
+ update(statusKey: string, params: StatusUpdateParams): Promise<ApiResponse<TicketStatus>>;
900
+ /** Delete a status. */
901
+ del(statusKey: string): Promise<ApiResponse<DeleteResponse>>;
902
+ /** Reorder statuses. */
903
+ reorder(orderedKeys: string[]): Promise<ApiResponse<TicketStatus[]>>;
904
+ }
905
+ /** Manage quick reply templates. */
906
+ declare class QuickRepliesResource {
907
+ private readonly client;
908
+ constructor(client: HttpClient);
909
+ /** List all quick replies. */
910
+ list(): Promise<ApiResponse<QuickReply[]>>;
911
+ /** Create a new quick reply. */
912
+ create(params: QuickReplyCreateParams, options?: RequestOptions): Promise<ApiResponse<QuickReply>>;
913
+ /** Update a quick reply. */
914
+ update(replyId: string, params: QuickReplyUpdateParams): Promise<ApiResponse<QuickReply>>;
915
+ /** Delete a quick reply. */
916
+ del(replyId: string): Promise<ApiResponse<DeleteResponse>>;
917
+ /** Reorder quick replies. */
918
+ reorder(orderedIds: string[]): Promise<ApiResponse<QuickReply[]>>;
919
+ }
920
+ /** Manage team settings. */
921
+ declare class SettingsResource {
922
+ private readonly client;
923
+ /** Ticket status configuration. */
924
+ readonly statuses: StatusesResource;
925
+ /** Quick reply templates. */
926
+ readonly quickReplies: QuickRepliesResource;
927
+ constructor(client: HttpClient);
928
+ /** Get all team settings. */
929
+ get(): Promise<ApiResponse<TeamSettings>>;
930
+ /** Update team settings (bulk). */
931
+ update(params: TeamSettingsUpdateParams): Promise<ApiResponse<TeamSettings>>;
932
+ /** Get business hours configuration. */
933
+ getBusinessHours(): Promise<ApiResponse<BusinessHours>>;
934
+ /** Update business hours configuration. */
935
+ updateBusinessHours(params: BusinessHoursUpdateParams): Promise<ApiResponse<BusinessHours>>;
936
+ /** Get widget settings. */
937
+ getWidget(): Promise<ApiResponse<WidgetSettings>>;
938
+ /** Update widget settings. */
939
+ updateWidget(params: WidgetSettingsUpdateParams): Promise<ApiResponse<WidgetSettings>>;
940
+ }
941
+
942
+ /** A notification. */
943
+ interface Notification {
944
+ id: string;
945
+ object: 'notification';
946
+ type: string;
947
+ title: string;
948
+ body: string | null;
949
+ resourceType: string | null;
950
+ resourceId: string | null;
951
+ actorId: string | null;
952
+ actorName: string | null;
953
+ read: boolean;
954
+ readAt: string | null;
955
+ createdAt: string;
956
+ }
957
+ /** Parameters for listing notifications. */
958
+ interface NotificationListParams extends PaginationParams {
959
+ unreadOnly?: boolean;
960
+ }
961
+ /** Unread count response. */
962
+ interface UnreadCount {
963
+ object: 'unread_count';
964
+ count: number;
965
+ }
966
+
967
+ /** Manage notifications. */
968
+ declare class NotificationsResource {
969
+ private readonly client;
970
+ constructor(client: HttpClient);
971
+ /** List notifications. */
972
+ list(params?: NotificationListParams): Promise<ListResponse<Notification>>;
973
+ /** Get unread notification count. */
974
+ unreadCount(): Promise<ApiResponse<UnreadCount>>;
975
+ /** Mark a single notification as read. */
976
+ markRead(notificationId: string): Promise<ApiResponse<Notification>>;
977
+ /** Mark all notifications as read. */
978
+ markAllRead(): Promise<ApiResponse<{
979
+ updated: number;
980
+ }>>;
981
+ }
982
+
983
+ /** A file attachment. */
984
+ interface Attachment {
985
+ id: string;
986
+ object: 'attachment';
987
+ filename: string;
988
+ contentType: string;
989
+ size: number;
990
+ url: string;
991
+ ticketId: string | null;
992
+ uploadedBy: string | null;
993
+ createdAt: string;
994
+ }
995
+ /** Parameters for listing attachments. */
996
+ interface AttachmentListParams extends PaginationParams {
997
+ ticketId?: string;
998
+ }
999
+
1000
+ /** Manage file attachments. */
1001
+ declare class AttachmentsResource {
1002
+ private readonly client;
1003
+ constructor(client: HttpClient);
1004
+ /** List attachments. */
1005
+ list(params?: AttachmentListParams): Promise<ListResponse<Attachment>>;
1006
+ /** Get a single attachment. */
1007
+ get(attachmentId: string): Promise<ApiResponse<Attachment>>;
1008
+ /** Delete an attachment. */
1009
+ del(attachmentId: string): Promise<ApiResponse<DeleteResponse>>;
1010
+ }
1011
+
1012
+ /** A custom field definition. */
1013
+ interface CustomField {
1014
+ id: string;
1015
+ object: 'custom_field';
1016
+ name: string;
1017
+ key: string;
1018
+ type: 'text' | 'number' | 'select' | 'multiselect' | 'date' | 'boolean';
1019
+ entityType: 'tickets' | 'customers';
1020
+ description: string | null;
1021
+ required: boolean;
1022
+ options: string[] | null;
1023
+ position: number;
1024
+ createdAt: string;
1025
+ updatedAt: string;
1026
+ }
1027
+ /** Parameters for listing custom fields. */
1028
+ interface CustomFieldListParams extends PaginationParams {
1029
+ entityType?: 'tickets' | 'customers';
1030
+ }
1031
+ /** Parameters for creating a custom field. */
1032
+ interface CustomFieldCreateParams {
1033
+ name: string;
1034
+ key: string;
1035
+ type: 'text' | 'number' | 'select' | 'multiselect' | 'date' | 'boolean';
1036
+ entityType: 'tickets' | 'customers';
1037
+ description?: string;
1038
+ required?: boolean;
1039
+ options?: string[];
1040
+ }
1041
+ /** Parameters for updating a custom field. */
1042
+ interface CustomFieldUpdateParams {
1043
+ name?: string;
1044
+ description?: string;
1045
+ required?: boolean;
1046
+ options?: string[];
1047
+ }
1048
+
1049
+ /** Manage custom field definitions. */
1050
+ declare class CustomFieldsResource {
1051
+ private readonly client;
1052
+ constructor(client: HttpClient);
1053
+ /** List custom fields. */
1054
+ list(params?: CustomFieldListParams): Promise<ListResponse<CustomField>>;
1055
+ /** Get a single custom field. */
1056
+ get(fieldId: string): Promise<ApiResponse<CustomField>>;
1057
+ /** Create a custom field. */
1058
+ create(params: CustomFieldCreateParams, options?: RequestOptions): Promise<ApiResponse<CustomField>>;
1059
+ /** Update a custom field. */
1060
+ update(fieldId: string, params: CustomFieldUpdateParams): Promise<ApiResponse<CustomField>>;
1061
+ /** Delete a custom field. */
1062
+ del(fieldId: string): Promise<ApiResponse<DeleteResponse>>;
1063
+ /** Reorder custom fields. */
1064
+ reorder(orderedIds: string[]): Promise<ApiResponse<CustomField[]>>;
1065
+ }
1066
+
1067
+ /** An SLA rule. */
1068
+ interface SlaRule {
1069
+ id: string;
1070
+ object: 'sla_rule';
1071
+ name: string;
1072
+ description: string | null;
1073
+ priority: string;
1074
+ responseTarget: number;
1075
+ resolutionTarget: number;
1076
+ businessHoursOnly: boolean;
1077
+ enabled: boolean;
1078
+ position: number;
1079
+ createdAt: string;
1080
+ updatedAt: string;
1081
+ }
1082
+ /** Parameters for listing SLA rules. */
1083
+ interface SlaRuleListParams extends PaginationParams {
1084
+ enabled?: boolean;
1085
+ }
1086
+ /** Parameters for creating an SLA rule. */
1087
+ interface SlaRuleCreateParams {
1088
+ name: string;
1089
+ description?: string;
1090
+ priority: string;
1091
+ responseTarget: number;
1092
+ resolutionTarget: number;
1093
+ businessHoursOnly?: boolean;
1094
+ enabled?: boolean;
1095
+ }
1096
+ /** Parameters for updating an SLA rule. */
1097
+ interface SlaRuleUpdateParams {
1098
+ name?: string;
1099
+ description?: string;
1100
+ priority?: string;
1101
+ responseTarget?: number;
1102
+ resolutionTarget?: number;
1103
+ businessHoursOnly?: boolean;
1104
+ enabled?: boolean;
1105
+ }
1106
+
1107
+ /** Manage SLA rules. */
1108
+ declare class SlaResource {
1109
+ private readonly client;
1110
+ constructor(client: HttpClient);
1111
+ /** List SLA rules. */
1112
+ list(params?: SlaRuleListParams): Promise<ListResponse<SlaRule>>;
1113
+ /** Get a single SLA rule. */
1114
+ get(ruleId: string): Promise<ApiResponse<SlaRule>>;
1115
+ /** Create an SLA rule. */
1116
+ create(params: SlaRuleCreateParams, options?: RequestOptions): Promise<ApiResponse<SlaRule>>;
1117
+ /** Update an SLA rule. */
1118
+ update(ruleId: string, params: SlaRuleUpdateParams): Promise<ApiResponse<SlaRule>>;
1119
+ /** Delete an SLA rule. */
1120
+ del(ruleId: string): Promise<ApiResponse<DeleteResponse>>;
1121
+ }
1122
+
1123
+ /** Analytics overview response. */
1124
+ interface AnalyticsOverview {
1125
+ object: 'analytics_overview';
1126
+ period: string;
1127
+ tickets: {
1128
+ total: number;
1129
+ open: number;
1130
+ resolved: number;
1131
+ avgResponseTime: number | null;
1132
+ avgResolutionTime: number | null;
1133
+ };
1134
+ customers: {
1135
+ total: number;
1136
+ active: number;
1137
+ new: number;
1138
+ };
1139
+ csat: {
1140
+ average: number | null;
1141
+ totalResponses: number;
1142
+ };
1143
+ [key: string]: unknown;
1144
+ }
1145
+ /** Analytics query parameters. */
1146
+ interface AnalyticsParams {
1147
+ period?: 'day' | 'week' | 'month' | 'quarter' | 'year';
1148
+ startDate?: string;
1149
+ endDate?: string;
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;
1161
+ }
1162
+ /** CSAT statistics. */
1163
+ interface CsatStats {
1164
+ object: 'csat_stats';
1165
+ average: number | null;
1166
+ totalResponses: number;
1167
+ distribution: Record<string, number>;
1168
+ trend: Array<{
1169
+ date: string;
1170
+ average: number;
1171
+ count: number;
1172
+ }>;
1173
+ }
1174
+ /** A CSAT response. */
1175
+ interface CsatResponse {
1176
+ id: string;
1177
+ object: 'csat_response';
1178
+ ticketId: string;
1179
+ customerId: string | null;
1180
+ rating: number;
1181
+ comment: string | null;
1182
+ createdAt: string;
1183
+ }
1184
+
1185
+ /** Access analytics and CSAT data. */
1186
+ declare class AnalyticsResource {
1187
+ private readonly client;
1188
+ constructor(client: HttpClient);
1189
+ /** Get analytics overview. */
1190
+ overview(params?: AnalyticsParams): Promise<ApiResponse<AnalyticsOverview>>;
1191
+ /** Get per-agent performance stats. */
1192
+ agents(params?: AnalyticsParams): Promise<ApiResponse<AgentStats[]>>;
1193
+ /** Get CSAT statistics. */
1194
+ csatStats(params?: AnalyticsParams): Promise<ApiResponse<CsatStats>>;
1195
+ /** List individual CSAT responses. */
1196
+ csatResponses(params?: AnalyticsParams & {
1197
+ page?: number;
1198
+ pageSize?: number;
1199
+ }): Promise<ListResponse<CsatResponse>>;
1200
+ }
1201
+
1202
+ /** Bulk operation result. */
1203
+ interface BulkResult {
1204
+ object: 'bulk_result';
1205
+ action: string;
1206
+ resource: string;
1207
+ total: number;
1208
+ succeeded: number;
1209
+ failed: number;
1210
+ errors: Array<{
1211
+ id: string;
1212
+ error: string;
1213
+ }>;
1214
+ }
1215
+ /** Parameters for a bulk update. */
1216
+ interface BulkUpdateParams {
1217
+ resource: 'tickets' | 'customers' | 'articles';
1218
+ ids: string[];
1219
+ data: Record<string, unknown>;
1220
+ }
1221
+ /** Parameters for a bulk delete. */
1222
+ interface BulkDeleteParams {
1223
+ resource: 'tickets' | 'customers' | 'articles';
1224
+ ids: string[];
1225
+ }
1226
+
1227
+ /** Perform bulk operations on resources. */
1228
+ declare class BulkResource {
1229
+ private readonly client;
1230
+ constructor(client: HttpClient);
1231
+ /** Bulk update resources. */
1232
+ update(params: BulkUpdateParams, options?: RequestOptions): Promise<ApiResponse<BulkResult>>;
1233
+ /** Bulk delete resources. */
1234
+ del(params: BulkDeleteParams, options?: RequestOptions): Promise<ApiResponse<BulkResult>>;
1235
+ }
1236
+
1237
+ /** Export request parameters. */
1238
+ interface ExportCreateParams {
1239
+ resources: Array<{
1240
+ type: 'tickets' | 'customers' | 'articles';
1241
+ filters?: Record<string, unknown>;
1242
+ }>;
1243
+ format?: 'json' | 'csv';
1244
+ }
1245
+ /** Export response. */
1246
+ interface ExportResult {
1247
+ object: 'export';
1248
+ format: string;
1249
+ resources: Record<string, unknown[]> | string;
1250
+ totalRows: number;
1251
+ }
1252
+
1253
+ /** Import request parameters. */
1254
+ interface ImportCreateParams {
1255
+ resource: 'tickets' | 'customers' | 'articles';
1256
+ records: Record<string, unknown>[];
1257
+ mergeStrategy?: 'skip' | 'overwrite' | 'merge';
1258
+ }
1259
+ /** Import result. */
1260
+ interface ImportResult {
1261
+ object: 'import_result';
1262
+ resource: string;
1263
+ total: number;
1264
+ created: number;
1265
+ updated: number;
1266
+ skipped: number;
1267
+ errors: Array<{
1268
+ index: number;
1269
+ error: string;
1270
+ }>;
1271
+ }
1272
+ /** Import log entry. */
1273
+ interface ImportLog {
1274
+ id: string;
1275
+ object: 'import_log';
1276
+ resource: string;
1277
+ status: string;
1278
+ totalRecords: number;
1279
+ created: number;
1280
+ updated: number;
1281
+ skipped: number;
1282
+ errors: number;
1283
+ createdAt: string;
1284
+ }
1285
+ /** Parameters for listing import logs. */
1286
+ interface ImportLogListParams extends PaginationParams {
1287
+ resource?: string;
1288
+ }
1289
+
1290
+ /** Export data from your team. */
1291
+ declare class ExportResource {
1292
+ private readonly client;
1293
+ constructor(client: HttpClient);
1294
+ /** Create an export. Returns exported data synchronously. */
1295
+ create(params: ExportCreateParams, options?: RequestOptions): Promise<ApiResponse<ExportResult>>;
1296
+ }
1297
+ /** Import data into your team. */
1298
+ declare class ImportResource {
1299
+ private readonly client;
1300
+ constructor(client: HttpClient);
1301
+ /** Run an import. Processes records synchronously (max 500). */
1302
+ create(params: ImportCreateParams, options?: RequestOptions): Promise<ApiResponse<ImportResult>>;
1303
+ /** List import history logs. */
1304
+ logs(params?: ImportLogListParams): Promise<ListResponse<ImportLog>>;
1305
+ /** Get a single import log. */
1306
+ getLog(logId: string): Promise<ApiResponse<ImportLog>>;
1307
+ }
1308
+
1309
+ /** An audit log entry. */
1310
+ interface AuditLogEntry {
1311
+ id: string;
1312
+ object: 'audit_log_entry';
1313
+ action: string;
1314
+ resourceType: string;
1315
+ resourceId: string | null;
1316
+ actorId: string | null;
1317
+ actorName: string | null;
1318
+ actorType: string;
1319
+ details: Record<string, unknown>;
1320
+ ipAddress: string | null;
1321
+ createdAt: string;
1322
+ }
1323
+ /** Parameters for listing audit log entries. */
1324
+ interface AuditLogListParams extends PaginationParams {
1325
+ action?: string;
1326
+ resourceType?: string;
1327
+ resourceId?: string;
1328
+ actorId?: string;
1329
+ startDate?: string;
1330
+ endDate?: string;
1331
+ }
1332
+
1333
+ /** Access the audit log. */
1334
+ declare class AuditLogResource {
1335
+ private readonly client;
1336
+ constructor(client: HttpClient);
1337
+ /** List audit log entries. */
1338
+ list(params?: AuditLogListParams): Promise<ListResponse<AuditLogEntry>>;
1339
+ }
1340
+
1341
+ /** Search result item. */
1342
+ interface SearchResult {
1343
+ object: 'search_result';
1344
+ type: 'ticket' | 'customer' | 'article';
1345
+ id: string;
1346
+ title: string;
1347
+ snippet: string | null;
1348
+ score: number;
1349
+ [key: string]: unknown;
1350
+ }
1351
+ /** Search parameters. */
1352
+ interface SearchParams {
1353
+ query: string;
1354
+ types?: Array<'tickets' | 'customers' | 'articles'>;
1355
+ limit?: number;
1356
+ }
1357
+
1358
+ /** Search across tickets, customers, and articles. */
1359
+ declare class SearchResource {
1360
+ private readonly client;
1361
+ constructor(client: HttpClient);
1362
+ /** Perform a cross-resource search. */
1363
+ query(params: SearchParams): Promise<ApiResponse<SearchResult[]>>;
1364
+ }
1365
+
1366
+ /** A tag with usage count. */
1367
+ interface Tag {
1368
+ object: 'tag';
1369
+ name: string;
1370
+ count: number;
1371
+ }
1372
+ /** Parameters for listing tags. */
1373
+ interface TagListParams extends PaginationParams {
1374
+ search?: string;
1375
+ }
1376
+
1377
+ /** Manage tags. */
1378
+ declare class TagsResource {
1379
+ private readonly client;
1380
+ constructor(client: HttpClient);
1381
+ /** List all tags with usage counts. */
1382
+ list(params?: TagListParams): Promise<ListResponse<Tag>>;
1383
+ /** Create a tag. */
1384
+ create(name: string, options?: RequestOptions): Promise<ApiResponse<Tag>>;
1385
+ /** Delete a tag. */
1386
+ del(name: string): Promise<ApiResponse<DeleteResponse>>;
1387
+ }
1388
+
1389
+ /** An activity/timeline event. */
1390
+ interface ActivityEvent {
1391
+ id: string;
1392
+ object: 'activity';
1393
+ type: string;
1394
+ resourceType: string;
1395
+ resourceId: string | null;
1396
+ actorId: string | null;
1397
+ actorName: string | null;
1398
+ description: string;
1399
+ details: Record<string, unknown>;
1400
+ createdAt: string;
1401
+ }
1402
+ /** Parameters for listing activity. */
1403
+ interface ActivityListParams extends PaginationParams {
1404
+ resourceType?: string;
1405
+ resourceId?: string;
1406
+ type?: string;
1407
+ }
1408
+
1409
+ /** Access the activity feed. */
1410
+ declare class ActivityResource {
1411
+ private readonly client;
1412
+ constructor(client: HttpClient);
1413
+ /** List recent activity events. */
1414
+ list(params?: ActivityListParams): Promise<ListResponse<ActivityEvent>>;
1415
+ }
1416
+
1417
+ /** A customer group/segment. */
1418
+ interface CustomerGroup {
1419
+ id: string;
1420
+ object: 'customer_group';
1421
+ name: string;
1422
+ description: string | null;
1423
+ filters: Record<string, unknown>;
1424
+ customerCount: number;
1425
+ createdAt: string;
1426
+ updatedAt: string;
1427
+ }
1428
+ /** Parameters for listing customer groups. */
1429
+ interface CustomerGroupListParams extends PaginationParams {
1430
+ search?: string;
1431
+ }
1432
+ /** Parameters for creating a customer group. */
1433
+ interface CustomerGroupCreateParams {
1434
+ name: string;
1435
+ description?: string;
1436
+ filters?: Record<string, unknown>;
1437
+ }
1438
+ /** Parameters for updating a customer group. */
1439
+ interface CustomerGroupUpdateParams {
1440
+ name?: string;
1441
+ description?: string;
1442
+ filters?: Record<string, unknown>;
1443
+ }
1444
+
1445
+ /** Manage customer groups/segments. */
1446
+ declare class CustomerGroupsResource extends BaseResource<CustomerGroup, CustomerGroupListParams, CustomerGroupCreateParams, CustomerGroupUpdateParams> {
1447
+ constructor(client: HttpClient);
1448
+ }
1449
+
1450
+ /** Player stats. */
1451
+ interface Player {
1452
+ object: 'player';
1453
+ userId: string;
1454
+ name: string | null;
1455
+ level: number;
1456
+ xp: number;
1457
+ xpToNextLevel: number;
1458
+ totalXp: number;
1459
+ streak: number;
1460
+ ticketsResolved: number;
1461
+ rank: number | null;
1462
+ scores: {
1463
+ daily: number;
1464
+ weekly: number;
1465
+ allTime: number;
1466
+ };
1467
+ [key: string]: unknown;
1468
+ }
1469
+ /** Boss state. */
1470
+ interface Boss {
1471
+ object: 'boss';
1472
+ active: boolean;
1473
+ name: string | null;
1474
+ title: string | null;
1475
+ difficulty: string | null;
1476
+ health: number;
1477
+ maxHealth: number;
1478
+ healthPercent: number;
1479
+ abilities: Record<string, unknown> | null;
1480
+ participants: Array<{
1481
+ userId: string;
1482
+ name: string | null;
1483
+ damage: number;
1484
+ }>;
1485
+ spawnedAt: string | null;
1486
+ }
1487
+ /** Boss damage result. */
1488
+ interface BossDamageResult {
1489
+ object: 'boss_damage';
1490
+ damage: number;
1491
+ bossHealth: number;
1492
+ bossMaxHealth: number;
1493
+ defeated: boolean;
1494
+ [key: string]: unknown;
1495
+ }
1496
+ /** Boss defeat record. */
1497
+ interface BossDefeat {
1498
+ id: string;
1499
+ object: 'boss_defeat';
1500
+ bossName: string;
1501
+ difficulty: string;
1502
+ defeatedAt: string;
1503
+ participants: Array<{
1504
+ userId: string;
1505
+ name: string | null;
1506
+ damage: number;
1507
+ }>;
1508
+ [key: string]: unknown;
1509
+ }
1510
+ /** Parameters for listing boss defeats. */
1511
+ interface BossDefeatListParams extends PaginationParams {
1512
+ }
1513
+ /** Parameters for spawning a boss. */
1514
+ interface BossSpawnParams {
1515
+ difficulty?: 'easy' | 'medium' | 'hard';
1516
+ }
1517
+ /** Parameters for dealing boss damage. */
1518
+ interface BossDamageParams {
1519
+ userId: string;
1520
+ ticketId: string;
1521
+ }
1522
+ /** Leaderboard entry. */
1523
+ interface LeaderboardEntry {
1524
+ object: 'leaderboard_entry';
1525
+ rank: number;
1526
+ userId: string;
1527
+ name: string | null;
1528
+ avatarUrl: string | null;
1529
+ score: number;
1530
+ level: number;
1531
+ }
1532
+ /** Leaderboard parameters. */
1533
+ interface LeaderboardParams extends PaginationParams {
1534
+ period?: 'daily' | 'weekly' | 'allTime';
1535
+ }
1536
+ /** An achievement. */
1537
+ interface Achievement {
1538
+ id: string;
1539
+ object: 'achievement';
1540
+ name: string;
1541
+ description: string | null;
1542
+ category: string | null;
1543
+ icon: string | null;
1544
+ xpReward: number;
1545
+ unlocked: boolean;
1546
+ unlockedAt: string | null;
1547
+ progress?: {
1548
+ current: number;
1549
+ target: number;
1550
+ };
1551
+ }
1552
+ /** Parameters for listing achievements. */
1553
+ interface AchievementListParams extends PaginationParams {
1554
+ category?: string;
1555
+ }
1556
+ /** A daily quest. */
1557
+ interface Quest {
1558
+ id: string;
1559
+ object: 'quest';
1560
+ title: string;
1561
+ description: string | null;
1562
+ type: string;
1563
+ target: number;
1564
+ current: number;
1565
+ completed: boolean;
1566
+ xpReward: number;
1567
+ completedAt: string | null;
1568
+ }
1569
+ /** A daily puzzle. */
1570
+ interface Puzzle {
1571
+ id: string;
1572
+ object: 'puzzle';
1573
+ type: string;
1574
+ difficulty: string;
1575
+ data: Record<string, unknown>;
1576
+ completed: boolean;
1577
+ xpReward: number;
1578
+ }
1579
+ /** Puzzle completion parameters. */
1580
+ interface PuzzleCompleteParams {
1581
+ userId: string;
1582
+ answer: string;
1583
+ }
1584
+ /** Puzzle completion result. */
1585
+ interface PuzzleCompleteResult {
1586
+ object: 'puzzle_result';
1587
+ correct: boolean;
1588
+ xpAwarded: number;
1589
+ streak: number;
1590
+ }
1591
+ /** Puzzle streak info. */
1592
+ interface PuzzleStreak {
1593
+ object: 'puzzle_streak';
1594
+ userId: string;
1595
+ currentStreak: number;
1596
+ longestStreak: number;
1597
+ totalCompleted: number;
1598
+ }
1599
+ /** A one-up (kudos to a teammate). */
1600
+ interface OneUp {
1601
+ id: string;
1602
+ object: 'one_up';
1603
+ senderId: string;
1604
+ senderName: string | null;
1605
+ recipientId: string;
1606
+ recipientName: string | null;
1607
+ message: string | null;
1608
+ createdAt: string;
1609
+ }
1610
+ /** Parameters for listing one-ups. */
1611
+ interface OneUpListParams extends PaginationParams {
1612
+ userId?: string;
1613
+ }
1614
+ /** Parameters for sending a one-up. */
1615
+ interface OneUpCreateParams {
1616
+ recipientId: string;
1617
+ message?: string;
1618
+ userId: string;
1619
+ }
1620
+ /** Remaining one-ups info. */
1621
+ interface OneUpRemaining {
1622
+ object: 'one_up_remaining';
1623
+ remaining: number;
1624
+ limit: number;
1625
+ resetsAt: string;
1626
+ }
1627
+ /** A high five (kudos between teams). */
1628
+ interface HighFive {
1629
+ id: string;
1630
+ object: 'high_five';
1631
+ senderTeamId: string;
1632
+ senderTeamName: string | null;
1633
+ recipientTeamId: string;
1634
+ recipientTeamName: string | null;
1635
+ senderId: string;
1636
+ senderName: string | null;
1637
+ message: string | null;
1638
+ createdAt: string;
1639
+ }
1640
+ /** Parameters for listing high fives. */
1641
+ interface HighFiveListParams extends PaginationParams {
1642
+ }
1643
+ /** Parameters for sending a high five. */
1644
+ interface HighFiveCreateParams {
1645
+ recipientTeamId: string;
1646
+ message?: string;
1647
+ userId: string;
1648
+ }
1649
+ /** Can-send check result. */
1650
+ interface HighFiveCanSend {
1651
+ object: 'high_five_can_send';
1652
+ canSend: boolean;
1653
+ reason: string | null;
1654
+ }
1655
+ /** An unlocked cosmetic. */
1656
+ interface Cosmetic {
1657
+ id: string;
1658
+ object: 'cosmetic';
1659
+ type: string;
1660
+ name: string;
1661
+ rarity: string | null;
1662
+ unlockedAt: string;
1663
+ }
1664
+ /** Cosmetic preferences. */
1665
+ interface CosmeticPreferences {
1666
+ object: 'cosmetic_preferences';
1667
+ [key: string]: unknown;
1668
+ }
1669
+ /** A game season. */
1670
+ interface Season {
1671
+ id: string;
1672
+ object: 'season';
1673
+ name: string;
1674
+ number: number;
1675
+ startDate: string;
1676
+ endDate: string;
1677
+ active: boolean;
1678
+ daysRemaining: number | null;
1679
+ }
1680
+ /** Season stats for a user. */
1681
+ interface SeasonStats {
1682
+ object: 'season_stats';
1683
+ seasonId: string;
1684
+ userId: string;
1685
+ xp: number;
1686
+ level: number;
1687
+ ticketsResolved: number;
1688
+ [key: string]: unknown;
1689
+ }
1690
+ /** Skill tree data. */
1691
+ interface SkillTree {
1692
+ object: 'skill_tree';
1693
+ skills: Array<{
1694
+ id: string;
1695
+ name: string;
1696
+ description: string;
1697
+ category: string;
1698
+ maxLevel: number;
1699
+ currentLevel: number;
1700
+ bonuses: Record<string, unknown>;
1701
+ }>;
1702
+ availablePoints: number;
1703
+ totalPointsSpent: number;
1704
+ }
1705
+ /** Skill allocation parameters. */
1706
+ interface SkillAllocateParams {
1707
+ skillId: string;
1708
+ userId: string;
1709
+ }
1710
+ /** Skill allocation result. */
1711
+ interface SkillAllocateResult {
1712
+ object: 'skill_allocate';
1713
+ skillId: string;
1714
+ newLevel: number;
1715
+ remainingPoints: number;
1716
+ }
1717
+
1718
+ declare class BossResource {
1719
+ private readonly client;
1720
+ constructor(client: HttpClient);
1721
+ /** Get current boss state. */
1722
+ current(): Promise<ApiResponse<Boss>>;
1723
+ /** Check if a boss is active (lightweight). */
1724
+ isActive(): Promise<ApiResponse<{
1725
+ active: boolean;
1726
+ }>>;
1727
+ /** Spawn a new boss. */
1728
+ spawn(params?: BossSpawnParams, options?: RequestOptions): Promise<ApiResponse<Boss>>;
1729
+ /** Deal damage to the current boss. */
1730
+ damage(params: BossDamageParams, options?: RequestOptions): Promise<ApiResponse<BossDamageResult>>;
1731
+ /** List boss defeat history. */
1732
+ defeats(params?: BossDefeatListParams): Promise<ListResponse<BossDefeat>>;
1733
+ /** Get a single defeat record. */
1734
+ getDefeat(defeatId: string): Promise<ApiResponse<BossDefeat>>;
1735
+ }
1736
+ declare class AchievementsResource {
1737
+ private readonly client;
1738
+ constructor(client: HttpClient);
1739
+ /** List all achievements with progress. */
1740
+ list(params?: AchievementListParams): Promise<ApiResponse<{
1741
+ achievements: Achievement[];
1742
+ totalUnlocked: number;
1743
+ total: number;
1744
+ }>>;
1745
+ /** List unlocked achievements only. */
1746
+ unlocked(params?: {
1747
+ userId: string;
1748
+ }): Promise<ApiResponse<Achievement[]>>;
1749
+ /** Get a single achievement. */
1750
+ get(achievementId: string, params?: {
1751
+ userId?: string;
1752
+ }): Promise<ApiResponse<Achievement>>;
1753
+ }
1754
+ declare class QuestsResource {
1755
+ private readonly client;
1756
+ constructor(client: HttpClient);
1757
+ /** Get today's quests. */
1758
+ today(params?: {
1759
+ userId?: string;
1760
+ }): Promise<ApiResponse<Quest[]>>;
1761
+ /** Get quest history. */
1762
+ history(params?: {
1763
+ userId?: string;
1764
+ page?: number;
1765
+ pageSize?: number;
1766
+ }): Promise<ApiResponse<unknown>>;
1767
+ }
1768
+ declare class PuzzlesResource {
1769
+ private readonly client;
1770
+ constructor(client: HttpClient);
1771
+ /** Get today's puzzle. */
1772
+ today(params?: {
1773
+ userId?: string;
1774
+ }): Promise<ApiResponse<Puzzle>>;
1775
+ /** Submit a puzzle answer. */
1776
+ complete(params: PuzzleCompleteParams, options?: RequestOptions): Promise<ApiResponse<PuzzleCompleteResult>>;
1777
+ /** Get puzzle streak for a user. */
1778
+ streak(params: {
1779
+ userId: string;
1780
+ }): Promise<ApiResponse<PuzzleStreak>>;
1781
+ /** Get puzzle leaderboard. */
1782
+ leaderboard(params?: {
1783
+ type?: 'scores' | 'streaks';
1784
+ limit?: number;
1785
+ }): Promise<ApiResponse<unknown>>;
1786
+ }
1787
+ declare class OneUpsResource {
1788
+ private readonly client;
1789
+ constructor(client: HttpClient);
1790
+ /** List one-ups. */
1791
+ list(params?: OneUpListParams): Promise<ListResponse<OneUp>>;
1792
+ /** Send a one-up. */
1793
+ send(params: OneUpCreateParams, options?: RequestOptions): Promise<ApiResponse<OneUp>>;
1794
+ /** Check remaining free one-ups today. */
1795
+ remaining(params: {
1796
+ userId: string;
1797
+ }): Promise<ApiResponse<OneUpRemaining>>;
1798
+ }
1799
+ declare class HighFivesResource {
1800
+ private readonly client;
1801
+ constructor(client: HttpClient);
1802
+ /** List high fives. */
1803
+ list(params?: HighFiveListParams): Promise<ListResponse<HighFive>>;
1804
+ /** Send a high five. */
1805
+ send(params: HighFiveCreateParams, options?: RequestOptions): Promise<ApiResponse<HighFive>>;
1806
+ /** Check if you can send a high five to a team. */
1807
+ canSend(recipientTeamId: string, params: {
1808
+ userId: string;
1809
+ }): Promise<ApiResponse<HighFiveCanSend>>;
1810
+ }
1811
+ declare class CosmeticsResource {
1812
+ private readonly client;
1813
+ constructor(client: HttpClient);
1814
+ /** List unlocked cosmetics. */
1815
+ list(params?: {
1816
+ userId?: string;
1817
+ }): Promise<ApiResponse<Cosmetic[]>>;
1818
+ /** Get cosmetic preferences. */
1819
+ getPreferences(params: {
1820
+ userId: string;
1821
+ }): Promise<ApiResponse<CosmeticPreferences>>;
1822
+ /** Update cosmetic preferences. */
1823
+ updatePreferences(params: Record<string, unknown>): Promise<ApiResponse<CosmeticPreferences>>;
1824
+ }
1825
+ declare class SeasonsResource {
1826
+ private readonly client;
1827
+ constructor(client: HttpClient);
1828
+ /** List all seasons. */
1829
+ list(): Promise<ApiResponse<Season[]>>;
1830
+ /** Get the current active season. */
1831
+ current(): Promise<ApiResponse<Season>>;
1832
+ /** Get user stats for a season. */
1833
+ stats(seasonId: string, params: {
1834
+ userId: string;
1835
+ }): Promise<ApiResponse<SeasonStats>>;
1836
+ }
1837
+ declare class SkillsResource {
1838
+ private readonly client;
1839
+ constructor(client: HttpClient);
1840
+ /** Get the skill tree with current allocations. */
1841
+ get(params: {
1842
+ userId: string;
1843
+ }): Promise<ApiResponse<SkillTree>>;
1844
+ /** Allocate a skill point. */
1845
+ allocate(params: SkillAllocateParams, options?: RequestOptions): Promise<ApiResponse<SkillAllocateResult>>;
1846
+ /** Reset all skill allocations. */
1847
+ reset(params: {
1848
+ userId: string;
1849
+ }, options?: RequestOptions): Promise<ApiResponse<SkillTree>>;
1850
+ }
1851
+ /** Access all gamification features. */
1852
+ declare class GameResource {
1853
+ private readonly client;
1854
+ /** Boss battles. */
1855
+ readonly boss: BossResource;
1856
+ /** Achievements. */
1857
+ readonly achievements: AchievementsResource;
1858
+ /** Daily quests. */
1859
+ readonly quests: QuestsResource;
1860
+ /** Daily puzzles. */
1861
+ readonly puzzles: PuzzlesResource;
1862
+ /** One-ups (teammate kudos). */
1863
+ readonly oneUps: OneUpsResource;
1864
+ /** High fives (team-to-team kudos). */
1865
+ readonly highFives: HighFivesResource;
1866
+ /** Cosmetics. */
1867
+ readonly cosmetics: CosmeticsResource;
1868
+ /** Seasons. */
1869
+ readonly seasons: SeasonsResource;
1870
+ /** Skill tree. */
1871
+ readonly skills: SkillsResource;
1872
+ constructor(client: HttpClient);
1873
+ /** Get current player stats. */
1874
+ player(params?: {
1875
+ userId?: string;
1876
+ }): Promise<ApiResponse<Player>>;
1877
+ /** Get a specific player's stats by membership ID. */
1878
+ getPlayer(memberId: string): Promise<ApiResponse<Player>>;
1879
+ /** Get the team leaderboard. */
1880
+ leaderboard(params?: LeaderboardParams): Promise<ApiResponse<LeaderboardEntry[]>>;
1881
+ /** Get the current user's leaderboard position. */
1882
+ myRank(params?: {
1883
+ userId?: string;
1884
+ period?: string;
1885
+ }): Promise<ApiResponse<LeaderboardEntry>>;
1886
+ }
1887
+
1888
+ /** AI action types. */
1889
+ type AiAction = 'auto-tag' | 'suggest-reply' | 'summarize' | 'improve';
1890
+ /** Parameters for an AI action. */
1891
+ interface AiActionParams {
1892
+ action: AiAction;
1893
+ ticketId?: string;
1894
+ text?: string;
1895
+ context?: Record<string, unknown>;
1896
+ }
1897
+ /** AI action result. */
1898
+ interface AiActionResult {
1899
+ object: 'ai_result';
1900
+ action: AiAction;
1901
+ result: unknown;
1902
+ }
1903
+
1904
+ /** AI-powered actions (auto-tag, suggest reply, summarize, improve). */
1905
+ declare class AiResource {
1906
+ private readonly client;
1907
+ constructor(client: HttpClient);
1908
+ /** Run an AI action. */
1909
+ run(params: AiActionParams, options?: RequestOptions): Promise<ApiResponse<AiActionResult>>;
1910
+ /** Auto-tag a ticket. */
1911
+ autoTag(ticketId: string): Promise<ApiResponse<AiActionResult>>;
1912
+ /** Suggest a reply for a ticket. */
1913
+ suggestReply(ticketId: string): Promise<ApiResponse<AiActionResult>>;
1914
+ /** Summarize a ticket. */
1915
+ summarize(ticketId: string): Promise<ApiResponse<AiActionResult>>;
1916
+ /** Improve text. */
1917
+ improve(text: string): Promise<ApiResponse<AiActionResult>>;
1918
+ }
1919
+
1920
+ /** A saved view / filter preset. */
1921
+ interface SavedView {
1922
+ id: string;
1923
+ object: 'saved_view';
1924
+ name: string;
1925
+ description: string | null;
1926
+ entityType: 'tickets' | 'customers' | 'articles' | 'community_posts';
1927
+ filters: Record<string, unknown>;
1928
+ sortField: string;
1929
+ sortDirection: 'asc' | 'desc';
1930
+ visibility: 'private' | 'team';
1931
+ createdBy: string | null;
1932
+ createdAt: string;
1933
+ updatedAt: string;
1934
+ }
1935
+ /** Parameters for listing views. */
1936
+ interface ViewListParams extends PaginationParams {
1937
+ entityType?: string;
1938
+ }
1939
+ /** Parameters for creating a view. */
1940
+ interface ViewCreateParams {
1941
+ name: string;
1942
+ description?: string;
1943
+ entityType: 'tickets' | 'customers' | 'articles' | 'community_posts';
1944
+ filters?: Record<string, unknown>;
1945
+ sortField?: string;
1946
+ sortDirection?: 'asc' | 'desc';
1947
+ visibility?: 'private' | 'team';
1948
+ }
1949
+ /** Parameters for updating a view. */
1950
+ interface ViewUpdateParams {
1951
+ name?: string;
1952
+ description?: string;
1953
+ filters?: Record<string, unknown>;
1954
+ sortField?: string;
1955
+ sortDirection?: 'asc' | 'desc';
1956
+ visibility?: 'private' | 'team';
1957
+ }
1958
+ /** Parameters for executing a view. */
1959
+ interface ViewExecuteParams extends PaginationParams {
1960
+ }
1961
+
1962
+ /** Manage saved views (saved filters). */
1963
+ declare class ViewsResource extends BaseResource<SavedView, ViewListParams, ViewCreateParams, ViewUpdateParams> {
1964
+ constructor(client: HttpClient);
1965
+ /** Execute a view — returns the filtered results. */
1966
+ execute(viewId: string, params?: ViewExecuteParams): Promise<ListResponse<unknown>>;
1967
+ }
1968
+
1969
+ /** Subscription status. */
1970
+ interface Subscription {
1971
+ object: 'subscription';
1972
+ status: string;
1973
+ plan: string | null;
1974
+ currentPeriodStart: string | null;
1975
+ currentPeriodEnd: string | null;
1976
+ cancelAtPeriodEnd: boolean;
1977
+ memberCount: number;
1978
+ [key: string]: unknown;
1979
+ }
1980
+ /** Billing portal result. */
1981
+ interface BillingPortal {
1982
+ object: 'billing_portal';
1983
+ url: string;
1984
+ }
1985
+ /** Parameters for creating a billing portal session. */
1986
+ interface BillingPortalParams {
1987
+ returnUrl?: string;
1988
+ }
1989
+
1990
+ /** Access billing and subscription data. */
1991
+ declare class BillingResource {
1992
+ private readonly client;
1993
+ constructor(client: HttpClient);
1994
+ /** Get current subscription status. */
1995
+ subscription(): Promise<ApiResponse<Subscription>>;
1996
+ /** Create a Stripe billing portal session. */
1997
+ portal(params?: BillingPortalParams): Promise<ApiResponse<BillingPortal>>;
1998
+ }
1999
+
575
2000
  /** Error type constants matching the cStar API. */
576
2001
  declare const ErrorType: {
577
2002
  readonly AUTHENTICATION_ERROR: "authentication_error";
@@ -653,6 +2078,8 @@ declare class CStarClient {
653
2078
  readonly articles: ArticlesResource;
654
2079
  /** Manage webhook endpoints. */
655
2080
  readonly webhooks: WebhooksResource;
2081
+ /** Manage automation rules. */
2082
+ readonly automations: AutomationsResource;
656
2083
  /** Manage article categories. */
657
2084
  readonly categories: CategoriesResource;
658
2085
  /** Manage community posts and topics. */
@@ -660,10 +2087,48 @@ declare class CStarClient {
660
2087
  readonly posts: CommunityPostsResource;
661
2088
  readonly topics: CommunityTopicsResource;
662
2089
  };
2090
+ /** Manage team members and invites. */
2091
+ readonly members: MembersResource;
2092
+ /** Manage team settings, statuses, quick replies, business hours, and widget. */
2093
+ readonly settings: SettingsResource;
2094
+ /** Manage notifications. */
2095
+ readonly notifications: NotificationsResource;
2096
+ /** Manage file attachments. */
2097
+ readonly attachments: AttachmentsResource;
2098
+ /** Manage custom field definitions. */
2099
+ readonly customFields: CustomFieldsResource;
2100
+ /** Manage SLA rules. */
2101
+ readonly sla: SlaResource;
2102
+ /** Access analytics and CSAT data. */
2103
+ readonly analytics: AnalyticsResource;
2104
+ /** Perform bulk operations. */
2105
+ readonly bulk: BulkResource;
2106
+ /** Export data. */
2107
+ readonly export: ExportResource;
2108
+ /** Import data. */
2109
+ readonly import: ImportResource;
2110
+ /** Access the audit log. */
2111
+ readonly auditLog: AuditLogResource;
2112
+ /** Search across resources. */
2113
+ readonly search: SearchResource;
2114
+ /** Manage tags. */
2115
+ readonly tags: TagsResource;
2116
+ /** Access the activity feed. */
2117
+ readonly activity: ActivityResource;
2118
+ /** Manage customer groups/segments. */
2119
+ readonly customerGroups: CustomerGroupsResource;
2120
+ /** Access all gamification features. */
2121
+ readonly game: GameResource;
2122
+ /** AI-powered actions. */
2123
+ readonly ai: AiResource;
2124
+ /** Manage saved views. */
2125
+ readonly views: ViewsResource;
2126
+ /** Access billing and subscription data. */
2127
+ readonly billing: BillingResource;
663
2128
  private readonly client;
664
2129
  constructor(config: CStarClientConfig);
665
2130
  /** Whether this client is using test mode keys (sk_test_* or pk_test_*). */
666
2131
  get isTestMode(): boolean;
667
2132
  }
668
2133
 
669
- export { type ApiErrorBody, type ApiResponse, type Article, type ArticleCreateParams, type ArticleListParams, type ArticleUpdateParams, 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 Customer, type CustomerCreateParams, type CustomerListParams, type CustomerUpdateParams, type DeleteResponse, ErrorType, type ListResponse, type Message, type MessageCreateParams, type Metadata, type PaginationInfo, type PaginationParams, type RequestOptions, type Ticket, type TicketCreateParams, type TicketCustomerSummary, type TicketListParams, type TicketUpdateParams, type Webhook, type WebhookCreateParams, type WebhookEvent, type WebhookEventData, type WebhookEventType, type WebhookListParams, type WebhookTestResult, type WebhookUpdateParams };
2134
+ export { type Achievement, type AchievementListParams, type ActivityEvent, type ActivityListParams, type AgentStats, 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 CsatResponse, type CsatStats, type CustomField, type CustomFieldCreateParams, type CustomFieldListParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerGroup, type CustomerGroupCreateParams, type CustomerGroupListParams, type CustomerGroupUpdateParams, type CustomerListParams, type CustomerUpdateParams, type DeleteResponse, ErrorType, type ExportCreateParams, type ExportResult, 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 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 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 WebhookTestResult, type WebhookUpdateParams, type WidgetSettings, type WidgetSettingsUpdateParams };