UNPKG

bungie-net-core

Version:

An easy way to interact with the Bungie.net API

523 lines (522 loc) 18.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.awaGetActionToken = awaGetActionToken; exports.awaInitializeRequest = awaInitializeRequest; exports.awaProvideAuthorizationResult = awaProvideAuthorizationResult; exports.clearLoadout = clearLoadout; exports.equipItem = equipItem; exports.equipItems = equipItems; exports.equipLoadout = equipLoadout; exports.getActivityHistory = getActivityHistory; exports.getCharacter = getCharacter; exports.getClanAggregateStats = getClanAggregateStats; exports.getClanBannerSource = getClanBannerSource; exports.getClanLeaderboards = getClanLeaderboards; exports.getClanWeeklyRewardState = getClanWeeklyRewardState; exports.getCollectibleNodeDetails = getCollectibleNodeDetails; exports.getDestinyAggregateActivityStats = getDestinyAggregateActivityStats; exports.getDestinyEntityDefinition = getDestinyEntityDefinition; exports.getDestinyManifest = getDestinyManifest; exports.getHistoricalStats = getHistoricalStats; exports.getHistoricalStatsDefinition = getHistoricalStatsDefinition; exports.getHistoricalStatsForAccount = getHistoricalStatsForAccount; exports.getItem = getItem; exports.getLeaderboards = getLeaderboards; exports.getLeaderboardsForCharacter = getLeaderboardsForCharacter; exports.getLinkedProfiles = getLinkedProfiles; exports.getPostGameCarnageReport = getPostGameCarnageReport; exports.getProfile = getProfile; exports.getPublicMilestoneContent = getPublicMilestoneContent; exports.getPublicMilestones = getPublicMilestones; exports.getPublicVendors = getPublicVendors; exports.getUniqueWeaponHistory = getUniqueWeaponHistory; exports.getVendor = getVendor; exports.getVendors = getVendors; exports.insertSocketPlug = insertSocketPlug; exports.insertSocketPlugFree = insertSocketPlugFree; exports.pullFromPostmaster = pullFromPostmaster; exports.reportOffensivePostGameCarnageReportPlayer = reportOffensivePostGameCarnageReportPlayer; exports.searchDestinyEntities = searchDestinyEntities; exports.searchDestinyPlayerByBungieName = searchDestinyPlayerByBungieName; exports.setItemLockState = setItemLockState; exports.setQuestTrackedState = setQuestTrackedState; exports.snapshotLoadout = snapshotLoadout; exports.transferItem = transferItem; exports.updateLoadoutIdentifiers = updateLoadoutIdentifiers; async function getDestinyManifest(http) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Manifest/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getDestinyEntityDefinition(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Manifest/${params.entityType}/${params.hashIdentifier}/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function searchDestinyPlayerByBungieName(http, params, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/SearchDestinyPlayerByBungieName/${params.membershipType}/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function getLinkedProfiles(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Profile/${params.membershipId}/LinkedProfiles/`; const searchParams = new URLSearchParams(); if (params.getAllMemberships !== undefined) searchParams.append('getAllMemberships', params.getAllMemberships.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getProfile(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Profile/${params.destinyMembershipId}/`; const searchParams = new URLSearchParams(); if (params.components !== undefined) searchParams.append('components', params.components.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getCharacter(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Profile/${params.destinyMembershipId}/Character/${params.characterId}/`; const searchParams = new URLSearchParams(); if (params.components !== undefined) searchParams.append('components', params.components.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getClanWeeklyRewardState(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Clan/${params.groupId}/WeeklyRewardState/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getClanBannerSource(http) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Clan/ClanBannerDictionary/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getItem(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Profile/${params.destinyMembershipId}/Item/${params.itemInstanceId}/`; const searchParams = new URLSearchParams(); if (params.components !== undefined) searchParams.append('components', params.components.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getVendors(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Profile/${params.destinyMembershipId}/Character/${params.characterId}/Vendors/`; const searchParams = new URLSearchParams(); if (params.components !== undefined) searchParams.append('components', params.components.toString()); if (params.filter !== undefined) searchParams.append('filter', params.filter.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getVendor(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Profile/${params.destinyMembershipId}/Character/${params.characterId}/Vendors/${params.vendorHash}/`; const searchParams = new URLSearchParams(); if (params.components !== undefined) searchParams.append('components', params.components.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getPublicVendors(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Vendors/`; const searchParams = new URLSearchParams(); if (params.components !== undefined) searchParams.append('components', params.components.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getCollectibleNodeDetails(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Profile/${params.destinyMembershipId}/Character/${params.characterId}/Collectibles/${params.collectiblePresentationNodeHash}/`; const searchParams = new URLSearchParams(); if (params.components !== undefined) searchParams.append('components', params.components.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function transferItem(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Items/TransferItem/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function pullFromPostmaster(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Items/PullFromPostmaster/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function equipItem(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Items/EquipItem/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function equipItems(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Items/EquipItems/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function equipLoadout(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Loadouts/EquipLoadout/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function snapshotLoadout(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Loadouts/SnapshotLoadout/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function updateLoadoutIdentifiers(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Loadouts/UpdateLoadoutIdentifiers/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function clearLoadout(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Loadouts/ClearLoadout/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function setItemLockState(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Items/SetLockState/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function setQuestTrackedState(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Items/SetTrackedState/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function insertSocketPlug(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Items/InsertSocketPlug/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function insertSocketPlugFree(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Actions/Items/InsertSocketPlugFree/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function getPostGameCarnageReport(http, params) { const baseUrl = `https://stats.bungie.net/Platform/Destiny2/Stats/PostGameCarnageReport/${params.activityId}/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function reportOffensivePostGameCarnageReportPlayer(http, params, body) { const baseUrl = `https://stats.bungie.net/Platform/Destiny2/Stats/PostGameCarnageReport/${params.activityId}/Report/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function getHistoricalStatsDefinition(http) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Stats/Definition/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getClanLeaderboards(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Stats/Leaderboards/Clans/${params.groupId}/`; const searchParams = new URLSearchParams(); if (params.maxtop !== undefined) searchParams.append('maxtop', params.maxtop.toString()); if (params.modes !== undefined) searchParams.append('modes', params.modes.toString()); if (params.statid !== undefined) searchParams.append('statid', params.statid.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getClanAggregateStats(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Stats/AggregateClanStats/${params.groupId}/`; const searchParams = new URLSearchParams(); if (params.modes !== undefined) searchParams.append('modes', params.modes.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getLeaderboards(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Account/${params.destinyMembershipId}/Stats/Leaderboards/`; const searchParams = new URLSearchParams(); if (params.maxtop !== undefined) searchParams.append('maxtop', params.maxtop.toString()); if (params.modes !== undefined) searchParams.append('modes', params.modes.toString()); if (params.statid !== undefined) searchParams.append('statid', params.statid.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getLeaderboardsForCharacter(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Stats/Leaderboards/${params.membershipType}/${params.destinyMembershipId}/${params.characterId}/`; const searchParams = new URLSearchParams(); if (params.maxtop !== undefined) searchParams.append('maxtop', params.maxtop.toString()); if (params.modes !== undefined) searchParams.append('modes', params.modes.toString()); if (params.statid !== undefined) searchParams.append('statid', params.statid.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function searchDestinyEntities(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Armory/Search/${params.type}/${params.searchTerm}/`; const searchParams = new URLSearchParams(); if (params.page !== undefined) searchParams.append('page', params.page.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getHistoricalStats(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Account/${params.destinyMembershipId}/Character/${params.characterId}/Stats/`; const searchParams = new URLSearchParams(); if (params.dayend !== undefined) searchParams.append('dayend', params.dayend.toString()); if (params.daystart !== undefined) searchParams.append('daystart', params.daystart.toString()); if (params.groups !== undefined) searchParams.append('groups', params.groups.toString()); if (params.modes !== undefined) searchParams.append('modes', params.modes.toString()); if (params.periodType !== undefined) searchParams.append('periodType', params.periodType.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getHistoricalStatsForAccount(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Account/${params.destinyMembershipId}/Stats/`; const searchParams = new URLSearchParams(); if (params.groups !== undefined) searchParams.append('groups', params.groups.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getActivityHistory(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Account/${params.destinyMembershipId}/Character/${params.characterId}/Stats/Activities/`; const searchParams = new URLSearchParams(); if (params.count !== undefined) searchParams.append('count', params.count.toString()); if (params.mode !== undefined) searchParams.append('mode', params.mode.toString()); if (params.page !== undefined) searchParams.append('page', params.page.toString()); return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getUniqueWeaponHistory(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Account/${params.destinyMembershipId}/Character/${params.characterId}/Stats/UniqueWeapons/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getDestinyAggregateActivityStats(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/${params.membershipType}/Account/${params.destinyMembershipId}/Character/${params.characterId}/Stats/AggregateActivityStats/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getPublicMilestoneContent(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Milestones/${params.milestoneHash}/Content/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function getPublicMilestones(http) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Milestones/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); } async function awaInitializeRequest(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Awa/Initialize/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function awaProvideAuthorizationResult(http, body) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Awa/AwaProvideAuthorizationResult/`; const searchParams = undefined; return await http({ method: 'POST', baseUrl, searchParams, body, contentType: 'application/json' }); } async function awaGetActionToken(http, params) { const baseUrl = `https://www.bungie.net/Platform/Destiny2/Awa/GetActionToken/${params.correlationId}/`; const searchParams = undefined; return await http({ method: 'GET', baseUrl, searchParams, body: undefined }); }