@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/README.md +195 -87
- package/dist/index.cjs +856 -0
- package/dist/index.d.cts +1466 -1
- package/dist/index.d.ts +1466 -1
- package/dist/index.js +856 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -334,6 +334,65 @@ var WebhooksResource = class extends BaseResource {
|
|
|
334
334
|
}
|
|
335
335
|
};
|
|
336
336
|
|
|
337
|
+
// src/resources/automations.ts
|
|
338
|
+
var AutomationsResource = class extends BaseResource {
|
|
339
|
+
constructor(client) {
|
|
340
|
+
super(client, "/automations");
|
|
341
|
+
}
|
|
342
|
+
/** Toggle a rule's enabled state. */
|
|
343
|
+
async toggle(ruleId, enabled) {
|
|
344
|
+
return this.client.request(
|
|
345
|
+
"PATCH",
|
|
346
|
+
`/automations/${ruleId}/toggle`,
|
|
347
|
+
{ body: enabled !== void 0 ? { enabled } : {} }
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
/** Reorder rules by providing an ordered array of IDs. */
|
|
351
|
+
async reorder(orderedIds) {
|
|
352
|
+
return this.client.request("PUT", "/automations/reorder", {
|
|
353
|
+
body: { orderedIds }
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
/** Dry-run a rule against a specific resource (no actions executed). */
|
|
357
|
+
async test(ruleId, params) {
|
|
358
|
+
return this.client.request(
|
|
359
|
+
"POST",
|
|
360
|
+
`/automations/${ruleId}/test`,
|
|
361
|
+
{ body: params }
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
/** Get execution history for a specific rule. */
|
|
365
|
+
async executions(ruleId, params) {
|
|
366
|
+
const searchParams = new URLSearchParams();
|
|
367
|
+
if (params?.page) searchParams.set("page", String(params.page));
|
|
368
|
+
if (params?.pageSize) searchParams.set("pageSize", String(params.pageSize));
|
|
369
|
+
if (params?.triggerEvent) searchParams.set("triggerEvent", params.triggerEvent);
|
|
370
|
+
if (params?.resourceId) searchParams.set("resourceId", params.resourceId);
|
|
371
|
+
const qs = searchParams.toString();
|
|
372
|
+
return this.client.request(
|
|
373
|
+
"GET",
|
|
374
|
+
`/automations/${ruleId}/executions${qs ? `?${qs}` : ""}`
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
/** Get all execution history for the team. */
|
|
378
|
+
async allExecutions(params) {
|
|
379
|
+
const searchParams = new URLSearchParams();
|
|
380
|
+
if (params?.page) searchParams.set("page", String(params.page));
|
|
381
|
+
if (params?.pageSize) searchParams.set("pageSize", String(params.pageSize));
|
|
382
|
+
if (params?.triggerEvent) searchParams.set("triggerEvent", params.triggerEvent);
|
|
383
|
+
if (params?.resourceId) searchParams.set("resourceId", params.resourceId);
|
|
384
|
+
const qs = searchParams.toString();
|
|
385
|
+
return this.client.request(
|
|
386
|
+
"GET",
|
|
387
|
+
`/automations/executions${qs ? `?${qs}` : ""}`
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
/** Test conditions against sample data (without a rule). */
|
|
391
|
+
async evaluate(params) {
|
|
392
|
+
return this.client.request("POST", "/automations/evaluate", { body: params });
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
337
396
|
// src/resources/categories.ts
|
|
338
397
|
var CategoriesResource = class extends BaseResource {
|
|
339
398
|
constructor(client) {
|
|
@@ -384,6 +443,783 @@ var CommunityTopicsResource = class extends BaseResource {
|
|
|
384
443
|
}
|
|
385
444
|
};
|
|
386
445
|
|
|
446
|
+
// src/resources/members.ts
|
|
447
|
+
var InvitesResource = class {
|
|
448
|
+
constructor(client) {
|
|
449
|
+
this.client = client;
|
|
450
|
+
}
|
|
451
|
+
/** List pending invites. */
|
|
452
|
+
async list(params) {
|
|
453
|
+
return this.client.request("GET", "/invites", {
|
|
454
|
+
query: params
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
/** Create and send a new invite. */
|
|
458
|
+
async create(params, options) {
|
|
459
|
+
return this.client.request("POST", "/invites", {
|
|
460
|
+
body: params,
|
|
461
|
+
idempotencyKey: options?.idempotencyKey
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
/** Revoke a pending invite. */
|
|
465
|
+
async del(inviteId) {
|
|
466
|
+
return this.client.request("DELETE", `/invites/${inviteId}`);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
var MembersResource = class {
|
|
470
|
+
constructor(client) {
|
|
471
|
+
this.client = client;
|
|
472
|
+
this.invites = new InvitesResource(client);
|
|
473
|
+
}
|
|
474
|
+
/** List all team members. */
|
|
475
|
+
async list(params) {
|
|
476
|
+
return this.client.request("GET", "/members", {
|
|
477
|
+
query: params
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
/** Get a single member by membership ID. */
|
|
481
|
+
async get(memberId) {
|
|
482
|
+
return this.client.request("GET", `/members/${memberId}`);
|
|
483
|
+
}
|
|
484
|
+
/** Update a member's role. */
|
|
485
|
+
async update(memberId, params) {
|
|
486
|
+
return this.client.request("PATCH", `/members/${memberId}`, {
|
|
487
|
+
body: params
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
/** Remove a member from the team. */
|
|
491
|
+
async del(memberId) {
|
|
492
|
+
return this.client.request("DELETE", `/members/${memberId}`);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
// src/resources/settings.ts
|
|
497
|
+
var StatusesResource = class {
|
|
498
|
+
constructor(client) {
|
|
499
|
+
this.client = client;
|
|
500
|
+
}
|
|
501
|
+
/** List all statuses. */
|
|
502
|
+
async list() {
|
|
503
|
+
return this.client.request("GET", "/settings/statuses");
|
|
504
|
+
}
|
|
505
|
+
/** Create a new status. */
|
|
506
|
+
async create(params, options) {
|
|
507
|
+
return this.client.request("POST", "/settings/statuses", {
|
|
508
|
+
body: params,
|
|
509
|
+
idempotencyKey: options?.idempotencyKey
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
/** Update a status. */
|
|
513
|
+
async update(statusKey, params) {
|
|
514
|
+
return this.client.request(
|
|
515
|
+
"PATCH",
|
|
516
|
+
`/settings/statuses/${statusKey}`,
|
|
517
|
+
{ body: params }
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
/** Delete a status. */
|
|
521
|
+
async del(statusKey) {
|
|
522
|
+
return this.client.request(
|
|
523
|
+
"DELETE",
|
|
524
|
+
`/settings/statuses/${statusKey}`
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
/** Reorder statuses. */
|
|
528
|
+
async reorder(orderedKeys) {
|
|
529
|
+
return this.client.request("PUT", "/settings/statuses/reorder", {
|
|
530
|
+
body: { orderedKeys }
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
var QuickRepliesResource = class {
|
|
535
|
+
constructor(client) {
|
|
536
|
+
this.client = client;
|
|
537
|
+
}
|
|
538
|
+
/** List all quick replies. */
|
|
539
|
+
async list() {
|
|
540
|
+
return this.client.request("GET", "/settings/quick-replies");
|
|
541
|
+
}
|
|
542
|
+
/** Create a new quick reply. */
|
|
543
|
+
async create(params, options) {
|
|
544
|
+
return this.client.request("POST", "/settings/quick-replies", {
|
|
545
|
+
body: params,
|
|
546
|
+
idempotencyKey: options?.idempotencyKey
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
/** Update a quick reply. */
|
|
550
|
+
async update(replyId, params) {
|
|
551
|
+
return this.client.request(
|
|
552
|
+
"PATCH",
|
|
553
|
+
`/settings/quick-replies/${replyId}`,
|
|
554
|
+
{ body: params }
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
/** Delete a quick reply. */
|
|
558
|
+
async del(replyId) {
|
|
559
|
+
return this.client.request(
|
|
560
|
+
"DELETE",
|
|
561
|
+
`/settings/quick-replies/${replyId}`
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
/** Reorder quick replies. */
|
|
565
|
+
async reorder(orderedIds) {
|
|
566
|
+
return this.client.request(
|
|
567
|
+
"PUT",
|
|
568
|
+
"/settings/quick-replies/reorder",
|
|
569
|
+
{ body: { orderedIds } }
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
var SettingsResource = class {
|
|
574
|
+
constructor(client) {
|
|
575
|
+
this.client = client;
|
|
576
|
+
this.statuses = new StatusesResource(client);
|
|
577
|
+
this.quickReplies = new QuickRepliesResource(client);
|
|
578
|
+
}
|
|
579
|
+
/** Get all team settings. */
|
|
580
|
+
async get() {
|
|
581
|
+
return this.client.request("GET", "/settings");
|
|
582
|
+
}
|
|
583
|
+
/** Update team settings (bulk). */
|
|
584
|
+
async update(params) {
|
|
585
|
+
return this.client.request("PATCH", "/settings", { body: params });
|
|
586
|
+
}
|
|
587
|
+
/** Get business hours configuration. */
|
|
588
|
+
async getBusinessHours() {
|
|
589
|
+
return this.client.request("GET", "/settings/business-hours");
|
|
590
|
+
}
|
|
591
|
+
/** Update business hours configuration. */
|
|
592
|
+
async updateBusinessHours(params) {
|
|
593
|
+
return this.client.request("PATCH", "/settings/business-hours", {
|
|
594
|
+
body: params
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
/** Get widget settings. */
|
|
598
|
+
async getWidget() {
|
|
599
|
+
return this.client.request("GET", "/settings/widget");
|
|
600
|
+
}
|
|
601
|
+
/** Update widget settings. */
|
|
602
|
+
async updateWidget(params) {
|
|
603
|
+
return this.client.request("PATCH", "/settings/widget", {
|
|
604
|
+
body: params
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// src/resources/notifications.ts
|
|
610
|
+
var NotificationsResource = class {
|
|
611
|
+
constructor(client) {
|
|
612
|
+
this.client = client;
|
|
613
|
+
}
|
|
614
|
+
/** List notifications. */
|
|
615
|
+
async list(params) {
|
|
616
|
+
return this.client.request("GET", "/notifications", {
|
|
617
|
+
query: params
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
/** Get unread notification count. */
|
|
621
|
+
async unreadCount() {
|
|
622
|
+
return this.client.request("GET", "/notifications/unread-count");
|
|
623
|
+
}
|
|
624
|
+
/** Mark a single notification as read. */
|
|
625
|
+
async markRead(notificationId) {
|
|
626
|
+
return this.client.request(
|
|
627
|
+
"PATCH",
|
|
628
|
+
`/notifications/${notificationId}`,
|
|
629
|
+
{ body: { read: true } }
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
/** Mark all notifications as read. */
|
|
633
|
+
async markAllRead() {
|
|
634
|
+
return this.client.request(
|
|
635
|
+
"POST",
|
|
636
|
+
"/notifications/mark-all-read"
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
// src/resources/attachments.ts
|
|
642
|
+
var AttachmentsResource = class {
|
|
643
|
+
constructor(client) {
|
|
644
|
+
this.client = client;
|
|
645
|
+
}
|
|
646
|
+
/** List attachments. */
|
|
647
|
+
async list(params) {
|
|
648
|
+
return this.client.request("GET", "/attachments", {
|
|
649
|
+
query: params
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
/** Get a single attachment. */
|
|
653
|
+
async get(attachmentId) {
|
|
654
|
+
return this.client.request("GET", `/attachments/${attachmentId}`);
|
|
655
|
+
}
|
|
656
|
+
/** Delete an attachment. */
|
|
657
|
+
async del(attachmentId) {
|
|
658
|
+
return this.client.request(
|
|
659
|
+
"DELETE",
|
|
660
|
+
`/attachments/${attachmentId}`
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
// src/resources/customFields.ts
|
|
666
|
+
var CustomFieldsResource = class {
|
|
667
|
+
constructor(client) {
|
|
668
|
+
this.client = client;
|
|
669
|
+
}
|
|
670
|
+
/** List custom fields. */
|
|
671
|
+
async list(params) {
|
|
672
|
+
return this.client.request("GET", "/custom-fields", {
|
|
673
|
+
query: params
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
/** Get a single custom field. */
|
|
677
|
+
async get(fieldId) {
|
|
678
|
+
return this.client.request("GET", `/custom-fields/${fieldId}`);
|
|
679
|
+
}
|
|
680
|
+
/** Create a custom field. */
|
|
681
|
+
async create(params, options) {
|
|
682
|
+
return this.client.request("POST", "/custom-fields", {
|
|
683
|
+
body: params,
|
|
684
|
+
idempotencyKey: options?.idempotencyKey
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
/** Update a custom field. */
|
|
688
|
+
async update(fieldId, params) {
|
|
689
|
+
return this.client.request("PATCH", `/custom-fields/${fieldId}`, {
|
|
690
|
+
body: params
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
/** Delete a custom field. */
|
|
694
|
+
async del(fieldId) {
|
|
695
|
+
return this.client.request("DELETE", `/custom-fields/${fieldId}`);
|
|
696
|
+
}
|
|
697
|
+
/** Reorder custom fields. */
|
|
698
|
+
async reorder(orderedIds) {
|
|
699
|
+
return this.client.request("PUT", "/custom-fields/reorder", {
|
|
700
|
+
body: { orderedIds }
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
// src/resources/sla.ts
|
|
706
|
+
var SlaResource = class {
|
|
707
|
+
constructor(client) {
|
|
708
|
+
this.client = client;
|
|
709
|
+
}
|
|
710
|
+
/** List SLA rules. */
|
|
711
|
+
async list(params) {
|
|
712
|
+
return this.client.request("GET", "/sla/rules", {
|
|
713
|
+
query: params
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
/** Get a single SLA rule. */
|
|
717
|
+
async get(ruleId) {
|
|
718
|
+
return this.client.request("GET", `/sla/rules/${ruleId}`);
|
|
719
|
+
}
|
|
720
|
+
/** Create an SLA rule. */
|
|
721
|
+
async create(params, options) {
|
|
722
|
+
return this.client.request("POST", "/sla/rules", {
|
|
723
|
+
body: params,
|
|
724
|
+
idempotencyKey: options?.idempotencyKey
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
/** Update an SLA rule. */
|
|
728
|
+
async update(ruleId, params) {
|
|
729
|
+
return this.client.request("PATCH", `/sla/rules/${ruleId}`, {
|
|
730
|
+
body: params
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
/** Delete an SLA rule. */
|
|
734
|
+
async del(ruleId) {
|
|
735
|
+
return this.client.request("DELETE", `/sla/rules/${ruleId}`);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
// src/resources/analytics.ts
|
|
740
|
+
var AnalyticsResource = class {
|
|
741
|
+
constructor(client) {
|
|
742
|
+
this.client = client;
|
|
743
|
+
}
|
|
744
|
+
/** Get analytics overview. */
|
|
745
|
+
async overview(params) {
|
|
746
|
+
return this.client.request("GET", "/analytics/overview", {
|
|
747
|
+
query: params
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
/** Get per-agent performance stats. */
|
|
751
|
+
async agents(params) {
|
|
752
|
+
return this.client.request("GET", "/analytics/agents", {
|
|
753
|
+
query: params
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
/** Get CSAT statistics. */
|
|
757
|
+
async csatStats(params) {
|
|
758
|
+
return this.client.request("GET", "/csat/stats", {
|
|
759
|
+
query: params
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
/** List individual CSAT responses. */
|
|
763
|
+
async csatResponses(params) {
|
|
764
|
+
return this.client.request("GET", "/csat/responses", {
|
|
765
|
+
query: params
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
// src/resources/bulk.ts
|
|
771
|
+
var BulkResource = class {
|
|
772
|
+
constructor(client) {
|
|
773
|
+
this.client = client;
|
|
774
|
+
}
|
|
775
|
+
/** Bulk update resources. */
|
|
776
|
+
async update(params, options) {
|
|
777
|
+
return this.client.request("POST", "/bulk", {
|
|
778
|
+
body: { action: "update", ...params },
|
|
779
|
+
idempotencyKey: options?.idempotencyKey
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
/** Bulk delete resources. */
|
|
783
|
+
async del(params, options) {
|
|
784
|
+
return this.client.request("POST", "/bulk", {
|
|
785
|
+
body: { action: "delete", ...params },
|
|
786
|
+
idempotencyKey: options?.idempotencyKey
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
// src/resources/exportImport.ts
|
|
792
|
+
var ExportResource = class {
|
|
793
|
+
constructor(client) {
|
|
794
|
+
this.client = client;
|
|
795
|
+
}
|
|
796
|
+
/** Create an export. Returns exported data synchronously. */
|
|
797
|
+
async create(params, options) {
|
|
798
|
+
return this.client.request("POST", "/export", {
|
|
799
|
+
body: params,
|
|
800
|
+
idempotencyKey: options?.idempotencyKey
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
var ImportResource = class {
|
|
805
|
+
constructor(client) {
|
|
806
|
+
this.client = client;
|
|
807
|
+
}
|
|
808
|
+
/** Run an import. Processes records synchronously (max 500). */
|
|
809
|
+
async create(params, options) {
|
|
810
|
+
return this.client.request("POST", "/import", {
|
|
811
|
+
body: params,
|
|
812
|
+
idempotencyKey: options?.idempotencyKey
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
/** List import history logs. */
|
|
816
|
+
async logs(params) {
|
|
817
|
+
return this.client.request("GET", "/import", {
|
|
818
|
+
query: params
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
/** Get a single import log. */
|
|
822
|
+
async getLog(logId) {
|
|
823
|
+
return this.client.request("GET", `/import/logs/${logId}`);
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
// src/resources/auditLog.ts
|
|
828
|
+
var AuditLogResource = class {
|
|
829
|
+
constructor(client) {
|
|
830
|
+
this.client = client;
|
|
831
|
+
}
|
|
832
|
+
/** List audit log entries. */
|
|
833
|
+
async list(params) {
|
|
834
|
+
return this.client.request("GET", "/audit-log", {
|
|
835
|
+
query: params
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
// src/resources/search.ts
|
|
841
|
+
var SearchResource = class {
|
|
842
|
+
constructor(client) {
|
|
843
|
+
this.client = client;
|
|
844
|
+
}
|
|
845
|
+
/** Perform a cross-resource search. */
|
|
846
|
+
async query(params) {
|
|
847
|
+
const query = {
|
|
848
|
+
q: params.query,
|
|
849
|
+
limit: params.limit?.toString()
|
|
850
|
+
};
|
|
851
|
+
if (params.types?.length) {
|
|
852
|
+
query.types = params.types.join(",");
|
|
853
|
+
}
|
|
854
|
+
return this.client.request("GET", "/search", { query });
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
// src/resources/tags.ts
|
|
859
|
+
var TagsResource = class {
|
|
860
|
+
constructor(client) {
|
|
861
|
+
this.client = client;
|
|
862
|
+
}
|
|
863
|
+
/** List all tags with usage counts. */
|
|
864
|
+
async list(params) {
|
|
865
|
+
return this.client.request("GET", "/tags", {
|
|
866
|
+
query: params
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
/** Create a tag. */
|
|
870
|
+
async create(name, options) {
|
|
871
|
+
return this.client.request("POST", "/tags", {
|
|
872
|
+
body: { name },
|
|
873
|
+
idempotencyKey: options?.idempotencyKey
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
/** Delete a tag. */
|
|
877
|
+
async del(name) {
|
|
878
|
+
return this.client.request(
|
|
879
|
+
"DELETE",
|
|
880
|
+
`/tags/${encodeURIComponent(name)}`
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
// src/resources/activity.ts
|
|
886
|
+
var ActivityResource = class {
|
|
887
|
+
constructor(client) {
|
|
888
|
+
this.client = client;
|
|
889
|
+
}
|
|
890
|
+
/** List recent activity events. */
|
|
891
|
+
async list(params) {
|
|
892
|
+
return this.client.request("GET", "/activity", {
|
|
893
|
+
query: params
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
// src/resources/customerGroups.ts
|
|
899
|
+
var CustomerGroupsResource = class extends BaseResource {
|
|
900
|
+
constructor(client) {
|
|
901
|
+
super(client, "/customer-groups");
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
// src/resources/game.ts
|
|
906
|
+
var BossResource = class {
|
|
907
|
+
constructor(client) {
|
|
908
|
+
this.client = client;
|
|
909
|
+
}
|
|
910
|
+
/** Get current boss state. */
|
|
911
|
+
async current() {
|
|
912
|
+
return this.client.request("GET", "/game/boss");
|
|
913
|
+
}
|
|
914
|
+
/** Check if a boss is active (lightweight). */
|
|
915
|
+
async isActive() {
|
|
916
|
+
return this.client.request("GET", "/game/boss/active");
|
|
917
|
+
}
|
|
918
|
+
/** Spawn a new boss. */
|
|
919
|
+
async spawn(params, options) {
|
|
920
|
+
return this.client.request("POST", "/game/boss/spawn", {
|
|
921
|
+
body: params ?? {},
|
|
922
|
+
idempotencyKey: options?.idempotencyKey
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
/** Deal damage to the current boss. */
|
|
926
|
+
async damage(params, options) {
|
|
927
|
+
return this.client.request("POST", "/game/boss/damage", {
|
|
928
|
+
body: params,
|
|
929
|
+
idempotencyKey: options?.idempotencyKey
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
/** List boss defeat history. */
|
|
933
|
+
async defeats(params) {
|
|
934
|
+
return this.client.request("GET", "/game/boss/defeats", {
|
|
935
|
+
query: params
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
/** Get a single defeat record. */
|
|
939
|
+
async getDefeat(defeatId) {
|
|
940
|
+
return this.client.request("GET", `/game/boss/defeats/${defeatId}`);
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
var AchievementsResource = class {
|
|
944
|
+
constructor(client) {
|
|
945
|
+
this.client = client;
|
|
946
|
+
}
|
|
947
|
+
/** List all achievements with progress. */
|
|
948
|
+
async list(params) {
|
|
949
|
+
return this.client.request("GET", "/game/achievements", {
|
|
950
|
+
query: params
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
/** List unlocked achievements only. */
|
|
954
|
+
async unlocked(params) {
|
|
955
|
+
return this.client.request("GET", "/game/achievements/unlocked", {
|
|
956
|
+
query: params
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
/** Get a single achievement. */
|
|
960
|
+
async get(achievementId, params) {
|
|
961
|
+
return this.client.request("GET", `/game/achievements/${achievementId}`, {
|
|
962
|
+
query: params
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
var QuestsResource = class {
|
|
967
|
+
constructor(client) {
|
|
968
|
+
this.client = client;
|
|
969
|
+
}
|
|
970
|
+
/** Get today's quests. */
|
|
971
|
+
async today(params) {
|
|
972
|
+
return this.client.request("GET", "/game/quests/today", {
|
|
973
|
+
query: params
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
/** Get quest history. */
|
|
977
|
+
async history(params) {
|
|
978
|
+
return this.client.request("GET", "/game/quests/history", {
|
|
979
|
+
query: params
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
var PuzzlesResource = class {
|
|
984
|
+
constructor(client) {
|
|
985
|
+
this.client = client;
|
|
986
|
+
}
|
|
987
|
+
/** Get today's puzzle. */
|
|
988
|
+
async today(params) {
|
|
989
|
+
return this.client.request("GET", "/game/puzzles/today", {
|
|
990
|
+
query: params
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
/** Submit a puzzle answer. */
|
|
994
|
+
async complete(params, options) {
|
|
995
|
+
return this.client.request("POST", "/game/puzzles/complete", {
|
|
996
|
+
body: params,
|
|
997
|
+
idempotencyKey: options?.idempotencyKey
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
/** Get puzzle streak for a user. */
|
|
1001
|
+
async streak(params) {
|
|
1002
|
+
return this.client.request("GET", "/game/puzzles/streak", {
|
|
1003
|
+
query: params
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
/** Get puzzle leaderboard. */
|
|
1007
|
+
async leaderboard(params) {
|
|
1008
|
+
return this.client.request("GET", "/game/puzzles/leaderboard", {
|
|
1009
|
+
query: params
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
var OneUpsResource = class {
|
|
1014
|
+
constructor(client) {
|
|
1015
|
+
this.client = client;
|
|
1016
|
+
}
|
|
1017
|
+
/** List one-ups. */
|
|
1018
|
+
async list(params) {
|
|
1019
|
+
return this.client.request("GET", "/game/one-ups", {
|
|
1020
|
+
query: params
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
/** Send a one-up. */
|
|
1024
|
+
async send(params, options) {
|
|
1025
|
+
return this.client.request("POST", "/game/one-ups", {
|
|
1026
|
+
body: params,
|
|
1027
|
+
idempotencyKey: options?.idempotencyKey
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
/** Check remaining free one-ups today. */
|
|
1031
|
+
async remaining(params) {
|
|
1032
|
+
return this.client.request("GET", "/game/one-ups/remaining", {
|
|
1033
|
+
query: params
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
var HighFivesResource = class {
|
|
1038
|
+
constructor(client) {
|
|
1039
|
+
this.client = client;
|
|
1040
|
+
}
|
|
1041
|
+
/** List high fives. */
|
|
1042
|
+
async list(params) {
|
|
1043
|
+
return this.client.request("GET", "/game/high-fives", {
|
|
1044
|
+
query: params
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
/** Send a high five. */
|
|
1048
|
+
async send(params, options) {
|
|
1049
|
+
return this.client.request("POST", "/game/high-fives", {
|
|
1050
|
+
body: params,
|
|
1051
|
+
idempotencyKey: options?.idempotencyKey
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
/** Check if you can send a high five to a team. */
|
|
1055
|
+
async canSend(recipientTeamId, params) {
|
|
1056
|
+
return this.client.request("GET", `/game/high-fives/can-send/${recipientTeamId}`, {
|
|
1057
|
+
query: params
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
var CosmeticsResource = class {
|
|
1062
|
+
constructor(client) {
|
|
1063
|
+
this.client = client;
|
|
1064
|
+
}
|
|
1065
|
+
/** List unlocked cosmetics. */
|
|
1066
|
+
async list(params) {
|
|
1067
|
+
return this.client.request("GET", "/game/cosmetics", {
|
|
1068
|
+
query: params
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
/** Get cosmetic preferences. */
|
|
1072
|
+
async getPreferences(params) {
|
|
1073
|
+
return this.client.request("GET", "/game/cosmetics/preferences", {
|
|
1074
|
+
query: params
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
/** Update cosmetic preferences. */
|
|
1078
|
+
async updatePreferences(params) {
|
|
1079
|
+
return this.client.request("PATCH", "/game/cosmetics/preferences", { body: params });
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
var SeasonsResource = class {
|
|
1083
|
+
constructor(client) {
|
|
1084
|
+
this.client = client;
|
|
1085
|
+
}
|
|
1086
|
+
/** List all seasons. */
|
|
1087
|
+
async list() {
|
|
1088
|
+
return this.client.request("GET", "/game/seasons");
|
|
1089
|
+
}
|
|
1090
|
+
/** Get the current active season. */
|
|
1091
|
+
async current() {
|
|
1092
|
+
return this.client.request("GET", "/game/seasons/current");
|
|
1093
|
+
}
|
|
1094
|
+
/** Get user stats for a season. */
|
|
1095
|
+
async stats(seasonId, params) {
|
|
1096
|
+
return this.client.request("GET", `/game/seasons/${seasonId}/stats`, {
|
|
1097
|
+
query: params
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
var SkillsResource = class {
|
|
1102
|
+
constructor(client) {
|
|
1103
|
+
this.client = client;
|
|
1104
|
+
}
|
|
1105
|
+
/** Get the skill tree with current allocations. */
|
|
1106
|
+
async get(params) {
|
|
1107
|
+
return this.client.request("GET", "/game/skills", {
|
|
1108
|
+
query: params
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
/** Allocate a skill point. */
|
|
1112
|
+
async allocate(params, options) {
|
|
1113
|
+
return this.client.request("POST", "/game/skills/allocate", {
|
|
1114
|
+
body: params,
|
|
1115
|
+
idempotencyKey: options?.idempotencyKey
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
/** Reset all skill allocations. */
|
|
1119
|
+
async reset(params, options) {
|
|
1120
|
+
return this.client.request("POST", "/game/skills/reset", {
|
|
1121
|
+
body: params,
|
|
1122
|
+
idempotencyKey: options?.idempotencyKey
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
var GameResource = class {
|
|
1127
|
+
constructor(client) {
|
|
1128
|
+
this.client = client;
|
|
1129
|
+
this.boss = new BossResource(client);
|
|
1130
|
+
this.achievements = new AchievementsResource(client);
|
|
1131
|
+
this.quests = new QuestsResource(client);
|
|
1132
|
+
this.puzzles = new PuzzlesResource(client);
|
|
1133
|
+
this.oneUps = new OneUpsResource(client);
|
|
1134
|
+
this.highFives = new HighFivesResource(client);
|
|
1135
|
+
this.cosmetics = new CosmeticsResource(client);
|
|
1136
|
+
this.seasons = new SeasonsResource(client);
|
|
1137
|
+
this.skills = new SkillsResource(client);
|
|
1138
|
+
}
|
|
1139
|
+
/** Get current player stats. */
|
|
1140
|
+
async player(params) {
|
|
1141
|
+
return this.client.request("GET", "/game/player", {
|
|
1142
|
+
query: params
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
/** Get a specific player's stats by membership ID. */
|
|
1146
|
+
async getPlayer(memberId) {
|
|
1147
|
+
return this.client.request("GET", `/game/player/${memberId}`);
|
|
1148
|
+
}
|
|
1149
|
+
/** Get the team leaderboard. */
|
|
1150
|
+
async leaderboard(params) {
|
|
1151
|
+
return this.client.request("GET", "/game/leaderboard", {
|
|
1152
|
+
query: params
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
/** Get the current user's leaderboard position. */
|
|
1156
|
+
async myRank(params) {
|
|
1157
|
+
return this.client.request("GET", "/game/leaderboard/me", {
|
|
1158
|
+
query: params
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1163
|
+
// src/resources/ai.ts
|
|
1164
|
+
var AiResource = class {
|
|
1165
|
+
constructor(client) {
|
|
1166
|
+
this.client = client;
|
|
1167
|
+
}
|
|
1168
|
+
/** Run an AI action. */
|
|
1169
|
+
async run(params, options) {
|
|
1170
|
+
return this.client.request("POST", "/ai", {
|
|
1171
|
+
body: params,
|
|
1172
|
+
idempotencyKey: options?.idempotencyKey
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
/** Auto-tag a ticket. */
|
|
1176
|
+
async autoTag(ticketId) {
|
|
1177
|
+
return this.run({ action: "auto-tag", ticketId });
|
|
1178
|
+
}
|
|
1179
|
+
/** Suggest a reply for a ticket. */
|
|
1180
|
+
async suggestReply(ticketId) {
|
|
1181
|
+
return this.run({ action: "suggest-reply", ticketId });
|
|
1182
|
+
}
|
|
1183
|
+
/** Summarize a ticket. */
|
|
1184
|
+
async summarize(ticketId) {
|
|
1185
|
+
return this.run({ action: "summarize", ticketId });
|
|
1186
|
+
}
|
|
1187
|
+
/** Improve text. */
|
|
1188
|
+
async improve(text) {
|
|
1189
|
+
return this.run({ action: "improve", text });
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1193
|
+
// src/resources/views.ts
|
|
1194
|
+
var ViewsResource = class extends BaseResource {
|
|
1195
|
+
constructor(client) {
|
|
1196
|
+
super(client, "/views");
|
|
1197
|
+
}
|
|
1198
|
+
/** Execute a view — returns the filtered results. */
|
|
1199
|
+
async execute(viewId, params) {
|
|
1200
|
+
return this.client.request("GET", `/views/${viewId}/tickets`, {
|
|
1201
|
+
query: params
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
// src/resources/billing.ts
|
|
1207
|
+
var BillingResource = class {
|
|
1208
|
+
constructor(client) {
|
|
1209
|
+
this.client = client;
|
|
1210
|
+
}
|
|
1211
|
+
/** Get current subscription status. */
|
|
1212
|
+
async subscription() {
|
|
1213
|
+
return this.client.request("GET", "/billing/subscription");
|
|
1214
|
+
}
|
|
1215
|
+
/** Create a Stripe billing portal session. */
|
|
1216
|
+
async portal(params) {
|
|
1217
|
+
return this.client.request("POST", "/billing/portal", {
|
|
1218
|
+
body: params ?? {}
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
|
|
387
1223
|
// src/index.ts
|
|
388
1224
|
var CStarClient = class {
|
|
389
1225
|
constructor(config) {
|
|
@@ -392,11 +1228,31 @@ var CStarClient = class {
|
|
|
392
1228
|
this.customers = new CustomersResource(this.client);
|
|
393
1229
|
this.articles = new ArticlesResource(this.client);
|
|
394
1230
|
this.webhooks = new WebhooksResource(this.client);
|
|
1231
|
+
this.automations = new AutomationsResource(this.client);
|
|
395
1232
|
this.categories = new CategoriesResource(this.client);
|
|
396
1233
|
this.community = {
|
|
397
1234
|
posts: new CommunityPostsResource(this.client),
|
|
398
1235
|
topics: new CommunityTopicsResource(this.client)
|
|
399
1236
|
};
|
|
1237
|
+
this.members = new MembersResource(this.client);
|
|
1238
|
+
this.settings = new SettingsResource(this.client);
|
|
1239
|
+
this.notifications = new NotificationsResource(this.client);
|
|
1240
|
+
this.attachments = new AttachmentsResource(this.client);
|
|
1241
|
+
this.customFields = new CustomFieldsResource(this.client);
|
|
1242
|
+
this.sla = new SlaResource(this.client);
|
|
1243
|
+
this.analytics = new AnalyticsResource(this.client);
|
|
1244
|
+
this.bulk = new BulkResource(this.client);
|
|
1245
|
+
this.export = new ExportResource(this.client);
|
|
1246
|
+
this.import = new ImportResource(this.client);
|
|
1247
|
+
this.auditLog = new AuditLogResource(this.client);
|
|
1248
|
+
this.search = new SearchResource(this.client);
|
|
1249
|
+
this.tags = new TagsResource(this.client);
|
|
1250
|
+
this.activity = new ActivityResource(this.client);
|
|
1251
|
+
this.customerGroups = new CustomerGroupsResource(this.client);
|
|
1252
|
+
this.game = new GameResource(this.client);
|
|
1253
|
+
this.ai = new AiResource(this.client);
|
|
1254
|
+
this.views = new ViewsResource(this.client);
|
|
1255
|
+
this.billing = new BillingResource(this.client);
|
|
400
1256
|
}
|
|
401
1257
|
/** Whether this client is using test mode keys (sk_test_* or pk_test_*). */
|
|
402
1258
|
get isTestMode() {
|