Skip to content

Commit a639071

Browse files
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>
1 parent abf4b61 commit a639071

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/core/src/api/monetization.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { makeURLSearchParams, type RequestData, type REST } from '@discordjs/res
44
import {
55
Routes,
66
type RESTGetAPIEntitlementsQuery,
7+
type RESTGetAPIEntitlementResult,
78
type RESTGetAPIEntitlementsResult,
89
type RESTGetAPISKUsResult,
910
type RESTGetAPISKUSubscriptionResult,
@@ -84,6 +85,24 @@ export class MonetizationAPI {
8485
}) as Promise<RESTGetAPIEntitlementsResult>;
8586
}
8687

88+
/**
89+
* Fetches an entitlement for an application.
90+
*
91+
* @see {@link https://discord.com/developers/docs/resources/entitlement#get-entitlement}
92+
* @param applicationId - The application id to fetch the entitlement for
93+
* @param entitlementId - The entitlement id to fetch
94+
* @param options - The options for fetching the entitlement
95+
*/
96+
public async getEntitlement(
97+
applicationId: Snowflake,
98+
entitlementId: Snowflake,
99+
{ signal }: Pick<RequestData, 'signal'> = {},
100+
) {
101+
return this.rest.get(Routes.entitlement(applicationId, entitlementId), {
102+
signal,
103+
}) as Promise<RESTGetAPIEntitlementResult>;
104+
}
105+
87106
/**
88107
* Creates a test entitlement for an application's SKU.
89108
*

0 commit comments

Comments
 (0)