glitch-javascript-sdk 2.4.8 → 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,7 @@
1
+ import Route from "./interface";
2
+ declare class RafflesRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default RafflesRoute;
package/dist/index.d.ts CHANGED
@@ -6270,6 +6270,21 @@ declare class Scheduler {
6270
6270
  * @param scheduler_id The ID of the promotion schedule.
6271
6271
  */
6272
6272
  static getTikTokMusic<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
6273
+ /**
6274
+ * Get TikTok Music List with advanced filtering (Keyword, Recommendations, Liked).
6275
+ * @param params { music_scene: 'CREATIVE_ASSET'|'CAROUSEL_ADS', search_type: string, filtering: object }
6276
+ */
6277
+ static getTikTokMusicList<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
6278
+ /**
6279
+ * Get the top 200 trending hashtags on TikTok.
6280
+ * @param params { country_code: string, category_name: string, date_range: string }
6281
+ */
6282
+ static getTikTokTrendingHashtags<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
6283
+ /**
6284
+ * Get trending search keywords on TikTok.
6285
+ * @param params { is_personalized: boolean }
6286
+ */
6287
+ static getTikTokTrendingKeywords<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
6273
6288
  }
6274
6289
 
6275
6290
  declare class Funnel {
@@ -6946,6 +6961,96 @@ declare class TwitchReporting {
6946
6961
  static getStreamersForGame<T>(game_name: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
6947
6962
  }
6948
6963
 
6964
+ declare class Raffles {
6965
+ /**
6966
+ * List all raffles.
6967
+ * @param params Filter by title_id, community_id, or status.
6968
+ */
6969
+ static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
6970
+ /**
6971
+ * Create a new raffle for a specific title.
6972
+ */
6973
+ static create<T>(data: object): AxiosPromise<Response<T>>;
6974
+ /**
6975
+ * Get full details of a raffle.
6976
+ */
6977
+ static view<T>(raffle_id: string): AxiosPromise<Response<T>>;
6978
+ /**
6979
+ * Update raffle settings (Draft/Active status, dates, etc).
6980
+ */
6981
+ static update<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
6982
+ /**
6983
+ * Delete a raffle.
6984
+ */
6985
+ static delete<T>(raffle_id: string): AxiosPromise<Response<T>>;
6986
+ /**
6987
+ * Enter the authenticated user into the raffle.
6988
+ * @param data { referral_code?, device_fingerprint? }
6989
+ */
6990
+ static enter<T>(raffle_id: string, data?: object): AxiosPromise<Response<T>>;
6991
+ /**
6992
+ * Record a viral action (Steam Wishlist, Social Share) to earn more tickets.
6993
+ * @param data { action_type: 'steam_wishlist'|'social_share', platform?, reference_id? }
6994
+ */
6995
+ static performAction<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
6996
+ /**
6997
+ * Get the authenticated user's specific entry status for this raffle.
6998
+ */
6999
+ static me<T>(raffle_id: string): AxiosPromise<Response<T>>;
7000
+ /**
7001
+ * Submit shipping address for a winning entry.
7002
+ * @param entry_id The UUID of the RaffleEntry.
7003
+ */
7004
+ static updateAddress<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
7005
+ /**
7006
+ * Invite a friend via email to join the raffle.
7007
+ */
7008
+ static inviteFriend<T>(raffle_id: string, data: {
7009
+ email: string;
7010
+ }): AxiosPromise<Response<T>>;
7011
+ /**
7012
+ * Get the public list of winners (only available if raffle is completed).
7013
+ */
7014
+ static winners<T>(raffle_id: string): AxiosPromise<Response<T>>;
7015
+ /**
7016
+ * Add a prize tier (quantity, value, description) to the raffle.
7017
+ */
7018
+ static addPrize<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
7019
+ /**
7020
+ * Randomly draw winners for all prize tiers based on ticket weights.
7021
+ */
7022
+ static drawWinners<T>(raffle_id: string): AxiosPromise<Response<T>>;
7023
+ /**
7024
+ * Manually assign a specific user to a specific prize (Live Event Mode).
7025
+ * @param data { entry_id, prize_id }
7026
+ */
7027
+ static pickWinner<T>(raffle_id: string, data: object): AxiosPromise<Response<T>>;
7028
+ /**
7029
+ * Provide shipping/tracking info for a prize fulfillment.
7030
+ * @param entry_id The UUID of the RaffleEntry.
7031
+ */
7032
+ static fulfillPrize<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
7033
+ /**
7034
+ * Disqualify an entry for fraud or rule violations.
7035
+ */
7036
+ static disqualify<T>(raffle_id: string, entry_id: string, data: {
7037
+ reason: string;
7038
+ }): AxiosPromise<Response<T>>;
7039
+ /**
7040
+ * List all participants/entries for management.
7041
+ * @param params { opt_in_playtesting?, page?, per_page? }
7042
+ */
7043
+ static listParticipants<T>(raffle_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
7044
+ /**
7045
+ * Check if the raffle is fully funded in the community ledger.
7046
+ */
7047
+ static escrowStatus<T>(raffle_id: string): AxiosPromise<Response<T>>;
7048
+ /**
7049
+ * Get viral loop analytics (K-factor, Cost Per Entry).
7050
+ */
7051
+ static analytics<T>(raffle_id: string): AxiosPromise<Response<T>>;
7052
+ }
7053
+
6949
7054
  interface Route {
6950
7055
  url: string;
6951
7056
  method: string;
@@ -7293,6 +7398,7 @@ declare class Glitch {
7293
7398
  AIUsage: typeof AIUsage;
7294
7399
  MarketingAgencies: typeof MarketingAgencies;
7295
7400
  TwitchReporting: typeof TwitchReporting;
7401
+ Raffles: typeof Raffles;
7296
7402
  };
7297
7403
  static util: {
7298
7404
  Requests: typeof Requests;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.4.8",
3
+ "version": "2.5.0",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -0,0 +1,149 @@
1
+ import RafflesRoute from "../routes/RafflesRoute";
2
+ import Requests from "../util/Requests";
3
+ import Response from "../util/Response";
4
+ import { AxiosPromise } from "axios";
5
+
6
+ class Raffles {
7
+
8
+ /**
9
+ * List all raffles.
10
+ * @param params Filter by title_id, community_id, or status.
11
+ */
12
+ public static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
13
+ return Requests.processRoute(RafflesRoute.routes.list, undefined, undefined, params);
14
+ }
15
+
16
+ /**
17
+ * Create a new raffle for a specific title.
18
+ */
19
+ public static create<T>(data: object): AxiosPromise<Response<T>> {
20
+ return Requests.processRoute(RafflesRoute.routes.create, data);
21
+ }
22
+
23
+ /**
24
+ * Get full details of a raffle.
25
+ */
26
+ public static view<T>(raffle_id: string): AxiosPromise<Response<T>> {
27
+ return Requests.processRoute(RafflesRoute.routes.view, {}, { raffle_id });
28
+ }
29
+
30
+ /**
31
+ * Update raffle settings (Draft/Active status, dates, etc).
32
+ */
33
+ public static update<T>(raffle_id: string, data: object): AxiosPromise<Response<T>> {
34
+ return Requests.processRoute(RafflesRoute.routes.update, data, { raffle_id });
35
+ }
36
+
37
+ /**
38
+ * Delete a raffle.
39
+ */
40
+ public static delete<T>(raffle_id: string): AxiosPromise<Response<T>> {
41
+ return Requests.processRoute(RafflesRoute.routes.delete, {}, { raffle_id });
42
+ }
43
+
44
+ /**
45
+ * Enter the authenticated user into the raffle.
46
+ * @param data { referral_code?, device_fingerprint? }
47
+ */
48
+ public static enter<T>(raffle_id: string, data?: object): AxiosPromise<Response<T>> {
49
+ return Requests.processRoute(RafflesRoute.routes.enter, data, { raffle_id });
50
+ }
51
+
52
+ /**
53
+ * Record a viral action (Steam Wishlist, Social Share) to earn more tickets.
54
+ * @param data { action_type: 'steam_wishlist'|'social_share', platform?, reference_id? }
55
+ */
56
+ public static performAction<T>(raffle_id: string, data: object): AxiosPromise<Response<T>> {
57
+ return Requests.processRoute(RafflesRoute.routes.performAction, data, { raffle_id });
58
+ }
59
+
60
+ /**
61
+ * Get the authenticated user's specific entry status for this raffle.
62
+ */
63
+ public static me<T>(raffle_id: string): AxiosPromise<Response<T>> {
64
+ return Requests.processRoute(RafflesRoute.routes.me, {}, { raffle_id });
65
+ }
66
+
67
+ /**
68
+ * Submit shipping address for a winning entry.
69
+ * @param entry_id The UUID of the RaffleEntry.
70
+ */
71
+ public static updateAddress<T>(entry_id: string, data: object): AxiosPromise<Response<T>> {
72
+ return Requests.processRoute(RafflesRoute.routes.updateAddress, data, { entry_id });
73
+ }
74
+
75
+ /**
76
+ * Invite a friend via email to join the raffle.
77
+ */
78
+ public static inviteFriend<T>(raffle_id: string, data: { email: string }): AxiosPromise<Response<T>> {
79
+ return Requests.processRoute(RafflesRoute.routes.inviteFriend, data, { raffle_id });
80
+ }
81
+
82
+ /**
83
+ * Get the public list of winners (only available if raffle is completed).
84
+ */
85
+ public static winners<T>(raffle_id: string): AxiosPromise<Response<T>> {
86
+ return Requests.processRoute(RafflesRoute.routes.winners, {}, { raffle_id });
87
+ }
88
+
89
+ /**
90
+ * Add a prize tier (quantity, value, description) to the raffle.
91
+ */
92
+ public static addPrize<T>(raffle_id: string, data: object): AxiosPromise<Response<T>> {
93
+ return Requests.processRoute(RafflesRoute.routes.addPrize, data, { raffle_id });
94
+ }
95
+
96
+ /**
97
+ * Randomly draw winners for all prize tiers based on ticket weights.
98
+ */
99
+ public static drawWinners<T>(raffle_id: string): AxiosPromise<Response<T>> {
100
+ return Requests.processRoute(RafflesRoute.routes.drawWinners, {}, { raffle_id });
101
+ }
102
+
103
+ /**
104
+ * Manually assign a specific user to a specific prize (Live Event Mode).
105
+ * @param data { entry_id, prize_id }
106
+ */
107
+ public static pickWinner<T>(raffle_id: string, data: object): AxiosPromise<Response<T>> {
108
+ return Requests.processRoute(RafflesRoute.routes.pickWinner, data, { raffle_id });
109
+ }
110
+
111
+ /**
112
+ * Provide shipping/tracking info for a prize fulfillment.
113
+ * @param entry_id The UUID of the RaffleEntry.
114
+ */
115
+ public static fulfillPrize<T>(entry_id: string, data: object): AxiosPromise<Response<T>> {
116
+ return Requests.processRoute(RafflesRoute.routes.fulfillPrize, data, { entry_id });
117
+ }
118
+
119
+ /**
120
+ * Disqualify an entry for fraud or rule violations.
121
+ */
122
+ public static disqualify<T>(raffle_id: string, entry_id: string, data: { reason: string }): AxiosPromise<Response<T>> {
123
+ return Requests.processRoute(RafflesRoute.routes.disqualify, data, { raffle_id, entry_id });
124
+ }
125
+
126
+ /**
127
+ * List all participants/entries for management.
128
+ * @param params { opt_in_playtesting?, page?, per_page? }
129
+ */
130
+ public static listParticipants<T>(raffle_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
131
+ return Requests.processRoute(RafflesRoute.routes.participants, {}, { raffle_id }, params);
132
+ }
133
+
134
+ /**
135
+ * Check if the raffle is fully funded in the community ledger.
136
+ */
137
+ public static escrowStatus<T>(raffle_id: string): AxiosPromise<Response<T>> {
138
+ return Requests.processRoute(RafflesRoute.routes.escrowStatus, {}, { raffle_id });
139
+ }
140
+
141
+ /**
142
+ * Get viral loop analytics (K-factor, Cost Per Entry).
143
+ */
144
+ public static analytics<T>(raffle_id: string): AxiosPromise<Response<T>> {
145
+ return Requests.processRoute(RafflesRoute.routes.analytics, {}, { raffle_id });
146
+ }
147
+ }
148
+
149
+ export default Raffles;
@@ -858,6 +858,30 @@ class Scheduler {
858
858
  return Requests.processRoute(SchedulerRoute.routes.getTikTokMusic, {}, { scheduler_id }, params);
859
859
  }
860
860
 
861
+ /**
862
+ * Get TikTok Music List with advanced filtering (Keyword, Recommendations, Liked).
863
+ * @param params { music_scene: 'CREATIVE_ASSET'|'CAROUSEL_ADS', search_type: string, filtering: object }
864
+ */
865
+ public static getTikTokMusicList<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
866
+ return Requests.processRoute(SchedulerRoute.routes.getTikTokMusicList, {}, { scheduler_id }, params);
867
+ }
868
+
869
+ /**
870
+ * Get the top 200 trending hashtags on TikTok.
871
+ * @param params { country_code: string, category_name: string, date_range: string }
872
+ */
873
+ public static getTikTokTrendingHashtags<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
874
+ return Requests.processRoute(SchedulerRoute.routes.getTikTokTrendingHashtags, {}, { scheduler_id }, params);
875
+ }
876
+
877
+ /**
878
+ * Get trending search keywords on TikTok.
879
+ * @param params { is_personalized: boolean }
880
+ */
881
+ public static getTikTokTrendingKeywords<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
882
+ return Requests.processRoute(SchedulerRoute.routes.getTikTokTrendingKeywords, {}, { scheduler_id }, params);
883
+ }
884
+
861
885
  }
862
886
 
863
887
  export default Scheduler;
package/src/api/index.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
 
42
43
  export {Ads};
43
44
  export {AccessKeys};
@@ -78,4 +79,5 @@ export {Fingerprinting};
78
79
  export {ShortLinks};
79
80
  export {AIUsage};
80
81
  export {MarketingAgencies};
81
- export {TwitchReporting};
82
+ export {TwitchReporting};
83
+ export {Raffles};
package/src/index.ts CHANGED
@@ -42,6 +42,7 @@ import {ShortLinks} from "./api";
42
42
  import {AIUsage} from "./api";
43
43
  import {MarketingAgencies} from "./api"
44
44
  import {TwitchReporting} from './api'
45
+ import {Raffles} from './api'
45
46
 
46
47
  import Requests from "./util/Requests";
47
48
  import Parser from "./util/Parser";
@@ -113,6 +114,7 @@ class Glitch {
113
114
  AIUsage : AIUsage,
114
115
  MarketingAgencies : MarketingAgencies,
115
116
  TwitchReporting: TwitchReporting,
117
+ Raffles : Raffles,
116
118
  }
117
119
 
118
120
  public static util = {
@@ -0,0 +1,35 @@
1
+ import Route from "./interface";
2
+ import HTTP_METHODS from "../constants/HttpMethods";
3
+
4
+ class RafflesRoute {
5
+
6
+ public static routes: { [key: string]: Route } = {
7
+ // CRUD
8
+ list: { url: '/raffles', method: HTTP_METHODS.GET },
9
+ create: { url: '/raffles', method: HTTP_METHODS.POST },
10
+ view: { url: '/raffles/{raffle_id}', method: HTTP_METHODS.GET },
11
+ update: { url: '/raffles/{raffle_id}', method: HTTP_METHODS.PUT },
12
+ delete: { url: '/raffles/{raffle_id}', method: HTTP_METHODS.DELETE },
13
+
14
+ // User/Player Actions
15
+ enter: { url: '/raffles/{raffle_id}/enter', method: HTTP_METHODS.POST },
16
+ performAction: { url: '/raffles/{raffle_id}/actions', method: HTTP_METHODS.POST },
17
+ me: { url: '/raffles/{raffle_id}/me', method: HTTP_METHODS.GET },
18
+ updateAddress: { url: '/raffles/entries/{entry_id}/address', method: HTTP_METHODS.PUT },
19
+ inviteFriend: { url: '/raffles/{raffle_id}/invite-friend', method: HTTP_METHODS.POST },
20
+ winners: { url: '/raffles/{raffle_id}/winners', method: HTTP_METHODS.GET },
21
+
22
+ // Admin/Developer Actions
23
+ addPrize: { url: '/raffles/{raffle_id}/prizes', method: HTTP_METHODS.POST },
24
+ drawWinners: { url: '/raffles/{raffle_id}/draw', method: HTTP_METHODS.POST },
25
+ pickWinner: { url: '/raffles/{raffle_id}/pick-winner', method: HTTP_METHODS.POST },
26
+ fulfillPrize: { url: '/raffles/entries/{entry_id}/fulfill', method: HTTP_METHODS.PUT },
27
+ disqualify: { url: '/raffles/{raffle_id}/disqualify/{entry_id}', method: HTTP_METHODS.POST },
28
+ participants: { url: '/raffles/{raffle_id}/participants', method: HTTP_METHODS.GET },
29
+ escrowStatus: { url: '/raffles/{raffle_id}/escrow', method: HTTP_METHODS.GET },
30
+ analytics: { url: '/raffles/{raffle_id}/analytics', method: HTTP_METHODS.GET },
31
+ };
32
+
33
+ }
34
+
35
+ export default RafflesRoute;
@@ -133,6 +133,10 @@ class SchedulerRoute {
133
133
 
134
134
  getTikTokHashtags: { url: '/schedulers/{scheduler_id}/tiktok/discovery/hashtags', method: HTTP_METHODS.GET },
135
135
  getTikTokMusic: { url: '/schedulers/{scheduler_id}/tiktok/discovery/music', method: HTTP_METHODS.GET },
136
+ getTikTokMusicList: { url: '/schedulers/{scheduler_id}/tiktok/music', method: HTTP_METHODS.GET },
137
+ getTikTokTrendingHashtags: { url: '/schedulers/{scheduler_id}/tiktok/discovery/hashtags/trending', method: HTTP_METHODS.GET },
138
+ getTikTokHashtagDetail: { url: '/schedulers/{scheduler_id}/tiktok/discovery/hashtags/detail', method: HTTP_METHODS.GET },
139
+ getTikTokTrendingKeywords: { url: '/schedulers/{scheduler_id}/tiktok/discovery/search-keywords', method: HTTP_METHODS.GET },
136
140
 
137
141
  };
138
142
  }