mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 22:16:08 +00:00
fix: application shorter
This commit is contained in:
parent
11c72e66f6
commit
2f1ba85a94
@ -1,8 +1,47 @@
|
|||||||
import { Entitlement } from '../../structures/Entitlement';
|
import { Entitlement } from '../../structures/Entitlement';
|
||||||
import type { APIEntitlement, RESTGetAPIEntitlementsQuery, RESTPostAPIEntitlementBody } from '../../types';
|
import type {
|
||||||
|
APIEntitlement,
|
||||||
|
RESTGetAPIEntitlementsQuery,
|
||||||
|
RESTPostAPIApplicationEmojiJSONBody,
|
||||||
|
RESTPostAPIEntitlementBody,
|
||||||
|
} from '../../types';
|
||||||
import { BaseShorter } from './base';
|
import { BaseShorter } from './base';
|
||||||
|
|
||||||
export class ApplicationShorter extends BaseShorter {
|
export class ApplicationShorter extends BaseShorter {
|
||||||
|
/**
|
||||||
|
* Lists the emojis for the application.
|
||||||
|
* @param applicationId The ID of the application.
|
||||||
|
* @returns The emojis.
|
||||||
|
*/
|
||||||
|
async listEmojis(applicationId: string) {
|
||||||
|
return this.client.proxy.applications(applicationId).emojis.get();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets an emoji for the application.
|
||||||
|
* @param applicationId The ID of the application.
|
||||||
|
* @param emojiId The ID of the emoji.
|
||||||
|
* @returns The emoji.
|
||||||
|
*/
|
||||||
|
async getEmoji(applicationId: string, emojiId: string) {
|
||||||
|
return this.client.proxy.applications(applicationId).emojis(emojiId).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new emoji for the application.
|
||||||
|
* @param applicationId The ID of the application.
|
||||||
|
* @param body.name The name of the emoji.
|
||||||
|
* @param body.image The [image data string](https://discord.com/developers/docs/reference#image-data) of the emoji.
|
||||||
|
* @returns The created emoji.
|
||||||
|
*/
|
||||||
|
async createEmoji(applicationId: string, body: RESTPostAPIApplicationEmojiJSONBody) {
|
||||||
|
return this.client.proxy.applications(applicationId).emojis.post({ body });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists the entitlements for the application.
|
||||||
|
* @param applicationId The ID of the application.
|
||||||
|
* @param [query] The query parameters.
|
||||||
|
*/
|
||||||
async listEntitlements(applicationId: string, query?: RESTGetAPIEntitlementsQuery) {
|
async listEntitlements(applicationId: string, query?: RESTGetAPIEntitlementsQuery) {
|
||||||
return this.client.proxy
|
return this.client.proxy
|
||||||
.applications(applicationId)
|
.applications(applicationId)
|
||||||
@ -10,10 +49,20 @@ export class ApplicationShorter extends BaseShorter {
|
|||||||
.then(et => et.map(e => new Entitlement(this.client, e)));
|
.then(et => et.map(e => new Entitlement(this.client, e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Consumes an entitlement for the application.
|
||||||
|
* @param applicationId The ID of the application.
|
||||||
|
* @param entitlementId The ID of the entitlement.
|
||||||
|
*/
|
||||||
async consumeEntitlement(applicationId: string, entitlementId: string) {
|
async consumeEntitlement(applicationId: string, entitlementId: string) {
|
||||||
return this.client.proxy.applications(applicationId).entitlements(entitlementId).consume.post();
|
return this.client.proxy.applications(applicationId).entitlements(entitlementId).consume.post();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a test entitlement for the application.
|
||||||
|
* @param applicationId The ID of the application.
|
||||||
|
* @param body The body of the request.
|
||||||
|
*/
|
||||||
async createTestEntitlement(applicationId: string, body: RESTPostAPIEntitlementBody) {
|
async createTestEntitlement(applicationId: string, body: RESTPostAPIEntitlementBody) {
|
||||||
return this.client.proxy
|
return this.client.proxy
|
||||||
.applications(applicationId)
|
.applications(applicationId)
|
||||||
@ -21,10 +70,20 @@ export class ApplicationShorter extends BaseShorter {
|
|||||||
.then(et => new Entitlement(this.client, et as APIEntitlement));
|
.then(et => new Entitlement(this.client, et as APIEntitlement));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a test entitlement for the application.
|
||||||
|
* @param applicationId The ID of the application.
|
||||||
|
* @param entitlementId The ID of the entitlement.
|
||||||
|
*/
|
||||||
async deleteTestEntitlement(applicationId: string, entitlementId: string) {
|
async deleteTestEntitlement(applicationId: string, entitlementId: string) {
|
||||||
return this.client.proxy.applications(applicationId).entitlements(entitlementId).delete();
|
return this.client.proxy.applications(applicationId).entitlements(entitlementId).delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists the SKUs for the application.
|
||||||
|
* @param applicationId The ID of the application.
|
||||||
|
* @returns The SKUs.
|
||||||
|
*/
|
||||||
async listSKUs(applicationId: string) {
|
async listSKUs(applicationId: string) {
|
||||||
return this.client.proxy.applications(applicationId).skus.get();
|
return this.client.proxy.applications(applicationId).skus.get();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user