glitch-javascript-sdk 2.4.9 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +145 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Raffles.d.ts +98 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +145 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/RafflesRoute.d.ts +7 -0
- package/dist/index.d.ts +97 -0
- package/package.json +1 -1
- package/src/api/Raffles.ts +134 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +2 -0
- package/src/routes/RafflesRoute.ts +35 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
3
|
+
declare class Raffles {
|
|
4
|
+
/**
|
|
5
|
+
* List all raffles with optional filters.
|
|
6
|
+
*/
|
|
7
|
+
static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
8
|
+
/**
|
|
9
|
+
* Create a new raffle (Game Owner).
|
|
10
|
+
*/
|
|
11
|
+
static create<T>(data: object): AxiosPromise<Response<T>>;
|
|
12
|
+
/**
|
|
13
|
+
* Retrieve details for a specific raffle.
|
|
14
|
+
*/
|
|
15
|
+
static view<T>(id: string): AxiosPromise<Response<T>>;
|
|
16
|
+
/**
|
|
17
|
+
* Enter a raffle (User/Player). Requires Steam ID.
|
|
18
|
+
*/
|
|
19
|
+
static enter<T>(id: string, data: {
|
|
20
|
+
referral_code?: string;
|
|
21
|
+
device_fingerprint?: string;
|
|
22
|
+
opt_in_playtesting?: boolean;
|
|
23
|
+
}): AxiosPromise<Response<T>>;
|
|
24
|
+
/**
|
|
25
|
+
* Get the authenticated user's entry status for a specific raffle.
|
|
26
|
+
*/
|
|
27
|
+
static me<T>(id: string): AxiosPromise<Response<T>>;
|
|
28
|
+
/**
|
|
29
|
+
* Record a viral action (e.g., Steam Wishlist, Social Share).
|
|
30
|
+
*/
|
|
31
|
+
static performAction<T>(id: string, data: {
|
|
32
|
+
action_type: string;
|
|
33
|
+
platform?: string;
|
|
34
|
+
reference_id?: string;
|
|
35
|
+
}): AxiosPromise<Response<T>>;
|
|
36
|
+
/**
|
|
37
|
+
* Post raffle content to social media via Glitch API.
|
|
38
|
+
*/
|
|
39
|
+
static shareSocially<T>(id: string, data: {
|
|
40
|
+
platform: string;
|
|
41
|
+
content: string;
|
|
42
|
+
}): AxiosPromise<Response<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Send an invitation email to a friend.
|
|
45
|
+
*/
|
|
46
|
+
static inviteFriend<T>(id: string, data: {
|
|
47
|
+
email: string;
|
|
48
|
+
}): AxiosPromise<Response<T>>;
|
|
49
|
+
/**
|
|
50
|
+
* Add a prize tier to a raffle (Game Owner).
|
|
51
|
+
*/
|
|
52
|
+
static addPrize<T>(id: string, data: object): AxiosPromise<Response<T>>;
|
|
53
|
+
/**
|
|
54
|
+
* Trigger the automated drawing process (Game Owner).
|
|
55
|
+
*/
|
|
56
|
+
static drawWinners<T>(id: string): AxiosPromise<Response<T>>;
|
|
57
|
+
/**
|
|
58
|
+
* Manually select a winner for a specific prize (Live Event Mode).
|
|
59
|
+
*/
|
|
60
|
+
static pickWinner<T>(id: string, data: {
|
|
61
|
+
entry_id: string;
|
|
62
|
+
prize_id: string;
|
|
63
|
+
}): AxiosPromise<Response<T>>;
|
|
64
|
+
/**
|
|
65
|
+
* Get the public list of winners for a completed raffle.
|
|
66
|
+
*/
|
|
67
|
+
static winners<T>(id: string): AxiosPromise<Response<T>>;
|
|
68
|
+
/**
|
|
69
|
+
* List all participants/entries for a raffle (Game Owner).
|
|
70
|
+
*/
|
|
71
|
+
static participants<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
72
|
+
/**
|
|
73
|
+
* Update shipping/tracking info for a prize (Game Owner).
|
|
74
|
+
*/
|
|
75
|
+
static fulfillPrize<T>(entry_id: string, data: {
|
|
76
|
+
tracking_number: string;
|
|
77
|
+
shipping_carrier: string;
|
|
78
|
+
}): AxiosPromise<Response<T>>;
|
|
79
|
+
/**
|
|
80
|
+
* Submit shipping address for a won prize (User/Winner).
|
|
81
|
+
*/
|
|
82
|
+
static updateAddress<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
|
|
83
|
+
/**
|
|
84
|
+
* Disqualify a specific entry (Game Owner).
|
|
85
|
+
*/
|
|
86
|
+
static disqualify<T>(id: string, entry_id: string, data: {
|
|
87
|
+
reason: string;
|
|
88
|
+
}): AxiosPromise<Response<T>>;
|
|
89
|
+
/**
|
|
90
|
+
* Check if the raffle is fully funded in the community ledger.
|
|
91
|
+
*/
|
|
92
|
+
static escrowStatus<T>(id: string): AxiosPromise<Response<T>>;
|
|
93
|
+
/**
|
|
94
|
+
* Get viral loop analytics (K-Factor, Cost Per Entry).
|
|
95
|
+
*/
|
|
96
|
+
static analytics<T>(id: string): AxiosPromise<Response<T>>;
|
|
97
|
+
}
|
|
98
|
+
export default Raffles;
|
package/dist/esm/api/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ import ShortLinks from "./ShortLinks";
|
|
|
38
38
|
import AIUsage from "./AIUsage";
|
|
39
39
|
import MarketingAgencies from "./MarketingAgencies";
|
|
40
40
|
import TwitchReporting from "./TwitchReporting";
|
|
41
|
+
import Raffles from "./Raffles";
|
|
41
42
|
export { Ads };
|
|
42
43
|
export { AccessKeys };
|
|
43
44
|
export { Auth };
|
|
@@ -78,3 +79,4 @@ export { ShortLinks };
|
|
|
78
79
|
export { AIUsage };
|
|
79
80
|
export { MarketingAgencies };
|
|
80
81
|
export { TwitchReporting };
|
|
82
|
+
export { Raffles };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ import { ShortLinks } from "./api";
|
|
|
38
38
|
import { AIUsage } from "./api";
|
|
39
39
|
import { MarketingAgencies } from "./api";
|
|
40
40
|
import { TwitchReporting } from './api';
|
|
41
|
+
import { Raffles } from './api';
|
|
41
42
|
import Requests from "./util/Requests";
|
|
42
43
|
import Parser from "./util/Parser";
|
|
43
44
|
import Session from "./util/Session";
|
|
@@ -97,6 +98,7 @@ declare class Glitch {
|
|
|
97
98
|
AIUsage: typeof AIUsage;
|
|
98
99
|
MarketingAgencies: typeof MarketingAgencies;
|
|
99
100
|
TwitchReporting: typeof TwitchReporting;
|
|
101
|
+
Raffles: typeof Raffles;
|
|
100
102
|
};
|
|
101
103
|
static util: {
|
|
102
104
|
Requests: typeof Requests;
|
package/dist/esm/index.js
CHANGED
|
@@ -16187,6 +16187,150 @@ var TwitchReporting = /** @class */ (function () {
|
|
|
16187
16187
|
return TwitchReporting;
|
|
16188
16188
|
}());
|
|
16189
16189
|
|
|
16190
|
+
var RafflesRoute = /** @class */ (function () {
|
|
16191
|
+
function RafflesRoute() {
|
|
16192
|
+
}
|
|
16193
|
+
RafflesRoute.routes = {
|
|
16194
|
+
list: { url: '/raffles', method: HTTP_METHODS.GET },
|
|
16195
|
+
create: { url: '/raffles', method: HTTP_METHODS.POST },
|
|
16196
|
+
view: { url: '/raffles/{id}', method: HTTP_METHODS.GET },
|
|
16197
|
+
enter: { url: '/raffles/{id}/enter', method: HTTP_METHODS.POST },
|
|
16198
|
+
me: { url: '/raffles/{id}/me', method: HTTP_METHODS.GET },
|
|
16199
|
+
performAction: { url: '/raffles/{id}/actions', method: HTTP_METHODS.POST },
|
|
16200
|
+
shareSocially: { url: '/raffles/{id}/share', method: HTTP_METHODS.POST },
|
|
16201
|
+
inviteFriend: { url: '/raffles/{id}/invite-friend', method: HTTP_METHODS.POST },
|
|
16202
|
+
// Prize Management
|
|
16203
|
+
addPrize: { url: '/raffles/{id}/prizes', method: HTTP_METHODS.POST },
|
|
16204
|
+
// Drawing & Winners
|
|
16205
|
+
drawWinners: { url: '/raffles/{id}/draw', method: HTTP_METHODS.POST },
|
|
16206
|
+
pickWinner: { url: '/raffles/{id}/pick-winner', method: HTTP_METHODS.POST },
|
|
16207
|
+
winners: { url: '/raffles/{id}/winners', method: HTTP_METHODS.GET },
|
|
16208
|
+
// Participant & Fulfillment Management
|
|
16209
|
+
participants: { url: '/raffles/{id}/participants', method: HTTP_METHODS.GET },
|
|
16210
|
+
fulfillPrize: { url: '/raffles/entries/{entry_id}/fulfill', method: HTTP_METHODS.PUT },
|
|
16211
|
+
updateAddress: { url: '/raffles/entries/{entry_id}/address', method: HTTP_METHODS.PUT },
|
|
16212
|
+
disqualify: { url: '/raffles/{id}/disqualify/{entry_id}', method: HTTP_METHODS.POST },
|
|
16213
|
+
// Analytics & Finance
|
|
16214
|
+
escrowStatus: { url: '/raffles/{id}/escrow', method: HTTP_METHODS.GET },
|
|
16215
|
+
analytics: { url: '/raffles/{id}/analytics', method: HTTP_METHODS.GET },
|
|
16216
|
+
};
|
|
16217
|
+
return RafflesRoute;
|
|
16218
|
+
}());
|
|
16219
|
+
|
|
16220
|
+
var Raffles = /** @class */ (function () {
|
|
16221
|
+
function Raffles() {
|
|
16222
|
+
}
|
|
16223
|
+
/**
|
|
16224
|
+
* List all raffles with optional filters.
|
|
16225
|
+
*/
|
|
16226
|
+
Raffles.list = function (params) {
|
|
16227
|
+
return Requests.processRoute(RafflesRoute.routes.list, undefined, undefined, params);
|
|
16228
|
+
};
|
|
16229
|
+
/**
|
|
16230
|
+
* Create a new raffle (Game Owner).
|
|
16231
|
+
*/
|
|
16232
|
+
Raffles.create = function (data) {
|
|
16233
|
+
return Requests.processRoute(RafflesRoute.routes.create, data);
|
|
16234
|
+
};
|
|
16235
|
+
/**
|
|
16236
|
+
* Retrieve details for a specific raffle.
|
|
16237
|
+
*/
|
|
16238
|
+
Raffles.view = function (id) {
|
|
16239
|
+
return Requests.processRoute(RafflesRoute.routes.view, {}, { id: id });
|
|
16240
|
+
};
|
|
16241
|
+
/**
|
|
16242
|
+
* Enter a raffle (User/Player). Requires Steam ID.
|
|
16243
|
+
*/
|
|
16244
|
+
Raffles.enter = function (id, data) {
|
|
16245
|
+
return Requests.processRoute(RafflesRoute.routes.enter, data, { id: id });
|
|
16246
|
+
};
|
|
16247
|
+
/**
|
|
16248
|
+
* Get the authenticated user's entry status for a specific raffle.
|
|
16249
|
+
*/
|
|
16250
|
+
Raffles.me = function (id) {
|
|
16251
|
+
return Requests.processRoute(RafflesRoute.routes.me, {}, { id: id });
|
|
16252
|
+
};
|
|
16253
|
+
/**
|
|
16254
|
+
* Record a viral action (e.g., Steam Wishlist, Social Share).
|
|
16255
|
+
*/
|
|
16256
|
+
Raffles.performAction = function (id, data) {
|
|
16257
|
+
return Requests.processRoute(RafflesRoute.routes.performAction, data, { id: id });
|
|
16258
|
+
};
|
|
16259
|
+
/**
|
|
16260
|
+
* Post raffle content to social media via Glitch API.
|
|
16261
|
+
*/
|
|
16262
|
+
Raffles.shareSocially = function (id, data) {
|
|
16263
|
+
return Requests.processRoute(RafflesRoute.routes.shareSocially, data, { id: id });
|
|
16264
|
+
};
|
|
16265
|
+
/**
|
|
16266
|
+
* Send an invitation email to a friend.
|
|
16267
|
+
*/
|
|
16268
|
+
Raffles.inviteFriend = function (id, data) {
|
|
16269
|
+
return Requests.processRoute(RafflesRoute.routes.inviteFriend, data, { id: id });
|
|
16270
|
+
};
|
|
16271
|
+
/**
|
|
16272
|
+
* Add a prize tier to a raffle (Game Owner).
|
|
16273
|
+
*/
|
|
16274
|
+
Raffles.addPrize = function (id, data) {
|
|
16275
|
+
return Requests.processRoute(RafflesRoute.routes.addPrize, data, { id: id });
|
|
16276
|
+
};
|
|
16277
|
+
/**
|
|
16278
|
+
* Trigger the automated drawing process (Game Owner).
|
|
16279
|
+
*/
|
|
16280
|
+
Raffles.drawWinners = function (id) {
|
|
16281
|
+
return Requests.processRoute(RafflesRoute.routes.drawWinners, {}, { id: id });
|
|
16282
|
+
};
|
|
16283
|
+
/**
|
|
16284
|
+
* Manually select a winner for a specific prize (Live Event Mode).
|
|
16285
|
+
*/
|
|
16286
|
+
Raffles.pickWinner = function (id, data) {
|
|
16287
|
+
return Requests.processRoute(RafflesRoute.routes.pickWinner, data, { id: id });
|
|
16288
|
+
};
|
|
16289
|
+
/**
|
|
16290
|
+
* Get the public list of winners for a completed raffle.
|
|
16291
|
+
*/
|
|
16292
|
+
Raffles.winners = function (id) {
|
|
16293
|
+
return Requests.processRoute(RafflesRoute.routes.winners, {}, { id: id });
|
|
16294
|
+
};
|
|
16295
|
+
/**
|
|
16296
|
+
* List all participants/entries for a raffle (Game Owner).
|
|
16297
|
+
*/
|
|
16298
|
+
Raffles.participants = function (id, params) {
|
|
16299
|
+
return Requests.processRoute(RafflesRoute.routes.participants, {}, { id: id }, params);
|
|
16300
|
+
};
|
|
16301
|
+
/**
|
|
16302
|
+
* Update shipping/tracking info for a prize (Game Owner).
|
|
16303
|
+
*/
|
|
16304
|
+
Raffles.fulfillPrize = function (entry_id, data) {
|
|
16305
|
+
return Requests.processRoute(RafflesRoute.routes.fulfillPrize, data, { entry_id: entry_id });
|
|
16306
|
+
};
|
|
16307
|
+
/**
|
|
16308
|
+
* Submit shipping address for a won prize (User/Winner).
|
|
16309
|
+
*/
|
|
16310
|
+
Raffles.updateAddress = function (entry_id, data) {
|
|
16311
|
+
return Requests.processRoute(RafflesRoute.routes.updateAddress, data, { entry_id: entry_id });
|
|
16312
|
+
};
|
|
16313
|
+
/**
|
|
16314
|
+
* Disqualify a specific entry (Game Owner).
|
|
16315
|
+
*/
|
|
16316
|
+
Raffles.disqualify = function (id, entry_id, data) {
|
|
16317
|
+
return Requests.processRoute(RafflesRoute.routes.disqualify, data, { id: id, entry_id: entry_id });
|
|
16318
|
+
};
|
|
16319
|
+
/**
|
|
16320
|
+
* Check if the raffle is fully funded in the community ledger.
|
|
16321
|
+
*/
|
|
16322
|
+
Raffles.escrowStatus = function (id) {
|
|
16323
|
+
return Requests.processRoute(RafflesRoute.routes.escrowStatus, {}, { id: id });
|
|
16324
|
+
};
|
|
16325
|
+
/**
|
|
16326
|
+
* Get viral loop analytics (K-Factor, Cost Per Entry).
|
|
16327
|
+
*/
|
|
16328
|
+
Raffles.analytics = function (id) {
|
|
16329
|
+
return Requests.processRoute(RafflesRoute.routes.analytics, {}, { id: id });
|
|
16330
|
+
};
|
|
16331
|
+
return Raffles;
|
|
16332
|
+
}());
|
|
16333
|
+
|
|
16190
16334
|
var Parser = /** @class */ (function () {
|
|
16191
16335
|
function Parser() {
|
|
16192
16336
|
}
|
|
@@ -16715,6 +16859,7 @@ var Glitch = /** @class */ (function () {
|
|
|
16715
16859
|
AIUsage: AIUsage,
|
|
16716
16860
|
MarketingAgencies: MarketingAgencies,
|
|
16717
16861
|
TwitchReporting: TwitchReporting,
|
|
16862
|
+
Raffles: Raffles,
|
|
16718
16863
|
};
|
|
16719
16864
|
Glitch.util = {
|
|
16720
16865
|
Requests: Requests,
|