@fundedfast/sdk 1.3.0 → 1.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/CHANGELOG.md +153 -0
- package/README.md +8 -8
- package/dist/cjs/client.d.ts +3 -1
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +19 -2
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/resources/admin.d.ts +285 -84
- package/dist/cjs/resources/admin.d.ts.map +1 -1
- package/dist/cjs/resources/admin.js +326 -99
- package/dist/cjs/resources/admin.js.map +1 -1
- package/dist/cjs/resources/public.d.ts +47 -19
- package/dist/cjs/resources/public.d.ts.map +1 -1
- package/dist/cjs/resources/public.js +87 -37
- package/dist/cjs/resources/public.js.map +1 -1
- package/dist/cjs/types.d.ts +696 -82
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/client.d.ts +3 -1
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +19 -2
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/resources/admin.d.ts +285 -84
- package/dist/esm/resources/admin.d.ts.map +1 -1
- package/dist/esm/resources/admin.js +324 -98
- package/dist/esm/resources/admin.js.map +1 -1
- package/dist/esm/resources/public.d.ts +47 -19
- package/dist/esm/resources/public.d.ts.map +1 -1
- package/dist/esm/resources/public.js +87 -37
- package/dist/esm/resources/public.js.map +1 -1
- package/dist/esm/types.d.ts +696 -82
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { FastClient } from '../client.js';
|
|
2
|
-
import type { AdminBetEvent, BulkSettleResult, WebhookDelivery, AuditEntry, TenantSettings, AdminOverview, BonusOffer, BonusStats, MissionDef, TournamentDef, TournamentLeaderboardEntry, LoyaltyConfig, LoyaltyTier, LoyaltyStats, WebhookEchoEntry, ChallengeTierFull, Ruleset, AdapterMapping, ReconciliationFlag, RewardRule, Reward, SelfExclusionRecord } from '../types.js';
|
|
2
|
+
import type { AdminBetEvent, BulkSettleResult, WebhookDelivery, AuditEntry, TenantSettings, AdminOverview, BonusOffer, BonusStats, MissionDef, TournamentDef, TournamentLeaderboardEntry, LoyaltyConfig, LoyaltyTier, LoyaltyStats, WebhookEchoEntry, ChallengeTierFull, Ruleset, AdapterMapping, ReconciliationFlag, RewardRule, Reward, SelfExclusionRecord, PayoutRequest, PayoutExecution, BetStatus, ChallengeTierCreateRequest, WebhookDeadLetter, WebhookSecretRotation, AuditLogType, AuditLogPage, MissionCreateRequest, TournamentCreateRequest, TournamentEntry, LoyaltyTierCreateRequest, RewardRuleInput, RewardApplication, GrantableRewardType, RewardApplyMode, RulesetCreateRequest, RulesetUpdateRequest, BonusOfferCreateRequest, BonusOfferUpdateRequest, MissionUpdateRequest, LoyaltyConfigUpdateRequest, LoyaltyTierUpdateRequest, AchievementCreateRequest, AchievementUpdateRequest, ThemeUpdateRequest, NotificationPreferencesUpdate, SelfExclusionRequest } from '../types.js';
|
|
3
|
+
/** Body of a manual reward grant. */
|
|
4
|
+
export interface RewardGrantRequest {
|
|
5
|
+
rewardType: GrantableRewardType;
|
|
6
|
+
/** In EUR for money types, otherwise percent or days. */
|
|
7
|
+
value?: number;
|
|
8
|
+
/** @deprecated Use `value`; the API ignores `rewardValue` on grants. The SDK maps it. */
|
|
9
|
+
rewardValue?: number;
|
|
10
|
+
applyMode?: RewardApplyMode;
|
|
11
|
+
expiresInDays?: number;
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
}
|
|
3
14
|
export declare class AdminApi {
|
|
4
15
|
readonly challengeTiers: AdminChallengeTiersApi;
|
|
5
16
|
readonly rulesets: AdminRulesetsApi;
|
|
@@ -23,13 +34,14 @@ export declare class AdminApi {
|
|
|
23
34
|
readonly notificationChannels: AdminNotificationChannelsApi;
|
|
24
35
|
readonly templates: AdminTemplatesApi;
|
|
25
36
|
readonly support: AdminSupportApi;
|
|
37
|
+
readonly payouts: AdminPayoutsApi;
|
|
26
38
|
constructor(client: FastClient);
|
|
27
39
|
}
|
|
28
40
|
export declare class AdminChallengeTiersApi {
|
|
29
41
|
private readonly client;
|
|
30
42
|
constructor(client: FastClient);
|
|
31
43
|
list(): Promise<ChallengeTierFull[]>;
|
|
32
|
-
create(data:
|
|
44
|
+
create(data: ChallengeTierCreateRequest): Promise<ChallengeTierFull>;
|
|
33
45
|
update(id: string, data: Partial<ChallengeTierFull>): Promise<ChallengeTierFull>;
|
|
34
46
|
delete(id: string): Promise<{
|
|
35
47
|
deleted: boolean;
|
|
@@ -39,8 +51,8 @@ export declare class AdminRulesetsApi {
|
|
|
39
51
|
private readonly client;
|
|
40
52
|
constructor(client: FastClient);
|
|
41
53
|
list(): Promise<Ruleset[]>;
|
|
42
|
-
create(data:
|
|
43
|
-
update(id: string, data:
|
|
54
|
+
create(data: RulesetCreateRequest): Promise<Ruleset>;
|
|
55
|
+
update(id: string, data: RulesetUpdateRequest): Promise<Ruleset>;
|
|
44
56
|
delete(id: string): Promise<{
|
|
45
57
|
deleted: boolean;
|
|
46
58
|
}>;
|
|
@@ -48,11 +60,16 @@ export declare class AdminRulesetsApi {
|
|
|
48
60
|
export declare class AdminBetsApi {
|
|
49
61
|
private readonly client;
|
|
50
62
|
constructor(client: FastClient);
|
|
63
|
+
/** Bet events, newest first (max 200). */
|
|
51
64
|
list(options?: {
|
|
52
|
-
status?:
|
|
65
|
+
status?: BetStatus;
|
|
53
66
|
userId?: string;
|
|
54
67
|
}): Promise<AdminBetEvent[]>;
|
|
55
68
|
settle(id: string, outcome: 'won' | 'lost'): Promise<AdminBetEvent>;
|
|
69
|
+
/**
|
|
70
|
+
* Settle up to 50 placed bets in one call. Each result says `settled` or
|
|
71
|
+
* `error` (with the reason, e.g. `not_found`, `already_settled`).
|
|
72
|
+
*/
|
|
56
73
|
bulkSettle(settlements: Array<{
|
|
57
74
|
betEventId: string;
|
|
58
75
|
outcome: 'won' | 'lost';
|
|
@@ -61,18 +78,55 @@ export declare class AdminBetsApi {
|
|
|
61
78
|
found: number;
|
|
62
79
|
processed: number;
|
|
63
80
|
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Export bet events as CSV (up to 10,000 rows), header line included.
|
|
83
|
+
*
|
|
84
|
+
* @param options.from / options.to - full ISO 8601 date-times (e.g. `2026-10-01T00:00:00Z`); a bare date is rejected
|
|
85
|
+
* @returns The CSV text
|
|
86
|
+
*/
|
|
64
87
|
export(options?: {
|
|
65
88
|
from?: string;
|
|
66
89
|
to?: string;
|
|
67
90
|
userId?: string;
|
|
68
|
-
|
|
91
|
+
status?: BetStatus;
|
|
92
|
+
}): Promise<string>;
|
|
93
|
+
}
|
|
94
|
+
/** Funded payout requests waiting for the operator, and the decision on them. */
|
|
95
|
+
export declare class AdminPayoutsApi {
|
|
96
|
+
private readonly client;
|
|
97
|
+
constructor(client: FastClient);
|
|
98
|
+
list(options?: {
|
|
99
|
+
status?: 'pending' | 'executed' | 'rejected';
|
|
100
|
+
userId?: string;
|
|
101
|
+
limit?: number;
|
|
102
|
+
}): Promise<PayoutRequest[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Execute a pending request: the money moves and the cycle closes.
|
|
105
|
+
*
|
|
106
|
+
* @throws {FastApiError} 409 `open_bets` while the account has bets not yet settled; confirm once they have
|
|
107
|
+
* @throws {FastApiError} 409 `payout_amount_changed` when a full-amount request no longer matches what is available
|
|
108
|
+
* (a bet settled since it was made). The request is updated to the new amount; review it and confirm again.
|
|
109
|
+
* @throws {FastApiError} 409 `payout_request_not_pending` if it was already decided
|
|
110
|
+
*/
|
|
111
|
+
confirm(id: string): Promise<PayoutExecution>;
|
|
112
|
+
/** Reject a pending request. Nothing on the account changes. */
|
|
113
|
+
reject(id: string, reason?: string): Promise<{
|
|
114
|
+
payoutRequestId: string;
|
|
115
|
+
status: 'rejected';
|
|
116
|
+
}>;
|
|
69
117
|
}
|
|
70
118
|
export declare class AdminWebhooksApi {
|
|
71
119
|
private readonly client;
|
|
72
120
|
constructor(client: FastClient);
|
|
73
121
|
list(): Promise<WebhookDelivery[]>;
|
|
74
|
-
deadLetters(): Promise<
|
|
75
|
-
|
|
122
|
+
deadLetters(): Promise<WebhookDeadLetter[]>;
|
|
123
|
+
/**
|
|
124
|
+
* Replay a dead-lettered webhook delivery.
|
|
125
|
+
* @throws {FastApiError} 404 `not_found`, 409 `already_replayed`
|
|
126
|
+
*/
|
|
127
|
+
replay(id: string): Promise<{
|
|
128
|
+
replayed: boolean;
|
|
129
|
+
}>;
|
|
76
130
|
/** Retry a failed webhook delivery (resets it to pending and re-dispatches). */
|
|
77
131
|
retry(id: string): Promise<Record<string, unknown>>;
|
|
78
132
|
/**
|
|
@@ -83,13 +137,19 @@ export declare class AdminWebhooksApi {
|
|
|
83
137
|
hookDeadLetters(): Promise<{
|
|
84
138
|
deadLetters: Record<string, unknown>[];
|
|
85
139
|
}>;
|
|
86
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* Replay a dead-letter post-bet hook run. Double-counting is prevented server-side.
|
|
142
|
+
* @throws {FastApiError} 404 `not_found`, 409 `already_replayed`, 502 `hook_failed` when the hook fails again (a 5xx, so the client's retry policy applies first)
|
|
143
|
+
*/
|
|
87
144
|
replayHook(id: string): Promise<{
|
|
88
145
|
replayed: boolean;
|
|
146
|
+
outcome: string;
|
|
89
147
|
}>;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Rotate the webhook signing secret. The new secret is in `newSecret` and is
|
|
150
|
+
* shown only here; the old one stays valid for `gracePeriodHours`.
|
|
151
|
+
*/
|
|
152
|
+
rotateSecret(): Promise<WebhookSecretRotation>;
|
|
93
153
|
health(): Promise<Record<string, unknown>>;
|
|
94
154
|
echo(limit?: number, eventType?: string): Promise<{
|
|
95
155
|
webhooks: WebhookEchoEntry[];
|
|
@@ -104,23 +164,37 @@ export declare class AdminWebhooksApi {
|
|
|
104
164
|
export declare class AdminAuditApi {
|
|
105
165
|
private readonly client;
|
|
106
166
|
constructor(client: FastClient);
|
|
167
|
+
/**
|
|
168
|
+
* Ledger audit view: bet events (`type: 'bets'`, the default) or webhook
|
|
169
|
+
* deliveries (`type: 'webhooks'`). For the admin action log use {@link adminLog}.
|
|
170
|
+
*/
|
|
107
171
|
list(options?: {
|
|
108
|
-
type?:
|
|
172
|
+
type?: AuditLogType;
|
|
173
|
+
userId?: string;
|
|
174
|
+
from?: string;
|
|
175
|
+
to?: string;
|
|
109
176
|
limit?: number;
|
|
110
177
|
offset?: number;
|
|
111
|
-
}): Promise<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
178
|
+
}): Promise<AuditLogPage>;
|
|
179
|
+
/**
|
|
180
|
+
* Admin action log: who changed what. Filter by `actor` (an admin email, or
|
|
181
|
+
* `api-key`), `action`, `resourceType` and a full ISO 8601 `from`/`to`.
|
|
182
|
+
* `userId` is a deprecated alias of `actor`.
|
|
183
|
+
*/
|
|
116
184
|
adminLog(options?: {
|
|
117
185
|
action?: string;
|
|
186
|
+
actor?: string;
|
|
187
|
+
resourceType?: string;
|
|
188
|
+
from?: string;
|
|
189
|
+
to?: string; /** @deprecated Use `actor`. */
|
|
118
190
|
userId?: string;
|
|
119
191
|
limit?: number;
|
|
120
192
|
offset?: number;
|
|
121
193
|
}): Promise<{
|
|
122
194
|
entries: AuditEntry[];
|
|
123
195
|
total: number;
|
|
196
|
+
limit: number;
|
|
197
|
+
offset: number;
|
|
124
198
|
}>;
|
|
125
199
|
/**
|
|
126
200
|
* Bulk data export (GDPR Art. 20).
|
|
@@ -147,7 +221,8 @@ export declare class AdminSettingsApi {
|
|
|
147
221
|
getIntegrationMode(): Promise<{
|
|
148
222
|
integrationMode: string;
|
|
149
223
|
}>;
|
|
150
|
-
|
|
224
|
+
/** Set the webhook URL. Pass null to stop deliveries. */
|
|
225
|
+
setWebhookUrl(url: string | null): Promise<Record<string, unknown>>;
|
|
151
226
|
/**
|
|
152
227
|
* Set the single operator approval URL. FAST calls this one endpoint before any
|
|
153
228
|
* money/irreversible action (purchase, withdrawal, cancel); the action `type` is
|
|
@@ -155,17 +230,38 @@ export declare class AdminSettingsApi {
|
|
|
155
230
|
*/
|
|
156
231
|
setApprovalUrl(approvalUrl: string | null): Promise<Record<string, unknown>>;
|
|
157
232
|
setChallengeLimit(limit: number | null): Promise<Record<string, unknown>>;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Set the default currency (ISO 4217) and, optionally, the list of supported
|
|
235
|
+
* currencies. The API has no currency symbol setting; a string passed as the
|
|
236
|
+
* second argument (the old `symbol` parameter) is ignored.
|
|
237
|
+
*/
|
|
238
|
+
setCurrency(defaultCurrency: string, supportedCurrencies?: string[] | string): Promise<{
|
|
239
|
+
defaultCurrency: string;
|
|
240
|
+
supportedCurrencies: string[];
|
|
241
|
+
}>;
|
|
242
|
+
/** Set the funded exposure alert threshold. Pass null to disable. */
|
|
243
|
+
setExposureAlert(threshold: number | null): Promise<Record<string, unknown>>;
|
|
244
|
+
configExport(data: {
|
|
245
|
+
exportEnabled: boolean;
|
|
246
|
+
exportEmail: string | null;
|
|
247
|
+
exportWebhookUrl: string | null;
|
|
248
|
+
}): Promise<Record<string, unknown>>;
|
|
161
249
|
/**
|
|
162
250
|
* Presigned download URL for one day's export CSV.
|
|
163
251
|
* @param date Export date as YYYY-MM-DD. Required by the endpoint.
|
|
164
252
|
*/
|
|
165
253
|
downloadExport(date: string): Promise<Record<string, unknown>>;
|
|
166
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Generate the daily export now, for yesterday (UTC) or `date` (YYYY-MM-DD).
|
|
256
|
+
*/
|
|
257
|
+
testExport(date?: string): Promise<{
|
|
258
|
+
success: boolean;
|
|
259
|
+
date: string;
|
|
260
|
+
transactionCount: number;
|
|
261
|
+
downloadUrl: string | null;
|
|
262
|
+
}>;
|
|
167
263
|
getTheme(): Promise<Record<string, unknown>>;
|
|
168
|
-
setTheme(theme:
|
|
264
|
+
setTheme(theme: ThemeUpdateRequest): Promise<Record<string, unknown>>;
|
|
169
265
|
clearSnapshots(): Promise<{
|
|
170
266
|
cleared: number;
|
|
171
267
|
}>;
|
|
@@ -185,13 +281,16 @@ export declare class AdminBonusesApi {
|
|
|
185
281
|
private readonly client;
|
|
186
282
|
constructor(client: FastClient);
|
|
187
283
|
listOffers(): Promise<BonusOffer[]>;
|
|
188
|
-
createOffer(data:
|
|
189
|
-
updateOffer(id: string, data:
|
|
284
|
+
createOffer(data: BonusOfferCreateRequest): Promise<BonusOffer>;
|
|
285
|
+
updateOffer(id: string, data: BonusOfferUpdateRequest): Promise<BonusOffer>;
|
|
286
|
+
/** Disable an offer. The API keeps the row (sets `enabled: false`) rather than deleting it. */
|
|
190
287
|
deleteOffer(id: string): Promise<{
|
|
191
|
-
|
|
288
|
+
disabled: boolean;
|
|
192
289
|
}>;
|
|
290
|
+
/** Active user bonuses across the tenant. */
|
|
193
291
|
listActive(): Promise<Record<string, unknown>[]>;
|
|
194
292
|
cancel(id: string): Promise<Record<string, unknown>>;
|
|
293
|
+
/** @param data.depositAmount - Integer cents, like every bonus amount (5000 = 50.00). */
|
|
195
294
|
grantToUser(data: {
|
|
196
295
|
userId: string;
|
|
197
296
|
bonusOfferId: string;
|
|
@@ -203,16 +302,18 @@ export declare class AdminBonusesApi {
|
|
|
203
302
|
available: Record<string, unknown>[];
|
|
204
303
|
completed: Record<string, unknown>[];
|
|
205
304
|
}>;
|
|
305
|
+
/** @param depositAmount - Integer cents (5000 = 50.00); required for deposit_match and reload offers. */
|
|
206
306
|
activate(userId: string, bonusOfferId: string, depositAmount?: number): Promise<Record<string, unknown>>;
|
|
207
307
|
}
|
|
208
308
|
export declare class AdminMissionsApi {
|
|
209
309
|
private readonly client;
|
|
210
310
|
constructor(client: FastClient);
|
|
211
311
|
list(): Promise<MissionDef[]>;
|
|
212
|
-
create(data:
|
|
213
|
-
update(id: string, data:
|
|
312
|
+
create(data: MissionCreateRequest): Promise<MissionDef>;
|
|
313
|
+
update(id: string, data: MissionUpdateRequest): Promise<MissionDef>;
|
|
314
|
+
/** Disable a mission. The API keeps the row (sets `enabled: false`) rather than deleting it. */
|
|
214
315
|
delete(id: string): Promise<{
|
|
215
|
-
|
|
316
|
+
disabled: boolean;
|
|
216
317
|
}>;
|
|
217
318
|
stats(): Promise<Record<string, unknown>>;
|
|
218
319
|
statsForMission(id: string): Promise<Record<string, unknown>>;
|
|
@@ -229,15 +330,23 @@ export declare class AdminTournamentsApi {
|
|
|
229
330
|
private readonly client;
|
|
230
331
|
constructor(client: FastClient);
|
|
231
332
|
list(): Promise<TournamentDef[]>;
|
|
232
|
-
create(data:
|
|
233
|
-
update(id: string, data: Partial<
|
|
234
|
-
/**
|
|
235
|
-
|
|
333
|
+
create(data: TournamentCreateRequest): Promise<TournamentDef>;
|
|
334
|
+
update(id: string, data: Partial<TournamentCreateRequest>): Promise<TournamentDef>;
|
|
335
|
+
/**
|
|
336
|
+
* Cancel an upcoming or active tournament. `cancelled` is false when the
|
|
337
|
+
* tournament is unknown, already finished or already cancelled.
|
|
338
|
+
*/
|
|
339
|
+
cancel(id: string): Promise<{
|
|
340
|
+
cancelled: boolean;
|
|
341
|
+
}>;
|
|
236
342
|
settle(id: string): Promise<Record<string, unknown>>;
|
|
237
343
|
entries(id: string): Promise<{
|
|
238
|
-
entries:
|
|
344
|
+
entries: TournamentEntry[];
|
|
345
|
+
}>;
|
|
346
|
+
invite(id: string, userIds: string[]): Promise<{
|
|
347
|
+
invited: number;
|
|
348
|
+
alreadyInvited: number;
|
|
239
349
|
}>;
|
|
240
|
-
invite(id: string, userIds: string[]): Promise<Record<string, unknown>>;
|
|
241
350
|
invites(id: string): Promise<{
|
|
242
351
|
invites: Record<string, unknown>[];
|
|
243
352
|
}>;
|
|
@@ -255,21 +364,41 @@ export declare class AdminLoyaltyApi {
|
|
|
255
364
|
private readonly client;
|
|
256
365
|
constructor(client: FastClient);
|
|
257
366
|
getConfig(): Promise<LoyaltyConfig | null>;
|
|
258
|
-
setConfig(config:
|
|
367
|
+
setConfig(config: LoyaltyConfigUpdateRequest): Promise<LoyaltyConfig>;
|
|
259
368
|
getTiers(): Promise<LoyaltyTier[]>;
|
|
260
|
-
createTier(data:
|
|
261
|
-
updateTier(id: string, data:
|
|
369
|
+
createTier(data: LoyaltyTierCreateRequest): Promise<LoyaltyTier>;
|
|
370
|
+
updateTier(id: string, data: LoyaltyTierUpdateRequest): Promise<LoyaltyTier>;
|
|
262
371
|
deleteTier(id: string): Promise<{
|
|
263
372
|
deleted: boolean;
|
|
264
373
|
}>;
|
|
374
|
+
/**
|
|
375
|
+
* Users' loyalty state, most points first. Filter by `tier`, the tier
|
|
376
|
+
* **name**. `tierId` is still accepted: the SDK looks the name up first.
|
|
377
|
+
*/
|
|
265
378
|
listUsers(options?: {
|
|
379
|
+
tier?: string; /** @deprecated Use `tier` (the tier name). */
|
|
266
380
|
tierId?: string;
|
|
267
381
|
limit?: number;
|
|
382
|
+
offset?: number;
|
|
268
383
|
}): Promise<{
|
|
269
384
|
users: Record<string, unknown>[];
|
|
385
|
+
total: number;
|
|
386
|
+
}>;
|
|
387
|
+
/** One user's loyalty state and recent point history. `loyalty` is null when the user has none yet. */
|
|
388
|
+
getUser(userId: string): Promise<{
|
|
389
|
+
loyalty: Record<string, unknown> | null;
|
|
390
|
+
history: {
|
|
391
|
+
entries: Record<string, unknown>[];
|
|
392
|
+
total: number;
|
|
393
|
+
};
|
|
394
|
+
}>;
|
|
395
|
+
/**
|
|
396
|
+
* Add (positive) or remove (negative) points. The API records a reason with
|
|
397
|
+
* every adjustment; when none is given the SDK sends `'Manual adjustment'`.
|
|
398
|
+
*/
|
|
399
|
+
adjustPoints(userId: string, points: number, reason?: string): Promise<{
|
|
400
|
+
newTotal: number;
|
|
270
401
|
}>;
|
|
271
|
-
getUser(userId: string): Promise<Record<string, unknown>>;
|
|
272
|
-
adjustPoints(userId: string, points: number, reason?: string): Promise<Record<string, unknown>>;
|
|
273
402
|
getPublicTiers(): Promise<LoyaltyTier[]>;
|
|
274
403
|
stats(): Promise<LoyaltyStats>;
|
|
275
404
|
getUserLoyalty(userId: string): Promise<Record<string, unknown> | null>;
|
|
@@ -277,25 +406,46 @@ export declare class AdminLoyaltyApi {
|
|
|
277
406
|
export declare class AdminAnalyticsApi {
|
|
278
407
|
private readonly client;
|
|
279
408
|
constructor(client: FastClient);
|
|
280
|
-
overview(
|
|
409
|
+
/** Dashboard overview for a month (default: the current one). */
|
|
410
|
+
overview(options?: {
|
|
411
|
+
month?: number;
|
|
412
|
+
year?: number;
|
|
413
|
+
}): Promise<AdminOverview>;
|
|
414
|
+
/**
|
|
415
|
+
* Recent API requests for the tenant, newest first (max 200). Filter by
|
|
416
|
+
* `path` prefix, `status` (e.g. `500`, `4xx`) or `correlationId`.
|
|
417
|
+
* The API does not paginate; `offset` is ignored.
|
|
418
|
+
*/
|
|
281
419
|
requestLog(options?: {
|
|
282
|
-
|
|
420
|
+
path?: string;
|
|
421
|
+
status?: string;
|
|
422
|
+
correlationId?: string;
|
|
423
|
+
limit?: number; /** @deprecated Not supported by the API. */
|
|
283
424
|
offset?: number;
|
|
284
425
|
}): Promise<{
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
426
|
+
requests: Array<{
|
|
427
|
+
id: string;
|
|
428
|
+
method: string;
|
|
429
|
+
path: string;
|
|
430
|
+
statusCode: number;
|
|
431
|
+
durationMs: number;
|
|
432
|
+
correlationId: string | null;
|
|
433
|
+
userAgent: string | null;
|
|
434
|
+
ip: string | null;
|
|
435
|
+
createdAt: string;
|
|
436
|
+
}>;
|
|
437
|
+
}>;
|
|
438
|
+
/** Challenge analytics (pass/fail rates, volumes). `from`/`to` are full ISO 8601 date-times; a bare date is rejected. */
|
|
289
439
|
challenges(options?: {
|
|
290
440
|
from?: string;
|
|
291
441
|
to?: string;
|
|
292
442
|
}): Promise<Record<string, unknown>>;
|
|
293
|
-
/** Revenue analytics
|
|
443
|
+
/** Revenue analytics. `from`/`to` are full ISO 8601 date-times; a bare date is rejected. */
|
|
294
444
|
revenue(options?: {
|
|
295
445
|
from?: string;
|
|
296
446
|
to?: string;
|
|
297
447
|
}): Promise<Record<string, unknown>>;
|
|
298
|
-
/** User cohort analytics
|
|
448
|
+
/** User cohort analytics. `from`/`to` are full ISO 8601 date-times; a bare date is rejected. */
|
|
299
449
|
users(options?: {
|
|
300
450
|
from?: string;
|
|
301
451
|
to?: string;
|
|
@@ -333,24 +483,32 @@ export declare class AdminAchievementsApi {
|
|
|
333
483
|
rarity: string;
|
|
334
484
|
enabled: boolean;
|
|
335
485
|
}>>;
|
|
336
|
-
create(data:
|
|
337
|
-
update(id: string, data:
|
|
486
|
+
create(data: AchievementCreateRequest): Promise<Record<string, unknown>>;
|
|
487
|
+
update(id: string, data: AchievementUpdateRequest): Promise<Record<string, unknown>>;
|
|
338
488
|
delete(id: string): Promise<{
|
|
339
489
|
deleted: boolean;
|
|
340
490
|
}>;
|
|
341
491
|
forUser(userId: string): Promise<{
|
|
342
492
|
achievements: Record<string, unknown>[];
|
|
493
|
+
totalPoints: number;
|
|
343
494
|
}>;
|
|
495
|
+
/** @throws {FastApiError} 409 `already_earned` if the user has it */
|
|
344
496
|
grant(userId: string, achievementId: string): Promise<{
|
|
345
497
|
id: string;
|
|
498
|
+
tenantId: string;
|
|
499
|
+
userId: string;
|
|
346
500
|
achievementId: string;
|
|
347
|
-
|
|
501
|
+
earnedAt: string;
|
|
502
|
+
metadata: Record<string, unknown> | null;
|
|
348
503
|
}>;
|
|
504
|
+
/** Grant one achievement to up to 500 users. Users who already have it are counted in `skipped`. */
|
|
349
505
|
bulkGrant(data: {
|
|
350
506
|
achievementId: string;
|
|
351
507
|
userIds: string[];
|
|
352
508
|
}): Promise<{
|
|
353
509
|
granted: number;
|
|
510
|
+
skipped: number;
|
|
511
|
+
results: Array<Record<string, unknown>>;
|
|
354
512
|
}>;
|
|
355
513
|
gdprExport(userId: string): Promise<Record<string, unknown>>;
|
|
356
514
|
gdprErase(userId: string, confirmUserId: string): Promise<Record<string, unknown>>;
|
|
@@ -362,7 +520,7 @@ export declare class AdminNotificationsApi {
|
|
|
362
520
|
private readonly client;
|
|
363
521
|
constructor(client: FastClient);
|
|
364
522
|
getPreferences(): Promise<Record<string, unknown>>;
|
|
365
|
-
setPreferences(prefs:
|
|
523
|
+
setPreferences(prefs: NotificationPreferencesUpdate): Promise<Record<string, unknown>>;
|
|
366
524
|
}
|
|
367
525
|
export declare class AdminRewardsApi {
|
|
368
526
|
private readonly client;
|
|
@@ -381,30 +539,34 @@ export declare class AdminRewardsApi {
|
|
|
381
539
|
history(userId: string, options?: {
|
|
382
540
|
limit?: number;
|
|
383
541
|
}): Promise<{
|
|
384
|
-
|
|
385
|
-
total: number;
|
|
542
|
+
history: RewardApplication[];
|
|
386
543
|
}>;
|
|
387
|
-
/**
|
|
388
|
-
|
|
544
|
+
/**
|
|
545
|
+
* Manually grant a reward to a user.
|
|
546
|
+
*
|
|
547
|
+
* `value` is in EUR for money types, otherwise percent or days.
|
|
548
|
+
* `rewardValue` is accepted as a deprecated alias of `value`.
|
|
549
|
+
*
|
|
550
|
+
* @returns The id of the new pending reward
|
|
551
|
+
*/
|
|
552
|
+
grant(data: RewardGrantRequest & {
|
|
389
553
|
userId: string;
|
|
390
|
-
rewardType: string;
|
|
391
|
-
rewardValue: number;
|
|
392
|
-
applyMode?: string;
|
|
393
|
-
expiresInDays?: number;
|
|
394
554
|
}): Promise<{
|
|
395
|
-
|
|
555
|
+
rewardId: string;
|
|
396
556
|
}>;
|
|
397
|
-
/**
|
|
398
|
-
bulkGrant(data: {
|
|
557
|
+
/** Grant the same reward to up to 500 users. `rewardValue` is a deprecated alias of `value`. */
|
|
558
|
+
bulkGrant(data: RewardGrantRequest & {
|
|
399
559
|
userIds: string[];
|
|
400
|
-
rewardType: string;
|
|
401
|
-
rewardValue: number;
|
|
402
|
-
applyMode?: string;
|
|
403
560
|
}): Promise<{
|
|
404
561
|
granted: number;
|
|
562
|
+
failed: number;
|
|
405
563
|
}>;
|
|
406
|
-
/**
|
|
564
|
+
/**
|
|
565
|
+
* Revoke a pending (unconsumed) reward.
|
|
566
|
+
* @throws {FastApiError} 404 if it does not exist or was already consumed
|
|
567
|
+
*/
|
|
407
568
|
delete(id: string): Promise<{
|
|
569
|
+
revoked: boolean; /** @deprecated Use `revoked`. */
|
|
408
570
|
deleted: boolean;
|
|
409
571
|
}>;
|
|
410
572
|
}
|
|
@@ -414,9 +576,13 @@ export declare class AdminRewardRulesApi {
|
|
|
414
576
|
/** List all reward rule definitions. */
|
|
415
577
|
list(): Promise<RewardRule[]>;
|
|
416
578
|
/** Create a new reward rule. */
|
|
417
|
-
|
|
579
|
+
/**
|
|
580
|
+
* Create a reward rule. `name`, `criteria`, `rewardType` and `rewardValue`
|
|
581
|
+
* are required. The deprecated `triggerType`/`triggerThreshold` are mapped to `criteria`.
|
|
582
|
+
*/
|
|
583
|
+
create(data: RewardRuleInput & Required<Pick<RewardRuleInput, 'name' | 'rewardType' | 'rewardValue'>>): Promise<RewardRule>;
|
|
418
584
|
/** Update an existing reward rule. */
|
|
419
|
-
update(id: string, data:
|
|
585
|
+
update(id: string, data: RewardRuleInput): Promise<RewardRule>;
|
|
420
586
|
/** Delete a reward rule. */
|
|
421
587
|
delete(id: string): Promise<{
|
|
422
588
|
deleted: boolean;
|
|
@@ -425,20 +591,38 @@ export declare class AdminRewardRulesApi {
|
|
|
425
591
|
export declare class AdminSelfExclusionApi {
|
|
426
592
|
private readonly client;
|
|
427
593
|
constructor(client: FastClient);
|
|
428
|
-
/** List
|
|
429
|
-
list(
|
|
594
|
+
/** List currently excluded users (paginated: limit default 100, max 500). */
|
|
595
|
+
list(options?: {
|
|
596
|
+
limit?: number;
|
|
597
|
+
offset?: number;
|
|
598
|
+
}): Promise<{
|
|
599
|
+
entries: SelfExclusionRecord[];
|
|
600
|
+
total: number;
|
|
601
|
+
limit: number;
|
|
602
|
+
offset: number;
|
|
603
|
+
/** @deprecated Use `entries`. */
|
|
430
604
|
exclusions: SelfExclusionRecord[];
|
|
431
605
|
}>;
|
|
432
|
-
/**
|
|
606
|
+
/**
|
|
607
|
+
* Get the exclusion for a user.
|
|
608
|
+
* @throws {FastApiError} 404 if the user is not excluded
|
|
609
|
+
*/
|
|
433
610
|
get(userId: string): Promise<SelfExclusionRecord>;
|
|
434
|
-
/**
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
611
|
+
/**
|
|
612
|
+
* Exclude a user from purchasing challenges. Upsert: re-excluding updates the record.
|
|
613
|
+
*
|
|
614
|
+
* Give `expiresAt` (ISO 8601) for a temporary exclusion; omit it (or pass
|
|
615
|
+
* null) for a permanent one. `durationDays` is converted to `expiresAt`
|
|
616
|
+
* client-side (now + days).
|
|
617
|
+
*/
|
|
618
|
+
exclude(data: SelfExclusionRequest): Promise<SelfExclusionRecord>;
|
|
619
|
+
/**
|
|
620
|
+
* Lift the exclusion for a user (the record is removed).
|
|
621
|
+
* @throws {FastApiError} 404 if the user is not excluded
|
|
622
|
+
*/
|
|
441
623
|
lift(userId: string): Promise<{
|
|
624
|
+
reinstated: boolean;
|
|
625
|
+
userId: string; /** @deprecated Use `reinstated`. */
|
|
442
626
|
lifted: boolean;
|
|
443
627
|
}>;
|
|
444
628
|
}
|
|
@@ -574,14 +758,26 @@ export declare class AdminTemplatesApi {
|
|
|
574
758
|
export declare class AdminSupportApi {
|
|
575
759
|
private readonly client;
|
|
576
760
|
constructor(client: FastClient);
|
|
761
|
+
/** Support requests for the tenant. The API does not paginate; `limit` is ignored. */
|
|
577
762
|
list(options?: {
|
|
578
|
-
status?: string;
|
|
763
|
+
status?: string; /** @deprecated Not supported by the API. */
|
|
579
764
|
limit?: number;
|
|
580
765
|
}): Promise<{
|
|
581
766
|
requests: Record<string, unknown>[];
|
|
582
767
|
}>;
|
|
583
|
-
|
|
584
|
-
|
|
768
|
+
/** A support request with its messages. */
|
|
769
|
+
get(id: string): Promise<{
|
|
770
|
+
request: Record<string, unknown>;
|
|
771
|
+
messages: Record<string, unknown>[];
|
|
772
|
+
}>;
|
|
773
|
+
/**
|
|
774
|
+
* Open a new support request. Category defaults to 'other'.
|
|
775
|
+
*
|
|
776
|
+
* @deprecated Needs an admin session: the API records which admin wrote it
|
|
777
|
+
* and answers 400 `unauthorized` to a server API key. It works only if the
|
|
778
|
+
* client sends an admin JWT, e.g. `new FastClient({ apiKey, headers: { Authorization: 'Bearer <admin JWT>' } })`.
|
|
779
|
+
* Open requests from the backoffice instead.
|
|
780
|
+
*/
|
|
585
781
|
create(data: {
|
|
586
782
|
subject: string;
|
|
587
783
|
body: string;
|
|
@@ -589,7 +785,12 @@ export declare class AdminSupportApi {
|
|
|
589
785
|
}): Promise<{
|
|
590
786
|
request: Record<string, unknown>;
|
|
591
787
|
}>;
|
|
592
|
-
/**
|
|
788
|
+
/**
|
|
789
|
+
* Add a message to an existing support request.
|
|
790
|
+
*
|
|
791
|
+
* @deprecated Needs an admin session, like {@link create}: a server API key
|
|
792
|
+
* gets 400 `unauthorized`. Reply from the backoffice instead.
|
|
793
|
+
*/
|
|
593
794
|
addMessage(id: string, body: string): Promise<Record<string, unknown>>;
|
|
594
795
|
/** Close a support request. */
|
|
595
796
|
close(id: string): Promise<Record<string, unknown>>;
|