UNPKG

quria

Version:

A user-friendly Destiny 2 API Wrapper written with TypeScript and approved by -Axis Minds- Oryx.

99 lines (95 loc) 5.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Tokens = void 0; const adapters_1 = require("../../adapters"); class Tokens { url; headers; constructor(url, headers) { this.url = url; this.headers = headers; } /** * Twitch Drops self-repair function - scans twitch for drops not marked as fulfilled and resyncs them. * @returns Twitch Drops self-repair function - scans twitch for drops not marked as fulfilled and resyncs them. */ ForceDropsRepair(tokens) { const requestURL = `${this.url}/Tokens/Partner/ForceDropsRepair/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "POST", authHeaders); } /** * Claim a partner offer as the authenticated user. * @returns Claim a partner offer as the authenticated user. */ ClaimPartnerOffer(PartnerOfferId, BungieNetMembershipId, TransactionId, tokens) { const requestURL = `${this.url}/Tokens/Partner/ClaimOffer/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); const bodyParams = { PartnerOfferId, BungieNetMembershipId, TransactionId }; return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams)); } /** * Apply a partner offer to the targeted user. This endpoint does not claim a new offer, but any already claimed offers will be applied to the game if not already. * @param partnerApplicationId The partner application identifier. * @param targetBnetMembershipId The bungie.net user to apply missing offers to. If not self, elevated permissions are required. * @returns Apply a partner offer to the targeted user. This endpoint does not claim a new offer, but any already claimed offers will be applied to the game if not already. */ ApplyMissingPartnerOffersWithoutClaim(partnerApplicationId, targetBnetMembershipId, tokens) { const requestURL = `${this.url}/Tokens/Partner/ApplyMissingOffers/${partnerApplicationId}/${targetBnetMembershipId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "POST", authHeaders); } /** * Returns the partner sku and offer history of the targeted user. Elevated permissions are required to see users that are not yourself. * @param partnerApplicationId The partner application identifier. * @param targetBnetMembershipId The bungie.net user to apply missing offers to. If not self, elevated permissions are required. * @returns Returns the partner sku and offer history of the targeted user. Elevated permissions are required to see users that are not yourself. */ GetPartnerOfferSkuHistory(partnerApplicationId, targetBnetMembershipId, tokens) { const requestURL = `${this.url}/Tokens/Partner/History/${partnerApplicationId}/${targetBnetMembershipId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "GET", authHeaders); } /** * Returns the partner rewards history of the targeted user, both partner offers and Twitch drops. * @param partnerApplicationId The partner application identifier. * @param targetBnetMembershipId The bungie.net user to return reward history for. * @returns Returns the partner rewards history of the targeted user, both partner offers and Twitch drops. */ GetPartnerRewardHistory(partnerApplicationId, targetBnetMembershipId, tokens) { const requestURL = `${this.url}/Tokens/Partner/History/${targetBnetMembershipId}/Application/${partnerApplicationId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "GET", authHeaders); } /** * Returns the bungie rewards for the targeted user. * @param membershipId bungie.net user membershipId for requested user rewards. If not self, elevated permissions are required. * @returns Returns the bungie rewards for the targeted user. */ GetBungieRewardsForUser(membershipId, tokens) { const requestURL = `${this.url}/Tokens/Rewards/GetRewardsForUser/${membershipId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "GET", authHeaders); } /** * Returns the bungie rewards for the targeted user when a platform membership Id and Type are used. * @param membershipId users platform membershipId for requested user rewards. If not self, elevated permissions are required. * @param membershipType The target Destiny 2 membership type. * @returns Returns the bungie rewards for the targeted user when a platform membership Id and Type are used. */ GetBungieRewardsForPlatformUser(membershipId, membershipType, tokens) { const requestURL = `${this.url}/Tokens/Rewards/GetRewardsForPlatformUser/${membershipId}/${membershipType}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "GET", authHeaders); } /** * Returns a list of the current bungie rewards * @returns Returns a list of the current bungie rewards */ GetBungieRewardsList(tokens) { const requestURL = `${this.url}/Tokens/Rewards/BungieRewards/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "GET", authHeaders); } } exports.Tokens = Tokens;