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
package/dist/index.d.ts
CHANGED
|
@@ -6961,6 +6961,102 @@ 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 with optional filters.
|
|
6967
|
+
*/
|
|
6968
|
+
static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
6969
|
+
/**
|
|
6970
|
+
* Create a new raffle (Game Owner).
|
|
6971
|
+
*/
|
|
6972
|
+
static create<T>(data: object): AxiosPromise<Response<T>>;
|
|
6973
|
+
/**
|
|
6974
|
+
* Retrieve details for a specific raffle.
|
|
6975
|
+
*/
|
|
6976
|
+
static view<T>(id: string): AxiosPromise<Response<T>>;
|
|
6977
|
+
/**
|
|
6978
|
+
* Enter a raffle (User/Player). Requires Steam ID.
|
|
6979
|
+
*/
|
|
6980
|
+
static enter<T>(id: string, data: {
|
|
6981
|
+
referral_code?: string;
|
|
6982
|
+
device_fingerprint?: string;
|
|
6983
|
+
opt_in_playtesting?: boolean;
|
|
6984
|
+
}): AxiosPromise<Response<T>>;
|
|
6985
|
+
/**
|
|
6986
|
+
* Get the authenticated user's entry status for a specific raffle.
|
|
6987
|
+
*/
|
|
6988
|
+
static me<T>(id: string): AxiosPromise<Response<T>>;
|
|
6989
|
+
/**
|
|
6990
|
+
* Record a viral action (e.g., Steam Wishlist, Social Share).
|
|
6991
|
+
*/
|
|
6992
|
+
static performAction<T>(id: string, data: {
|
|
6993
|
+
action_type: string;
|
|
6994
|
+
platform?: string;
|
|
6995
|
+
reference_id?: string;
|
|
6996
|
+
}): AxiosPromise<Response<T>>;
|
|
6997
|
+
/**
|
|
6998
|
+
* Post raffle content to social media via Glitch API.
|
|
6999
|
+
*/
|
|
7000
|
+
static shareSocially<T>(id: string, data: {
|
|
7001
|
+
platform: string;
|
|
7002
|
+
content: string;
|
|
7003
|
+
}): AxiosPromise<Response<T>>;
|
|
7004
|
+
/**
|
|
7005
|
+
* Send an invitation email to a friend.
|
|
7006
|
+
*/
|
|
7007
|
+
static inviteFriend<T>(id: string, data: {
|
|
7008
|
+
email: string;
|
|
7009
|
+
}): AxiosPromise<Response<T>>;
|
|
7010
|
+
/**
|
|
7011
|
+
* Add a prize tier to a raffle (Game Owner).
|
|
7012
|
+
*/
|
|
7013
|
+
static addPrize<T>(id: string, data: object): AxiosPromise<Response<T>>;
|
|
7014
|
+
/**
|
|
7015
|
+
* Trigger the automated drawing process (Game Owner).
|
|
7016
|
+
*/
|
|
7017
|
+
static drawWinners<T>(id: string): AxiosPromise<Response<T>>;
|
|
7018
|
+
/**
|
|
7019
|
+
* Manually select a winner for a specific prize (Live Event Mode).
|
|
7020
|
+
*/
|
|
7021
|
+
static pickWinner<T>(id: string, data: {
|
|
7022
|
+
entry_id: string;
|
|
7023
|
+
prize_id: string;
|
|
7024
|
+
}): AxiosPromise<Response<T>>;
|
|
7025
|
+
/**
|
|
7026
|
+
* Get the public list of winners for a completed raffle.
|
|
7027
|
+
*/
|
|
7028
|
+
static winners<T>(id: string): AxiosPromise<Response<T>>;
|
|
7029
|
+
/**
|
|
7030
|
+
* List all participants/entries for a raffle (Game Owner).
|
|
7031
|
+
*/
|
|
7032
|
+
static participants<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
7033
|
+
/**
|
|
7034
|
+
* Update shipping/tracking info for a prize (Game Owner).
|
|
7035
|
+
*/
|
|
7036
|
+
static fulfillPrize<T>(entry_id: string, data: {
|
|
7037
|
+
tracking_number: string;
|
|
7038
|
+
shipping_carrier: string;
|
|
7039
|
+
}): AxiosPromise<Response<T>>;
|
|
7040
|
+
/**
|
|
7041
|
+
* Submit shipping address for a won prize (User/Winner).
|
|
7042
|
+
*/
|
|
7043
|
+
static updateAddress<T>(entry_id: string, data: object): AxiosPromise<Response<T>>;
|
|
7044
|
+
/**
|
|
7045
|
+
* Disqualify a specific entry (Game Owner).
|
|
7046
|
+
*/
|
|
7047
|
+
static disqualify<T>(id: string, entry_id: string, data: {
|
|
7048
|
+
reason: string;
|
|
7049
|
+
}): AxiosPromise<Response<T>>;
|
|
7050
|
+
/**
|
|
7051
|
+
* Check if the raffle is fully funded in the community ledger.
|
|
7052
|
+
*/
|
|
7053
|
+
static escrowStatus<T>(id: string): AxiosPromise<Response<T>>;
|
|
7054
|
+
/**
|
|
7055
|
+
* Get viral loop analytics (K-Factor, Cost Per Entry).
|
|
7056
|
+
*/
|
|
7057
|
+
static analytics<T>(id: string): AxiosPromise<Response<T>>;
|
|
7058
|
+
}
|
|
7059
|
+
|
|
6964
7060
|
interface Route {
|
|
6965
7061
|
url: string;
|
|
6966
7062
|
method: string;
|
|
@@ -7308,6 +7404,7 @@ declare class Glitch {
|
|
|
7308
7404
|
AIUsage: typeof AIUsage;
|
|
7309
7405
|
MarketingAgencies: typeof MarketingAgencies;
|
|
7310
7406
|
TwitchReporting: typeof TwitchReporting;
|
|
7407
|
+
Raffles: typeof Raffles;
|
|
7311
7408
|
};
|
|
7312
7409
|
static util: {
|
|
7313
7410
|
Requests: typeof Requests;
|
package/package.json
CHANGED
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
* List all raffles with optional filters.
|
|
9
|
+
*/
|
|
10
|
+
public static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
11
|
+
return Requests.processRoute(RafflesRoute.routes.list, undefined, undefined, params);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Create a new raffle (Game Owner).
|
|
16
|
+
*/
|
|
17
|
+
public static create<T>(data: object): AxiosPromise<Response<T>> {
|
|
18
|
+
return Requests.processRoute(RafflesRoute.routes.create, data);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Retrieve details for a specific raffle.
|
|
23
|
+
*/
|
|
24
|
+
public static view<T>(id: string): AxiosPromise<Response<T>> {
|
|
25
|
+
return Requests.processRoute(RafflesRoute.routes.view, {}, { id });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Enter a raffle (User/Player). Requires Steam ID.
|
|
30
|
+
*/
|
|
31
|
+
public static enter<T>(id: string, data: { referral_code?: string, device_fingerprint?: string, opt_in_playtesting?: boolean }): AxiosPromise<Response<T>> {
|
|
32
|
+
return Requests.processRoute(RafflesRoute.routes.enter, data, { id });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the authenticated user's entry status for a specific raffle.
|
|
37
|
+
*/
|
|
38
|
+
public static me<T>(id: string): AxiosPromise<Response<T>> {
|
|
39
|
+
return Requests.processRoute(RafflesRoute.routes.me, {}, { id });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Record a viral action (e.g., Steam Wishlist, Social Share).
|
|
44
|
+
*/
|
|
45
|
+
public static performAction<T>(id: string, data: { action_type: string, platform?: string, reference_id?: string }): AxiosPromise<Response<T>> {
|
|
46
|
+
return Requests.processRoute(RafflesRoute.routes.performAction, data, { id });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Post raffle content to social media via Glitch API.
|
|
51
|
+
*/
|
|
52
|
+
public static shareSocially<T>(id: string, data: { platform: string, content: string }): AxiosPromise<Response<T>> {
|
|
53
|
+
return Requests.processRoute(RafflesRoute.routes.shareSocially, data, { id });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Send an invitation email to a friend.
|
|
58
|
+
*/
|
|
59
|
+
public static inviteFriend<T>(id: string, data: { email: string }): AxiosPromise<Response<T>> {
|
|
60
|
+
return Requests.processRoute(RafflesRoute.routes.inviteFriend, data, { id });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Add a prize tier to a raffle (Game Owner).
|
|
65
|
+
*/
|
|
66
|
+
public static addPrize<T>(id: string, data: object): AxiosPromise<Response<T>> {
|
|
67
|
+
return Requests.processRoute(RafflesRoute.routes.addPrize, data, { id });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Trigger the automated drawing process (Game Owner).
|
|
72
|
+
*/
|
|
73
|
+
public static drawWinners<T>(id: string): AxiosPromise<Response<T>> {
|
|
74
|
+
return Requests.processRoute(RafflesRoute.routes.drawWinners, {}, { id });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Manually select a winner for a specific prize (Live Event Mode).
|
|
79
|
+
*/
|
|
80
|
+
public static pickWinner<T>(id: string, data: { entry_id: string, prize_id: string }): AxiosPromise<Response<T>> {
|
|
81
|
+
return Requests.processRoute(RafflesRoute.routes.pickWinner, data, { id });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get the public list of winners for a completed raffle.
|
|
86
|
+
*/
|
|
87
|
+
public static winners<T>(id: string): AxiosPromise<Response<T>> {
|
|
88
|
+
return Requests.processRoute(RafflesRoute.routes.winners, {}, { id });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* List all participants/entries for a raffle (Game Owner).
|
|
93
|
+
*/
|
|
94
|
+
public static participants<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
95
|
+
return Requests.processRoute(RafflesRoute.routes.participants, {}, { id }, params);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Update shipping/tracking info for a prize (Game Owner).
|
|
100
|
+
*/
|
|
101
|
+
public static fulfillPrize<T>(entry_id: string, data: { tracking_number: string, shipping_carrier: string }): AxiosPromise<Response<T>> {
|
|
102
|
+
return Requests.processRoute(RafflesRoute.routes.fulfillPrize, data, { entry_id });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Submit shipping address for a won prize (User/Winner).
|
|
107
|
+
*/
|
|
108
|
+
public static updateAddress<T>(entry_id: string, data: object): AxiosPromise<Response<T>> {
|
|
109
|
+
return Requests.processRoute(RafflesRoute.routes.updateAddress, data, { entry_id });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Disqualify a specific entry (Game Owner).
|
|
114
|
+
*/
|
|
115
|
+
public static disqualify<T>(id: string, entry_id: string, data: { reason: string }): AxiosPromise<Response<T>> {
|
|
116
|
+
return Requests.processRoute(RafflesRoute.routes.disqualify, data, { id, entry_id });
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Check if the raffle is fully funded in the community ledger.
|
|
121
|
+
*/
|
|
122
|
+
public static escrowStatus<T>(id: string): AxiosPromise<Response<T>> {
|
|
123
|
+
return Requests.processRoute(RafflesRoute.routes.escrowStatus, {}, { id });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get viral loop analytics (K-Factor, Cost Per Entry).
|
|
128
|
+
*/
|
|
129
|
+
public static analytics<T>(id: string): AxiosPromise<Response<T>> {
|
|
130
|
+
return Requests.processRoute(RafflesRoute.routes.analytics, {}, { id });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
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
|
+
public static routes: { [key: string]: Route } = {
|
|
6
|
+
list: { url: '/raffles', method: HTTP_METHODS.GET },
|
|
7
|
+
create: { url: '/raffles', method: HTTP_METHODS.POST },
|
|
8
|
+
view: { url: '/raffles/{id}', method: HTTP_METHODS.GET },
|
|
9
|
+
enter: { url: '/raffles/{id}/enter', method: HTTP_METHODS.POST },
|
|
10
|
+
me: { url: '/raffles/{id}/me', method: HTTP_METHODS.GET },
|
|
11
|
+
performAction: { url: '/raffles/{id}/actions', method: HTTP_METHODS.POST },
|
|
12
|
+
shareSocially: { url: '/raffles/{id}/share', method: HTTP_METHODS.POST },
|
|
13
|
+
inviteFriend: { url: '/raffles/{id}/invite-friend', method: HTTP_METHODS.POST },
|
|
14
|
+
|
|
15
|
+
// Prize Management
|
|
16
|
+
addPrize: { url: '/raffles/{id}/prizes', method: HTTP_METHODS.POST },
|
|
17
|
+
|
|
18
|
+
// Drawing & Winners
|
|
19
|
+
drawWinners: { url: '/raffles/{id}/draw', method: HTTP_METHODS.POST },
|
|
20
|
+
pickWinner: { url: '/raffles/{id}/pick-winner', method: HTTP_METHODS.POST },
|
|
21
|
+
winners: { url: '/raffles/{id}/winners', method: HTTP_METHODS.GET },
|
|
22
|
+
|
|
23
|
+
// Participant & Fulfillment Management
|
|
24
|
+
participants: { url: '/raffles/{id}/participants', method: HTTP_METHODS.GET },
|
|
25
|
+
fulfillPrize: { url: '/raffles/entries/{entry_id}/fulfill', method: HTTP_METHODS.PUT },
|
|
26
|
+
updateAddress: { url: '/raffles/entries/{entry_id}/address', method: HTTP_METHODS.PUT },
|
|
27
|
+
disqualify: { url: '/raffles/{id}/disqualify/{entry_id}', method: HTTP_METHODS.POST },
|
|
28
|
+
|
|
29
|
+
// Analytics & Finance
|
|
30
|
+
escrowStatus: { url: '/raffles/{id}/escrow', method: HTTP_METHODS.GET },
|
|
31
|
+
analytics: { url: '/raffles/{id}/analytics', method: HTTP_METHODS.GET },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default RafflesRoute;
|