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.
- package/dist/cjs/index.js +158 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Raffles.d.ts +92 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +158 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/RafflesRoute.d.ts +7 -0
- package/dist/index.d.ts +91 -0
- package/package.json +1 -1
- package/src/api/Raffles.ts +149 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +2 -0
- package/src/routes/RafflesRoute.ts +35 -0
package/dist/index.d.ts
CHANGED
|
@@ -6961,6 +6961,96 @@ declare class TwitchReporting {
|
|
|
6961
6961
|
static getStreamersForGame<T>(game_name: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
6962
6962
|
}
|
|
6963
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
|
+
|
|
6964
7054
|
interface Route {
|
|
6965
7055
|
url: string;
|
|
6966
7056
|
method: string;
|
|
@@ -7308,6 +7398,7 @@ declare class Glitch {
|
|
|
7308
7398
|
AIUsage: typeof AIUsage;
|
|
7309
7399
|
MarketingAgencies: typeof MarketingAgencies;
|
|
7310
7400
|
TwitchReporting: typeof TwitchReporting;
|
|
7401
|
+
Raffles: typeof Raffles;
|
|
7311
7402
|
};
|
|
7312
7403
|
static util: {
|
|
7313
7404
|
Requests: typeof Requests;
|
package/package.json
CHANGED
|
@@ -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;
|
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;
|