quria
Version:
A user-friendly Destiny 2 API Wrapper written with TypeScript and approved by -Axis Minds- Oryx.
543 lines (524 loc) • 43.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Destiny2 = void 0;
const adapters_1 = require("../../adapters");
class Destiny2 {
url;
headers;
constructor(url, headers) {
this.url = url;
this.headers = headers;
}
/**
* Returns the current version of the manifest as a json object.
* @returns Returns the current version of the manifest as a json object.
*/
GetDestinyManifest(tokens) {
const requestURL = `${this.url}/Destiny2/Manifest/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns the static definition of an entity of the given Type and hash identifier. Examine the API Documentation for the Type Names of entities that have their own definitions. Note that the return type will always *inherit from* DestinyDefinition, but the specific type returned will be the requested entity type if it can be found. Please don't use this as a chatty alternative to the Manifest database if you require large sets of data, but for simple and one-off accesses this should be handy.
* @param entityType The type of entity for whom you would like results. These correspond to the entity's definition contract name. For instance, if you are looking for items, this property should be 'DestinyInventoryItemDefinition'. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is tentatively in final form, but there may be bugs that prevent desirable operation.
* @param hashIdentifier The hash identifier for the specific Entity you want returned.
* @returns Returns the static definition of an entity of the given Type and hash identifier. Examine the API Documentation for the Type Names of entities that have their own definitions. Note that the return type will always *inherit from* DestinyDefinition, but the specific type returned will be the requested entity type if it can be found. Please don't use this as a chatty alternative to the Manifest database if you require large sets of data, but for simple and one-off accesses this should be handy.
*/
GetDestinyEntityDefinition(entityType, hashIdentifier, tokens) {
const requestURL = `${this.url}/Destiny2/Manifest/${entityType}/${hashIdentifier}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns a list of Destiny memberships given a global Bungie Display Name. This method will hide overridden memberships due to cross save.
* @param membershipType A valid non-BungieNet membership type, or All. Indicates which memberships to return. You probably want this set to All.
* @returns Returns a list of Destiny memberships given a global Bungie Display Name. This method will hide overridden memberships due to cross save.
*/
SearchDestinyPlayerByBungieName(membershipType, displayName, displayNameCode, tokens) {
const requestURL = `${this.url}/Destiny2/SearchDestinyPlayerByBungieName/${membershipType}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { displayName, displayNameCode };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Returns a summary information about all profiles linked to the requesting membership type/membership ID that have valid Destiny information. The passed-in Membership Type/Membership ID may be a Bungie.Net membership or a Destiny membership. It only returns the minimal amount of data to begin making more substantive requests, but will hopefully serve as a useful alternative to UserServices for people who just care about Destiny data. Note that it will only return linked accounts whose linkages you are allowed to view.
* @param getAllMemberships (optional) if set to 'true', all memberships regardless of whether they're obscured by overrides will be returned. Normal privacy restrictions on account linking will still apply no matter what.
* @param membershipId The ID of the membership whose linked Destiny accounts you want returned. Make sure your membership ID matches its Membership Type: don't pass us a PSN membership ID and the XBox membership type, it's not going to work!
* @param membershipType The type for the membership whose linked Destiny accounts you want returned.
* @returns Returns a summary information about all profiles linked to the requesting membership type/membership ID that have valid Destiny information. The passed-in Membership Type/Membership ID may be a Bungie.Net membership or a Destiny membership. It only returns the minimal amount of data to begin making more substantive requests, but will hopefully serve as a useful alternative to UserServices for people who just care about Destiny data. Note that it will only return linked accounts whose linkages you are allowed to view.
*/
GetLinkedProfiles(membershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Profile/${membershipId}/LinkedProfiles/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns Destiny Profile information for the supplied membership.
* @param components A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
* @param destinyMembershipId Destiny membership ID.
* @param membershipType A valid non-BungieNet membership type.
* @returns Returns Destiny Profile information for the supplied membership.
*/
GetProfile(destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Profile/${destinyMembershipId}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns character information for the supplied character.
* @param characterId ID of the character.
* @param components A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
* @param destinyMembershipId Destiny membership ID.
* @param membershipType A valid non-BungieNet membership type.
* @returns Returns character information for the supplied character.
*/
GetCharacter(characterId, destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Profile/${destinyMembershipId}/Character/${characterId}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.
* @param groupId A valid group id of clan.
* @returns Returns information on the weekly clan rewards and if the clan has earned them or not. Note that this will always report rewards as not redeemed.
*/
GetClanWeeklyRewardState(groupId, tokens) {
const requestURL = `${this.url}/Destiny2/Clan/${groupId}/WeeklyRewardState/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Returns the dictionary of values for the Clan Banner
* @returns Returns the dictionary of values for the Clan Banner
*/
GetClanBannerSource(tokens) {
const requestURL = `${this.url}/Destiny2/Clan/ClanBannerDictionary/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Retrieve the details of an instanced Destiny Item. An instanced Destiny item is one with an ItemInstanceId. Non-instanced items, such as materials, have no useful instance-specific details and thus are not queryable here.
* @param components A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
* @param destinyMembershipId The membership ID of the destiny profile.
* @param itemInstanceId The Instance ID of the destiny item.
* @param membershipType A valid non-BungieNet membership type.
* @returns Retrieve the details of an instanced Destiny Item. An instanced Destiny item is one with an ItemInstanceId. Non-instanced items, such as materials, have no useful instance-specific details and thus are not queryable here.
*/
GetItem(destinyMembershipId, itemInstanceId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Profile/${destinyMembershipId}/Item/${itemInstanceId}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get currently available vendors from the list of vendors that can possibly have rotating inventory. Note that this does not include things like preview vendors and vendors-as-kiosks, neither of whom have rotating/dynamic inventories. Use their definitions as-is for those.
* @param characterId The Destiny Character ID of the character for whom we're getting vendor info.
* @param components A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
* @param destinyMembershipId Destiny membership ID of another user. You may be denied.
* @param filter The filter of what vendors and items to return, if any.
* @param membershipType A valid non-BungieNet membership type.
* @returns Get currently available vendors from the list of vendors that can possibly have rotating inventory. Note that this does not include things like preview vendors and vendors-as-kiosks, neither of whom have rotating/dynamic inventories. Use their definitions as-is for those.
*/
GetVendors(characterId, destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Profile/${destinyMembershipId}/Character/${characterId}/Vendors/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get the details of a specific Vendor.
* @param characterId The Destiny Character ID of the character for whom we're getting vendor info.
* @param components A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
* @param destinyMembershipId Destiny membership ID of another user. You may be denied.
* @param membershipType A valid non-BungieNet membership type.
* @param vendorHash The Hash identifier of the Vendor to be returned.
* @returns Get the details of a specific Vendor.
*/
GetVendor(characterId, destinyMembershipId, membershipType, vendorHash, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Profile/${destinyMembershipId}/Character/${characterId}/Vendors/${vendorHash}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Get items available from vendors where the vendors have items for sale that are common for everyone. If any portion of the Vendor's available inventory is character or account specific, we will be unable to return their data from this endpoint due to the way that available inventory is computed. As I am often guilty of saying: 'It's a long story...'
* @param components A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
* @returns Get items available from vendors where the vendors have items for sale that are common for everyone. If any portion of the Vendor's available inventory is character or account specific, we will be unable to return their data from this endpoint due to the way that available inventory is computed. As I am often guilty of saying: 'It's a long story...'
*/
GetPublicVendors(queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/Vendors/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Given a Presentation Node that has Collectibles as direct descendants, this will return item details about those descendants in the context of the requesting character.
* @param characterId The Destiny Character ID of the character for whom we're getting collectible detail info.
* @param collectiblePresentationNodeHash The hash identifier of the Presentation Node for whom we should return collectible details. Details will only be returned for collectibles that are direct descendants of this node.
* @param components A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
* @param destinyMembershipId Destiny membership ID of another user. You may be denied.
* @param membershipType A valid non-BungieNet membership type.
* @returns Given a Presentation Node that has Collectibles as direct descendants, this will return item details about those descendants in the context of the requesting character.
*/
GetCollectibleNodeDetails(characterId, collectiblePresentationNodeHash, destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Profile/${destinyMembershipId}/Character/${characterId}/Collectibles/${collectiblePresentationNodeHash}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Transfer an item to/from your vault. You must have a valid Destiny account. You must also pass BOTH a reference AND an instance ID if it's an instanced item. itshappening.gif
* @returns Transfer an item to/from your vault. You must have a valid Destiny account. You must also pass BOTH a reference AND an instance ID if it's an instanced item. itshappening.gif
*/
TransferItem(itemReferenceHash, stackSize, transferToVault, itemId, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Items/TransferItem/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = {
itemReferenceHash,
stackSize,
transferToVault,
itemId,
characterId,
membershipType,
};
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Extract an item from the Postmaster, with whatever implications that may entail. You must have a valid Destiny account. You must also pass BOTH a reference AND an instance ID if it's an instanced item.
* @returns Extract an item from the Postmaster, with whatever implications that may entail. You must have a valid Destiny account. You must also pass BOTH a reference AND an instance ID if it's an instanced item.
*/
PullFromPostmaster(itemReferenceHash, stackSize, itemId, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Items/PullFromPostmaster/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = {
itemReferenceHash,
stackSize,
itemId,
characterId,
membershipType,
};
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Equip an item. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline.
* @returns Equip an item. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline.
*/
EquipItem(itemId, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Items/EquipItem/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { itemId, characterId, membershipType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Equip a list of items by itemInstanceIds. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline. Any items not found on your character will be ignored.
* @returns Equip a list of items by itemInstanceIds. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline. Any items not found on your character will be ignored.
*/
EquipItems(itemIds, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Items/EquipItems/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { itemIds, characterId, membershipType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Equip a loadout. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline.
* @returns Equip a loadout. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline.
*/
EquipLoadout(loadoutIndex, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Loadouts/EquipLoadout/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { loadoutIndex, characterId, membershipType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Snapshot a loadout with the currently equipped items.
* @returns Snapshot a loadout with the currently equipped items.
*/
SnapshotLoadout(colorHash, iconHash, nameHash, loadoutIndex, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Loadouts/SnapshotLoadout/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = {
colorHash,
iconHash,
nameHash,
loadoutIndex,
characterId,
membershipType,
};
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Update the color, icon, and name of a loadout.
* @returns Update the color, icon, and name of a loadout.
*/
UpdateLoadoutIdentifiers(colorHash, iconHash, nameHash, loadoutIndex, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Loadouts/UpdateLoadoutIdentifiers/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = {
colorHash,
iconHash,
nameHash,
loadoutIndex,
characterId,
membershipType,
};
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Clear the identifiers and items of a loadout.
* @returns Clear the identifiers and items of a loadout.
*/
ClearLoadout(loadoutIndex, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Loadouts/ClearLoadout/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { loadoutIndex, characterId, membershipType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Set the Lock State for an instanced item. You must have a valid Destiny Account.
* @returns Set the Lock State for an instanced item. You must have a valid Destiny Account.
*/
SetItemLockState(state, itemId, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Items/SetLockState/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { state, itemId, characterId, membershipType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Set the Tracking State for an instanced item, if that item is a Quest or Bounty. You must have a valid Destiny Account. Yeah, it's an item.
* @returns Set the Tracking State for an instanced item, if that item is a Quest or Bounty. You must have a valid Destiny Account. Yeah, it's an item.
*/
SetQuestTrackedState(state, itemId, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Items/SetTrackedState/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { state, itemId, characterId, membershipType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Insert a plug into a socketed item. I know how it sounds, but I assure you it's much more G-rated than you might be guessing. We haven't decided yet whether this will be able to insert plugs that have side effects, but if we do it will require special scope permission for an application attempting to do so. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline. Request must include proof of permission for 'InsertPlugs' from the account owner.
* @returns Insert a plug into a socketed item. I know how it sounds, but I assure you it's much more G-rated than you might be guessing. We haven't decided yet whether this will be able to insert plugs that have side effects, but if we do it will require special scope permission for an application attempting to do so. You must have a valid Destiny Account, and either be in a social space, in orbit, or offline. Request must include proof of permission for 'InsertPlugs' from the account owner.
*/
InsertSocketPlug(actionToken, itemInstanceId, plug, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Items/InsertSocketPlug/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { actionToken, itemInstanceId, plug, characterId, membershipType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Insert a 'free' plug into an item's socket. This does not require 'Advanced Write Action' authorization and is available to 3rd-party apps, but will only work on 'free and reversible' socket actions (Perks, Armor Mods, Shaders, Ornaments, etc.). You must have a valid Destiny Account, and the character must either be in a social space, in orbit, or offline.
* @returns Insert a 'free' plug into an item's socket. This does not require 'Advanced Write Action' authorization and is available to 3rd-party apps, but will only work on 'free and reversible' socket actions (Perks, Armor Mods, Shaders, Ornaments, etc.). You must have a valid Destiny Account, and the character must either be in a social space, in orbit, or offline.
*/
InsertSocketPlugFree(plug, itemId, characterId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/Actions/Items/InsertSocketPlugFree/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { plug, itemId, characterId, membershipType };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Gets the available post game carnage report for the activity ID.
* @param activityId The ID of the activity whose PGCR is requested.
* @returns Gets the available post game carnage report for the activity ID.
*/
GetPostGameCarnageReport(activityId, tokens) {
const requestURL = `${this.url.replace("www.bungie.net", "stats.bungie.net")}/Destiny2/Stats/PostGameCarnageReport/${activityId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Report a player that you met in an activity that was engaging in ToS-violating activities. Both you and the offending player must have played in the activityId passed in. Please use this judiciously and only when you have strong suspicions of violation, pretty please.
* @param activityId The ID of the activity where you ran into the brigand that you're reporting.
* @returns Report a player that you met in an activity that was engaging in ToS-violating activities. Both you and the offending player must have played in the activityId passed in. Please use this judiciously and only when you have strong suspicions of violation, pretty please.
*/
ReportOffensivePostGameCarnageReportPlayer(activityId, reasonCategoryHashes, reasonHashes, offendingCharacterId, tokens) {
const requestURL = `${this.url}/Destiny2/Stats/PostGameCarnageReport/${activityId}/Report/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { reasonCategoryHashes, reasonHashes, offendingCharacterId };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Gets historical stats definitions.
* @returns Gets historical stats definitions.
*/
GetHistoricalStatsDefinition(tokens) {
const requestURL = `${this.url}/Destiny2/Stats/Definition/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.
* @param groupId Group ID of the clan whose leaderboards you wish to fetch.
* @param maxtop Maximum number of top players to return. Use a large number to get entire leaderboard.
* @param modes List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.
* @param statid ID of stat to return rather than returning all Leaderboard stats.
* @returns Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.
*/
GetClanLeaderboards(groupId, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/Stats/Leaderboards/Clans/${groupId}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.
* @param groupId Group ID of the clan whose leaderboards you wish to fetch.
* @param modes List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.
* @returns Gets aggregated stats for a clan using the same categories as the clan leaderboards. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.
*/
GetClanAggregateStats(groupId, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/Stats/AggregateClanStats/${groupId}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint has not yet been implemented. It is being returned for a preview of future functionality, and for public comment/suggestion/preparation.
* @param destinyMembershipId The Destiny membershipId of the user to retrieve.
* @param maxtop Maximum number of top players to return. Use a large number to get entire leaderboard.
* @param membershipType A valid non-BungieNet membership type.
* @param modes List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.
* @param statid ID of stat to return rather than returning all Leaderboard stats.
* @returns Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint has not yet been implemented. It is being returned for a preview of future functionality, and for public comment/suggestion/preparation.
*/
GetLeaderboards(destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Account/${destinyMembershipId}/Stats/Leaderboards/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.
* @param characterId The specific character to build the leaderboard around for the provided Destiny Membership.
* @param destinyMembershipId The Destiny membershipId of the user to retrieve.
* @param maxtop Maximum number of top players to return. Use a large number to get entire leaderboard.
* @param membershipType A valid non-BungieNet membership type.
* @param modes List of game modes for which to get leaderboards. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.
* @param statid ID of stat to return rather than returning all Leaderboard stats.
* @returns Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.
*/
GetLeaderboardsForCharacter(characterId, destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/Stats/Leaderboards/${membershipType}/${destinyMembershipId}/${characterId}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets a page list of Destiny items.
* @param page Page number to return, starting with 0.
* @param searchTerm The string to use when searching for Destiny entities.
* @param type The type of entity for whom you would like results. These correspond to the entity's definition contract name. For instance, if you are looking for items, this property should be 'DestinyInventoryItemDefinition'.
* @returns Gets a page list of Destiny items.
*/
SearchDestinyEntities(searchTerm, type, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/Armory/Search/${type}/${searchTerm}/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets historical stats for indicated character.
* @param characterId The id of the character to retrieve. You can omit this character ID or set it to 0 to get aggregate stats across all characters.
* @param dayend Last day to return when daily stats are requested. Use the format YYYY-MM-DD. Currently, we cannot allow more than 31 days of daily data to be requested in a single request.
* @param daystart First day to return when daily stats are requested. Use the format YYYY-MM-DD. Currently, we cannot allow more than 31 days of daily data to be requested in a single request.
* @param destinyMembershipId The Destiny membershipId of the user to retrieve.
* @param groups Group of stats to include, otherwise only general stats are returned. Comma separated list is allowed. Values: General, Weapons, Medals
* @param membershipType A valid non-BungieNet membership type.
* @param modes Game modes to return. See the documentation for DestinyActivityModeType for valid values, and pass in string representation, comma delimited.
* @param periodType Indicates a specific period type to return. Optional. May be: Daily, AllTime, or Activity
* @returns Gets historical stats for indicated character.
*/
GetHistoricalStats(characterId, destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Account/${destinyMembershipId}/Character/${characterId}/Stats/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets aggregate historical stats organized around each character for a given account.
* @param destinyMembershipId The Destiny membershipId of the user to retrieve.
* @param groups Groups of stats to include, otherwise only general stats are returned. Comma separated list is allowed. Values: General, Weapons, Medals.
* @param membershipType A valid non-BungieNet membership type.
* @returns Gets aggregate historical stats organized around each character for a given account.
*/
GetHistoricalStatsForAccount(destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Account/${destinyMembershipId}/Stats/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets activity history stats for indicated character.
* @param characterId The id of the character to retrieve.
* @param count Number of rows to return
* @param destinyMembershipId The Destiny membershipId of the user to retrieve.
* @param membershipType A valid non-BungieNet membership type.
* @param mode A filter for the activity mode to be returned. None returns all activities. See the documentation for DestinyActivityModeType for valid values, and pass in string representation.
* @param page Page number to return, starting with 0.
* @returns Gets activity history stats for indicated character.
*/
GetActivityHistory(characterId, destinyMembershipId, membershipType, queryString, tokens) {
const requestURL = (0, adapters_1.formatQueryStrings)(`${this.url}/Destiny2/${membershipType}/Account/${destinyMembershipId}/Character/${characterId}/Stats/Activities/`, queryString);
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets details about unique weapon usage, including all exotic weapons.
* @param characterId The id of the character to retrieve.
* @param destinyMembershipId The Destiny membershipId of the user to retrieve.
* @param membershipType A valid non-BungieNet membership type.
* @returns Gets details about unique weapon usage, including all exotic weapons.
*/
GetUniqueWeaponHistory(characterId, destinyMembershipId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/${membershipType}/Account/${destinyMembershipId}/Character/${characterId}/Stats/UniqueWeapons/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets all activities the character has participated in together with aggregate statistics for those activities.
* @param characterId The specific character whose activities should be returned.
* @param destinyMembershipId The Destiny membershipId of the user to retrieve.
* @param membershipType A valid non-BungieNet membership type.
* @returns Gets all activities the character has participated in together with aggregate statistics for those activities.
*/
GetDestinyAggregateActivityStats(characterId, destinyMembershipId, membershipType, tokens) {
const requestURL = `${this.url}/Destiny2/${membershipType}/Account/${destinyMembershipId}/Character/${characterId}/Stats/AggregateActivityStats/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets custom localized content for the milestone of the given hash, if it exists.
* @param milestoneHash The identifier for the milestone to be returned.
* @returns Gets custom localized content for the milestone of the given hash, if it exists.
*/
GetPublicMilestoneContent(milestoneHash, tokens) {
const requestURL = `${this.url}/Destiny2/Milestones/${milestoneHash}/Content/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Gets public information about currently available Milestones.
* @returns Gets public information about currently available Milestones.
*/
GetPublicMilestones(tokens) {
const requestURL = `${this.url}/Destiny2/Milestones/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
/**
* Initialize a request to perform an advanced write action.
* @returns Initialize a request to perform an advanced write action.
*/
AwaInitializeRequest(type, affectedItemId, membershipType, characterId, tokens) {
const requestURL = `${this.url}/Destiny2/Awa/Initialize/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { type, affectedItemId, membershipType, characterId };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Provide the result of the user interaction. Called by the Bungie Destiny App to approve or reject a request.
* @returns Provide the result of the user interaction. Called by the Bungie Destiny App to approve or reject a request.
*/
AwaProvideAuthorizationResult(selection, correlationId, nonce, tokens) {
const requestURL = `${this.url}/Destiny2/Awa/AwaProvideAuthorizationResult/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
const bodyParams = { selection, correlationId, nonce };
return adapters_1.Controller.request(requestURL, true, "POST", authHeaders, JSON.stringify(bodyParams));
}
/**
* Returns the action token if user approves the request.
* @param correlationId The identifier for the advanced write action request.
* @returns Returns the action token if user approves the request.
*/
AwaGetActionToken(correlationId, tokens) {
const requestURL = `${this.url}/Destiny2/Awa/GetActionToken/${correlationId}/`;
const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens);
return adapters_1.Controller.request(requestURL, true, "GET", authHeaders);
}
}
exports.Destiny2 = Destiny2;