glitch-javascript-sdk 2.4.9 → 2.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.
@@ -0,0 +1,92 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class Raffles {
4
+ /**
5
+ * List all raffles.
6
+ * @param params Filter by title_id, community_id, or status.
7
+ */
8
+ static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
9
+ /**
10
+ * Create a new raffle for a specific title.
11
+ */
12
+ static create<T>(data: object): AxiosPromise<Response<T>>;
13
+ /**
14
+ * Get full details of a raffle.
15
+ */
16
+ static view<T>(raffle_id: string): AxiosPromise<Response<T>>;
17
+ /**
18
+ * Update raffle settings (Draft/Active status, dates, etc).
19
+ */
20
+ static update<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
21
+ /**
22
+ * Delete a raffle.
23
+ */
24
+ static delete<T>(raffle_id: string): AxiosPromise<Response<T>>;
25
+ /**
26
+ * Enter the authenticated user into the raffle.
27
+ * @param data { referral_code?, device_fingerprint? }
28
+ */
29
+ static enter<T>(raffle_id: string, data?: object): AxiosPromise<Response<T>>;
30
+ /**
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? }
33
+ */
34
+ static performAction<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
35
+ /**
36
+ * Get the authenticated user's specific entry status for this raffle.
37
+ */
38
+ static me<T>(raffle_id: string): AxiosPromise<Response<T>>;
39
+ /**
40
+ * Submit shipping address for a winning entry.
41
+ * @param entry_id The UUID of the RaffleEntry.
42
+ */
43
+ static updateAddress<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
44
+ /**
45
+ * Invite a friend via email to join the raffle.
46
+ */
47
+ static inviteFriend<T>(raffle_id: string, data: {
48
+ email: string;
49
+ }): AxiosPromise<Response<T>>;
50
+ /**
51
+ * Get the public list of winners (only available if raffle is completed).
52
+ */
53
+ static winners<T>(raffle_id: string): AxiosPromise<Response<T>>;
54
+ /**
55
+ * Add a prize tier (quantity, value, description) to the raffle.
56
+ */
57
+ static addPrize<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
58
+ /**
59
+ * Randomly draw winners for all prize tiers based on ticket weights.
60
+ */
61
+ static drawWinners<T>(raffle_id: string): AxiosPromise<Response<T>>;
62
+ /**
63
+ * Manually assign a specific user to a specific prize (Live Event Mode).
64
+ * @param data { entry_id, prize_id }
65
+ */
66
+ static pickWinner<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
67
+ /**
68
+ * Provide shipping/tracking info for a prize fulfillment.
69
+ * @param entry_id The UUID of the RaffleEntry.
70
+ */
71
+ static fulfillPrize<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
72
+ /**
73
+ * Disqualify an entry for fraud or rule violations.
74
+ */
75
+ static disqualify<T>(raffle_id: string, entry_id: string, data: {
76
+ reason: string;
77
+ }): 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
+ /**
84
+ * Check if the raffle is fully funded in the community ledger.
85
+ */
86
+ static escrowStatus<T>(raffle_id: string): AxiosPromise<Response<T>>;
87
+ /**
88
+ * Get viral loop analytics (K-factor, Cost Per Entry).
89
+ */
90
+ static analytics<T>(raffle_id: string): AxiosPromise<Response<T>>;
91
+ }
92
+ export default Raffles;
@@ -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 };
@@ -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,163 @@ 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
+ // CRUD
16195
+ list: { url: '/raffles', method: HTTP_METHODS.GET },
16196
+ 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 },
16211
+ 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 },
16216
+ };
16217
+ return RafflesRoute;
16218
+ }());
16219
+
16220
+ var Raffles = /** @class */ (function () {
16221
+ function Raffles() {
16222
+ }
16223
+ /**
16224
+ * List all raffles.
16225
+ * @param params Filter by title_id, community_id, or status.
16226
+ */
16227
+ Raffles.list = function (params) {
16228
+ return Requests.processRoute(RafflesRoute.routes.list, undefined, undefined, params);
16229
+ };
16230
+ /**
16231
+ * Create a new raffle for a specific title.
16232
+ */
16233
+ Raffles.create = function (data) {
16234
+ return Requests.processRoute(RafflesRoute.routes.create, data);
16235
+ };
16236
+ /**
16237
+ * Get full details of a raffle.
16238
+ */
16239
+ Raffles.view = function (raffle_id) {
16240
+ return Requests.processRoute(RafflesRoute.routes.view, {}, { raffle_id: raffle_id });
16241
+ };
16242
+ /**
16243
+ * Update raffle settings (Draft/Active status, dates, etc).
16244
+ */
16245
+ Raffles.update = function (raffle_id, data) {
16246
+ return Requests.processRoute(RafflesRoute.routes.update, data, { raffle_id: raffle_id });
16247
+ };
16248
+ /**
16249
+ * Delete a raffle.
16250
+ */
16251
+ Raffles.delete = function (raffle_id) {
16252
+ return Requests.processRoute(RafflesRoute.routes.delete, {}, { raffle_id: raffle_id });
16253
+ };
16254
+ /**
16255
+ * Enter the authenticated user into the raffle.
16256
+ * @param data { referral_code?, device_fingerprint? }
16257
+ */
16258
+ Raffles.enter = function (raffle_id, data) {
16259
+ return Requests.processRoute(RafflesRoute.routes.enter, data, { raffle_id: raffle_id });
16260
+ };
16261
+ /**
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? }
16264
+ */
16265
+ Raffles.performAction = function (raffle_id, data) {
16266
+ return Requests.processRoute(RafflesRoute.routes.performAction, data, { raffle_id: raffle_id });
16267
+ };
16268
+ /**
16269
+ * Get the authenticated user's specific entry status for this raffle.
16270
+ */
16271
+ Raffles.me = function (raffle_id) {
16272
+ return Requests.processRoute(RafflesRoute.routes.me, {}, { raffle_id: raffle_id });
16273
+ };
16274
+ /**
16275
+ * Submit shipping address for a winning entry.
16276
+ * @param entry_id The UUID of the RaffleEntry.
16277
+ */
16278
+ Raffles.updateAddress = function (entry_id, data) {
16279
+ return Requests.processRoute(RafflesRoute.routes.updateAddress, data, { entry_id: entry_id });
16280
+ };
16281
+ /**
16282
+ * Invite a friend via email to join the raffle.
16283
+ */
16284
+ Raffles.inviteFriend = function (raffle_id, data) {
16285
+ return Requests.processRoute(RafflesRoute.routes.inviteFriend, data, { raffle_id: raffle_id });
16286
+ };
16287
+ /**
16288
+ * Get the public list of winners (only available if raffle is completed).
16289
+ */
16290
+ Raffles.winners = function (raffle_id) {
16291
+ return Requests.processRoute(RafflesRoute.routes.winners, {}, { raffle_id: raffle_id });
16292
+ };
16293
+ /**
16294
+ * Add a prize tier (quantity, value, description) to the raffle.
16295
+ */
16296
+ Raffles.addPrize = function (raffle_id, data) {
16297
+ return Requests.processRoute(RafflesRoute.routes.addPrize, data, { raffle_id: raffle_id });
16298
+ };
16299
+ /**
16300
+ * Randomly draw winners for all prize tiers based on ticket weights.
16301
+ */
16302
+ Raffles.drawWinners = function (raffle_id) {
16303
+ return Requests.processRoute(RafflesRoute.routes.drawWinners, {}, { raffle_id: raffle_id });
16304
+ };
16305
+ /**
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.
16315
+ */
16316
+ Raffles.fulfillPrize = function (entry_id, data) {
16317
+ return Requests.processRoute(RafflesRoute.routes.fulfillPrize, data, { entry_id: entry_id });
16318
+ };
16319
+ /**
16320
+ * Disqualify an entry for fraud or rule violations.
16321
+ */
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 });
16324
+ };
16325
+ /**
16326
+ * List all participants/entries for management.
16327
+ * @param params { opt_in_playtesting?, page?, per_page? }
16328
+ */
16329
+ Raffles.listParticipants = function (raffle_id, params) {
16330
+ return Requests.processRoute(RafflesRoute.routes.participants, {}, { raffle_id: raffle_id }, params);
16331
+ };
16332
+ /**
16333
+ * Check if the raffle is fully funded in the community ledger.
16334
+ */
16335
+ Raffles.escrowStatus = function (raffle_id) {
16336
+ return Requests.processRoute(RafflesRoute.routes.escrowStatus, {}, { raffle_id: raffle_id });
16337
+ };
16338
+ /**
16339
+ * Get viral loop analytics (K-factor, Cost Per Entry).
16340
+ */
16341
+ Raffles.analytics = function (raffle_id) {
16342
+ return Requests.processRoute(RafflesRoute.routes.analytics, {}, { raffle_id: raffle_id });
16343
+ };
16344
+ return Raffles;
16345
+ }());
16346
+
16190
16347
  var Parser = /** @class */ (function () {
16191
16348
  function Parser() {
16192
16349
  }
@@ -16715,6 +16872,7 @@ var Glitch = /** @class */ (function () {
16715
16872
  AIUsage: AIUsage,
16716
16873
  MarketingAgencies: MarketingAgencies,
16717
16874
  TwitchReporting: TwitchReporting,
16875
+ Raffles: Raffles,
16718
16876
  };
16719
16877
  Glitch.util = {
16720
16878
  Requests: Requests,