1.0.7 • Published 10 months ago

julesapi v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

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
  • 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 hoursPlayedand 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.

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.0

11 months ago