feat(monetization): Add get entitlement endpoint (#10605)

feat(monetization): add get entitlement endpoint

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Jiralite
2024-12-05 15:43:35 +00:00
committed by GitHub
parent abf4b6103c
commit a6390716fe

View File

@@ -4,6 +4,7 @@ import { makeURLSearchParams, type RequestData, type REST } from '@discordjs/res
import {
Routes,
type RESTGetAPIEntitlementsQuery,
type RESTGetAPIEntitlementResult,
type RESTGetAPIEntitlementsResult,
type RESTGetAPISKUsResult,
type RESTGetAPISKUSubscriptionResult,
@@ -84,6 +85,24 @@ export class MonetizationAPI {
}) as Promise<RESTGetAPIEntitlementsResult>;
}
/**
* Fetches an entitlement for an application.
*
* @see {@link https://discord.com/developers/docs/resources/entitlement#get-entitlement}
* @param applicationId - The application id to fetch the entitlement for
* @param entitlementId - The entitlement id to fetch
* @param options - The options for fetching the entitlement
*/
public async getEntitlement(
applicationId: Snowflake,
entitlementId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.get(Routes.entitlement(applicationId, entitlementId), {
signal,
}) as Promise<RESTGetAPIEntitlementResult>;
}
/**
* Creates a test entitlement for an application's SKU.
*