@cstar.help/js 0.5.0 → 0.5.2
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/community/index.js
CHANGED
|
@@ -2,9 +2,30 @@
|
|
|
2
2
|
var DEFAULT_BASE_URL = "https://www.cstar.help";
|
|
3
3
|
var CommunityClient = class {
|
|
4
4
|
constructor(config) {
|
|
5
|
+
this.sessionToken = null;
|
|
6
|
+
this.teamId = null;
|
|
5
7
|
this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
6
8
|
this.teamSlug = config.teamSlug;
|
|
7
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Set a session token from identity verification.
|
|
12
|
+
* This enables authenticated operations (create posts, vote, comment).
|
|
13
|
+
*
|
|
14
|
+
* The token is the same `sessionToken` returned by `ChatClient.identify()`.
|
|
15
|
+
*/
|
|
16
|
+
setSessionToken(token, teamId) {
|
|
17
|
+
this.sessionToken = token;
|
|
18
|
+
if (teamId) this.teamId = teamId;
|
|
19
|
+
}
|
|
20
|
+
/** Clear the session token and return to read-only mode. */
|
|
21
|
+
clearSession() {
|
|
22
|
+
this.sessionToken = null;
|
|
23
|
+
this.teamId = null;
|
|
24
|
+
}
|
|
25
|
+
/** Whether the client has an active session token. */
|
|
26
|
+
get isAuthenticated() {
|
|
27
|
+
return this.sessionToken !== null;
|
|
28
|
+
}
|
|
8
29
|
/** List all public community topics. */
|
|
9
30
|
async topics() {
|
|
10
31
|
const response = await this.fetch(
|
|
@@ -42,6 +63,134 @@ var CommunityClient = class {
|
|
|
42
63
|
q: query
|
|
43
64
|
});
|
|
44
65
|
}
|
|
66
|
+
// ── Authenticated Actions (require setSessionToken) ──
|
|
67
|
+
/**
|
|
68
|
+
* Create a new community post. Requires an active session token.
|
|
69
|
+
*
|
|
70
|
+
* @throws Error if no session token is set or the request fails
|
|
71
|
+
*/
|
|
72
|
+
async createPost(params) {
|
|
73
|
+
const teamId = this.resolveTeamId();
|
|
74
|
+
const response = await this.authenticatedFetch("/api/widget/community", {
|
|
75
|
+
method: "POST",
|
|
76
|
+
body: {
|
|
77
|
+
teamId,
|
|
78
|
+
action: "createPost",
|
|
79
|
+
title: params.title,
|
|
80
|
+
body: params.body,
|
|
81
|
+
topicId: params.topicId
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return response.data.post;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Toggle vote on a post. Returns new vote state and count.
|
|
88
|
+
* Requires an active session token.
|
|
89
|
+
*/
|
|
90
|
+
async vote(postId) {
|
|
91
|
+
const teamId = this.resolveTeamId();
|
|
92
|
+
const response = await this.authenticatedFetch("/api/widget/community", {
|
|
93
|
+
method: "POST",
|
|
94
|
+
body: { teamId, action: "vote", postId }
|
|
95
|
+
});
|
|
96
|
+
return response.data;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Add a comment to a post. Requires an active session token.
|
|
100
|
+
*/
|
|
101
|
+
async comment(postId, params) {
|
|
102
|
+
const teamId = this.resolveTeamId();
|
|
103
|
+
const response = await this.authenticatedFetch("/api/widget/community", {
|
|
104
|
+
method: "POST",
|
|
105
|
+
body: {
|
|
106
|
+
teamId,
|
|
107
|
+
action: "createComment",
|
|
108
|
+
postId,
|
|
109
|
+
commentBody: params.body,
|
|
110
|
+
parentCommentId: params.parentCommentId ?? null
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return response.data.comment;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Toggle follow on a post. Requires an active session token.
|
|
117
|
+
*/
|
|
118
|
+
async follow(postId) {
|
|
119
|
+
const teamId = this.resolveTeamId();
|
|
120
|
+
const response = await this.authenticatedFetch("/api/widget/community", {
|
|
121
|
+
method: "POST",
|
|
122
|
+
body: { teamId, action: "follow", postId }
|
|
123
|
+
});
|
|
124
|
+
return response.data;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Check if the current user has voted on a specific post.
|
|
128
|
+
* Requires an active session token.
|
|
129
|
+
*/
|
|
130
|
+
async getVoteStatus(postId) {
|
|
131
|
+
const teamId = this.resolveTeamId();
|
|
132
|
+
const response = await this.authenticatedFetch("/api/widget/community", {
|
|
133
|
+
method: "GET",
|
|
134
|
+
query: { teamId, postId }
|
|
135
|
+
});
|
|
136
|
+
return response.data.voted;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Check vote status for multiple posts in a single request.
|
|
140
|
+
* Returns a map of postId → voted boolean.
|
|
141
|
+
* Requires an active session token.
|
|
142
|
+
*/
|
|
143
|
+
async bulkVoteStatus(postIds) {
|
|
144
|
+
if (postIds.length === 0) return {};
|
|
145
|
+
const teamId = this.resolveTeamId();
|
|
146
|
+
const response = await this.authenticatedFetch("/api/widget/community", {
|
|
147
|
+
method: "GET",
|
|
148
|
+
query: { teamId, postIds: postIds.join(",") }
|
|
149
|
+
});
|
|
150
|
+
return response.data;
|
|
151
|
+
}
|
|
152
|
+
// ── Internal Helpers ──
|
|
153
|
+
/**
|
|
154
|
+
* Resolve team slug to team ID (cached after first call).
|
|
155
|
+
* For authenticated operations that require teamId.
|
|
156
|
+
*/
|
|
157
|
+
resolveTeamId() {
|
|
158
|
+
if (this.teamId) return this.teamId;
|
|
159
|
+
throw new Error(
|
|
160
|
+
"Team ID is required for authenticated operations. Pass it via setSessionToken(token, teamId) or use ChatClient.identify() which provides it automatically."
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
async authenticatedFetch(path, options) {
|
|
164
|
+
if (!this.sessionToken) {
|
|
165
|
+
throw new Error(
|
|
166
|
+
"Session token required. Call setSessionToken() or use ChatClient.identify() first."
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
let url = `${this.baseUrl}${path}`;
|
|
170
|
+
if (options.query) {
|
|
171
|
+
const params = new URLSearchParams();
|
|
172
|
+
for (const [key, value] of Object.entries(options.query)) {
|
|
173
|
+
if (value !== void 0) params.set(key, value);
|
|
174
|
+
}
|
|
175
|
+
const qs = params.toString();
|
|
176
|
+
if (qs) url += `?${qs}`;
|
|
177
|
+
}
|
|
178
|
+
const headers = {
|
|
179
|
+
"Content-Type": "application/json",
|
|
180
|
+
Authorization: `Bearer ${this.sessionToken}`
|
|
181
|
+
};
|
|
182
|
+
const response = await globalThis.fetch(url, {
|
|
183
|
+
method: options.method,
|
|
184
|
+
headers,
|
|
185
|
+
body: options.body ? JSON.stringify(options.body) : void 0
|
|
186
|
+
});
|
|
187
|
+
if (!response.ok) {
|
|
188
|
+
const errorBody = await response.json().catch(() => ({ error: { message: "Request failed" } }));
|
|
189
|
+
const message = typeof errorBody.error === "string" ? errorBody.error : errorBody.error?.message ?? `Community API error: ${response.status}`;
|
|
190
|
+
throw new Error(message);
|
|
191
|
+
}
|
|
192
|
+
return response.json();
|
|
193
|
+
}
|
|
45
194
|
async fetch(path, query) {
|
|
46
195
|
let url = `${this.baseUrl}${path}`;
|
|
47
196
|
if (query) {
|
package/dist/index.cjs
CHANGED
|
@@ -97,7 +97,7 @@ function parseError(statusCode, body, retryAfter) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// src/client.ts
|
|
100
|
-
var SDK_VERSION = "0.
|
|
100
|
+
var SDK_VERSION = "0.5.0";
|
|
101
101
|
var DEFAULT_BASE_URL = "https://www.cstar.help";
|
|
102
102
|
var DEFAULT_API_VERSION = "2026-03-01";
|
|
103
103
|
var DEFAULT_MAX_RETRIES = 3;
|
|
@@ -113,6 +113,11 @@ var HttpClient = class {
|
|
|
113
113
|
timeout: config.timeout ?? DEFAULT_TIMEOUT
|
|
114
114
|
};
|
|
115
115
|
this.environment = config.apiKey.startsWith("sk_test_") || config.apiKey.startsWith("pk_test_") ? "test" : "live";
|
|
116
|
+
if (config.apiKey.startsWith("sk_") && typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined") {
|
|
117
|
+
console.warn(
|
|
118
|
+
"[cStar] WARNING: Secret API key detected in a browser environment. This exposes your key to anyone viewing your site. Use CStarClient with secret keys on the server only. For client-side use, import from @cstar.help/js/chat, /library, or /community instead."
|
|
119
|
+
);
|
|
120
|
+
}
|
|
116
121
|
}
|
|
117
122
|
/**
|
|
118
123
|
* Make an authenticated request to the cStar API.
|
|
@@ -148,6 +153,7 @@ var HttpClient = class {
|
|
|
148
153
|
throw lastError;
|
|
149
154
|
}
|
|
150
155
|
if (response.ok) {
|
|
156
|
+
if (response.status === 204) return void 0;
|
|
151
157
|
return await response.json();
|
|
152
158
|
}
|
|
153
159
|
const errorBody = await response.json().catch(() => null);
|
|
@@ -332,6 +338,46 @@ var WebhooksResource = class extends BaseResource {
|
|
|
332
338
|
{ body: params ?? {} }
|
|
333
339
|
);
|
|
334
340
|
}
|
|
341
|
+
/** Fire a test webhook event to all active webhooks and CLI listeners. */
|
|
342
|
+
async triggerTest(params, options) {
|
|
343
|
+
return this.client.request(
|
|
344
|
+
"POST",
|
|
345
|
+
"/webhooks/trigger-test",
|
|
346
|
+
{ body: params, idempotencyKey: options?.idempotencyKey }
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
/** Get a sample webhook payload for an event type (used by Zapier). */
|
|
350
|
+
async sample(event) {
|
|
351
|
+
return this.client.request(
|
|
352
|
+
"GET",
|
|
353
|
+
`/webhooks/sample/${encodeURIComponent(event)}`
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
/** Subscribe to an event (REST Hooks / Zapier protocol). */
|
|
357
|
+
async subscribe(params, options) {
|
|
358
|
+
return this.client.request("POST", "/webhooks/subscribe", {
|
|
359
|
+
body: params,
|
|
360
|
+
idempotencyKey: options?.idempotencyKey
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
/** Unsubscribe from an event (REST Hooks / Zapier protocol). Returns void (204 No Content). */
|
|
364
|
+
async unsubscribe(subscriptionId) {
|
|
365
|
+
await this.client.request("DELETE", `/webhooks/subscribe/${subscriptionId}`);
|
|
366
|
+
}
|
|
367
|
+
/** Register a CLI listener (returns listenerId and signing secret). */
|
|
368
|
+
async listen(params, options) {
|
|
369
|
+
return this.client.request("POST", "/webhooks/listen", {
|
|
370
|
+
body: params,
|
|
371
|
+
idempotencyKey: options?.idempotencyKey
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
/** Deregister a CLI listener. */
|
|
375
|
+
async unlisten(listenerId) {
|
|
376
|
+
return this.client.request(
|
|
377
|
+
"DELETE",
|
|
378
|
+
`/webhooks/listen/${listenerId}`
|
|
379
|
+
);
|
|
380
|
+
}
|
|
335
381
|
};
|
|
336
382
|
|
|
337
383
|
// src/resources/automations.ts
|
|
@@ -611,29 +657,74 @@ var NotificationsResource = class {
|
|
|
611
657
|
constructor(client) {
|
|
612
658
|
this.client = client;
|
|
613
659
|
}
|
|
614
|
-
/** List notifications. */
|
|
660
|
+
/** List notifications for a user. */
|
|
615
661
|
async list(params) {
|
|
616
662
|
return this.client.request("GET", "/notifications", {
|
|
617
663
|
query: params
|
|
618
664
|
});
|
|
619
665
|
}
|
|
620
|
-
/** Get unread notification count. */
|
|
621
|
-
async unreadCount() {
|
|
622
|
-
return this.client.request("GET", "/notifications/unread-count"
|
|
666
|
+
/** Get unread notification count for a user. */
|
|
667
|
+
async unreadCount(userId) {
|
|
668
|
+
return this.client.request("GET", "/notifications/unread-count", {
|
|
669
|
+
query: { userId }
|
|
670
|
+
});
|
|
623
671
|
}
|
|
624
672
|
/** Mark a single notification as read. */
|
|
625
|
-
async markRead(notificationId) {
|
|
673
|
+
async markRead(notificationId, userId) {
|
|
626
674
|
return this.client.request(
|
|
627
675
|
"PATCH",
|
|
628
|
-
`/notifications/${notificationId}`,
|
|
629
|
-
{ body: {
|
|
676
|
+
`/notifications/${notificationId}/read`,
|
|
677
|
+
{ body: { userId } }
|
|
630
678
|
);
|
|
631
679
|
}
|
|
632
680
|
/** Mark all notifications as read. */
|
|
633
|
-
async markAllRead() {
|
|
681
|
+
async markAllRead(userId) {
|
|
682
|
+
return this.client.request(
|
|
683
|
+
"POST",
|
|
684
|
+
"/notifications/mark-all-read",
|
|
685
|
+
{ body: { userId } }
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
/** Delete (dismiss) a notification. For broadcast notifications, pass userId as a query param. */
|
|
689
|
+
async del(notificationId, params) {
|
|
690
|
+
return this.client.request(
|
|
691
|
+
"DELETE",
|
|
692
|
+
`/notifications/${notificationId}`,
|
|
693
|
+
{ query: params }
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
// src/resources/mentions.ts
|
|
699
|
+
var MentionsResource = class {
|
|
700
|
+
constructor(client) {
|
|
701
|
+
this.client = client;
|
|
702
|
+
}
|
|
703
|
+
/** List mentions for a user. */
|
|
704
|
+
async list(params) {
|
|
705
|
+
return this.client.request("GET", "/mentions", {
|
|
706
|
+
query: params
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
/** Get unread mention count for a user. */
|
|
710
|
+
async unreadCount(userId) {
|
|
711
|
+
return this.client.request("GET", "/mentions/unread-count", {
|
|
712
|
+
query: { userId }
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
/** Mark a single mention as read. */
|
|
716
|
+
async markRead(mentionId) {
|
|
717
|
+
return this.client.request(
|
|
718
|
+
"PATCH",
|
|
719
|
+
`/mentions/${mentionId}/read`
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
/** Mark all mentions as read for a user. */
|
|
723
|
+
async markAllRead(userId) {
|
|
634
724
|
return this.client.request(
|
|
635
725
|
"POST",
|
|
636
|
-
"/
|
|
726
|
+
"/mentions/mark-all-read",
|
|
727
|
+
{ body: { userId } }
|
|
637
728
|
);
|
|
638
729
|
}
|
|
639
730
|
};
|
|
@@ -713,10 +804,6 @@ var SlaResource = class {
|
|
|
713
804
|
query: params
|
|
714
805
|
});
|
|
715
806
|
}
|
|
716
|
-
/** Get a single SLA rule. */
|
|
717
|
-
async get(ruleId) {
|
|
718
|
-
return this.client.request("GET", `/sla/rules/${ruleId}`);
|
|
719
|
-
}
|
|
720
807
|
/** Create an SLA rule. */
|
|
721
808
|
async create(params, options) {
|
|
722
809
|
return this.client.request("POST", "/sla/rules", {
|
|
@@ -734,35 +821,79 @@ var SlaResource = class {
|
|
|
734
821
|
async del(ruleId) {
|
|
735
822
|
return this.client.request("DELETE", `/sla/rules/${ruleId}`);
|
|
736
823
|
}
|
|
824
|
+
/** Reorder SLA rules by providing an ordered array of IDs. */
|
|
825
|
+
async reorder(orderedIds) {
|
|
826
|
+
return this.client.request("PUT", "/sla/rules/reorder", {
|
|
827
|
+
body: { orderedIds }
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
/** Get SLA compliance metrics. */
|
|
831
|
+
async metrics(params) {
|
|
832
|
+
return this.client.request("GET", "/sla/metrics", {
|
|
833
|
+
query: params
|
|
834
|
+
});
|
|
835
|
+
}
|
|
737
836
|
};
|
|
738
837
|
|
|
739
838
|
// src/resources/analytics.ts
|
|
740
|
-
var
|
|
839
|
+
var CsatSurveysResource = class {
|
|
741
840
|
constructor(client) {
|
|
742
841
|
this.client = client;
|
|
743
842
|
}
|
|
744
|
-
/**
|
|
745
|
-
async
|
|
746
|
-
return this.client.request("GET", "/
|
|
843
|
+
/** List CSAT surveys. */
|
|
844
|
+
async list(params) {
|
|
845
|
+
return this.client.request("GET", "/csat/surveys", {
|
|
747
846
|
query: params
|
|
748
847
|
});
|
|
749
848
|
}
|
|
750
|
-
/** Get
|
|
751
|
-
async
|
|
752
|
-
return this.client.request("GET",
|
|
849
|
+
/** Get a single CSAT survey. */
|
|
850
|
+
async get(surveyId) {
|
|
851
|
+
return this.client.request("GET", `/csat/surveys/${surveyId}`);
|
|
852
|
+
}
|
|
853
|
+
/** Create and send a CSAT survey. */
|
|
854
|
+
async create(params) {
|
|
855
|
+
return this.client.request("POST", "/csat/surveys", {
|
|
856
|
+
body: params
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
var AnalyticsResource = class {
|
|
861
|
+
constructor(client) {
|
|
862
|
+
this.client = client;
|
|
863
|
+
this.csatSurveys = new CsatSurveysResource(client);
|
|
864
|
+
}
|
|
865
|
+
/** Get analytics data. Specify type to control the response shape. */
|
|
866
|
+
async get(params) {
|
|
867
|
+
return this.client.request("GET", "/analytics", {
|
|
753
868
|
query: params
|
|
754
869
|
});
|
|
755
870
|
}
|
|
871
|
+
/** Get analytics overview (shortcut for type=overview). */
|
|
872
|
+
async overview(params) {
|
|
873
|
+
return this.get({ ...params, type: "overview" });
|
|
874
|
+
}
|
|
875
|
+
/** Get agent performance stats (shortcut for type=performance). */
|
|
876
|
+
async performance(params) {
|
|
877
|
+
return this.get({ ...params, type: "performance" });
|
|
878
|
+
}
|
|
879
|
+
/** Get library analytics (shortcut for type=library). */
|
|
880
|
+
async library(params) {
|
|
881
|
+
return this.get({ ...params, type: "library" });
|
|
882
|
+
}
|
|
756
883
|
/** Get CSAT statistics. */
|
|
757
884
|
async csatStats(params) {
|
|
758
885
|
return this.client.request("GET", "/csat/stats", {
|
|
759
886
|
query: params
|
|
760
887
|
});
|
|
761
888
|
}
|
|
762
|
-
/**
|
|
763
|
-
async
|
|
764
|
-
return this.client.request("GET", "/csat/
|
|
765
|
-
|
|
889
|
+
/** Get CSAT settings. */
|
|
890
|
+
async csatSettings() {
|
|
891
|
+
return this.client.request("GET", "/csat/settings");
|
|
892
|
+
}
|
|
893
|
+
/** Update CSAT settings. */
|
|
894
|
+
async updateCsatSettings(params) {
|
|
895
|
+
return this.client.request("PATCH", "/csat/settings", {
|
|
896
|
+
body: params
|
|
766
897
|
});
|
|
767
898
|
}
|
|
768
899
|
};
|
|
@@ -896,9 +1027,39 @@ var ActivityResource = class {
|
|
|
896
1027
|
};
|
|
897
1028
|
|
|
898
1029
|
// src/resources/customerGroups.ts
|
|
1030
|
+
var CustomerGroupMembersResource = class {
|
|
1031
|
+
constructor(client) {
|
|
1032
|
+
this.client = client;
|
|
1033
|
+
}
|
|
1034
|
+
/** List members in a group. */
|
|
1035
|
+
async list(groupId, params) {
|
|
1036
|
+
return this.client.request(
|
|
1037
|
+
"GET",
|
|
1038
|
+
`/customer-groups/${groupId}/members`,
|
|
1039
|
+
{ query: params }
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
/** Add member(s) to a group. */
|
|
1043
|
+
async add(groupId, params, options) {
|
|
1044
|
+
return this.client.request(
|
|
1045
|
+
"POST",
|
|
1046
|
+
`/customer-groups/${groupId}/members`,
|
|
1047
|
+
{ body: params, idempotencyKey: options?.idempotencyKey }
|
|
1048
|
+
);
|
|
1049
|
+
}
|
|
1050
|
+
/** Remove a member from a group. */
|
|
1051
|
+
async remove(groupId, customerId) {
|
|
1052
|
+
return this.client.request(
|
|
1053
|
+
"DELETE",
|
|
1054
|
+
`/customer-groups/${groupId}/members`,
|
|
1055
|
+
{ query: { customerId } }
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
899
1059
|
var CustomerGroupsResource = class extends BaseResource {
|
|
900
1060
|
constructor(client) {
|
|
901
1061
|
super(client, "/customer-groups");
|
|
1062
|
+
this.members = new CustomerGroupMembersResource(client);
|
|
902
1063
|
}
|
|
903
1064
|
};
|
|
904
1065
|
|
|
@@ -962,6 +1123,29 @@ var AchievementsResource = class {
|
|
|
962
1123
|
query: params
|
|
963
1124
|
});
|
|
964
1125
|
}
|
|
1126
|
+
/** Get recently unlocked achievements across the team. */
|
|
1127
|
+
async recent(params) {
|
|
1128
|
+
return this.client.request("GET", "/game/achievements/recent", {
|
|
1129
|
+
query: params
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
var GameActivityResource = class {
|
|
1134
|
+
constructor(client) {
|
|
1135
|
+
this.client = client;
|
|
1136
|
+
}
|
|
1137
|
+
/** Get the team activity feed. */
|
|
1138
|
+
async list(params) {
|
|
1139
|
+
return this.client.request("GET", "/game/activity", {
|
|
1140
|
+
query: params
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
/** Get activity for a specific member. */
|
|
1144
|
+
async forMember(memberId, params) {
|
|
1145
|
+
return this.client.request("GET", `/game/activity/member/${memberId}`, {
|
|
1146
|
+
query: params
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
965
1149
|
};
|
|
966
1150
|
var QuestsResource = class {
|
|
967
1151
|
constructor(client) {
|
|
@@ -1135,6 +1319,7 @@ var GameResource = class {
|
|
|
1135
1319
|
this.cosmetics = new CosmeticsResource(client);
|
|
1136
1320
|
this.seasons = new SeasonsResource(client);
|
|
1137
1321
|
this.skills = new SkillsResource(client);
|
|
1322
|
+
this.activity = new GameActivityResource(client);
|
|
1138
1323
|
}
|
|
1139
1324
|
/** Get current player stats. */
|
|
1140
1325
|
async player(params) {
|
|
@@ -1158,6 +1343,10 @@ var GameResource = class {
|
|
|
1158
1343
|
query: params
|
|
1159
1344
|
});
|
|
1160
1345
|
}
|
|
1346
|
+
/** Get game balance configuration (read-only constants). */
|
|
1347
|
+
async config() {
|
|
1348
|
+
return this.client.request("GET", "/game/config");
|
|
1349
|
+
}
|
|
1161
1350
|
};
|
|
1162
1351
|
|
|
1163
1352
|
// src/resources/ai.ts
|
|
@@ -1195,9 +1384,9 @@ var ViewsResource = class extends BaseResource {
|
|
|
1195
1384
|
constructor(client) {
|
|
1196
1385
|
super(client, "/views");
|
|
1197
1386
|
}
|
|
1198
|
-
/** Execute a view — returns the filtered results. */
|
|
1387
|
+
/** Execute a view — returns the filtered results. The server uses the view's entity_type to determine which table to query. */
|
|
1199
1388
|
async execute(viewId, params) {
|
|
1200
|
-
return this.client.request("GET", `/views/${viewId}/
|
|
1389
|
+
return this.client.request("GET", `/views/${viewId}/execute`, {
|
|
1201
1390
|
query: params
|
|
1202
1391
|
});
|
|
1203
1392
|
}
|
|
@@ -1237,6 +1426,7 @@ var CStarClient = class {
|
|
|
1237
1426
|
this.members = new MembersResource(this.client);
|
|
1238
1427
|
this.settings = new SettingsResource(this.client);
|
|
1239
1428
|
this.notifications = new NotificationsResource(this.client);
|
|
1429
|
+
this.mentions = new MentionsResource(this.client);
|
|
1240
1430
|
this.attachments = new AttachmentsResource(this.client);
|
|
1241
1431
|
this.customFields = new CustomFieldsResource(this.client);
|
|
1242
1432
|
this.sla = new SlaResource(this.client);
|