snowtransfer 0.17.7 → 0.18.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/CHANGELOG.md +60 -0
- package/LICENSE.md +1 -1
- package/README.md +4 -5
- package/dist/Constants.d.ts +59 -0
- package/dist/Constants.js +123 -0
- package/dist/Endpoints.d.ts +120 -0
- package/dist/Endpoints.js +121 -0
- package/dist/RequestHandler.d.ts +258 -0
- package/dist/RequestHandler.js +629 -0
- package/dist/SnowTransfer.d.ts +70 -0
- package/dist/SnowTransfer.js +105 -0
- package/dist/StateMachine.d.ts +89 -0
- package/dist/StateMachine.js +208 -0
- package/dist/StateMachineGraph.d.ts +3 -0
- package/dist/StateMachineGraph.js +23 -0
- package/dist/Types.d.ts +76 -0
- package/dist/Types.js +2 -0
- package/dist/index.d.ts +25 -4102
- package/dist/index.js +63 -46
- package/dist/methods/Assets.d.ts +290 -0
- package/dist/methods/Assets.js +326 -0
- package/dist/methods/AuditLog.d.ts +40 -0
- package/dist/methods/AuditLog.js +44 -0
- package/dist/methods/AutoModeration.d.ts +122 -0
- package/dist/methods/AutoModeration.js +135 -0
- package/dist/methods/Bot.d.ts +65 -0
- package/dist/methods/Bot.js +75 -0
- package/dist/methods/Channel.d.ts +866 -0
- package/dist/methods/Channel.js +982 -0
- package/dist/methods/Entitlements.d.ts +87 -0
- package/dist/methods/Entitlements.js +99 -0
- package/dist/methods/Guild.d.ts +722 -0
- package/dist/methods/Guild.js +785 -0
- package/dist/methods/GuildScheduledEvent.d.ts +138 -0
- package/dist/methods/GuildScheduledEvent.js +155 -0
- package/dist/methods/GuildTemplate.d.ts +110 -0
- package/dist/methods/GuildTemplate.js +124 -0
- package/dist/methods/Interaction.d.ts +339 -0
- package/dist/methods/Interaction.js +359 -0
- package/dist/methods/Invite.d.ts +81 -0
- package/dist/methods/Invite.js +107 -0
- package/dist/methods/Sku.d.ts +58 -0
- package/dist/methods/Sku.js +66 -0
- package/dist/methods/StageInstance.d.ts +86 -0
- package/dist/methods/StageInstance.js +97 -0
- package/dist/methods/User.d.ts +167 -0
- package/dist/methods/User.js +184 -0
- package/dist/methods/Voice.d.ts +44 -0
- package/dist/methods/Voice.js +52 -0
- package/dist/methods/Webhook.d.ts +265 -0
- package/dist/methods/Webhook.js +256 -0
- package/dist/tokenless.d.ts +19 -0
- package/dist/tokenless.js +31 -0
- package/package.json +16 -11
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { RequestHandler } from "../RequestHandler";
|
|
2
|
+
import type { RESTGetAPIEntitlementsResult, RESTGetAPIEntitlementResult, RESTPostAPIEntitlementConsumeResult, RESTPostAPIEntitlementJSONBody, RESTPostAPIEntitlementResult, RESTDeleteAPIEntitlementResult } from "discord-api-types/v10";
|
|
3
|
+
/**
|
|
4
|
+
* Methods for interacting with Entitlements
|
|
5
|
+
* @since 0.13.0
|
|
6
|
+
*/
|
|
7
|
+
declare class EntitlementMethods {
|
|
8
|
+
readonly requestHandler: RequestHandler;
|
|
9
|
+
/**
|
|
10
|
+
* Create a new Entitement Method handler
|
|
11
|
+
*
|
|
12
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
13
|
+
*
|
|
14
|
+
* You can access the methods listed via `client.entitlement.method` where `client` is an initialized SnowTransfer instance
|
|
15
|
+
* @param requestHandler request handler that calls the rest api
|
|
16
|
+
*/
|
|
17
|
+
constructor(requestHandler: RequestHandler);
|
|
18
|
+
/**
|
|
19
|
+
* Returns all entitlements for a given app, active and expired
|
|
20
|
+
* @since 0.13.0
|
|
21
|
+
* @param appId Id of the app
|
|
22
|
+
* @returns Array of [entitlement objects](https://discord.com/developers/docs/resources/entitlement#entitlement-object)
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Get all entitlements for an app
|
|
26
|
+
* const client = new SnowTransfer("TOKEN")
|
|
27
|
+
* const entitlements = await client.entitlement.getEntitlements("app id")
|
|
28
|
+
*/
|
|
29
|
+
getEntitlements(appId: string): Promise<RESTGetAPIEntitlementsResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Get a single entitlement for a given app via Id
|
|
32
|
+
* @since 0.13.0
|
|
33
|
+
* @param appId Id of the app
|
|
34
|
+
* @param entitlementId Id of the entitlement
|
|
35
|
+
* @returns [entitlement object](https://discord.com/developers/docs/resources/entitlement#entitlement-object)
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Get an entitlement for an app by Id
|
|
39
|
+
* const client = new SnowTransfer("TOKEN")
|
|
40
|
+
* const entitlement = await client.entitlement.getEntitlement("app id", "entitlement id")
|
|
41
|
+
*/
|
|
42
|
+
getEntitlement(appId: string, entitlementId: string): Promise<RESTGetAPIEntitlementResult>;
|
|
43
|
+
/**
|
|
44
|
+
* For One-Time Purchase consumable SKUs, marks a given entitlement for the user as consumed
|
|
45
|
+
* @since 0.13.0
|
|
46
|
+
* @param appId Id of the app
|
|
47
|
+
* @param entitlementId Id of the entitlement
|
|
48
|
+
* @returns Resolves the Promise on successful execution
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Consume an entitlement
|
|
52
|
+
* const client = new SnowTransfer("TOKEN")
|
|
53
|
+
* client.entitlement.consumeEntitlement("app id", "entitlement id")
|
|
54
|
+
*/
|
|
55
|
+
consumeEntitlement(appId: string, entitlementId: string): Promise<RESTPostAPIEntitlementConsumeResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a test entitlement to a given SKU for a given guild or user. Discord will act as though that user or guild has entitlement to your premium offering
|
|
58
|
+
* @since 0.13.0
|
|
59
|
+
* @param appId Id of the app
|
|
60
|
+
* @param data Data to send
|
|
61
|
+
* @returns Partial [entitlement object](https://discord.com/developers/docs/resources/entitlement#entitlement-object)
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* // Create a test entitlement for a user
|
|
65
|
+
* const client = new SnowTransfer("TOKEN")
|
|
66
|
+
* const entitlement = await client.entitlement.createTestEntitlement("app id", {
|
|
67
|
+
* sku_id: "sku id",
|
|
68
|
+
* owner_id: "user id",
|
|
69
|
+
* owner_type: 2 // type 2 is for a user. Type 1 is for a guild
|
|
70
|
+
* })
|
|
71
|
+
*/
|
|
72
|
+
createTestEntitlement(appId: string, data: RESTPostAPIEntitlementJSONBody): Promise<RESTPostAPIEntitlementResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering
|
|
75
|
+
* @since 0.13.0
|
|
76
|
+
* @param appId Id of the app
|
|
77
|
+
* @param entitlementId Id of the entitlement
|
|
78
|
+
* @returns Resolves the Promise on successful execution
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Delete a test entitlement
|
|
82
|
+
* const client = new SnowTransfer("TOKEN")
|
|
83
|
+
* client.entitlement.deleteTestEntitlement("app id", "entitlement id")
|
|
84
|
+
*/
|
|
85
|
+
deleteTestEntitlement(appId: string, entitlementId: string): Promise<RESTDeleteAPIEntitlementResult>;
|
|
86
|
+
}
|
|
87
|
+
export = EntitlementMethods;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const Endpoints = require("../Endpoints");
|
|
3
|
+
/**
|
|
4
|
+
* Methods for interacting with Entitlements
|
|
5
|
+
* @since 0.13.0
|
|
6
|
+
*/
|
|
7
|
+
class EntitlementMethods {
|
|
8
|
+
requestHandler;
|
|
9
|
+
/**
|
|
10
|
+
* Create a new Entitement Method handler
|
|
11
|
+
*
|
|
12
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
13
|
+
*
|
|
14
|
+
* You can access the methods listed via `client.entitlement.method` where `client` is an initialized SnowTransfer instance
|
|
15
|
+
* @param requestHandler request handler that calls the rest api
|
|
16
|
+
*/
|
|
17
|
+
constructor(requestHandler) {
|
|
18
|
+
this.requestHandler = requestHandler;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns all entitlements for a given app, active and expired
|
|
22
|
+
* @since 0.13.0
|
|
23
|
+
* @param appId Id of the app
|
|
24
|
+
* @returns Array of [entitlement objects](https://discord.com/developers/docs/resources/entitlement#entitlement-object)
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Get all entitlements for an app
|
|
28
|
+
* const client = new SnowTransfer("TOKEN")
|
|
29
|
+
* const entitlements = await client.entitlement.getEntitlements("app id")
|
|
30
|
+
*/
|
|
31
|
+
async getEntitlements(appId) {
|
|
32
|
+
return this.requestHandler.request(Endpoints.APPLICATION_ENTITLEMENTS(appId), {}, "get", "json");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get a single entitlement for a given app via Id
|
|
36
|
+
* @since 0.13.0
|
|
37
|
+
* @param appId Id of the app
|
|
38
|
+
* @param entitlementId Id of the entitlement
|
|
39
|
+
* @returns [entitlement object](https://discord.com/developers/docs/resources/entitlement#entitlement-object)
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Get an entitlement for an app by Id
|
|
43
|
+
* const client = new SnowTransfer("TOKEN")
|
|
44
|
+
* const entitlement = await client.entitlement.getEntitlement("app id", "entitlement id")
|
|
45
|
+
*/
|
|
46
|
+
async getEntitlement(appId, entitlementId) {
|
|
47
|
+
return this.requestHandler.request(Endpoints.APPLICATION_ENTITLEMENT(appId, entitlementId), {}, "get", "json");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* For One-Time Purchase consumable SKUs, marks a given entitlement for the user as consumed
|
|
51
|
+
* @since 0.13.0
|
|
52
|
+
* @param appId Id of the app
|
|
53
|
+
* @param entitlementId Id of the entitlement
|
|
54
|
+
* @returns Resolves the Promise on successful execution
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* // Consume an entitlement
|
|
58
|
+
* const client = new SnowTransfer("TOKEN")
|
|
59
|
+
* client.entitlement.consumeEntitlement("app id", "entitlement id")
|
|
60
|
+
*/
|
|
61
|
+
async consumeEntitlement(appId, entitlementId) {
|
|
62
|
+
return this.requestHandler.request(Endpoints.APPLICATION_ENTITLEMENT_CONSUME(appId, entitlementId), {}, "post", "json");
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates a test entitlement to a given SKU for a given guild or user. Discord will act as though that user or guild has entitlement to your premium offering
|
|
66
|
+
* @since 0.13.0
|
|
67
|
+
* @param appId Id of the app
|
|
68
|
+
* @param data Data to send
|
|
69
|
+
* @returns Partial [entitlement object](https://discord.com/developers/docs/resources/entitlement#entitlement-object)
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* // Create a test entitlement for a user
|
|
73
|
+
* const client = new SnowTransfer("TOKEN")
|
|
74
|
+
* const entitlement = await client.entitlement.createTestEntitlement("app id", {
|
|
75
|
+
* sku_id: "sku id",
|
|
76
|
+
* owner_id: "user id",
|
|
77
|
+
* owner_type: 2 // type 2 is for a user. Type 1 is for a guild
|
|
78
|
+
* })
|
|
79
|
+
*/
|
|
80
|
+
async createTestEntitlement(appId, data) {
|
|
81
|
+
return this.requestHandler.request(Endpoints.APPLICATION_ENTITLEMENTS(appId), {}, "post", "json", data);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering
|
|
85
|
+
* @since 0.13.0
|
|
86
|
+
* @param appId Id of the app
|
|
87
|
+
* @param entitlementId Id of the entitlement
|
|
88
|
+
* @returns Resolves the Promise on successful execution
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // Delete a test entitlement
|
|
92
|
+
* const client = new SnowTransfer("TOKEN")
|
|
93
|
+
* client.entitlement.deleteTestEntitlement("app id", "entitlement id")
|
|
94
|
+
*/
|
|
95
|
+
async deleteTestEntitlement(appId, entitlementId) {
|
|
96
|
+
return this.requestHandler.request(Endpoints.APPLICATION_ENTITLEMENT(appId, entitlementId), {}, "delete", "json");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
module.exports = EntitlementMethods;
|