From 2a16832523b392c2c4485a1a35cd54061474f3d0 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:43:28 +0000 Subject: [PATCH] feat(monetization): add get entitlement endpoint --- packages/core/src/api/monetization.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/core/src/api/monetization.ts b/packages/core/src/api/monetization.ts index c4cd8dade6b6..caecfcd95bd4 100644 --- a/packages/core/src/api/monetization.ts +++ b/packages/core/src/api/monetization.ts @@ -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; } + /** + * 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 = {}, + ) { + return this.rest.get(Routes.entitlement(applicationId, entitlementId), { + signal, + }) as Promise; + } + /** * Creates a test entitlement for an application's SKU. *