glitch-javascript-sdk 2.5.0 → 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.
@@ -2,91 +2,97 @@ import Response from "../util/Response";
2
2
  import { AxiosPromise } from "axios";
3
3
  declare class Raffles {
4
4
  /**
5
- * List all raffles.
6
- * @param params Filter by title_id, community_id, or status.
5
+ * List all raffles with optional filters.
7
6
  */
8
7
  static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
9
8
  /**
10
- * Create a new raffle for a specific title.
9
+ * Create a new raffle (Game Owner).
11
10
  */
12
11
  static create<T>(data: object): AxiosPromise<Response<T>>;
13
12
  /**
14
- * Get full details of a raffle.
13
+ * Retrieve details for a specific raffle.
15
14
  */
16
- static view<T>(raffle_id: string): AxiosPromise<Response<T>>;
15
+ static view<T>(id: string): AxiosPromise<Response<T>>;
17
16
  /**
18
- * Update raffle settings (Draft/Active status, dates, etc).
17
+ * Enter a raffle (User/Player). Requires Steam ID.
19
18
  */
20
- static update<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
19
+ static enter<T>(id: string, data: {
20
+ referral_code?: string;
21
+ device_fingerprint?: string;
22
+ opt_in_playtesting?: boolean;
23
+ }): AxiosPromise<Response<T>>;
21
24
  /**
22
- * Delete a raffle.
25
+ * Get the authenticated user's entry status for a specific raffle.
23
26
  */
24
- static delete<T>(raffle_id: string): AxiosPromise<Response<T>>;
27
+ static me<T>(id: string): AxiosPromise<Response<T>>;
25
28
  /**
26
- * Enter the authenticated user into the raffle.
27
- * @param data { referral_code?, device_fingerprint? }
29
+ * Record a viral action (e.g., Steam Wishlist, Social Share).
28
30
  */
29
- static enter<T>(raffle_id: string, data?: object): AxiosPromise<Response<T>>;
31
+ static performAction<T>(id: string, data: {
32
+ action_type: string;
33
+ platform?: string;
34
+ reference_id?: string;
35
+ }): AxiosPromise<Response<T>>;
30
36
  /**
31
- * Record a viral action (Steam Wishlist, Social Share) to earn more tickets.
32
- * @param data { action_type: 'steam_wishlist'|'social_share', platform?, reference_id? }
37
+ * Post raffle content to social media via Glitch API.
33
38
  */
34
- static performAction<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
39
+ static shareSocially<T>(id: string, data: {
40
+ platform: string;
41
+ content: string;
42
+ }): AxiosPromise<Response<T>>;
35
43
  /**
36
- * Get the authenticated user's specific entry status for this raffle.
44
+ * Send an invitation email to a friend.
37
45
  */
38
- static me<T>(raffle_id: string): AxiosPromise<Response<T>>;
46
+ static inviteFriend<T>(id: string, data: {
47
+ email: string;
48
+ }): AxiosPromise<Response<T>>;
39
49
  /**
40
- * Submit shipping address for a winning entry.
41
- * @param entry_id The UUID of the RaffleEntry.
50
+ * Add a prize tier to a raffle (Game Owner).
42
51
  */
43
- static updateAddress<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
52
+ static addPrize<T>(id: string, data: object): AxiosPromise<Response<T>>;
44
53
  /**
45
- * Invite a friend via email to join the raffle.
54
+ * Trigger the automated drawing process (Game Owner).
46
55
  */
47
- static inviteFriend<T>(raffle_id: string, data: {
48
- email: string;
49
- }): AxiosPromise<Response<T>>;
56
+ static drawWinners<T>(id: string): AxiosPromise<Response<T>>;
50
57
  /**
51
- * Get the public list of winners (only available if raffle is completed).
58
+ * Manually select a winner for a specific prize (Live Event Mode).
52
59
  */
53
- static winners<T>(raffle_id: string): AxiosPromise<Response<T>>;
60
+ static pickWinner<T>(id: string, data: {
61
+ entry_id: string;
62
+ prize_id: string;
63
+ }): AxiosPromise<Response<T>>;
54
64
  /**
55
- * Add a prize tier (quantity, value, description) to the raffle.
65
+ * Get the public list of winners for a completed raffle.
56
66
  */
57
- static addPrize<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
67
+ static winners<T>(id: string): AxiosPromise<Response<T>>;
58
68
  /**
59
- * Randomly draw winners for all prize tiers based on ticket weights.
69
+ * List all participants/entries for a raffle (Game Owner).
60
70
  */
61
- static drawWinners<T>(raffle_id: string): AxiosPromise<Response<T>>;
71
+ static participants<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
62
72
  /**
63
- * Manually assign a specific user to a specific prize (Live Event Mode).
64
- * @param data { entry_id, prize_id }
73
+ * Update shipping/tracking info for a prize (Game Owner).
65
74
  */
66
- static pickWinner<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
75
+ static fulfillPrize<T>(entry_id: string, data: {
76
+ tracking_number: string;
77
+ shipping_carrier: string;
78
+ }): AxiosPromise<Response<T>>;
67
79
  /**
68
- * Provide shipping/tracking info for a prize fulfillment.
69
- * @param entry_id The UUID of the RaffleEntry.
80
+ * Submit shipping address for a won prize (User/Winner).
70
81
  */
71
- static fulfillPrize<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
82
+ static updateAddress<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
72
83
  /**
73
- * Disqualify an entry for fraud or rule violations.
84
+ * Disqualify a specific entry (Game Owner).
74
85
  */
75
- static disqualify<T>(raffle_id: string, entry_id: string, data: {
86
+ static disqualify<T>(id: string, entry_id: string, data: {
76
87
  reason: string;
77
88
  }): AxiosPromise<Response<T>>;
78
- /**
79
- * List all participants/entries for management.
80
- * @param params { opt_in_playtesting?, page?, per_page? }
81
- */
82
- static listParticipants<T>(raffle_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
83
89
  /**
84
90
  * Check if the raffle is fully funded in the community ledger.
85
91
  */
86
- static escrowStatus<T>(raffle_id: string): AxiosPromise<Response<T>>;
92
+ static escrowStatus<T>(id: string): AxiosPromise<Response<T>>;
87
93
  /**
88
- * Get viral loop analytics (K-factor, Cost Per Entry).
94
+ * Get viral loop analytics (K-Factor, Cost Per Entry).
89
95
  */
90
- static analytics<T>(raffle_id: string): AxiosPromise<Response<T>>;
96
+ static analytics<T>(id: string): AxiosPromise<Response<T>>;
91
97
  }
92
98
  export default Raffles;
package/dist/esm/index.js CHANGED
@@ -16191,28 +16191,28 @@ var RafflesRoute = /** @class */ (function () {
16191
16191
  function RafflesRoute() {
16192
16192
  }
16193
16193
  RafflesRoute.routes = {
16194
- // CRUD
16195
16194
  list: { url: '/raffles', method: HTTP_METHODS.GET },
16196
16195
  create: { url: '/raffles', method: HTTP_METHODS.POST },
16197
- view: { url: '/raffles/{raffle_id}', method: HTTP_METHODS.GET },
16198
- update: { url: '/raffles/{raffle_id}', method: HTTP_METHODS.PUT },
16199
- delete: { url: '/raffles/{raffle_id}', method: HTTP_METHODS.DELETE },
16200
- // User/Player Actions
16201
- enter: { url: '/raffles/{raffle_id}/enter', method: HTTP_METHODS.POST },
16202
- performAction: { url: '/raffles/{raffle_id}/actions', method: HTTP_METHODS.POST },
16203
- me: { url: '/raffles/{raffle_id}/me', method: HTTP_METHODS.GET },
16204
- updateAddress: { url: '/raffles/entries/{entry_id}/address', method: HTTP_METHODS.PUT },
16205
- inviteFriend: { url: '/raffles/{raffle_id}/invite-friend', method: HTTP_METHODS.POST },
16206
- winners: { url: '/raffles/{raffle_id}/winners', method: HTTP_METHODS.GET },
16207
- // Admin/Developer Actions
16208
- addPrize: { url: '/raffles/{raffle_id}/prizes', method: HTTP_METHODS.POST },
16209
- drawWinners: { url: '/raffles/{raffle_id}/draw', method: HTTP_METHODS.POST },
16210
- pickWinner: { url: '/raffles/{raffle_id}/pick-winner', 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 },
16211
16210
  fulfillPrize: { url: '/raffles/entries/{entry_id}/fulfill', method: HTTP_METHODS.PUT },
16212
- disqualify: { url: '/raffles/{raffle_id}/disqualify/{entry_id}', method: HTTP_METHODS.POST },
16213
- participants: { url: '/raffles/{raffle_id}/participants', method: HTTP_METHODS.GET },
16214
- escrowStatus: { url: '/raffles/{raffle_id}/escrow', method: HTTP_METHODS.GET },
16215
- analytics: { url: '/raffles/{raffle_id}/analytics', method: HTTP_METHODS.GET },
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
16216
  };
16217
16217
  return RafflesRoute;
16218
16218
  }());
@@ -16221,125 +16221,112 @@ var Raffles = /** @class */ (function () {
16221
16221
  function Raffles() {
16222
16222
  }
16223
16223
  /**
16224
- * List all raffles.
16225
- * @param params Filter by title_id, community_id, or status.
16224
+ * List all raffles with optional filters.
16226
16225
  */
16227
16226
  Raffles.list = function (params) {
16228
16227
  return Requests.processRoute(RafflesRoute.routes.list, undefined, undefined, params);
16229
16228
  };
16230
16229
  /**
16231
- * Create a new raffle for a specific title.
16230
+ * Create a new raffle (Game Owner).
16232
16231
  */
16233
16232
  Raffles.create = function (data) {
16234
16233
  return Requests.processRoute(RafflesRoute.routes.create, data);
16235
16234
  };
16236
16235
  /**
16237
- * Get full details of a raffle.
16236
+ * Retrieve details for a specific raffle.
16238
16237
  */
16239
- Raffles.view = function (raffle_id) {
16240
- return Requests.processRoute(RafflesRoute.routes.view, {}, { raffle_id: raffle_id });
16238
+ Raffles.view = function (id) {
16239
+ return Requests.processRoute(RafflesRoute.routes.view, {}, { id: id });
16241
16240
  };
16242
16241
  /**
16243
- * Update raffle settings (Draft/Active status, dates, etc).
16242
+ * Enter a raffle (User/Player). Requires Steam ID.
16244
16243
  */
16245
- Raffles.update = function (raffle_id, data) {
16246
- return Requests.processRoute(RafflesRoute.routes.update, data, { raffle_id: raffle_id });
16244
+ Raffles.enter = function (id, data) {
16245
+ return Requests.processRoute(RafflesRoute.routes.enter, data, { id: id });
16247
16246
  };
16248
16247
  /**
16249
- * Delete a raffle.
16248
+ * Get the authenticated user's entry status for a specific raffle.
16250
16249
  */
16251
- Raffles.delete = function (raffle_id) {
16252
- return Requests.processRoute(RafflesRoute.routes.delete, {}, { raffle_id: raffle_id });
16250
+ Raffles.me = function (id) {
16251
+ return Requests.processRoute(RafflesRoute.routes.me, {}, { id: id });
16253
16252
  };
16254
16253
  /**
16255
- * Enter the authenticated user into the raffle.
16256
- * @param data { referral_code?, device_fingerprint? }
16254
+ * Record a viral action (e.g., Steam Wishlist, Social Share).
16257
16255
  */
16258
- Raffles.enter = function (raffle_id, data) {
16259
- return Requests.processRoute(RafflesRoute.routes.enter, data, { raffle_id: raffle_id });
16256
+ Raffles.performAction = function (id, data) {
16257
+ return Requests.processRoute(RafflesRoute.routes.performAction, data, { id: id });
16260
16258
  };
16261
16259
  /**
16262
- * Record a viral action (Steam Wishlist, Social Share) to earn more tickets.
16263
- * @param data { action_type: 'steam_wishlist'|'social_share', platform?, reference_id? }
16260
+ * Post raffle content to social media via Glitch API.
16264
16261
  */
16265
- Raffles.performAction = function (raffle_id, data) {
16266
- return Requests.processRoute(RafflesRoute.routes.performAction, data, { raffle_id: raffle_id });
16262
+ Raffles.shareSocially = function (id, data) {
16263
+ return Requests.processRoute(RafflesRoute.routes.shareSocially, data, { id: id });
16267
16264
  };
16268
16265
  /**
16269
- * Get the authenticated user's specific entry status for this raffle.
16266
+ * Send an invitation email to a friend.
16270
16267
  */
16271
- Raffles.me = function (raffle_id) {
16272
- return Requests.processRoute(RafflesRoute.routes.me, {}, { raffle_id: raffle_id });
16268
+ Raffles.inviteFriend = function (id, data) {
16269
+ return Requests.processRoute(RafflesRoute.routes.inviteFriend, data, { id: id });
16273
16270
  };
16274
16271
  /**
16275
- * Submit shipping address for a winning entry.
16276
- * @param entry_id The UUID of the RaffleEntry.
16272
+ * Add a prize tier to a raffle (Game Owner).
16277
16273
  */
16278
- Raffles.updateAddress = function (entry_id, data) {
16279
- return Requests.processRoute(RafflesRoute.routes.updateAddress, data, { entry_id: entry_id });
16274
+ Raffles.addPrize = function (id, data) {
16275
+ return Requests.processRoute(RafflesRoute.routes.addPrize, data, { id: id });
16280
16276
  };
16281
16277
  /**
16282
- * Invite a friend via email to join the raffle.
16278
+ * Trigger the automated drawing process (Game Owner).
16283
16279
  */
16284
- Raffles.inviteFriend = function (raffle_id, data) {
16285
- return Requests.processRoute(RafflesRoute.routes.inviteFriend, data, { raffle_id: raffle_id });
16280
+ Raffles.drawWinners = function (id) {
16281
+ return Requests.processRoute(RafflesRoute.routes.drawWinners, {}, { id: id });
16286
16282
  };
16287
16283
  /**
16288
- * Get the public list of winners (only available if raffle is completed).
16284
+ * Manually select a winner for a specific prize (Live Event Mode).
16289
16285
  */
16290
- Raffles.winners = function (raffle_id) {
16291
- return Requests.processRoute(RafflesRoute.routes.winners, {}, { raffle_id: raffle_id });
16286
+ Raffles.pickWinner = function (id, data) {
16287
+ return Requests.processRoute(RafflesRoute.routes.pickWinner, data, { id: id });
16292
16288
  };
16293
16289
  /**
16294
- * Add a prize tier (quantity, value, description) to the raffle.
16290
+ * Get the public list of winners for a completed raffle.
16295
16291
  */
16296
- Raffles.addPrize = function (raffle_id, data) {
16297
- return Requests.processRoute(RafflesRoute.routes.addPrize, data, { raffle_id: raffle_id });
16292
+ Raffles.winners = function (id) {
16293
+ return Requests.processRoute(RafflesRoute.routes.winners, {}, { id: id });
16298
16294
  };
16299
16295
  /**
16300
- * Randomly draw winners for all prize tiers based on ticket weights.
16296
+ * List all participants/entries for a raffle (Game Owner).
16301
16297
  */
16302
- Raffles.drawWinners = function (raffle_id) {
16303
- return Requests.processRoute(RafflesRoute.routes.drawWinners, {}, { raffle_id: raffle_id });
16298
+ Raffles.participants = function (id, params) {
16299
+ return Requests.processRoute(RafflesRoute.routes.participants, {}, { id: id }, params);
16304
16300
  };
16305
16301
  /**
16306
- * Manually assign a specific user to a specific prize (Live Event Mode).
16307
- * @param data { entry_id, prize_id }
16308
- */
16309
- Raffles.pickWinner = function (raffle_id, data) {
16310
- return Requests.processRoute(RafflesRoute.routes.pickWinner, data, { raffle_id: raffle_id });
16311
- };
16312
- /**
16313
- * Provide shipping/tracking info for a prize fulfillment.
16314
- * @param entry_id The UUID of the RaffleEntry.
16302
+ * Update shipping/tracking info for a prize (Game Owner).
16315
16303
  */
16316
16304
  Raffles.fulfillPrize = function (entry_id, data) {
16317
16305
  return Requests.processRoute(RafflesRoute.routes.fulfillPrize, data, { entry_id: entry_id });
16318
16306
  };
16319
16307
  /**
16320
- * Disqualify an entry for fraud or rule violations.
16308
+ * Submit shipping address for a won prize (User/Winner).
16321
16309
  */
16322
- Raffles.disqualify = function (raffle_id, entry_id, data) {
16323
- return Requests.processRoute(RafflesRoute.routes.disqualify, data, { raffle_id: raffle_id, entry_id: entry_id });
16310
+ Raffles.updateAddress = function (entry_id, data) {
16311
+ return Requests.processRoute(RafflesRoute.routes.updateAddress, data, { entry_id: entry_id });
16324
16312
  };
16325
16313
  /**
16326
- * List all participants/entries for management.
16327
- * @param params { opt_in_playtesting?, page?, per_page? }
16314
+ * Disqualify a specific entry (Game Owner).
16328
16315
  */
16329
- Raffles.listParticipants = function (raffle_id, params) {
16330
- return Requests.processRoute(RafflesRoute.routes.participants, {}, { raffle_id: raffle_id }, params);
16316
+ Raffles.disqualify = function (id, entry_id, data) {
16317
+ return Requests.processRoute(RafflesRoute.routes.disqualify, data, { id: id, entry_id: entry_id });
16331
16318
  };
16332
16319
  /**
16333
16320
  * Check if the raffle is fully funded in the community ledger.
16334
16321
  */
16335
- Raffles.escrowStatus = function (raffle_id) {
16336
- return Requests.processRoute(RafflesRoute.routes.escrowStatus, {}, { raffle_id: raffle_id });
16322
+ Raffles.escrowStatus = function (id) {
16323
+ return Requests.processRoute(RafflesRoute.routes.escrowStatus, {}, { id: id });
16337
16324
  };
16338
16325
  /**
16339
- * Get viral loop analytics (K-factor, Cost Per Entry).
16326
+ * Get viral loop analytics (K-Factor, Cost Per Entry).
16340
16327
  */
16341
- Raffles.analytics = function (raffle_id) {
16342
- return Requests.processRoute(RafflesRoute.routes.analytics, {}, { raffle_id: raffle_id });
16328
+ Raffles.analytics = function (id) {
16329
+ return Requests.processRoute(RafflesRoute.routes.analytics, {}, { id: id });
16343
16330
  };
16344
16331
  return Raffles;
16345
16332
  }());