@retroachievements/api 0.0.0-development → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__playground.d.ts +1 -1
- package/dist/api.cjs.development.js +149 -1
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +148 -2
- package/dist/api.esm.js.map +1 -1
- package/dist/user/getUserClaims.d.ts +27 -0
- package/dist/user/getUserCompletedGames.d.ts +56 -0
- package/dist/user/getUserGameRankAndScore.d.ts +1 -1
- package/dist/user/index.d.ts +2 -0
- package/dist/user/models/get-user-completed-games-response.model.d.ts +13 -0
- package/dist/user/models/index.d.ts +4 -0
- package/dist/user/models/user-claims-response.model.d.ts +19 -0
- package/dist/user/models/user-claims.model.d.ts +19 -0
- package/dist/user/models/user-completed-games.model.d.ts +13 -0
- package/package.json +1 -1
- package/src/__playground.ts +8 -6
- package/src/user/getUserClaims.test.ts +82 -0
- package/src/user/getUserClaims.ts +59 -0
- package/src/user/getUserCompletedGames.test.ts +93 -0
- package/src/user/getUserCompletedGames.ts +89 -0
- package/src/user/getUserGameRankAndScore.ts +1 -1
- package/src/user/index.ts +2 -0
- package/src/user/models/get-user-completed-games-response.model.ts +13 -0
- package/src/user/models/index.ts +4 -0
- package/src/user/models/user-claims-response.model.ts +19 -0
- package/src/user/models/user-claims.model.ts +19 -0
- package/src/user/models/user-completed-games.model.ts +13 -0
package/dist/__playground.d.ts
CHANGED
|
@@ -1933,6 +1933,152 @@ var getGameInfoAndUserProgress = /*#__PURE__*/function () {
|
|
|
1933
1933
|
};
|
|
1934
1934
|
}();
|
|
1935
1935
|
|
|
1936
|
+
/**
|
|
1937
|
+
* A call to this function will retrieve a list of
|
|
1938
|
+
* achievement set claims made over the lifetime of a given
|
|
1939
|
+
* user, targeted by their username.
|
|
1940
|
+
*
|
|
1941
|
+
* @param authorization An object containing your userName and webApiKey.
|
|
1942
|
+
* This can be constructed with `buildAuthorization()`.
|
|
1943
|
+
*
|
|
1944
|
+
* @param payload.userName The user for which to retrieve the historical
|
|
1945
|
+
* achievement set claims list for.
|
|
1946
|
+
*
|
|
1947
|
+
* @example
|
|
1948
|
+
* ```
|
|
1949
|
+
* const userClaims = await getUserClaims(
|
|
1950
|
+
* authorization,
|
|
1951
|
+
* { userName: "xelnia" }
|
|
1952
|
+
* );
|
|
1953
|
+
* ```
|
|
1954
|
+
*
|
|
1955
|
+
* @returns An array containing all the achievement set claims
|
|
1956
|
+
* made over the lifetime of the given user.
|
|
1957
|
+
*/
|
|
1958
|
+
|
|
1959
|
+
var getUserClaims = /*#__PURE__*/function () {
|
|
1960
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(authorization, payload) {
|
|
1961
|
+
var userName, url, rawResponse;
|
|
1962
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1963
|
+
while (1) {
|
|
1964
|
+
switch (_context.prev = _context.next) {
|
|
1965
|
+
case 0:
|
|
1966
|
+
userName = payload.userName;
|
|
1967
|
+
url = buildRequestUrl(apiBaseUrl, "/API_GetUserClaims.php", authorization, {
|
|
1968
|
+
u: userName
|
|
1969
|
+
});
|
|
1970
|
+
_context.next = 4;
|
|
1971
|
+
return call({
|
|
1972
|
+
url: url
|
|
1973
|
+
});
|
|
1974
|
+
|
|
1975
|
+
case 4:
|
|
1976
|
+
rawResponse = _context.sent;
|
|
1977
|
+
return _context.abrupt("return", serializeProperties(rawResponse, {
|
|
1978
|
+
shouldCastToNumbers: ["ID", "GameID", "ClaimType", "SetType", "Status", "Extension", "Special", "MinutesLeft"]
|
|
1979
|
+
}));
|
|
1980
|
+
|
|
1981
|
+
case 6:
|
|
1982
|
+
case "end":
|
|
1983
|
+
return _context.stop();
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
}, _callee);
|
|
1987
|
+
}));
|
|
1988
|
+
|
|
1989
|
+
return function getUserClaims(_x, _x2) {
|
|
1990
|
+
return _ref.apply(this, arguments);
|
|
1991
|
+
};
|
|
1992
|
+
}();
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* A call to this function will retrieve completion metadata
|
|
1996
|
+
* about the games a given user has played. It returns two
|
|
1997
|
+
* entries per each game: one for the softcore completion and
|
|
1998
|
+
* one for the hardcore completion. These are designated by
|
|
1999
|
+
* the `hardcoreMode` property on the completion object.
|
|
2000
|
+
*
|
|
2001
|
+
* @param authorization An object containing your userName and webApiKey.
|
|
2002
|
+
* This can be constructed with `buildAuthorization()`.
|
|
2003
|
+
*
|
|
2004
|
+
* @param payload.userName The user for which to retrieve the
|
|
2005
|
+
* completion metadata for.
|
|
2006
|
+
*
|
|
2007
|
+
* @example
|
|
2008
|
+
* ```
|
|
2009
|
+
* const userCompletedGames = await getUserCompletedGames(
|
|
2010
|
+
* authorization,
|
|
2011
|
+
* { userName: "xelnia" }
|
|
2012
|
+
* );
|
|
2013
|
+
* ```
|
|
2014
|
+
*
|
|
2015
|
+
* @returns An array containing completion metadata objects
|
|
2016
|
+
* for a given user. Each game contains two completion records,
|
|
2017
|
+
* one for softcore and another for hardcore.
|
|
2018
|
+
* ```json
|
|
2019
|
+
* [
|
|
2020
|
+
* {
|
|
2021
|
+
* gameId: 14976,
|
|
2022
|
+
* title: 'Mortal Kombat',
|
|
2023
|
+
* imageIcon: '/Images/036812.png',
|
|
2024
|
+
* consoleId: 27,
|
|
2025
|
+
* consoleName: 'Arcade',
|
|
2026
|
+
* maxPossible: 35,
|
|
2027
|
+
* numAwarded: 13,
|
|
2028
|
+
* pctWon: 0.3714,
|
|
2029
|
+
* hardcoreMode: false
|
|
2030
|
+
* },
|
|
2031
|
+
* {
|
|
2032
|
+
* gameId: 14976,
|
|
2033
|
+
* title: 'Mortal Kombat',
|
|
2034
|
+
* imageIcon: '/Images/036812.png',
|
|
2035
|
+
* consoleId: 27,
|
|
2036
|
+
* consoleName: 'Arcade',
|
|
2037
|
+
* maxPossible: 35,
|
|
2038
|
+
* numAwarded: 13,
|
|
2039
|
+
* pctWon: 0.3714,
|
|
2040
|
+
* hardcoreMode: true
|
|
2041
|
+
* },
|
|
2042
|
+
* ]
|
|
2043
|
+
* ```
|
|
2044
|
+
*/
|
|
2045
|
+
|
|
2046
|
+
var getUserCompletedGames = /*#__PURE__*/function () {
|
|
2047
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(authorization, payload) {
|
|
2048
|
+
var userName, url, rawResponse;
|
|
2049
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2050
|
+
while (1) {
|
|
2051
|
+
switch (_context.prev = _context.next) {
|
|
2052
|
+
case 0:
|
|
2053
|
+
userName = payload.userName;
|
|
2054
|
+
url = buildRequestUrl(apiBaseUrl, "/API_GetUserCompletedGames.php", authorization, {
|
|
2055
|
+
u: userName
|
|
2056
|
+
});
|
|
2057
|
+
_context.next = 4;
|
|
2058
|
+
return call({
|
|
2059
|
+
url: url
|
|
2060
|
+
});
|
|
2061
|
+
|
|
2062
|
+
case 4:
|
|
2063
|
+
rawResponse = _context.sent;
|
|
2064
|
+
return _context.abrupt("return", serializeProperties(rawResponse, {
|
|
2065
|
+
shouldCastToNumbers: ["GameID", "ConsoleID", "MaxPossible", "NumAwarded", "PctWon"],
|
|
2066
|
+
shouldMapToBooleans: ["HardcoreMode"]
|
|
2067
|
+
}));
|
|
2068
|
+
|
|
2069
|
+
case 6:
|
|
2070
|
+
case "end":
|
|
2071
|
+
return _context.stop();
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
}, _callee);
|
|
2075
|
+
}));
|
|
2076
|
+
|
|
2077
|
+
return function getUserCompletedGames(_x, _x2) {
|
|
2078
|
+
return _ref.apply(this, arguments);
|
|
2079
|
+
};
|
|
2080
|
+
}();
|
|
2081
|
+
|
|
1936
2082
|
/**
|
|
1937
2083
|
* A call to this function will retrieve metadata about
|
|
1938
2084
|
* how a particular user has performed/ranked on a particular
|
|
@@ -1960,7 +2106,7 @@ var getGameInfoAndUserProgress = /*#__PURE__*/function () {
|
|
|
1960
2106
|
* @returns An array containing metadata about the user's
|
|
1961
2107
|
* rank and score for the target game ID. If metadata
|
|
1962
2108
|
* cannot be found, the array is empty.
|
|
1963
|
-
* ```
|
|
2109
|
+
* ```json
|
|
1964
2110
|
* [
|
|
1965
2111
|
* {
|
|
1966
2112
|
* user: "xelnia",
|
|
@@ -2354,6 +2500,8 @@ exports.getGameRankAndScore = getGameRankAndScore;
|
|
|
2354
2500
|
exports.getGameRating = getGameRating;
|
|
2355
2501
|
exports.getTicketData = getTicketData;
|
|
2356
2502
|
exports.getTopTenUsers = getTopTenUsers;
|
|
2503
|
+
exports.getUserClaims = getUserClaims;
|
|
2504
|
+
exports.getUserCompletedGames = getUserCompletedGames;
|
|
2357
2505
|
exports.getUserGameRankAndScore = getUserGameRankAndScore;
|
|
2358
2506
|
exports.getUserPoints = getUserPoints;
|
|
2359
2507
|
exports.getUserProgress = getUserProgress;
|