From 62f2ca5fbb9414d32b1df1b8bb7b47cdb7c1cfe1 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:43:35 +0000 Subject: [PATCH] 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> --- 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 7612b2cfe..4c5c46803 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. *