julesapi v1.0.7
Jules API TypeScript Wrapper
This TypeScript wrapper provides convenient access to the Jules API.
Table of Contents
Installation
This package relies on axios to make HTTP requests. Install it using npm:
npm install axios
Then, import the required functions from the module in your TypeScript file.
User API
The User API offers these functions:
getUserIdByName(apiKey: string, id: string): Promise<any>
- Retrieves a user ID using their username.
getUser(apiKey: string, id: string): Promise<any>
- Retrieves a username using their ID.
getUserName(apiKey: string, id: string): Promise<any>
- Retrieves a username using the user's ID.
getUserOwnedGames(apiKey: string, id: string): Promise<any>
- Retrieves the games owned by a user using their ID.
getUserOwnedGame(apiKey: string, userId: string, gameId: string): Promise<any>
- Retrieves a specific game owned by a user using the user's ID and the game's ID.
All functions need an apiKey
and id
as arguments. The getUserOwnedGame
function also requires gameId
.
Game API
The Game API offers these functions:
getGameIdByName(apiKey: string, id: string): Promise<any>
- Retrieves a game ID using its name. Use
%20
as a space
- Retrieves a game ID using its name. Use
getGame(apiKey: string, id: string): Promise<any>
- Retrieves a game using its ID.
getGameName(apiKey: string, id: string): Promise<any>
- Retrieves a game's name using its ID.
getGameDescription(apiKey: string, id: string, type: string): Promise<any>
- Retrieves a game's description using its ID.
getGameImage(apiKey: string, id: string, type: string): Promise<any>
- Retrieves a game's image using its ID.
getGameTags(apiKey: string, id: string): Promise<any>
- Retrieves a game's tags using its ID.
getGamePrice(apiKey: string, id: string): Promise<any>
- Retrieves a game's price using its ID.
getGameLanguage(apiKey: string, id: string): Promise<any>
- Retrieves a game's language using its ID.
getGameDeveloper(apiKey: string, id: string): Promise<any>
- Retrieves a game's developer information using its ID.
getGamePublisher(apiKey: string, id: string): Promise<any>
- Retrieves a game's publisher information using its ID.
getGameAgeRating(apiKey: string, id: string): Promise<any>
- Retrieves a game's age rating using its ID.
getGameInfo(apiKey: string, id: string, type: string): Promise<any>
- Retrieves a game's detailed information based on the type parameter using its ID.
All functions require an apiKey
and id
as arguments. Functions getGameDescription
, getGameImage
, GetOwnedGameInfo
and getGameInfo
also require a type
argument.
type
arguments involve the specific set of data you can recieve. For example:
getGameDescription
has types
main
and abbreviated
.
getGameImage
has types
CoverIMG
, CarouselIMG
, and SpotlightIMG
.
getOwnedGameInfo
has types
hoursPlayed
and achievements
.
getGameInfo
has types
TotalHoursByPlayers
, PlayerCount
, MaxPlayerCount
, ReleaseDate
, and LastUpdateDate
.
Error Handling
In the event of a server error or network issue, these functions will throw an error. You can catch these errors and handle them appropriately in your application. The error message will provide some information about what went wrong, which can help with troubleshooting. For example:
try
{
const user = await getUser(apiKey, userId);
console.log(user);
} catch (error) {
console.error(`Failed to get user: ${error.message}`);
}
Future Improvements
This document will be updated as more features are added to the API.