glitch-javascript-sdk 2.5.1 → 2.5.2
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 +109 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/DiscordMarketplace.d.ts +57 -0
- package/dist/esm/api/Raffles.d.ts +5 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +109 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/DiscordMarketplaceRoute.d.ts +7 -0
- package/dist/index.d.ts +61 -0
- package/package.json +1 -1
- package/src/api/DiscordMarketplace.ts +92 -0
- package/src/api/Raffles.ts +8 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +2 -0
- package/src/routes/DiscordMarketplaceRoute.ts +24 -0
- package/src/routes/RafflesRoute.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -7055,6 +7055,66 @@ declare class Raffles {
|
|
|
7055
7055
|
* Get viral loop analytics (K-Factor, Cost Per Entry).
|
|
7056
7056
|
*/
|
|
7057
7057
|
static analytics<T>(id: string): AxiosPromise<Response<T>>;
|
|
7058
|
+
/**
|
|
7059
|
+
* Update a raffle (Game Owner).
|
|
7060
|
+
* Handles status transitions (e.g., moving from draft to active).
|
|
7061
|
+
*/
|
|
7062
|
+
static update<T>(id: string, data: object): AxiosPromise<Response<T>>;
|
|
7063
|
+
}
|
|
7064
|
+
|
|
7065
|
+
declare class DiscordMarketplace {
|
|
7066
|
+
/**
|
|
7067
|
+
* Search for Discord servers available for sponsorship.
|
|
7068
|
+
*/
|
|
7069
|
+
static listListings<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
7070
|
+
/**
|
|
7071
|
+
* List a Discord server in the marketplace (Owner).
|
|
7072
|
+
*/
|
|
7073
|
+
static createListing<T>(data: object): AxiosPromise<Response<T>>;
|
|
7074
|
+
/**
|
|
7075
|
+
* Get details for a specific server listing.
|
|
7076
|
+
*/
|
|
7077
|
+
static viewListing<T>(id: string): AxiosPromise<Response<T>>;
|
|
7078
|
+
/**
|
|
7079
|
+
* Update listing settings like price or auto-approve (Owner).
|
|
7080
|
+
*/
|
|
7081
|
+
static updateListing<T>(id: string, data: object): AxiosPromise<Response<T>>;
|
|
7082
|
+
/**
|
|
7083
|
+
* Remove a server from the marketplace (Owner).
|
|
7084
|
+
*/
|
|
7085
|
+
static deleteListing<T>(id: string): AxiosPromise<Response<T>>;
|
|
7086
|
+
/**
|
|
7087
|
+
* List sponsored post orders. Use params { mode: 'buyer' | 'seller' }.
|
|
7088
|
+
*/
|
|
7089
|
+
static listOrders<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
7090
|
+
/**
|
|
7091
|
+
* Submit a post to a Discord server for sponsorship (Game Developer).
|
|
7092
|
+
*/
|
|
7093
|
+
static createOrder<T>(data: object): AxiosPromise<Response<T>>;
|
|
7094
|
+
/**
|
|
7095
|
+
* Get details for a specific order.
|
|
7096
|
+
*/
|
|
7097
|
+
static viewOrder<T>(id: string): AxiosPromise<Response<T>>;
|
|
7098
|
+
/**
|
|
7099
|
+
* Approve and publish a sponsored post (Owner).
|
|
7100
|
+
*/
|
|
7101
|
+
static approveOrder<T>(id: string): AxiosPromise<Response<T>>;
|
|
7102
|
+
/**
|
|
7103
|
+
* Reject a sponsored post (Owner).
|
|
7104
|
+
*/
|
|
7105
|
+
static rejectOrder<T>(id: string, data: {
|
|
7106
|
+
reason: string;
|
|
7107
|
+
}): AxiosPromise<Response<T>>;
|
|
7108
|
+
/**
|
|
7109
|
+
* Request changes to the post content (Owner).
|
|
7110
|
+
*/
|
|
7111
|
+
static requestChanges<T>(id: string, data: {
|
|
7112
|
+
reason: string;
|
|
7113
|
+
}): AxiosPromise<Response<T>>;
|
|
7114
|
+
/**
|
|
7115
|
+
* Resubmit a post after making requested changes (Game Developer).
|
|
7116
|
+
*/
|
|
7117
|
+
static resubmitOrder<T>(id: string): AxiosPromise<Response<T>>;
|
|
7058
7118
|
}
|
|
7059
7119
|
|
|
7060
7120
|
interface Route {
|
|
@@ -7405,6 +7465,7 @@ declare class Glitch {
|
|
|
7405
7465
|
MarketingAgencies: typeof MarketingAgencies;
|
|
7406
7466
|
TwitchReporting: typeof TwitchReporting;
|
|
7407
7467
|
Raffles: typeof Raffles;
|
|
7468
|
+
DiscordMarketplace: typeof DiscordMarketplace;
|
|
7408
7469
|
};
|
|
7409
7470
|
static util: {
|
|
7410
7471
|
Requests: typeof Requests;
|
package/package.json
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import DiscordMarketplaceRoute from "../routes/DiscordMarketplaceRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
class DiscordMarketplace {
|
|
7
|
+
/**
|
|
8
|
+
* Search for Discord servers available for sponsorship.
|
|
9
|
+
*/
|
|
10
|
+
public static listListings<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
11
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.listListings, undefined, undefined, params);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* List a Discord server in the marketplace (Owner).
|
|
16
|
+
*/
|
|
17
|
+
public static createListing<T>(data: object): AxiosPromise<Response<T>> {
|
|
18
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.createListing, data);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get details for a specific server listing.
|
|
23
|
+
*/
|
|
24
|
+
public static viewListing<T>(id: string): AxiosPromise<Response<T>> {
|
|
25
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.viewListing, {}, { id });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Update listing settings like price or auto-approve (Owner).
|
|
30
|
+
*/
|
|
31
|
+
public static updateListing<T>(id: string, data: object): AxiosPromise<Response<T>> {
|
|
32
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.updateListing, data, { id });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Remove a server from the marketplace (Owner).
|
|
37
|
+
*/
|
|
38
|
+
public static deleteListing<T>(id: string): AxiosPromise<Response<T>> {
|
|
39
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.deleteListing, {}, { id });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* List sponsored post orders. Use params { mode: 'buyer' | 'seller' }.
|
|
44
|
+
*/
|
|
45
|
+
public static listOrders<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
46
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.listOrders, undefined, undefined, params);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Submit a post to a Discord server for sponsorship (Game Developer).
|
|
51
|
+
*/
|
|
52
|
+
public static createOrder<T>(data: object): AxiosPromise<Response<T>> {
|
|
53
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.createOrder, data);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get details for a specific order.
|
|
58
|
+
*/
|
|
59
|
+
public static viewOrder<T>(id: string): AxiosPromise<Response<T>> {
|
|
60
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.viewOrder, {}, { id });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Approve and publish a sponsored post (Owner).
|
|
65
|
+
*/
|
|
66
|
+
public static approveOrder<T>(id: string): AxiosPromise<Response<T>> {
|
|
67
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.approveOrder, {}, { id });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Reject a sponsored post (Owner).
|
|
72
|
+
*/
|
|
73
|
+
public static rejectOrder<T>(id: string, data: { reason: string }): AxiosPromise<Response<T>> {
|
|
74
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.rejectOrder, data, { id });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Request changes to the post content (Owner).
|
|
79
|
+
*/
|
|
80
|
+
public static requestChanges<T>(id: string, data: { reason: string }): AxiosPromise<Response<T>> {
|
|
81
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.requestChanges, data, { id });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Resubmit a post after making requested changes (Game Developer).
|
|
86
|
+
*/
|
|
87
|
+
public static resubmitOrder<T>(id: string): AxiosPromise<Response<T>> {
|
|
88
|
+
return Requests.processRoute(DiscordMarketplaceRoute.routes.resubmitOrder, {}, { id });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default DiscordMarketplace;
|
package/src/api/Raffles.ts
CHANGED
|
@@ -129,6 +129,14 @@ class Raffles {
|
|
|
129
129
|
public static analytics<T>(id: string): AxiosPromise<Response<T>> {
|
|
130
130
|
return Requests.processRoute(RafflesRoute.routes.analytics, {}, { id });
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Update a raffle (Game Owner).
|
|
135
|
+
* Handles status transitions (e.g., moving from draft to active).
|
|
136
|
+
*/
|
|
137
|
+
public static update<T>(id: string, data: object): AxiosPromise<Response<T>> {
|
|
138
|
+
return Requests.processRoute(RafflesRoute.routes.update, data, { id });
|
|
139
|
+
}
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
export default Raffles;
|
package/src/api/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ import AIUsage from "./AIUsage";
|
|
|
39
39
|
import MarketingAgencies from "./MarketingAgencies";
|
|
40
40
|
import TwitchReporting from "./TwitchReporting";
|
|
41
41
|
import Raffles from "./Raffles";
|
|
42
|
+
import DiscordMarketplace from "./DiscordMarketplace";
|
|
42
43
|
|
|
43
44
|
export {Ads};
|
|
44
45
|
export {AccessKeys};
|
|
@@ -80,4 +81,5 @@ export {ShortLinks};
|
|
|
80
81
|
export {AIUsage};
|
|
81
82
|
export {MarketingAgencies};
|
|
82
83
|
export {TwitchReporting};
|
|
83
|
-
export {Raffles};
|
|
84
|
+
export {Raffles};
|
|
85
|
+
export {DiscordMarketplace};
|
package/src/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ import {AIUsage} from "./api";
|
|
|
43
43
|
import {MarketingAgencies} from "./api"
|
|
44
44
|
import {TwitchReporting} from './api'
|
|
45
45
|
import {Raffles} from './api'
|
|
46
|
+
import {DiscordMarketplace} from './api';
|
|
46
47
|
|
|
47
48
|
import Requests from "./util/Requests";
|
|
48
49
|
import Parser from "./util/Parser";
|
|
@@ -115,6 +116,7 @@ class Glitch {
|
|
|
115
116
|
MarketingAgencies : MarketingAgencies,
|
|
116
117
|
TwitchReporting: TwitchReporting,
|
|
117
118
|
Raffles : Raffles,
|
|
119
|
+
DiscordMarketplace : DiscordMarketplace,
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
public static util = {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class DiscordMarketplaceRoute {
|
|
5
|
+
public static routes: { [key: string]: Route } = {
|
|
6
|
+
// Listings
|
|
7
|
+
listListings: { url: '/discord-marketplace/listings', method: HTTP_METHODS.GET },
|
|
8
|
+
createListing: { url: '/discord-marketplace/listings', method: HTTP_METHODS.POST },
|
|
9
|
+
viewListing: { url: '/discord-marketplace/listings/{id}', method: HTTP_METHODS.GET },
|
|
10
|
+
updateListing: { url: '/discord-marketplace/listings/{id}', method: HTTP_METHODS.PUT },
|
|
11
|
+
deleteListing: { url: '/discord-marketplace/listings/{id}', method: HTTP_METHODS.DELETE },
|
|
12
|
+
|
|
13
|
+
// Orders
|
|
14
|
+
listOrders: { url: '/discord-marketplace/orders', method: HTTP_METHODS.GET },
|
|
15
|
+
createOrder: { url: '/discord-marketplace/orders', method: HTTP_METHODS.POST },
|
|
16
|
+
viewOrder: { url: '/discord-marketplace/orders/{id}', method: HTTP_METHODS.GET },
|
|
17
|
+
approveOrder: { url: '/discord-marketplace/orders/{id}/approve', method: HTTP_METHODS.POST },
|
|
18
|
+
rejectOrder: { url: '/discord-marketplace/orders/{id}/reject', method: HTTP_METHODS.POST },
|
|
19
|
+
requestChanges: { url: '/discord-marketplace/orders/{id}/request-changes', method: HTTP_METHODS.POST },
|
|
20
|
+
resubmitOrder: { url: '/discord-marketplace/orders/{id}/resubmit', method: HTTP_METHODS.POST },
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default DiscordMarketplaceRoute;
|
|
@@ -6,6 +6,7 @@ class RafflesRoute {
|
|
|
6
6
|
list: { url: '/raffles', method: HTTP_METHODS.GET },
|
|
7
7
|
create: { url: '/raffles', method: HTTP_METHODS.POST },
|
|
8
8
|
view: { url: '/raffles/{id}', method: HTTP_METHODS.GET },
|
|
9
|
+
update: { url: '/raffles/{id}', method: HTTP_METHODS.PUT },
|
|
9
10
|
enter: { url: '/raffles/{id}/enter', method: HTTP_METHODS.POST },
|
|
10
11
|
me: { url: '/raffles/{id}/me', method: HTTP_METHODS.GET },
|
|
11
12
|
performAction: { url: '/raffles/{id}/actions', method: HTTP_METHODS.POST },
|