Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

psn-api

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

psn-api - npm Package Compare versions

Comparing version 2.8.3 to 2.9.0

dist/graphql/getRecentlyPlayedGames.d.ts

1

dist/index.d.ts
export * from "./authenticate";
export * from "./graphql";
export * from "./models";

@@ -3,0 +4,0 @@ export * from "./search";

@@ -9,2 +9,3 @@ export * from "./all-call-options.model";

export * from "./rarest-thin-trophy.model";
export * from "./recently-played-games-response.model";
export * from "./social-account-result.model";

@@ -11,0 +12,0 @@ export * from "./title-platform.model";

2

dist/models/rarest-thin-trophy.model.d.ts
import type { Trophy } from "./trophy.model";
export declare type RarestThinTrophy = Pick<Trophy, "trophyId" | "trophyHidden" | "earned" | "trophyType" | "trophyRare" | "trophyEarnedRate">;
export type RarestThinTrophy = Pick<Trophy, "trophyId" | "trophyHidden" | "earned" | "trophyType" | "trophyRare" | "trophyEarnedRate">;

@@ -1,1 +0,1 @@

export declare type TitlePlatform = "PS5" | "PS4" | "PS3" | "Vita";
export type TitlePlatform = "PS5" | "PS4" | "PS3" | "Vita";
import type { Trophy } from "./trophy.model";
export declare type TitleThinTrophy = Pick<Trophy, "trophyId" | "trophyHidden" | "trophyType" | "trophyName" | "trophyDetail" | "trophyIconUrl" | "trophyGroupId">;
export type TitleThinTrophy = Pick<Trophy, "trophyId" | "trophyHidden" | "trophyType" | "trophyName" | "trophyDetail" | "trophyIconUrl" | "trophyGroupId">;
import type { TrophyCounts } from "./trophy-counts.model";
import type { TrophyGroup } from "./trophy-group.model";
declare type FromTrophyGroup = Pick<TrophyGroup, "trophyGroupId">;
type FromTrophyGroup = Pick<TrophyGroup, "trophyGroupId">;
export interface TrophyGroupEarnings extends FromTrophyGroup {

@@ -5,0 +5,0 @@ /**

@@ -1,1 +0,1 @@

export declare type TrophyType = "bronze" | "silver" | "gold" | "platinum";
export type TrophyType = "bronze" | "silver" | "gold" | "platinum";

@@ -1,1 +0,1 @@

export declare type UniversalSearchDomains = "SocialAllAccounts";
export type UniversalSearchDomains = "SocialAllAccounts";
import type { Trophy } from "./trophy.model";
export declare type UserThinTrophy = Pick<Trophy, "trophyId" | "trophyHidden" | "earned" | "earnedDateTime" | "trophyType" | "trophyRare" | "trophyEarnedRate" | "trophyProgressTargetValue" | "trophyRewardImageUrl" | "trophyRewardName">;
export type UserThinTrophy = Pick<Trophy, "trophyId" | "trophyHidden" | "earned" | "earnedDateTime" | "trophyType" | "trophyRare" | "trophyEarnedRate" | "trophyProgressTargetValue" | "trophyRewardImageUrl" | "trophyRewardName">;

@@ -18,2 +18,5 @@ 'use strict';

hasOwn = Op.hasOwnProperty,
defineProperty = Object.defineProperty || function (obj, key, desc) {
obj[key] = desc.value;
},
$Symbol = "function" == typeof Symbol ? Symbol : {},

@@ -42,36 +45,5 @@ iteratorSymbol = $Symbol.iterator || "@@iterator",

context = new Context(tryLocsList || []);
return generator._invoke = function (innerFn, self, context) {
var state = "suspendedStart";
return function (method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
return defineProperty(generator, "_invoke", {
value: makeInvokeMethod(innerFn, self, context)
}), generator;
}

@@ -130,20 +102,51 @@ function tryCatch(fn, obj, arg) {

var previousPromise;
this._invoke = function (method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
defineProperty(this, "_invoke", {
value: function (method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
});
}
function makeInvokeMethod(innerFn, self, context) {
var state = "suspendedStart";
return function (method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var methodName = context.method,
method = delegate.iterator[methodName];
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
var record = tryCatch(method, delegate.iterator, context.arg);

@@ -193,3 +196,9 @@ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;

}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
value: GeneratorFunctionPrototype,
configurable: !0
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
value: GeneratorFunction,
configurable: !0
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;

@@ -215,4 +224,5 @@ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));

return "[object Generator]";
}), exports.keys = function (object) {
var keys = [];
}), exports.keys = function (val) {
var object = Object(val),
keys = [];
for (var key in object) keys.push(key);

@@ -374,39 +384,37 @@ return keys.reverse(), function next() {

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
requestUrl = AUTH_BASE_URL + "/token";
_context.next = 3;
return fetch__default["default"](requestUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="
},
body: new URLSearchParams({
code: accessCode,
redirect_uri: "com.scee.psxandroid.scecompcall://redirect",
grant_type: "authorization_code",
token_format: "jwt"
}).toString()
});
case 3:
res = _context.sent;
_context.next = 6;
return res.json();
case 6:
raw = _context.sent;
return _context.abrupt("return", {
accessToken: raw.access_token,
expiresIn: raw.expires_in,
idToken: raw.id_token,
refreshToken: raw.refresh_token,
refreshTokenExpiresIn: raw.refresh_token_expires_in,
scope: raw.scope,
tokenType: raw.token_type
});
case 8:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
requestUrl = AUTH_BASE_URL + "/token";
_context.next = 3;
return fetch__default["default"](requestUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="
},
body: new URLSearchParams({
code: accessCode,
redirect_uri: "com.scee.psxandroid.scecompcall://redirect",
grant_type: "authorization_code",
token_format: "jwt"
}).toString()
});
case 3:
res = _context.sent;
_context.next = 6;
return res.json();
case 6:
raw = _context.sent;
return _context.abrupt("return", {
accessToken: raw.access_token,
expiresIn: raw.expires_in,
idToken: raw.id_token,
refreshToken: raw.refresh_token,
refreshTokenExpiresIn: raw.refresh_token_expires_in,
scope: raw.scope,
tokenType: raw.token_type
});
case 8:
case "end":
return _context.stop();
}

@@ -436,36 +444,34 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
queryString = new URLSearchParams({
access_type: "offline",
client_id: "09515159-7237-4370-9b40-3806e67c0891",
redirect_uri: "com.scee.psxandroid.scecompcall://redirect",
response_type: "code",
scope: "psn:mobile.v2.core psn:clientapp"
}).toString();
requestUrl = AUTH_BASE_URL + "/authorize?" + queryString; // This never returns a 200. As of Oct 10 2021, it seems to return a 302.
_context.next = 4;
return fetch__default["default"](requestUrl, {
headers: {
Cookie: "npsso=" + npssoToken
},
redirect: "manual"
});
case 4:
_yield$fetch = _context.sent;
responseHeaders = _yield$fetch.headers;
if (!(!responseHeaders.has("location") || !((_responseHeaders$get = responseHeaders.get("location")) != null && _responseHeaders$get.includes("?code=")))) {
_context.next = 8;
break;
}
throw new Error("\n There was a problem retrieving your PSN access code. Is your NPSSO code valid?\n To get a new NPSSO code, visit https://ca.account.sony.com/api/v1/ssocookie.\n ");
case 8:
redirectLocation = responseHeaders.get("location");
redirectParams = new URLSearchParams(redirectLocation.split("redirect/")[1]);
return _context.abrupt("return", redirectParams.get("code"));
case 11:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
queryString = new URLSearchParams({
access_type: "offline",
client_id: "09515159-7237-4370-9b40-3806e67c0891",
redirect_uri: "com.scee.psxandroid.scecompcall://redirect",
response_type: "code",
scope: "psn:mobile.v2.core psn:clientapp"
}).toString();
requestUrl = AUTH_BASE_URL + "/authorize?" + queryString; // This never returns a 200. As of Oct 10 2021, it seems to return a 302.
_context.next = 4;
return fetch__default["default"](requestUrl, {
headers: {
Cookie: "npsso=" + npssoToken
},
redirect: "manual"
});
case 4:
_yield$fetch = _context.sent;
responseHeaders = _yield$fetch.headers;
if (!(!responseHeaders.has("location") || !((_responseHeaders$get = responseHeaders.get("location")) != null && _responseHeaders$get.includes("?code=")))) {
_context.next = 8;
break;
}
throw new Error("\n There was a problem retrieving your PSN access code. Is your NPSSO code valid?\n To get a new NPSSO code, visit https://ca.account.sony.com/api/v1/ssocookie.\n ");
case 8:
redirectLocation = responseHeaders.get("location");
redirectParams = new URLSearchParams(redirectLocation.split("redirect/")[1]);
return _context.abrupt("return", redirectParams.get("code"));
case 11:
case "end":
return _context.stop();
}

@@ -483,39 +489,37 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
requestUrl = AUTH_BASE_URL + "/token";
_context.next = 3;
return fetch__default["default"](requestUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="
},
body: new URLSearchParams({
refresh_token: refreshToken,
grant_type: "refresh_token",
token_format: "jwt",
scope: "psn:mobile.v2.core psn:clientapp"
}).toString()
});
case 3:
res = _context.sent;
_context.next = 6;
return res.json();
case 6:
raw = _context.sent;
return _context.abrupt("return", {
accessToken: raw.access_token,
expiresIn: raw.expires_in,
idToken: raw.id_token,
refreshToken: raw.refresh_token,
refreshTokenExpiresIn: raw.refresh_token_expires_in,
scope: raw.scope,
tokenType: raw.token_type
});
case 8:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
requestUrl = AUTH_BASE_URL + "/token";
_context.next = 3;
return fetch__default["default"](requestUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="
},
body: new URLSearchParams({
refresh_token: refreshToken,
grant_type: "refresh_token",
token_format: "jwt",
scope: "psn:mobile.v2.core psn:clientapp"
}).toString()
});
case 3:
res = _context.sent;
_context.next = 6;
return res.json();
case 6:
raw = _context.sent;
return _context.abrupt("return", {
accessToken: raw.access_token,
expiresIn: raw.expires_in,
idToken: raw.id_token,
refreshToken: raw.refresh_token,
refreshTokenExpiresIn: raw.refresh_token_expires_in,
scope: raw.scope,
tokenType: raw.token_type
});
case 8:
case "end":
return _context.stop();
}

@@ -529,2 +533,111 @@ }, _callee);

var call = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, authorization, bodyPayload) {
var _config$method;
var response;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return fetch__default["default"](config.url, {
method: (_config$method = config == null ? void 0 : config.method) != null ? _config$method : "GET",
headers: _extends({
Authorization: "Bearer " + authorization.accessToken,
"Content-Type": "application/json"
}, config == null ? void 0 : config.headers),
body: JSON.stringify(bodyPayload)
});
case 2:
response = _context.sent;
_context.next = 5;
return response.json();
case 5:
return _context.abrupt("return", _context.sent);
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function call(_x, _x2, _x3) {
return _ref.apply(this, arguments);
};
}();
var GRAPHQL_BASE_URL = "https://web.np.playstation.com/api/graphql/v1/op";
/**
* GraphQL endpoints work differently to others in the codebase.
*
* The hashes in this file are reverse engineered from app-<hash>.js file loaded by the page
* at https://library.playstation.com/recently-played. Following the code in that file leads
* to some Apollo GraphQL code related to persisted queries. This means the request needs to
* contain a SHA256 hash of the GraphQL query being executed. Searching for PersistedQueryLink
* and createPersistedQueryLink_hashes, and an AST function in Sony's JS source and debugging
* will surface the exact GraphQL query that's passed to the hash function on the page.
*
* Thankfully it's easier to figure out future endpoints and hashes by:
*
* 1. Visiting a page, e.g https://library.playstation.com/recently-played
* 2. Using DevTools to find requests to https://web.np.playstation.com/api/graphql/v1/op
* 3. Decoding the URL parameters to find the correct SHA256 hash and some of the supported parameters
*/
// Hash is computed from the following query (without surrounding quotes):
// "query getUserGameList($categories: String, $limit: Int, $orderBy: String, $subscriptionService: SubscriptionService) {\n gameLibraryTitlesRetrieve(categories: $categories, limit: $limit, orderBy: $orderBy, subscriptionService: $subscriptionService) {\n __typename\n games {\n __typename\n conceptId\n entitlementId\n image {\n __typename\n url\n }\n isActive\n lastPlayedDateTime\n name\n platform\n productId\n subscriptionService\n titleId\n }\n }\n}\n"
var getUserGameListHash = "e780a6d8b921ef0c59ec01ea5c5255671272ca0d819edb61320914cf7a78b3ae";
/**
* A call to this function will retrieve recently played games for the user associated
* with the npsso token provided to this module during initialisation.
*
* This is useful if you want recent activity that isn't tied to trophy progress.
*
* @param authorization An object containing your access token, typically retrieved with `exchangeCodeForAccessToken()`.
*/
var getRecentlyPlayedGames = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(authorization, options) {
var _options, _options$limit, limit, _options$categories, categories, url, response;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (options === void 0) {
options = {};
}
_options = options, _options$limit = _options.limit, limit = _options$limit === void 0 ? 50 : _options$limit, _options$categories = _options.categories, categories = _options$categories === void 0 ? ["ps4_game", "ps5_native_game"] : _options$categories;
url = new URL(GRAPHQL_BASE_URL);
url.searchParams.set("operationName", "getUserGameList");
url.searchParams.set("variables", JSON.stringify({
limit: limit,
categories: categories.join(",")
}));
url.searchParams.set("extensions", JSON.stringify({
persistedQuery: {
version: 1,
sha256Hash: getUserGameListHash
}
}));
_context.next = 8;
return call({
url: url.toString()
}, authorization);
case 8:
response = _context.sent;
if (!(!response.data || !response.data.gameLibraryTitlesRetrieve)) {
_context.next = 11;
break;
}
throw new Error(JSON.stringify(response));
case 11:
return _context.abrupt("return", response);
case 12:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getRecentlyPlayedGames(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
exports.TrophyRarity = void 0;

@@ -567,37 +680,2 @@ (function (TrophyRarity) {

var call = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, authorization, bodyPayload) {
var _config$method;
var response;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return fetch__default["default"](config.url, {
method: (_config$method = config == null ? void 0 : config.method) != null ? _config$method : "GET",
headers: _extends({
Authorization: "Bearer " + authorization.accessToken,
"Content-Type": "application/json"
}, config == null ? void 0 : config.headers),
body: JSON.stringify(bodyPayload)
});
case 2:
response = _context.sent;
_context.next = 5;
return response.json();
case 5:
return _context.abrupt("return", _context.sent);
case 6:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function call(_x, _x2, _x3) {
return _ref.apply(this, arguments);
};
}();
var SEARCH_BASE_URL = "https://m.np.playstation.com/api/search";

@@ -609,22 +687,20 @@

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(SEARCH_BASE_URL, "/v1/universalSearch");
_context.next = 3;
return call({
url: url,
method: "POST"
}, authorization, {
searchTerm: searchTerm,
domainRequests: [{
domain: domain
}]
});
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(SEARCH_BASE_URL, "/v1/universalSearch");
_context.next = 3;
return call({
url: url,
method: "POST"
}, authorization, {
searchTerm: searchTerm,
domainRequests: [{
domain: domain
}]
});
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -663,20 +739,18 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies", options, {
npCommunicationId: npCommunicationId,
trophyGroupId: trophyGroupId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies", options, {
npCommunicationId: npCommunicationId,
trophyGroupId: trophyGroupId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -709,19 +783,17 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/npCommunicationIds/:npCommunicationId/trophyGroups", options, {
npCommunicationId: npCommunicationId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/npCommunicationIds/:npCommunicationId/trophyGroups", options, {
npCommunicationId: npCommunicationId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -736,8 +808,8 @@ }, _callee);

/**
* A call to this function will retrieve the earned status of trophies for a user
* from either a single - or all - trophy groups in a title. A title can have
* multiple groups of trophies (a `"default"` group which all titles have, and
* additional groups starting with a name of `"001"` and incrementing for each
* additional group). To retrieve trophies from all groups within a title
* (ie. the full trophy set), `trophyGroupId` should be set to `"all"`.
* A call to this function will retrieve a summarized list of titles played
* by a user, ordered by recent trophy unlocks. The maximum amount that can
* be returned by a single call is 800 (assuming a `limit` option of 800 is set).
* If the user has more titles than the given `limit` option, subsequent calls
* of this funciton must be made to fetch the complete list by paging via the
* `offset` option.
*

@@ -749,2 +821,5 @@ * The numeric `accountId` can be that of any PSN account for which the authenticating

*
* To fetch more detailed account progress for a title, the `getUserTrophiesEarnedForTitle()`
* function can be used.
*
* To find a user's `accountId`, the `makeUniversalSearch()` function can be used.

@@ -770,19 +845,17 @@ *

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/trophyTitles", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/trophyTitles", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -835,28 +908,26 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies", options, {
accountId: accountId,
npCommunicationId: npCommunicationId,
trophyGroupId: trophyGroupId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies", options, {
accountId: accountId,
npCommunicationId: npCommunicationId,
trophyGroupId: trophyGroupId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -905,27 +976,25 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups", options, {
accountId: accountId,
npCommunicationId: npCommunicationId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups", options, {
accountId: accountId,
npCommunicationId: npCommunicationId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -960,19 +1029,17 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/trophySummary", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/trophySummary", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -1000,25 +1067,23 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(USER_BASE_URL, "/:accountId/profiles", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(USER_BASE_URL, "/:accountId/profiles", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -1049,23 +1114,21 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = "https://us-prof.np.community.playstation.net/userProfile/v1/users/" + userName + "/profile2?fields=npId,onlineId,accountId,avatarUrls,plus,aboutMe,languagesUsed,trophySummary(@default,level,progress,earnedTrophies),isOfficiallyVerified,personalDetail(@default,profilePictureUrls),personalDetailSharing,personalDetailSharingRequestMessageFlag,primaryOnlineStatus,presences(@default,@titleInfo,platform,lastOnlineDate,hasBroadcastData),requestMessageFlag,blocking,friendRelation,following,consoleAvailability";
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = "https://us-prof.np.community.playstation.net/userProfile/v1/users/" + userName + "/profile2?fields=npId,onlineId,accountId,avatarUrls,plus,aboutMe,languagesUsed,trophySummary(@default,level,progress,earnedTrophies),isOfficiallyVerified,personalDetail(@default,profilePictureUrls),personalDetailSharing,personalDetailSharingRequestMessageFlag,primaryOnlineStatus,presences(@default,@titleInfo,platform,lastOnlineDate,hasBroadcastData),requestMessageFlag,blocking,friendRelation,following,consoleAvailability";
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -1093,25 +1156,23 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(USER_BASE_URL, "/:accountId/friends", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(USER_BASE_URL, "/:accountId/friends", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -1131,2 +1192,3 @@ }, _callee);

exports.getProfileFromUserName = getProfileFromUserName;
exports.getRecentlyPlayedGames = getRecentlyPlayedGames;
exports.getTitleTrophies = getTitleTrophies;

@@ -1133,0 +1195,0 @@ exports.getTitleTrophyGroups = getTitleTrophyGroups;

@@ -1,2 +0,2 @@

"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}Object.defineProperty(exports,"__esModule",{value:!0});var e=r(require("isomorphic-unfetch"));function t(){t=function(){return r};var r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(r,e,t){return Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{c({},"")}catch(r){c=function(r,e,t){return r[e]=t}}function s(r,e,t,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),a=new _(n||[]);return o._invoke=function(r,e,t){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(t.method=o,t.arg=a;;){var i=t.delegate;if(i){var u=k(i,t);if(u){if(u===l)continue;return u}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var c=p(r,e,t);if("normal"===c.type){if(n=t.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:t.done}}"throw"===c.type&&(n="completed",t.method="throw",t.arg=c.arg)}}}(r,t,a),o}function p(r,e,t){try{return{type:"normal",arg:r.call(e,t)}}catch(r){return{type:"throw",arg:r}}}r.wrap=s;var l={};function h(){}function f(){}function d(){}var v={};c(v,a,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(I([])));m&&m!==e&&n.call(m,a)&&(v=m);var g=d.prototype=h.prototype=Object.create(v);function w(r){["next","throw","return"].forEach((function(e){c(r,e,(function(r){return this._invoke(e,r)}))}))}function x(r,e){function t(o,a,i,u){var c=p(r[o],r,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(r){t("next",r,i,u)}),(function(r){t("throw",r,i,u)})):e.resolve(l).then((function(r){s.value=r,i(s)}),(function(r){return t("throw",r,i,u)}))}u(c.arg)}var o;this._invoke=function(r,n){function a(){return new e((function(e,o){t(r,n,e,o)}))}return o=o?o.then(a,a):a()}}function k(r,e){var t=r.iterator[e.method];if(void 0===t){if(e.delegate=null,"throw"===e.method){if(r.iterator.return&&(e.method="return",e.arg=void 0,k(r,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=p(t,r.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[r.resultName]=o.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function T(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function _(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(b,this),this.reset(!0)}function I(r){if(r){var e=r[a];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var t=-1,o=function e(){for(;++t<r.length;)if(n.call(r,t))return e.value=r[t],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return f.prototype=d,c(g,"constructor",d),c(d,"constructor",f),f.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(r){var e="function"==typeof r&&r.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,d):(r.__proto__=d,c(r,u,"GeneratorFunction")),r.prototype=Object.create(g),r},r.awrap=function(r){return{__await:r}},w(x.prototype),c(x.prototype,i,(function(){return this})),r.AsyncIterator=x,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new x(s(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(r){return r.done?r.value:i.next()}))},w(g),c(g,u,"Generator"),c(g,a,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),r.keys=function(r){var e=[];for(var t in r)e.push(t);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=I,_.prototype={constructor:_,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var r=this.tryEntries[0].completion;if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function t(t,n){return i.type="throw",i.arg=r,e.next=t,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return t("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return t(a.catchLoc,!0);if(this.prev<a.finallyLoc)return t(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return t(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return t(a.finallyLoc)}}}},abrupt:function(r,e){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===r||"continue"===r)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=r,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(i)},complete:function(r,e){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&e&&(this.next=e),l},finish:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];if(t.finallyLoc===r)return this.complete(t.completion,t.afterLoc),T(t),l}},catch:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];if(t.tryLoc===r){var n=t.completion;if("throw"===n.type){var o=n.arg;T(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,t){return this.delegate={iterator:I(r),resultName:e,nextLoc:t},"next"===this.method&&(this.arg=void 0),l}},r}function n(r,e,t,n,o,a,i){try{var u=r[a](i),c=u.value}catch(r){return void t(r)}u.done?e(c):Promise.resolve(c).then(n,o)}function o(r){return function(){var e=this,t=arguments;return new Promise((function(o,a){var i=r.apply(e,t);function u(r){n(i,o,a,u,c,"next",r)}function c(r){n(i,o,a,u,c,"throw",r)}u(void 0)}))}}function a(){return a=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},a.apply(this,arguments)}var i,u=function(){var r=o(t().mark((function r(n){var o,a;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=3,e.default("https://ca.account.sony.com/api/authz/v3/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="},body:new URLSearchParams({code:n,redirect_uri:"com.scee.psxandroid.scecompcall://redirect",grant_type:"authorization_code",token_format:"jwt"}).toString()});case 3:return o=r.sent,r.next=6,o.json();case 6:return r.abrupt("return",{accessToken:(a=r.sent).access_token,expiresIn:a.expires_in,idToken:a.id_token,refreshToken:a.refresh_token,refreshTokenExpiresIn:a.refresh_token_expires_in,scope:a.scope,tokenType:a.token_type});case 8:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),c=function(){var r=o(t().mark((function r(n){var o,a,i,u,c,s;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=new URLSearchParams({access_type:"offline",client_id:"09515159-7237-4370-9b40-3806e67c0891",redirect_uri:"com.scee.psxandroid.scecompcall://redirect",response_type:"code",scope:"psn:mobile.v2.core psn:clientapp"}).toString(),i="https://ca.account.sony.com/api/authz/v3/oauth/authorize?"+a,r.next=4,e.default(i,{headers:{Cookie:"npsso="+n},redirect:"manual"});case 4:if((u=r.sent.headers).has("location")&&null!=(o=u.get("location"))&&o.includes("?code=")){r.next=8;break}throw new Error("\n There was a problem retrieving your PSN access code. Is your NPSSO code valid?\n To get a new NPSSO code, visit https://ca.account.sony.com/api/v1/ssocookie.\n ");case 8:return c=u.get("location"),s=new URLSearchParams(c.split("redirect/")[1]),r.abrupt("return",s.get("code"));case 11:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),s=function(){var r=o(t().mark((function r(n){var o,a;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=3,e.default("https://ca.account.sony.com/api/authz/v3/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="},body:new URLSearchParams({refresh_token:n,grant_type:"refresh_token",token_format:"jwt",scope:"psn:mobile.v2.core psn:clientapp"}).toString()});case 3:return o=r.sent,r.next=6,o.json();case 6:return r.abrupt("return",{accessToken:(a=r.sent).access_token,expiresIn:a.expires_in,idToken:a.id_token,refreshToken:a.refresh_token,refreshTokenExpiresIn:a.refresh_token_expires_in,scope:a.scope,tokenType:a.token_type});case 8:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}();exports.TrophyRarity=void 0,(i=exports.TrophyRarity||(exports.TrophyRarity={}))[i.UltraRare=0]="UltraRare",i[i.VeryRare=1]="VeryRare",i[i.Rare=2]="Rare",i[i.Common=3]="Common";var p=["headerOverrides"],l=function(r,e,t,n){void 0===t&&(t={}),void 0===n&&(n={});for(var o=function(r,e){if(null==r)return{};var t,n,o={},a=Object.keys(r);for(n=0;n<a.length;n++)e.indexOf(t=a[n])>=0||(o[t]=r[t]);return o}(t,p),i=(r+"/"+e).replace(/([^:]\/)\/+/g,"$1"),u={},c=0,s=Object.entries(a({},n,o));c<s.length;c++){var l=s[c],h=l[0],f=l[1];i.includes(":"+h)?i=i.replace(":"+h,String(f)):void 0!==f&&(u[h]=String(f))}var d=new URLSearchParams(u).toString();return d.length>0?i+"?"+d:i},h=function(){var r=o(t().mark((function r(n,o,i){var u,c;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.default(n.url,{method:null!=(u=null==n?void 0:n.method)?u:"GET",headers:a({Authorization:"Bearer "+o.accessToken,"Content-Type":"application/json"},null==n?void 0:n.headers),body:JSON.stringify(i)});case 2:return c=r.sent,r.next=5,c.json();case 5:return r.abrupt("return",r.sent);case 6:case"end":return r.stop()}}),r)})));return function(e,t,n){return r.apply(this,arguments)}}(),f=function(){var r=o(t().mark((function r(e,n,o){var a;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=l("https://m.np.playstation.com/api/search","/v1/universalSearch"),r.next=3,h({url:a,method:"POST"},e,{searchTerm:n,domainRequests:[{domain:o}]});case 3:return r.abrupt("return",r.sent);case 4:case"end":return r.stop()}}),r)})));return function(e,t,n){return r.apply(this,arguments)}}(),d="https://m.np.playstation.com/api/trophy",v=function(){var r=o(t().mark((function r(e,n,o,a){var i;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=l(d,"/v1/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies",a,{npCommunicationId:n,trophyGroupId:o}),r.next=3,h({url:i,headers:null==a?void 0:a.headerOverrides},e);case 3:return r.abrupt("return",r.sent);case 4:case"end":return r.stop()}}),r)})));return function(e,t,n,o){return r.apply(this,arguments)}}(),y=function(){var r=o(t().mark((function r(e,n,o){var a;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=l(d,"/v1/npCommunicationIds/:npCommunicationId/trophyGroups",o,{npCommunicationId:n}),r.next=3,h({url:a,headers:null==o?void 0:o.headerOverrides},e);case 3:return r.abrupt("return",r.sent);case 4:case"end":return r.stop()}}),r)})));return function(e,t,n){return r.apply(this,arguments)}}(),m=function(){var r=o(t().mark((function r(e,n,o){var a;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=l(d,"/v1/users/:accountId/trophyTitles",o,{accountId:n}),r.next=3,h({url:a,headers:null==o?void 0:o.headerOverrides},e);case 3:return r.abrupt("return",r.sent);case 4:case"end":return r.stop()}}),r)})));return function(e,t,n){return r.apply(this,arguments)}}(),g=function(){var r=o(t().mark((function r(e,n,o,a,i){var u,c,s,p;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return u=l(d,"/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies",i,{accountId:n,npCommunicationId:o,trophyGroupId:a}),r.next=3,h({url:u,headers:null==i?void 0:i.headerOverrides},e);case 3:if(null==(c=r.sent)||!c.error){r.next=6;break}throw new Error(null!=(s=null==c||null==(p=c.error)?void 0:p.message)?s:"Unexpected Error");case 6:return r.abrupt("return",c);case 7:case"end":return r.stop()}}),r)})));return function(e,t,n,o,a){return r.apply(this,arguments)}}(),w=function(){var r=o(t().mark((function r(e,n,o,a){var i,u,c,s;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=l(d,"/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups",a,{accountId:n,npCommunicationId:o}),r.next=3,h({url:i,headers:null==a?void 0:a.headerOverrides},e);case 3:if(null==(u=r.sent)||!u.error){r.next=6;break}throw new Error(null!=(c=null==u||null==(s=u.error)?void 0:s.message)?c:"Unexpected Error");case 6:return r.abrupt("return",u);case 7:case"end":return r.stop()}}),r)})));return function(e,t,n,o){return r.apply(this,arguments)}}(),x=function(){var r=o(t().mark((function r(e,n,o){var a;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=l(d,"/v1/users/:accountId/trophySummary",o,{accountId:n}),r.next=3,h({url:a,headers:null==o?void 0:o.headerOverrides},e);case 3:return r.abrupt("return",r.sent);case 4:case"end":return r.stop()}}),r)})));return function(e,t,n){return r.apply(this,arguments)}}(),k="https://m.np.playstation.com/api/userProfile/v1/internal/users",b=function(){var r=o(t().mark((function r(e,n,o){var a,i,u,c;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=l(k,"/:accountId/profiles",o,{accountId:n}),r.next=3,h({url:a},e);case 3:if(null==(i=r.sent)||!i.error){r.next=6;break}throw new Error(null!=(u=null==i||null==(c=i.error)?void 0:c.message)?u:"Unexpected Error");case 6:return r.abrupt("return",i);case 7:case"end":return r.stop()}}),r)})));return function(e,t,n){return r.apply(this,arguments)}}(),T=function(){var r=o(t().mark((function r(e,n){var o,a,i,u;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o="https://us-prof.np.community.playstation.net/userProfile/v1/users/"+n+"/profile2?fields=npId,onlineId,accountId,avatarUrls,plus,aboutMe,languagesUsed,trophySummary(@default,level,progress,earnedTrophies),isOfficiallyVerified,personalDetail(@default,profilePictureUrls),personalDetailSharing,personalDetailSharingRequestMessageFlag,primaryOnlineStatus,presences(@default,@titleInfo,platform,lastOnlineDate,hasBroadcastData),requestMessageFlag,blocking,friendRelation,following,consoleAvailability",r.next=3,h({url:o},e);case 3:if(null==(a=r.sent)||!a.error){r.next=6;break}throw new Error(null!=(i=null==a||null==(u=a.error)?void 0:u.message)?i:"Unexpected Error");case 6:return r.abrupt("return",a);case 7:case"end":return r.stop()}}),r)})));return function(e,t){return r.apply(this,arguments)}}(),_=function(){var r=o(t().mark((function r(e,n,o){var a,i,u,c;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=l(k,"/:accountId/friends",o,{accountId:n}),r.next=3,h({url:a},e);case 3:if(null==(i=r.sent)||!i.error){r.next=6;break}throw new Error(null!=(u=null==i||null==(c=i.error)?void 0:c.message)?u:"Unexpected Error");case 6:return r.abrupt("return",i);case 7:case"end":return r.stop()}}),r)})));return function(e,t,n){return r.apply(this,arguments)}}();exports.call=h,exports.exchangeCodeForAccessToken=u,exports.exchangeNpssoForCode=c,exports.exchangeRefreshTokenForAuthTokens=s,exports.getProfileFromAccountId=b,exports.getProfileFromUserName=T,exports.getTitleTrophies=v,exports.getTitleTrophyGroups=y,exports.getUserFriendsAccountIds=_,exports.getUserTitles=m,exports.getUserTrophiesEarnedForTitle=g,exports.getUserTrophyGroupEarningsForTitle=w,exports.getUserTrophyProfileSummary=x,exports.makeUniversalSearch=f;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("isomorphic-unfetch"));function t(){t=function(){return e};var e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{u({},"")}catch(e){u=function(e,r,t){return e[r]=t}}function p(e,r,t,n){var a=Object.create((r&&r.prototype instanceof f?r:f).prototype),i=new I(n||[]);return o(a,"_invoke",{value:k(e,t,i)}),a}function l(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=p;var h={};function f(){}function d(){}function v(){}var y={};u(y,i,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==r&&n.call(g,i)&&(y=g);var w=v.prototype=f.prototype=Object.create(y);function x(e){["next","throw","return"].forEach((function(r){u(e,r,(function(e){return this._invoke(r,e)}))}))}function b(e,r){function t(o,a,i,c){var s=l(e[o],e,a);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?r.resolve(p.__await).then((function(e){t("next",e,i,c)}),(function(e){t("throw",e,i,c)})):r.resolve(p).then((function(e){u.value=e,i(u)}),(function(e){return t("throw",e,i,c)}))}c(s.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new r((function(r,o){t(e,n,r,o)}))}return a=a?a.then(o,o):o()}})}function k(e,r,t){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(t.method=o,t.arg=a;;){var i=t.delegate;if(i){var c=T(i,t);if(c){if(c===h)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=l(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function T(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,T(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),h;var o=l(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function _(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function O(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function E(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var t=-1,o=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return d.prototype=v,o(w,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:d,configurable:!0}),d.displayName=u(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},x(b.prototype),u(b.prototype,c,(function(){return this})),e.AsyncIterator=b,e.async=function(r,t,n,o,a){void 0===a&&(a=Promise);var i=new b(p(r,t,n,o),a);return e.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(w),u(w,s,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function t(t,n){return i.type="throw",i.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return t("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return t(a.catchLoc,!0);if(this.prev<a.finallyLoc)return t(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return t(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return t(a.finallyLoc)}}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(i)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),h},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),O(t),h}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;O(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:E(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),h}},e}function n(e,r,t,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void t(e)}c.done?r(s):Promise.resolve(s).then(n,o)}function o(e){return function(){var r=this,t=arguments;return new Promise((function(o,a){var i=e.apply(r,t);function c(e){n(i,o,a,c,s,"next",e)}function s(e){n(i,o,a,c,s,"throw",e)}c(void 0)}))}}function a(){return a=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},a.apply(this,arguments)}var i,c=function(){var e=o(t().mark((function e(n){var o,a;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=3,r.default("https://ca.account.sony.com/api/authz/v3/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="},body:new URLSearchParams({code:n,redirect_uri:"com.scee.psxandroid.scecompcall://redirect",grant_type:"authorization_code",token_format:"jwt"}).toString()});case 3:return o=e.sent,e.next=6,o.json();case 6:return e.abrupt("return",{accessToken:(a=e.sent).access_token,expiresIn:a.expires_in,idToken:a.id_token,refreshToken:a.refresh_token,refreshTokenExpiresIn:a.refresh_token_expires_in,scope:a.scope,tokenType:a.token_type});case 8:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),s=function(){var e=o(t().mark((function e(n){var o,a,i,c,s,u;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new URLSearchParams({access_type:"offline",client_id:"09515159-7237-4370-9b40-3806e67c0891",redirect_uri:"com.scee.psxandroid.scecompcall://redirect",response_type:"code",scope:"psn:mobile.v2.core psn:clientapp"}).toString(),i="https://ca.account.sony.com/api/authz/v3/oauth/authorize?"+a,e.next=4,r.default(i,{headers:{Cookie:"npsso="+n},redirect:"manual"});case 4:if((c=e.sent.headers).has("location")&&null!=(o=c.get("location"))&&o.includes("?code=")){e.next=8;break}throw new Error("\n There was a problem retrieving your PSN access code. Is your NPSSO code valid?\n To get a new NPSSO code, visit https://ca.account.sony.com/api/v1/ssocookie.\n ");case 8:return s=c.get("location"),u=new URLSearchParams(s.split("redirect/")[1]),e.abrupt("return",u.get("code"));case 11:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),u=function(){var e=o(t().mark((function e(n){var o,a;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=3,r.default("https://ca.account.sony.com/api/authz/v3/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="},body:new URLSearchParams({refresh_token:n,grant_type:"refresh_token",token_format:"jwt",scope:"psn:mobile.v2.core psn:clientapp"}).toString()});case 3:return o=e.sent,e.next=6,o.json();case 6:return e.abrupt("return",{accessToken:(a=e.sent).access_token,expiresIn:a.expires_in,idToken:a.id_token,refreshToken:a.refresh_token,refreshTokenExpiresIn:a.refresh_token_expires_in,scope:a.scope,tokenType:a.token_type});case 8:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),p=function(){var e=o(t().mark((function e(n,o,i){var c,s;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.default(n.url,{method:null!=(c=null==n?void 0:n.method)?c:"GET",headers:a({Authorization:"Bearer "+o.accessToken,"Content-Type":"application/json"},null==n?void 0:n.headers),body:JSON.stringify(i)});case 2:return s=e.sent,e.next=5,s.json();case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(r,t,n){return e.apply(this,arguments)}}(),l=function(){var e=o(t().mark((function e(r,n){var o,a,i,c,s,u,l;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n={}),i=void 0===(a=(o=n).limit)?50:a,s=void 0===(c=o.categories)?["ps4_game","ps5_native_game"]:c,(u=new URL("https://web.np.playstation.com/api/graphql/v1/op")).searchParams.set("operationName","getUserGameList"),u.searchParams.set("variables",JSON.stringify({limit:i,categories:s.join(",")})),u.searchParams.set("extensions",JSON.stringify({persistedQuery:{version:1,sha256Hash:"e780a6d8b921ef0c59ec01ea5c5255671272ca0d819edb61320914cf7a78b3ae"}})),e.next=8,p({url:u.toString()},r);case 8:if((l=e.sent).data&&l.data.gameLibraryTitlesRetrieve){e.next=11;break}throw new Error(JSON.stringify(l));case 11:return e.abrupt("return",l);case 12:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}();exports.TrophyRarity=void 0,(i=exports.TrophyRarity||(exports.TrophyRarity={}))[i.UltraRare=0]="UltraRare",i[i.VeryRare=1]="VeryRare",i[i.Rare=2]="Rare",i[i.Common=3]="Common";var h=["headerOverrides"],f=function(e,r,t,n){void 0===t&&(t={}),void 0===n&&(n={});for(var o=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}(t,h),i=(e+"/"+r).replace(/([^:]\/)\/+/g,"$1"),c={},s=0,u=Object.entries(a({},n,o));s<u.length;s++){var p=u[s],l=p[0],f=p[1];i.includes(":"+l)?i=i.replace(":"+l,String(f)):void 0!==f&&(c[l]=String(f))}var d=new URLSearchParams(c).toString();return d.length>0?i+"?"+d:i},d=function(){var e=o(t().mark((function e(r,n,o){var a;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=f("https://m.np.playstation.com/api/search","/v1/universalSearch"),e.next=3,p({url:a,method:"POST"},r,{searchTerm:n,domainRequests:[{domain:o}]});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(r,t,n){return e.apply(this,arguments)}}(),v="https://m.np.playstation.com/api/trophy",y=function(){var e=o(t().mark((function e(r,n,o,a){var i;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=f(v,"/v1/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies",a,{npCommunicationId:n,trophyGroupId:o}),e.next=3,p({url:i,headers:null==a?void 0:a.headerOverrides},r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(r,t,n,o){return e.apply(this,arguments)}}(),m=function(){var e=o(t().mark((function e(r,n,o){var a;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=f(v,"/v1/npCommunicationIds/:npCommunicationId/trophyGroups",o,{npCommunicationId:n}),e.next=3,p({url:a,headers:null==o?void 0:o.headerOverrides},r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(r,t,n){return e.apply(this,arguments)}}(),g=function(){var e=o(t().mark((function e(r,n,o){var a;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=f(v,"/v1/users/:accountId/trophyTitles",o,{accountId:n}),e.next=3,p({url:a,headers:null==o?void 0:o.headerOverrides},r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(r,t,n){return e.apply(this,arguments)}}(),w=function(){var e=o(t().mark((function e(r,n,o,a,i){var c,s,u,l;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=f(v,"/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies",i,{accountId:n,npCommunicationId:o,trophyGroupId:a}),e.next=3,p({url:c,headers:null==i?void 0:i.headerOverrides},r);case 3:if(null==(s=e.sent)||!s.error){e.next=6;break}throw new Error(null!=(u=null==s||null==(l=s.error)?void 0:l.message)?u:"Unexpected Error");case 6:return e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})));return function(r,t,n,o,a){return e.apply(this,arguments)}}(),x=function(){var e=o(t().mark((function e(r,n,o,a){var i,c,s,u;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=f(v,"/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups",a,{accountId:n,npCommunicationId:o}),e.next=3,p({url:i,headers:null==a?void 0:a.headerOverrides},r);case 3:if(null==(c=e.sent)||!c.error){e.next=6;break}throw new Error(null!=(s=null==c||null==(u=c.error)?void 0:u.message)?s:"Unexpected Error");case 6:return e.abrupt("return",c);case 7:case"end":return e.stop()}}),e)})));return function(r,t,n,o){return e.apply(this,arguments)}}(),b=function(){var e=o(t().mark((function e(r,n,o){var a;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=f(v,"/v1/users/:accountId/trophySummary",o,{accountId:n}),e.next=3,p({url:a,headers:null==o?void 0:o.headerOverrides},r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(r,t,n){return e.apply(this,arguments)}}(),k="https://m.np.playstation.com/api/userProfile/v1/internal/users",T=function(){var e=o(t().mark((function e(r,n,o){var a,i,c,s;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=f(k,"/:accountId/profiles",o,{accountId:n}),e.next=3,p({url:a},r);case 3:if(null==(i=e.sent)||!i.error){e.next=6;break}throw new Error(null!=(c=null==i||null==(s=i.error)?void 0:s.message)?c:"Unexpected Error");case 6:return e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)})));return function(r,t,n){return e.apply(this,arguments)}}(),_=function(){var e=o(t().mark((function e(r,n){var o,a,i,c;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o="https://us-prof.np.community.playstation.net/userProfile/v1/users/"+n+"/profile2?fields=npId,onlineId,accountId,avatarUrls,plus,aboutMe,languagesUsed,trophySummary(@default,level,progress,earnedTrophies),isOfficiallyVerified,personalDetail(@default,profilePictureUrls),personalDetailSharing,personalDetailSharingRequestMessageFlag,primaryOnlineStatus,presences(@default,@titleInfo,platform,lastOnlineDate,hasBroadcastData),requestMessageFlag,blocking,friendRelation,following,consoleAvailability",e.next=3,p({url:o},r);case 3:if(null==(a=e.sent)||!a.error){e.next=6;break}throw new Error(null!=(i=null==a||null==(c=a.error)?void 0:c.message)?i:"Unexpected Error");case 6:return e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}(),O=function(){var e=o(t().mark((function e(r,n,o){var a,i,c,s;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=f(k,"/:accountId/friends",o,{accountId:n}),e.next=3,p({url:a},r);case 3:if(null==(i=e.sent)||!i.error){e.next=6;break}throw new Error(null!=(c=null==i||null==(s=i.error)?void 0:s.message)?c:"Unexpected Error");case 6:return e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)})));return function(r,t,n){return e.apply(this,arguments)}}();exports.call=p,exports.exchangeCodeForAccessToken=c,exports.exchangeNpssoForCode=s,exports.exchangeRefreshTokenForAuthTokens=u,exports.getProfileFromAccountId=T,exports.getProfileFromUserName=_,exports.getRecentlyPlayedGames=l,exports.getTitleTrophies=y,exports.getTitleTrophyGroups=m,exports.getUserFriendsAccountIds=O,exports.getUserTitles=g,exports.getUserTrophiesEarnedForTitle=w,exports.getUserTrophyGroupEarningsForTitle=x,exports.getUserTrophyProfileSummary=b,exports.makeUniversalSearch=d;
//# sourceMappingURL=psn-api.cjs.production.min.js.map

@@ -10,2 +10,5 @@ import fetch from 'isomorphic-unfetch';

hasOwn = Op.hasOwnProperty,
defineProperty = Object.defineProperty || function (obj, key, desc) {
obj[key] = desc.value;
},
$Symbol = "function" == typeof Symbol ? Symbol : {},

@@ -34,36 +37,5 @@ iteratorSymbol = $Symbol.iterator || "@@iterator",

context = new Context(tryLocsList || []);
return generator._invoke = function (innerFn, self, context) {
var state = "suspendedStart";
return function (method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
return defineProperty(generator, "_invoke", {
value: makeInvokeMethod(innerFn, self, context)
}), generator;
}

@@ -122,20 +94,51 @@ function tryCatch(fn, obj, arg) {

var previousPromise;
this._invoke = function (method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
defineProperty(this, "_invoke", {
value: function (method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
});
}
function makeInvokeMethod(innerFn, self, context) {
var state = "suspendedStart";
return function (method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var methodName = context.method,
method = delegate.iterator[methodName];
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
var record = tryCatch(method, delegate.iterator, context.arg);

@@ -185,3 +188,9 @@ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;

}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
value: GeneratorFunctionPrototype,
configurable: !0
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
value: GeneratorFunction,
configurable: !0
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;

@@ -207,4 +216,5 @@ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));

return "[object Generator]";
}), exports.keys = function (object) {
var keys = [];
}), exports.keys = function (val) {
var object = Object(val),
keys = [];
for (var key in object) keys.push(key);

@@ -366,39 +376,37 @@ return keys.reverse(), function next() {

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
requestUrl = AUTH_BASE_URL + "/token";
_context.next = 3;
return fetch(requestUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="
},
body: new URLSearchParams({
code: accessCode,
redirect_uri: "com.scee.psxandroid.scecompcall://redirect",
grant_type: "authorization_code",
token_format: "jwt"
}).toString()
});
case 3:
res = _context.sent;
_context.next = 6;
return res.json();
case 6:
raw = _context.sent;
return _context.abrupt("return", {
accessToken: raw.access_token,
expiresIn: raw.expires_in,
idToken: raw.id_token,
refreshToken: raw.refresh_token,
refreshTokenExpiresIn: raw.refresh_token_expires_in,
scope: raw.scope,
tokenType: raw.token_type
});
case 8:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
requestUrl = AUTH_BASE_URL + "/token";
_context.next = 3;
return fetch(requestUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="
},
body: new URLSearchParams({
code: accessCode,
redirect_uri: "com.scee.psxandroid.scecompcall://redirect",
grant_type: "authorization_code",
token_format: "jwt"
}).toString()
});
case 3:
res = _context.sent;
_context.next = 6;
return res.json();
case 6:
raw = _context.sent;
return _context.abrupt("return", {
accessToken: raw.access_token,
expiresIn: raw.expires_in,
idToken: raw.id_token,
refreshToken: raw.refresh_token,
refreshTokenExpiresIn: raw.refresh_token_expires_in,
scope: raw.scope,
tokenType: raw.token_type
});
case 8:
case "end":
return _context.stop();
}

@@ -428,36 +436,34 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
queryString = new URLSearchParams({
access_type: "offline",
client_id: "09515159-7237-4370-9b40-3806e67c0891",
redirect_uri: "com.scee.psxandroid.scecompcall://redirect",
response_type: "code",
scope: "psn:mobile.v2.core psn:clientapp"
}).toString();
requestUrl = AUTH_BASE_URL + "/authorize?" + queryString; // This never returns a 200. As of Oct 10 2021, it seems to return a 302.
_context.next = 4;
return fetch(requestUrl, {
headers: {
Cookie: "npsso=" + npssoToken
},
redirect: "manual"
});
case 4:
_yield$fetch = _context.sent;
responseHeaders = _yield$fetch.headers;
if (!(!responseHeaders.has("location") || !((_responseHeaders$get = responseHeaders.get("location")) != null && _responseHeaders$get.includes("?code=")))) {
_context.next = 8;
break;
}
throw new Error("\n There was a problem retrieving your PSN access code. Is your NPSSO code valid?\n To get a new NPSSO code, visit https://ca.account.sony.com/api/v1/ssocookie.\n ");
case 8:
redirectLocation = responseHeaders.get("location");
redirectParams = new URLSearchParams(redirectLocation.split("redirect/")[1]);
return _context.abrupt("return", redirectParams.get("code"));
case 11:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
queryString = new URLSearchParams({
access_type: "offline",
client_id: "09515159-7237-4370-9b40-3806e67c0891",
redirect_uri: "com.scee.psxandroid.scecompcall://redirect",
response_type: "code",
scope: "psn:mobile.v2.core psn:clientapp"
}).toString();
requestUrl = AUTH_BASE_URL + "/authorize?" + queryString; // This never returns a 200. As of Oct 10 2021, it seems to return a 302.
_context.next = 4;
return fetch(requestUrl, {
headers: {
Cookie: "npsso=" + npssoToken
},
redirect: "manual"
});
case 4:
_yield$fetch = _context.sent;
responseHeaders = _yield$fetch.headers;
if (!(!responseHeaders.has("location") || !((_responseHeaders$get = responseHeaders.get("location")) != null && _responseHeaders$get.includes("?code=")))) {
_context.next = 8;
break;
}
throw new Error("\n There was a problem retrieving your PSN access code. Is your NPSSO code valid?\n To get a new NPSSO code, visit https://ca.account.sony.com/api/v1/ssocookie.\n ");
case 8:
redirectLocation = responseHeaders.get("location");
redirectParams = new URLSearchParams(redirectLocation.split("redirect/")[1]);
return _context.abrupt("return", redirectParams.get("code"));
case 11:
case "end":
return _context.stop();
}

@@ -475,39 +481,37 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
requestUrl = AUTH_BASE_URL + "/token";
_context.next = 3;
return fetch(requestUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="
},
body: new URLSearchParams({
refresh_token: refreshToken,
grant_type: "refresh_token",
token_format: "jwt",
scope: "psn:mobile.v2.core psn:clientapp"
}).toString()
});
case 3:
res = _context.sent;
_context.next = 6;
return res.json();
case 6:
raw = _context.sent;
return _context.abrupt("return", {
accessToken: raw.access_token,
expiresIn: raw.expires_in,
idToken: raw.id_token,
refreshToken: raw.refresh_token,
refreshTokenExpiresIn: raw.refresh_token_expires_in,
scope: raw.scope,
tokenType: raw.token_type
});
case 8:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
requestUrl = AUTH_BASE_URL + "/token";
_context.next = 3;
return fetch(requestUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Basic MDk1MTUxNTktNzIzNy00MzcwLTliNDAtMzgwNmU2N2MwODkxOnVjUGprYTV0bnRCMktxc1A="
},
body: new URLSearchParams({
refresh_token: refreshToken,
grant_type: "refresh_token",
token_format: "jwt",
scope: "psn:mobile.v2.core psn:clientapp"
}).toString()
});
case 3:
res = _context.sent;
_context.next = 6;
return res.json();
case 6:
raw = _context.sent;
return _context.abrupt("return", {
accessToken: raw.access_token,
expiresIn: raw.expires_in,
idToken: raw.id_token,
refreshToken: raw.refresh_token,
refreshTokenExpiresIn: raw.refresh_token_expires_in,
scope: raw.scope,
tokenType: raw.token_type
});
case 8:
case "end":
return _context.stop();
}

@@ -521,2 +525,111 @@ }, _callee);

var call = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, authorization, bodyPayload) {
var _config$method;
var response;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return fetch(config.url, {
method: (_config$method = config == null ? void 0 : config.method) != null ? _config$method : "GET",
headers: _extends({
Authorization: "Bearer " + authorization.accessToken,
"Content-Type": "application/json"
}, config == null ? void 0 : config.headers),
body: JSON.stringify(bodyPayload)
});
case 2:
response = _context.sent;
_context.next = 5;
return response.json();
case 5:
return _context.abrupt("return", _context.sent);
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function call(_x, _x2, _x3) {
return _ref.apply(this, arguments);
};
}();
var GRAPHQL_BASE_URL = "https://web.np.playstation.com/api/graphql/v1/op";
/**
* GraphQL endpoints work differently to others in the codebase.
*
* The hashes in this file are reverse engineered from app-<hash>.js file loaded by the page
* at https://library.playstation.com/recently-played. Following the code in that file leads
* to some Apollo GraphQL code related to persisted queries. This means the request needs to
* contain a SHA256 hash of the GraphQL query being executed. Searching for PersistedQueryLink
* and createPersistedQueryLink_hashes, and an AST function in Sony's JS source and debugging
* will surface the exact GraphQL query that's passed to the hash function on the page.
*
* Thankfully it's easier to figure out future endpoints and hashes by:
*
* 1. Visiting a page, e.g https://library.playstation.com/recently-played
* 2. Using DevTools to find requests to https://web.np.playstation.com/api/graphql/v1/op
* 3. Decoding the URL parameters to find the correct SHA256 hash and some of the supported parameters
*/
// Hash is computed from the following query (without surrounding quotes):
// "query getUserGameList($categories: String, $limit: Int, $orderBy: String, $subscriptionService: SubscriptionService) {\n gameLibraryTitlesRetrieve(categories: $categories, limit: $limit, orderBy: $orderBy, subscriptionService: $subscriptionService) {\n __typename\n games {\n __typename\n conceptId\n entitlementId\n image {\n __typename\n url\n }\n isActive\n lastPlayedDateTime\n name\n platform\n productId\n subscriptionService\n titleId\n }\n }\n}\n"
var getUserGameListHash = "e780a6d8b921ef0c59ec01ea5c5255671272ca0d819edb61320914cf7a78b3ae";
/**
* A call to this function will retrieve recently played games for the user associated
* with the npsso token provided to this module during initialisation.
*
* This is useful if you want recent activity that isn't tied to trophy progress.
*
* @param authorization An object containing your access token, typically retrieved with `exchangeCodeForAccessToken()`.
*/
var getRecentlyPlayedGames = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(authorization, options) {
var _options, _options$limit, limit, _options$categories, categories, url, response;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (options === void 0) {
options = {};
}
_options = options, _options$limit = _options.limit, limit = _options$limit === void 0 ? 50 : _options$limit, _options$categories = _options.categories, categories = _options$categories === void 0 ? ["ps4_game", "ps5_native_game"] : _options$categories;
url = new URL(GRAPHQL_BASE_URL);
url.searchParams.set("operationName", "getUserGameList");
url.searchParams.set("variables", JSON.stringify({
limit: limit,
categories: categories.join(",")
}));
url.searchParams.set("extensions", JSON.stringify({
persistedQuery: {
version: 1,
sha256Hash: getUserGameListHash
}
}));
_context.next = 8;
return call({
url: url.toString()
}, authorization);
case 8:
response = _context.sent;
if (!(!response.data || !response.data.gameLibraryTitlesRetrieve)) {
_context.next = 11;
break;
}
throw new Error(JSON.stringify(response));
case 11:
return _context.abrupt("return", response);
case 12:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getRecentlyPlayedGames(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
var TrophyRarity;

@@ -559,37 +672,2 @@ (function (TrophyRarity) {

var call = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, authorization, bodyPayload) {
var _config$method;
var response;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return fetch(config.url, {
method: (_config$method = config == null ? void 0 : config.method) != null ? _config$method : "GET",
headers: _extends({
Authorization: "Bearer " + authorization.accessToken,
"Content-Type": "application/json"
}, config == null ? void 0 : config.headers),
body: JSON.stringify(bodyPayload)
});
case 2:
response = _context.sent;
_context.next = 5;
return response.json();
case 5:
return _context.abrupt("return", _context.sent);
case 6:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function call(_x, _x2, _x3) {
return _ref.apply(this, arguments);
};
}();
var SEARCH_BASE_URL = "https://m.np.playstation.com/api/search";

@@ -601,22 +679,20 @@

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(SEARCH_BASE_URL, "/v1/universalSearch");
_context.next = 3;
return call({
url: url,
method: "POST"
}, authorization, {
searchTerm: searchTerm,
domainRequests: [{
domain: domain
}]
});
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(SEARCH_BASE_URL, "/v1/universalSearch");
_context.next = 3;
return call({
url: url,
method: "POST"
}, authorization, {
searchTerm: searchTerm,
domainRequests: [{
domain: domain
}]
});
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -655,20 +731,18 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies", options, {
npCommunicationId: npCommunicationId,
trophyGroupId: trophyGroupId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies", options, {
npCommunicationId: npCommunicationId,
trophyGroupId: trophyGroupId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -701,19 +775,17 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/npCommunicationIds/:npCommunicationId/trophyGroups", options, {
npCommunicationId: npCommunicationId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/npCommunicationIds/:npCommunicationId/trophyGroups", options, {
npCommunicationId: npCommunicationId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -728,8 +800,8 @@ }, _callee);

/**
* A call to this function will retrieve the earned status of trophies for a user
* from either a single - or all - trophy groups in a title. A title can have
* multiple groups of trophies (a `"default"` group which all titles have, and
* additional groups starting with a name of `"001"` and incrementing for each
* additional group). To retrieve trophies from all groups within a title
* (ie. the full trophy set), `trophyGroupId` should be set to `"all"`.
* A call to this function will retrieve a summarized list of titles played
* by a user, ordered by recent trophy unlocks. The maximum amount that can
* be returned by a single call is 800 (assuming a `limit` option of 800 is set).
* If the user has more titles than the given `limit` option, subsequent calls
* of this funciton must be made to fetch the complete list by paging via the
* `offset` option.
*

@@ -741,2 +813,5 @@ * The numeric `accountId` can be that of any PSN account for which the authenticating

*
* To fetch more detailed account progress for a title, the `getUserTrophiesEarnedForTitle()`
* function can be used.
*
* To find a user's `accountId`, the `makeUniversalSearch()` function can be used.

@@ -762,19 +837,17 @@ *

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/trophyTitles", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/trophyTitles", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -827,28 +900,26 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies", options, {
accountId: accountId,
npCommunicationId: npCommunicationId,
trophyGroupId: trophyGroupId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups/:trophyGroupId/trophies", options, {
accountId: accountId,
npCommunicationId: npCommunicationId,
trophyGroupId: trophyGroupId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -897,27 +968,25 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups", options, {
accountId: accountId,
npCommunicationId: npCommunicationId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/npCommunicationIds/:npCommunicationId/trophyGroups", options, {
accountId: accountId,
npCommunicationId: npCommunicationId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -952,19 +1021,17 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/trophySummary", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(TROPHY_BASE_URL, "/v1/users/:accountId/trophySummary", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url,
headers: options == null ? void 0 : options.headerOverrides
}, authorization);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}

@@ -992,25 +1059,23 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(USER_BASE_URL, "/:accountId/profiles", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(USER_BASE_URL, "/:accountId/profiles", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -1041,23 +1106,21 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = "https://us-prof.np.community.playstation.net/userProfile/v1/users/" + userName + "/profile2?fields=npId,onlineId,accountId,avatarUrls,plus,aboutMe,languagesUsed,trophySummary(@default,level,progress,earnedTrophies),isOfficiallyVerified,personalDetail(@default,profilePictureUrls),personalDetailSharing,personalDetailSharingRequestMessageFlag,primaryOnlineStatus,presences(@default,@titleInfo,platform,lastOnlineDate,hasBroadcastData),requestMessageFlag,blocking,friendRelation,following,consoleAvailability";
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = "https://us-prof.np.community.playstation.net/userProfile/v1/users/" + userName + "/profile2?fields=npId,onlineId,accountId,avatarUrls,plus,aboutMe,languagesUsed,trophySummary(@default,level,progress,earnedTrophies),isOfficiallyVerified,personalDetail(@default,profilePictureUrls),personalDetailSharing,personalDetailSharingRequestMessageFlag,primaryOnlineStatus,presences(@default,@titleInfo,platform,lastOnlineDate,hasBroadcastData),requestMessageFlag,blocking,friendRelation,following,consoleAvailability";
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -1085,25 +1148,23 @@ }, _callee);

return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(USER_BASE_URL, "/:accountId/friends", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
url = buildRequestUrl(USER_BASE_URL, "/:accountId/friends", options, {
accountId: accountId
});
_context.next = 3;
return call({
url: url
}, authorization);
case 3:
response = _context.sent;
if (!(response != null && response.error)) {
_context.next = 6;
break;
}
throw new Error((_response$error$messa = response == null ? void 0 : (_response$error = response.error) == null ? void 0 : _response$error.message) != null ? _response$error$messa : "Unexpected Error");
case 6:
return _context.abrupt("return", response);
case 7:
case "end":
return _context.stop();
}

@@ -1117,3 +1178,3 @@ }, _callee);

export { TrophyRarity, call, exchangeCodeForAccessToken, exchangeNpssoForCode, exchangeRefreshTokenForAuthTokens, getProfileFromAccountId, getProfileFromUserName, getTitleTrophies, getTitleTrophyGroups, getUserFriendsAccountIds, getUserTitles, getUserTrophiesEarnedForTitle, getUserTrophyGroupEarningsForTitle, getUserTrophyProfileSummary, makeUniversalSearch };
export { TrophyRarity, call, exchangeCodeForAccessToken, exchangeNpssoForCode, exchangeRefreshTokenForAuthTokens, getProfileFromAccountId, getProfileFromUserName, getRecentlyPlayedGames, getTitleTrophies, getTitleTrophyGroups, getUserFriendsAccountIds, getUserTitles, getUserTrophiesEarnedForTitle, getUserTrophyGroupEarningsForTitle, getUserTrophyProfileSummary, makeUniversalSearch };
//# sourceMappingURL=psn-api.esm.js.map
import type { AllCallOptions, AuthorizationPayload, TitleTrophiesResponse } from "../../models";
declare type GetTitleTrophiesOptions = Pick<AllCallOptions, "headerOverrides" | "limit" | "npServiceName" | "offset">;
type GetTitleTrophiesOptions = Pick<AllCallOptions, "headerOverrides" | "limit" | "npServiceName" | "offset">;
/**

@@ -4,0 +4,0 @@ * A call to this function will retrieve the trophy list of a

import type { AllCallOptions, AuthorizationPayload, TitleTrophyGroupsResponse } from "../../models";
declare type GetTitleTrophyGroupsOptions = Pick<AllCallOptions, "npServiceName" | "headerOverrides">;
type GetTitleTrophyGroupsOptions = Pick<AllCallOptions, "npServiceName" | "headerOverrides">;
/**

@@ -4,0 +4,0 @@ * A title may have multiple groups of trophies. This is most commonly

import type { AllCallOptions, AuthorizationPayload, UserTitlesResponse } from "../../models";
declare type GetUserTitlesOptions = Pick<AllCallOptions, "headerOverrides" | "limit" | "offset">;
type GetUserTitlesOptions = Pick<AllCallOptions, "headerOverrides" | "limit" | "offset">;
/**
* A call to this function will retrieve the earned status of trophies for a user
* from either a single - or all - trophy groups in a title. A title can have
* multiple groups of trophies (a `"default"` group which all titles have, and
* additional groups starting with a name of `"001"` and incrementing for each
* additional group). To retrieve trophies from all groups within a title
* (ie. the full trophy set), `trophyGroupId` should be set to `"all"`.
* A call to this function will retrieve a summarized list of titles played
* by a user, ordered by recent trophy unlocks. The maximum amount that can
* be returned by a single call is 800 (assuming a `limit` option of 800 is set).
* If the user has more titles than the given `limit` option, subsequent calls
* of this funciton must be made to fetch the complete list by paging via the
* `offset` option.
*

@@ -16,2 +16,5 @@ * The numeric `accountId` can be that of any PSN account for which the authenticating

*
* To fetch more detailed account progress for a title, the `getUserTrophiesEarnedForTitle()`
* function can be used.
*
* To find a user's `accountId`, the `makeUniversalSearch()` function can be used.

@@ -18,0 +21,0 @@ *

import type { AllCallOptions, AuthorizationPayload, UserTrophiesEarnedForTitleResponse } from "../../models";
declare type GetUserTrophiesEarnedForTitleOptions = Pick<AllCallOptions, "offset" | "npServiceName" | "limit" | "headerOverrides">;
type GetUserTrophiesEarnedForTitleOptions = Pick<AllCallOptions, "offset" | "npServiceName" | "limit" | "headerOverrides">;
/**

@@ -4,0 +4,0 @@ * A call to this function will retrieve the earned status of trophies for a user

import type { AllCallOptions, AuthorizationPayload, UserTrophyProfileSummaryResponse } from "../../models";
declare type GetUserTrophyProfileSummaryOptions = Pick<AllCallOptions, "headerOverrides">;
type GetUserTrophyProfileSummaryOptions = Pick<AllCallOptions, "headerOverrides">;
/**

@@ -4,0 +4,0 @@ * A call to this function will retrieve an overall summary of the number of

import type { AllCallOptions, AuthorizationPayload, ProfileFromAccountIdResponse } from "../models";
declare type GetProfileFromAccountIdOptions = Pick<AllCallOptions, "headerOverrides">;
type GetProfileFromAccountIdOptions = Pick<AllCallOptions, "headerOverrides">;
/**

@@ -4,0 +4,0 @@ * A call to this function will retrieve some profile information of the accountId being requested.

import type { AllCallOptions, AuthorizationPayload, GetUserFriendsAccountIdsResponse } from "../models";
declare type GetUserFriendsAccountIdsOptions = Pick<AllCallOptions, "limit" | "offset">;
type GetUserFriendsAccountIdsOptions = Pick<AllCallOptions, "limit" | "offset">;
/**

@@ -4,0 +4,0 @@ * A call to this function will retrieve the list of friended `accountId` values

@@ -13,3 +13,3 @@ {

],
"version": "2.8.3",
"version": "2.9.0",
"main": "dist/index.js",

@@ -42,3 +42,2 @@ "module": "dist/psn-api.esm.js",

"test:coverage": "jest --selectProjects UNIT --coverage",
"test:e2e": "dotenv-flow jest -- --selectProjects E2E --forceExit",
"verify": "npm run format:check && npm run lint && npm run test:coverage && npm run build && npm run size",

@@ -54,18 +53,18 @@ "size": "size-limit",

"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@digitak/esrun": "^3.2.13",
"@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2",
"@digitak/esrun": "^3.2.19",
"@faker-js/faker": "^7.6.0",
"@size-limit/preset-small-lib": "^8.1.0",
"@size-limit/preset-small-lib": "^8.1.2",
"@types/jest": "^27.5.2",
"@types/node": "^16.11.45",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"@types/node": "^16.18.12",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"cz-conventional-changelog": "^3.3.0",
"dotenv-flow-cli": "^1.0.0",
"dts-cli": "^1.6.0",
"eslint": "^8.25.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.1",
"eslint-plugin-import": "^2.26.0",
"dts-cli": "^1.6.3",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-simple-import-sort": "^8.0.0",

@@ -75,12 +74,11 @@ "eslint-plugin-sonarjs": "^0.16.0",

"husky": "^4.3.8",
"jest": "^29.2.1",
"msw": "^0.47.4",
"jest": "^29.4.1",
"msw": "^1.1.0",
"prettier": "2.7.1",
"pretty-quick": "^3.1.3",
"redis": "^4.3.1",
"semantic-release": "^19.0.5",
"size-limit": "^8.1.0",
"ts-jest": "^29.0.3",
"tslib": "^2.4.0",
"typescript": "^4.7.4"
"size-limit": "^8.1.2",
"ts-jest": "^29.0.5",
"tslib": "^2.5.0",
"typescript": "^4.9.5"
},

@@ -119,3 +117,6 @@ "size-limit": [

"url": "https://github.com/achievements-app/psn-api.git"
},
"resolutions": {
"rxjs": "^6.6.0"
}
}

@@ -132,2 +132,3 @@ <h1 align="center">psn-api</h1>

- [`getUserTrophyProfileSummary()`](https://psn-api.achievements.app/api-docs/user-trophies#getusertrophyprofilesummary) - Retrieve an overall summary of the number of trophies earned for a user broken down by type.
- [`getRecentlyPlayedGames()`](https://psn-api.achievements.app/api-docs/users#getrecentlyplayedgames) - Retrieve a list of recently played games for the user associated with the access token provided to this function.

@@ -141,2 +142,3 @@ ## Examples

- [PS5 MQTT](https://github.com/FunkeyFlo/ps5-mqtt) - Integrate your PlayStation 5 with Home Assistant.
- [evanshortiss/README.md](https://github.com/evanshortiss/evanshortiss) - Auto-updating GitHub bio with recently played games list.

@@ -161,10 +163,13 @@ ## Prior Art

<tr>
<td align="center"><a href="https://github.com/wescopeland"><img src="https://avatars.githubusercontent.com/u/3984985?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Wes Copeland</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=wescopeland" title="Code">💻</a> <a href="#example-wescopeland" title="Examples">💡</a> <a href="https://github.com/achievements-app/psn-api/commits?author=wescopeland" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/xelnia"><img src="https://avatars.githubusercontent.com/u/14896738?v=4?s=100" width="100px;" alt=""/><br /><sub><b>xelnia</b></sub></a><br /><a href="#ideas-xelnia" title="Ideas, Planning, & Feedback">🤔</a> <a href="#userTesting-xelnia" title="User Testing">📓</a></td>
<td align="center"><a href="https://github.com/andshrew"><img src="https://avatars.githubusercontent.com/u/7409326?v=4?s=100" width="100px;" alt=""/><br /><sub><b>andshrew</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=andshrew" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/purplem1lk"><img src="https://avatars.githubusercontent.com/u/49956513?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Susan Ma</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=purplem1lk" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/travisrroy"><img src="https://avatars.githubusercontent.com/u/24424190?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Travis Roy</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=travisrroy" title="Code">💻</a> <a href="#example-travisrroy" title="Examples">💡</a> <a href="https://github.com/achievements-app/psn-api/commits?author=travisrroy" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/Azimiao"><img src="https://avatars.githubusercontent.com/u/11534726?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yetu</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=Azimiao" title="Code">💻</a></td>
<td align="center"><a href="https://jojo.fandom.com/wiki/Yoshikage_Kira"><img src="https://avatars.githubusercontent.com/u/65515165?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yoshikage Kira</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=isFakeAccount" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/wescopeland"><img src="https://avatars.githubusercontent.com/u/3984985?v=4?s=100" width="100px;" alt="Wes Copeland"/><br /><sub><b>Wes Copeland</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=wescopeland" title="Code">💻</a> <a href="#example-wescopeland" title="Examples">💡</a> <a href="https://github.com/achievements-app/psn-api/commits?author=wescopeland" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/xelnia"><img src="https://avatars.githubusercontent.com/u/14896738?v=4?s=100" width="100px;" alt="xelnia"/><br /><sub><b>xelnia</b></sub></a><br /><a href="#ideas-xelnia" title="Ideas, Planning, & Feedback">🤔</a> <a href="#userTesting-xelnia" title="User Testing">📓</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andshrew"><img src="https://avatars.githubusercontent.com/u/7409326?v=4?s=100" width="100px;" alt="andshrew"/><br /><sub><b>andshrew</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=andshrew" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/purplem1lk"><img src="https://avatars.githubusercontent.com/u/49956513?v=4?s=100" width="100px;" alt="Susan Ma"/><br /><sub><b>Susan Ma</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=purplem1lk" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/travisrroy"><img src="https://avatars.githubusercontent.com/u/24424190?v=4?s=100" width="100px;" alt="Travis Roy"/><br /><sub><b>Travis Roy</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=travisrroy" title="Code">💻</a> <a href="#example-travisrroy" title="Examples">💡</a> <a href="https://github.com/achievements-app/psn-api/commits?author=travisrroy" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Azimiao"><img src="https://avatars.githubusercontent.com/u/11534726?v=4?s=100" width="100px;" alt="Yetu"/><br /><sub><b>Yetu</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=Azimiao" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://jojo.fandom.com/wiki/Yoshikage_Kira"><img src="https://avatars.githubusercontent.com/u/65515165?v=4?s=100" width="100px;" alt="Yoshikage Kira"/><br /><sub><b>Yoshikage Kira</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=isFakeAccount" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://evanshortiss.com"><img src="https://avatars.githubusercontent.com/u/1303687?v=4?s=100" width="100px;" alt="Evan Shortiss"/><br /><sub><b>Evan Shortiss</b></sub></a><br /><a href="https://github.com/achievements-app/psn-api/commits?author=evanshortiss" title="Code">💻</a> <a href="https://github.com/achievements-app/psn-api/commits?author=evanshortiss" title="Documentation">📖</a></td>
</tr>
</tbody>

@@ -171,0 +176,0 @@ </table>

export * from "./authenticate";
export * from "./graphql";
export * from "./models";

@@ -3,0 +4,0 @@ export * from "./search";

@@ -9,2 +9,3 @@ export * from "./all-call-options.model";

export * from "./rarest-thin-trophy.model";
export * from "./recently-played-games-response.model";
export * from "./social-account-result.model";

@@ -11,0 +12,0 @@ export * from "./title-platform.model";

@@ -16,8 +16,8 @@ import type {

/**
* A call to this function will retrieve the earned status of trophies for a user
* from either a single - or all - trophy groups in a title. A title can have
* multiple groups of trophies (a `"default"` group which all titles have, and
* additional groups starting with a name of `"001"` and incrementing for each
* additional group). To retrieve trophies from all groups within a title
* (ie. the full trophy set), `trophyGroupId` should be set to `"all"`.
* A call to this function will retrieve a summarized list of titles played
* by a user, ordered by recent trophy unlocks. The maximum amount that can
* be returned by a single call is 800 (assuming a `limit` option of 800 is set).
* If the user has more titles than the given `limit` option, subsequent calls
* of this funciton must be made to fetch the complete list by paging via the
* `offset` option.
*

@@ -29,2 +29,5 @@ * The numeric `accountId` can be that of any PSN account for which the authenticating

*
* To fetch more detailed account progress for a title, the `getUserTrophiesEarnedForTitle()`
* function can be used.
*
* To find a user's `accountId`, the `makeUniversalSearch()` function can be used.

@@ -31,0 +34,0 @@ *

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc