Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/core/src/api/monetization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
*
Expand Down
Loading