### Get TV Show Details Source: https://context7.com/risolvipro/collections/llms.txt Fetches complete TV show information, including seasons, episodes, cast, poster, genres, overview, and first air date from TMDB. ```APIDOC ## GET /tv/{id} ### Description Fetches complete TV show information, including seasons, episodes, cast, poster, genres, overview, and first air date from TMDB. ### Method `getTV(id)` ### Endpoint `/tv/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the TV show. #### Request Body None ### Request Example ```javascript // TMDB TV document app.api.tmdb.api_key = app.config.API_KEY; app.api.tmdb.language = app.config.LANGUAGE; let tv = app.api.tmdb.getTV(app.params.id); if(tv == undefined) { app.fail(); } let builder = app.document.builder(); builder.setString(tv.name, "title"); builder.setString(tv.id, "tmdb-id"); builder.setImage(tv.requestPoster(), "poster"); builder.setString(tv.overview, "overview"); builder.setListItems(tv.genres, "genre"); builder.setDate(tv.firstAirDate, "first-air-date"); builder.setDocuments(tv.actors(10), "actors"); builder.setManagedDocuments(tv.seasons, "seasons"); app.result(builder); // Example with TV show ID 1396 (Breaking Bad) ``` ### Response #### Success Response (200) - **tvShowDetails** (object) - An object containing comprehensive details about the TV show. - **name** (string) - The name of the TV show. - **id** (string) - The TMDB ID of the TV show. - **poster** (Image) - The poster image of the TV show. - **overview** (string) - A summary of the TV show. - **genres** (array) - An array of genre objects associated with the show. - **firstAirDate** (Date) - The first air date of the show. - **actors** (array) - An array of actor objects, limited to the first 10. - **seasons** (array) - An array of season objects, each containing episode details. #### Response Example ```json { "title": "Breaking Bad", "tmdb-id": "1396", "poster": "Image", "overview": "When Walter White...", "genre": [{ "id": 18, "name": "Drama" }], "first-air-date": "2008-01-20", "actors": [{ "name": "Bryan Cranston", "tmdb-id": "17419" }, ...], "seasons": [ { "name": "Season 1", "season-number": 1, "episodes": [ { "name": "Pilot", "season-number": 1, "episode-number": 1, "runtime": 3480 }, ... ] }, ... ] } ``` ``` -------------------------------- ### Get Movie Details Source: https://context7.com/risolvipro/collections/llms.txt Fetches detailed information for a specific movie using its ID. Includes movie data and credit information (cast and crew). ```APIDOC ## GET /movie/{id} ### Description Fetches detailed information for a specific movie using its ID. Includes movie data and credit information (cast and crew). ### Method `getMovie(id)` ### Endpoint `/movie/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the movie. #### Request Body None ### Request Example ```javascript let movieDetails = app.api.tmdb.getMovie("60369"); // Example ID for The Matrix ``` ### Response #### Success Response (200) - **movieClass** (object) - An object representing the movie with detailed information and credits. #### Response Example ```json { "id": 60369, "title": "The Matrix", "overview": "A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers.", "release_date": "1999-03-30", // ... other movie properties "credits": { "cast": [ { "name": "Keanu Reeves", "character": "Neo" }, // ... other cast members ], "crew": [ { "name": "The Wachowskis", "job": "Directors" }, // ... other crew members ] } } ``` ``` -------------------------------- ### Initialize Discogs API Client (JavaScript) Source: https://context7.com/risolvipro/collections/llms.txt Initializes the Discogs API client class with methods for searching releases by text or barcode and retrieving detailed release information. It relies on internal app modules for API requests and result formatting. ```javascript app.classes.api.discogs = class { constructor() { this.releaseClass = app.classes.api.discogs.release; } search(query){ let searchResults = []; let response = app.api.discogs.searchRequest(query); if(response != undefined && response.results != undefined){ for(let result of response.results){ let release = new app.classes.api.discogs.releaseResult(result); let searchResult = app.searchResult.new(); searchResult.title = release.formattedTitle; searchResult.subtitle = release.artist; searchResult.imageURL = release.thumb; let params = {id: release.id}; if(app.query.isBarcode()){ params.barcode = app.query.value; } searchResult.params = params; searchResults.push(searchResult); } } return searchResults; } getRelease(releaseID){ let response = app.api.discogs.releaseRequest(releaseID); if(response != undefined){ return new this.releaseClass(response); } return undefined; } } app.api.discogs = new app.classes.api.discogs(); // Example usage let query = {isText: () => true, value: "Radiohead"}; let results = app.api.discogs.search(query); // Returns array of Radiohead releases with formatted titles including format information ``` -------------------------------- ### Initialize Google Books API in JavaScript Source: https://context7.com/risolvipro/collections/llms.txt Initializes the Google Books API class with capabilities for searching books by text or barcode and retrieving individual volume details. It relies on a global `app` object for making requests and handling search results. ```javascript // Initialize API app.classes.api.googleBooks = class { constructor() { this.volumeClass = app.classes.api.googleBooks.volume; this.forceThumbnail = false; } search(query) { let searchResults = []; let baseURL = "https://www.googleapis.com/books/v1/volumes?q="; let url = undefined; if(query.isText()) { url = baseURL + encodeURIComponent(query.value); } else if(query.isBarcode()) { url = baseURL + "isbn:" + encodeURIComponent(query.value); } if(url != undefined) { let request = app.request(url); let response = request.send(); let data = response.json(); if(data?.items != undefined) { for(let item of data.items) { let volumeInfo = item.volumeInfo; let subtitle = volumeInfo.authors?.join(", "); let searchResult = app.searchResult.new(); searchResult.title = volumeInfo.title; searchResult.subtitle = subtitle; searchResult.imageURL = volumeInfo.imageLinks?.thumbnail; searchResult.params = { id: item.id, categories: volumeInfo.categories ?? [] }; searchResults.push(searchResult); } } } return searchResults; } getVolume(id) { let request = app.request("https://www.googleapis.com/books/v1/volumes/" + id); let response = request.send(); let data = response.json(); if(data?.volumeInfo != undefined) { return new this.volumeClass(data); } return undefined; } } app.api.googleBooks = new app.classes.api.googleBooks(); // Usage example let query = {isText: () => true, value: "JavaScript"}; let results = app.api.googleBooks.search(query); // Returns array of search results for JavaScript books ``` -------------------------------- ### Initialize TMDB API Source: https://context7.com/risolvipro/collections/llms.txt Initializes the TMDB API class, allowing for movie and TV show searches, API key validation, and fetching credit information. ```APIDOC ## Initialize TMDB API ### Description Creates the TMDB API class with movie and TV show search capabilities, API key validation, and credit fetching for cast and crew information. ### Method `constructor` ### Endpoint N/A ### Parameters None ### Request Example ```javascript app.classes.api.tmdb = class { constructor() { this.api_key = undefined; this.language = "en-US"; this.movieClass = app.classes.api.tmdb.movie; this.baseURL = "https://api.themoviedb.org/3"; } // ... other methods } app.api.tmdb = new app.classes.api.tmdb(); // Usage example app.api.tmdb.api_key = "your_api_key_here"; app.api.tmdb.language = "en-US"; ``` ### Response N/A ``` -------------------------------- ### Initialize TMDB API Class for Movies Source: https://context7.com/risolvipro/collections/llms.txt Creates a TMDB API class with capabilities to search for movies, validate API keys, and fetch credit information for cast and crew. It defines methods for searching movies by query and retrieving detailed movie information, including credits. Requires an API key for authentication. ```javascript app.classes.api.tmdb = class { constructor() { this.api_key = undefined; this.language = "en-US"; this.movieClass = app.classes.api.tmdb.movie; this.baseURL = "https://api.themoviedb.org/3"; } searchMovies(query) { if(!this.#hasApiKeys()) { let error = app.error.new(this.keyErrorMessage, app.error.type.API_KEY_REQUIRED); app.setError(error); return []; } let queryText = ""; if(query.isText()) { queryText = query.value; } let url = this.getEndpoint("/search/movie") + "?"; url += "api_key=" + this.api_key; url += "&language=" + encodeURIComponent(this.language); url += "&query=" + encodeURIComponent(queryText); url += "&include_adult=false"; let request = app.request(url); let response = request.send(); let searchResults = []; if(response.statusCode == 200) { let data = response.json(); if(data?.results != undefined) { for(let result of data.results) { let movie = new app.classes.api.tmdb.movieResult(result); let searchResult = app.searchResult.new(); searchResult.title = movie.title; if(movie.year != undefined){ searchResult.subtitle = movie.year.toString(); } searchResult.imageURL = movie.thumbnail; searchResult.params = {id: movie.id}; searchResults.push(searchResult); } } } return searchResults; } getMovie(id) { if(!this.#hasApiKeys()) { let error = app.error.new(this.keyErrorMessage, app.error.type.API_KEY_REQUIRED); app.setError(error); return undefined; } let url = this.getEndpoint("/movie/" + id) + "?"; url += "api_key=" + this.api_key; url += "&language=" + encodeURIComponent(this.language); let request = app.request(url); let response = request.send(); if(response.statusCode == 200) { let data = response.json(); if(data != undefined) { let creditsData = this.getMovieCredits(id); return new this.movieClass(data, creditsData); } } return undefined; } #hasApiKeys() { if(this.api_key === undefined || this.api_key == "YOUR API KEY"){ return false; } return true; } } app.api.tmdb = new app.classes.api.tmdb(); // Usage example app.api.tmdb.api_key = "your_api_key_here"; app.api.tmdb.language = "en-US"; let query = {isText: () => true, value: "The Matrix"}; let results = app.api.tmdb.searchMovies(query); // Returns array of Matrix movie results with posters and release years ``` -------------------------------- ### Google Books API Initialization and Search Source: https://context7.com/risolvipro/collections/llms.txt Initializes the Google Books API class with capabilities for text and barcode searches, returning formatted search results. ```APIDOC ## Initialize Google Books API Creates the Google Books API class instance with search and volume retrieval capabilities, including support for both text and barcode queries. ### Description Initializes the Google Books API and provides methods for searching books using text or barcode queries. It processes raw API responses to return structured search results. ### Method Initialization ### Endpoint N/A (Class initialization) ### Parameters None ### Request Example ```javascript // Initialize API app.classes.api.googleBooks = class { constructor() { this.volumeClass = app.classes.api.googleBooks.volume; this.forceThumbnail = false; } search(query) { let searchResults = []; let baseURL = "https://www.googleapis.com/books/v1/volumes?q="; let url = undefined; if(query.isText()) { url = baseURL + encodeURIComponent(query.value); } else if(query.isBarcode()) { url = baseURL + "isbn:" + encodeURIComponent(query.value); } if(url != undefined) { let request = app.request(url); let response = request.send(); let data = response.json(); if(data?.items != undefined) { for(let item of data.items) { let volumeInfo = item.volumeInfo; let subtitle = volumeInfo.authors?.join(", "); let searchResult = app.searchResult.new(); searchResult.title = volumeInfo.title; searchResult.subtitle = subtitle; searchResult.imageURL = volumeInfo.imageLinks?.thumbnail; searchResult.params = { id: item.id, categories: volumeInfo.categories ?? [] }; searchResults.push(searchResult); } } } return searchResults; } getVolume(id) { let request = app.request("https://www.googleapis.com/books/v1/volumes/" + id); let response = request.send(); let data = response.json(); if(data?.volumeInfo != undefined) { return new this.volumeClass(data); } return undefined; } } app.api.googleBooks = new app.classes.api.googleBooks(); // Usage example let query = {isText: () => true, value: "JavaScript"}; let results = app.api.googleBooks.search(query); // Returns array of search results for JavaScript books ``` ### Response #### Success Response (200) Returns an array of search result objects, each containing title, subtitle, imageURL, and parameters (id, categories). #### Response Example ```json [ { "title": "JavaScript: The Definitive Guide", "subtitle": "David Flanagan", "imageURL": "http://books.google.com/books/content?id=...", "params": { "id": "some_book_id", "categories": ["Computers", "Programming"] } } ] ``` ``` -------------------------------- ### Discogs API Retrieve Release Details Source: https://context7.com/risolvipro/collections/llms.txt Fetches complete music release information from Discogs using a release ID and constructs a detailed document. ```APIDOC ## Discogs API - Retrieve Release Details Fetches complete music release information from Discogs and builds a document with artists, cover art, tracklist, format, genres, styles, year, and barcode. ### Description This endpoint retrieves comprehensive details for a specific music release from the Discogs database using its unique ID. It then uses a document builder to construct a structured representation of the release, including metadata like artists, tracklist, format, genre, style, year, and barcode. ### Method GET (or internal equivalent) ### Endpoint N/A (Internal API call) ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the music release on Discogs. #### Query Parameters - **barcode** (string) - Optional - The barcode associated with the release, if available. ### Request Example ```javascript // Discogs document (1.0) let release = app.api.discogs.getRelease(app.params.id); if(release == undefined) { app.fail(); } let builder = app.document.builder(); builder.setString(release.title, "title"); builder.setDocuments(release.artists, "artists"); builder.setImage(release.requestImage(), "cover"); builder.setManagedDocuments(release.tracklist, "tracks"); builder.setListItem(release.format, "format"); builder.setListItems(release.genres, "genre"); builder.setListItems(release.styles, "style"); builder.setInteger(release.year, "year"); builder.setString(app.params.barcode, "barcode"); app.result(builder); // Example with release ID 123456 // Returns: {title: "The Dark Side Of The Moon", artists: [{name: "Pink Floyd", "discogs-id": "45"}], cover: Image, tracks: [{title: "Speak to Me", position: "1", duration: 68}, ...], format: "Vinyl", genre: ["Rock"], style: ["Psychedelic Rock", "Progressive Rock"], year: 1973, barcode: "..."} ``` ### Response #### Success Response (200) Returns a structured document object containing detailed information about the music release. #### Response Example ```json { "title": "The Dark Side Of The Moon", "artists": [ { "name": "Pink Floyd", "discogs-id": "45" } ], "cover": "Image data or URL", "tracks": [ { "title": "Speak to Me", "position": "1", "duration": 68 } ], "format": "Vinyl", "genre": [ "Rock" ], "style": [ "Psychedelic Rock", "Progressive Rock" ], "year": 1973, "barcode": "..." } ``` ``` -------------------------------- ### Retrieve Discogs Release Details in JavaScript Source: https://context7.com/risolvipro/collections/llms.txt Fetches detailed information for a specific music release from Discogs using its ID. It then constructs a document object containing the release's title, artists, cover image, tracklist, format, genres, styles, year, and barcode. This requires a `document.builder` utility. ```javascript // Discogs document (1.0) let release = app.api.discogs.getRelease(app.params.id); if(release == undefined) { app.fail(); } let builder = app.document.builder(); builder.setString(release.title, "title"); builder.setDocuments(release.artists, "artists"); builder.setImage(release.requestImage(), "cover"); builder.setManagedDocuments(release.tracklist, "tracks"); builder.setListItem(release.format, "format"); builder.setListItems(release.genres, "genre"); builder.setListItems(release.styles, "style"); builder.setInteger(release.year, "year"); builder.setString(app.params.barcode, "barcode"); app.result(builder); // Example with release ID 123456 // Returns: {title: "The Dark Side Of The Moon", artists: [{name: "Pink Floyd", discogs-id: "45"}], cover: Image, tracks: [{title: "Speak to Me", position: "1", duration: 68}, ...], format: "Vinyl", genre: ["Rock"], style: ["Psychedelic Rock", "Progressive Rock"], year: 1973, barcode: "..."} ``` -------------------------------- ### Initialize and Use IGDB API Class with OAuth (JavaScript) Source: https://context7.com/risolvipro/collections/llms.txt This JavaScript class initializes the IGDB API with OAuth token management, including automatic token refresh. It allows searching for games and retrieving custom fields. Ensure your client ID and secret are set. The search function returns an array of game search results, including platform and cover image information. ```javascript app.classes.api.igdb = class { constructor() { this.client_id = undefined; this.client_secret = undefined; this.extraFields = []; this.gameClass = app.classes.api.igdb.game; this.keyErrorMessage = "In order to use this feature, please register your personal API Keys at igdb.com/api"; } search(query) { if(!this.#hasApiKeys()){ let error = app.error.new(this.keyErrorMessage, app.error.type.API_KEY_REQUIRED); app.setError(error); return []; } this.refreshTokenIfNeeded(); let searchResults = []; let access_token = app.storage.igdb_access_token; if(access_token != undefined) { let queryText = ""; if(query.isText()) { queryText = query.value; } let escapedQuery = queryText.replace('"', '"'); let body = 'search "' + escapedQuery +'"'; fields name,cover.*,platforms.*;'; let request = this.request("/games/", body); let response = request.send(); if(response.statusCode == 200) { let data = response.json(); if(data != undefined) { for(let object of data) { let game = new app.classes.api.igdb.game(object); let searchResult = app.searchResult.new(); searchResult.title = game.name; searchResult.subtitle = game.platforms_strings.join(", "); searchResult.imageURL = game.dataCoverURL; searchResult.params = {id: game.id}; searchResults.push(searchResult); } } } } return searchResults; } refreshTokenIfNeeded() { let refresh = true; let access_token = app.storage.igdb_access_token; let expirationDate = app.storage.igdb_expiration_date; if(access_token != undefined && expirationDate != undefined) { if(app.date.isValid(expirationDate)) { let now = new Date(); if((now - expirationDate) < 0) { refresh = false; } } } if(refresh){ let url = "https://id.twitch.tv/oauth2/token?"; url += "&client_id=" + this.client_id; url += "&client_secret=" + this.client_secret; url += "&grant_type=client_credentials"; let request = app.request(url); request.method = "POST"; let response = request.send(); if(response.statusCode == 200) { let data = response.json(); if(data != undefined) { let now = new Date(); let expirationSeconds = parseInt(data.expires_in); let expirationDate = new Date(now.getTime() + expirationSeconds * 1000); app.storage.igdb_access_token = data.access_token; app.storage.igdb_expiration_date = expirationDate; } } } } #hasApiKeys() { if(this.client_id === undefined || this.client_secret === undefined){ return false; } else if(this.client_id == "YOUR CLIENT ID" || this.client_secret == "YOUR CLIENT SECRET"){ return false; } return true; } } app.api.igdb = new app.classes.api.igdb(); // Usage example app.api.igdb.client_id = "your_client_id"; app.api.igdb.client_secret = "your_client_secret"; let query = {isText: () => true, value: "Elden Ring"}; let results = app.api.igdb.search(query); // Returns array of Elden Ring results with platforms and cover images, automatically handles OAuth token ``` -------------------------------- ### Search TV Shows Source: https://context7.com/risolvipro/collections/llms.txt Searches The Movie Database for television series. Returns results including show names, first air dates, and poster images. ```APIDOC ## POST /search/tv ### Description Searches The Movie Database for television series. Returns results including show names, first air dates, and poster images. ### Method `searchTV(query)` ### Endpoint `/search/tv` ### Parameters #### Query Parameters - **query** (object) - Required - An object containing the search query. Expected to have a method `isText()` returning boolean and a `value` property. #### Request Body None ### Request Example ```javascript // TMDB TV search app.api.tmdb.api_key = app.config.API_KEY; app.api.tmdb.language = app.config.LANGUAGE; let results = app.api.tmdb.searchTV(app.query); app.result(results); // Example configuration // app.config.API_KEY = "your_tmdb_api_key"; // app.config.LANGUAGE = "en-US"; // User searches for "Breaking Bad" ``` ### Response #### Success Response (200) - **searchResults** (array) - An array of objects, each representing a TV show search result. - **title** (string) - The title of the TV show. - **subtitle** (string) - The first air date of the TV show. - **imageURL** (string) - The URL of the TV show's poster image. - **params** (object) - Parameters for the TV show, including 'id'. #### Response Example ```json [ { "title": "Breaking Bad", "subtitle": "2008", "imageURL": "https://image.tmdb.org/t/p/w500/...", "params": {"id": "1396"} } ] ``` ``` -------------------------------- ### Search Video Games with IGDB API (JavaScript) Source: https://context7.com/risolvipro/collections/llms.txt Searches the Internet Game Database for video games using OAuth authentication. It takes a query and returns results including game names, platforms, and cover art thumbnails. Ensure CLIENT_ID and CLIENT_SECRET are configured. ```javascript // IGDB search (1.2) app.api.igdb.client_id = app.config.CLIENT_ID; app.api.igdb.client_secret = app.config.CLIENT_SECRET; let results = app.api.igdb.search(app.query); app.result(results); // Example configuration // app.config.CLIENT_ID = "your_client_id"; // app.config.CLIENT_SECRET = "your_client_secret"; // User searches for "The Legend of Zelda" // Returns: [{title: "The Legend of Zelda: Breath of the Wild", subtitle: "Nintendo Switch, Wii U", imageURL: "https://...", params: {id: 7346}}] ``` -------------------------------- ### Discogs API Search Music Releases Source: https://context7.com/risolvipro/collections/llms.txt Searches the Discogs music database for releases based on a query and returns formatted results. ```APIDOC ## Discogs API - Search Music Releases Searches Discogs music database and returns formatted results with release titles, artists, formats, and cover thumbnails. ### Description This endpoint allows searching the Discogs music database using a provided query. It supports both text-based searches and barcode scans. The results are formatted to include the release title, artist(s), and a thumbnail image URL. ### Method GET (or internal equivalent) ### Endpoint N/A (Internal API call) ### Parameters #### Query Parameters - **query** (object) - Required - The search query object, which can represent text or a barcode. ### Request Example ```javascript // Example text search let query = app.query; // User types "Dark Side of the Moon" let results = app.api.discogs.search(query); // Returns: [{title: "The Dark Side Of The Moon (Vinyl)", subtitle: "Pink Floyd", imageURL: "https://...", params: {id: 123456}}] // Example barcode search with UPC let query = app.query; // User scans barcode let results = app.api.discogs.search(query); // Returns matching releases with barcode parameter preserved ``` ### Response #### Success Response (200) Returns an array of music release objects, each containing title, subtitle, imageURL, and additional parameters like release ID. #### Response Example ```json [ { "title": "The Dark Side Of The Moon (Vinyl)", "subtitle": "Pink Floyd", "imageURL": "https://...", "params": { "id": "123456" } } ] ``` ``` -------------------------------- ### Implement Custom IGDB Search with Release Dates in JavaScript Source: https://context7.com/risolvipro/collections/llms.txt Implements a custom IGDB search function that increases the result limit to 50 and formats the release date in search results. It handles API token refresh and error conditions, returning formatted search results with titles, subtitles (release dates), and image URLs. ```javascript app.library.search = (query) => { app.api.igdb.refreshTokenIfNeeded(); const access_token = app.storage.igdb_access_token; if (!access_token) return undefined; const searchResults = []; let queryText = ""; if (query.isText()) { queryText = query.value; } const request = app.api.igdb.request( "/games/", `search "${queryText.replace('"', '"')}"; limit 50; fields name,cover.*,first_release_date;`, ); const response = request.send(); if (response.statusCode === 200) { const data = response.json(); if (data) { const mappedResults = data.map((gameData) => { const game = new app.classes.api.igdb.game(gameData); const searchResult = app.searchResult.new(); searchResult.title = game.name; searchResult.imageURL = game.coverURL(); searchResult.params = {id: game.id}; if (game.firstReleaseDate) { searchResult.subtitle = game.firstReleaseDate.toLocaleDateString( undefined, {year: "numeric", month: "long", day: "numeric"} ); } return searchResult; }); searchResults.push(...mappedResults); } } else if (response.statusCode === 401) { app.api.igdb.clearToken(); } return searchResults; }; // Usage example let query = {isText: () => true, value: "Final Fantasy"}; let results = app.library.search(query); // Returns up to 50 results: [{title: "Final Fantasy VII", subtitle: "January 31, 1997", imageURL: "https://...", params: {id: 427}}] ``` -------------------------------- ### Fetch Game Completion Time Data in JavaScript Source: https://context7.com/risolvipro/collections/llms.txt Fetches game completion time data from IGDB's Time to Beat endpoint. It supports three completion categories: hastily, normally, and completely, converting seconds to hours for readability. Includes token refresh and error handling for API requests. ```javascript app.library.timeToBeat = (id) => { app.api.igdb.refreshTokenIfNeeded(); const access_token = app.storage.igdb_access_token; if (!access_token) return undefined; const request = app.api.igdb.request( "/game_time_to_beats/", `where game_id = ${id}; fields completely, hastily, normally;`, ); const response = request.send(); const { statusCode } = response; if (statusCode === 200) { const data = response.json(); const { completely, hastily, normally } = data?.[0] || {}; if (completely || hastily || normally) { return `Hastily: ${app.shared.secondsToHours(hastily)} Normally: ${app.shared.secondsToHours(normally)} Completely: ${app.shared.secondsToHours(completely)}`; } return undefined; } else if (statusCode === 401) { app.api.igdb.clearToken(); } return undefined; }; app.shared.secondsToHours = (seconds) => seconds ? `${Math.floor(seconds / 3600)}h` : "-"; // Usage example let timeToBeat = app.library.timeToBeat(7346); // Returns: "Hastily: 50h\nNormally: 100h\nCompletely: 150h" ``` -------------------------------- ### Search TV Shows using TMDB API Source: https://context7.com/risolvipro/collections/llms.txt Searches The Movie Database (TMDB) for television series using API key authentication. It configures the API key and language from the application's config, then performs a search using the provided query. The results are then displayed using the application's result handler. Requires TMDB API key and language configuration. ```javascript // TMDB TV search app.api.tmdb.api_key = app.config.API_KEY; app.api.tmdb.language = app.config.LANGUAGE; let results = app.api.tmdb.searchTV(app.query); app.result(results); // Example configuration // app.config.API_KEY = "your_tmdb_api_key"; // app.config.LANGUAGE = "en-US"; // User searches for "Breaking Bad" // Returns: [{title: "Breaking Bad", subtitle: "2008", imageURL: "https://image.tmdb.org/t/p/w500/...", params: {id: 1396}}] ``` -------------------------------- ### Google Books API: Retrieve Book Details Source: https://context7.com/risolvipro/collections/llms.txt Fetches complete book information from the Google Books API and constructs a structured document. It includes metadata such as authors, cover image, genre, publisher, publication date, page count, and ISBN. The `app.api.googleBooks.getVolume` function is used, and the data is processed using `app.document.builder()`. ```javascript // Google Books document (1.0) let volume = app.api.googleBooks.getVolume(app.params.id); if(volume == undefined) { app.fail(); } let builder = app.document.builder(); builder.setString(volume.title, "title"); builder.setDocuments(volume.authors, "authors"); builder.setImage(volume.requestImage(), "cover"); builder.setListItems(volume.categories(app.params.categories), "genre"); builder.setString(volume.publisher, "publisher"); builder.setDate(volume.publishedDate, "published-date"); builder.setInteger(volume.pageCount, "page-count"); builder.setString(volume.ISBN_13, "isbn"); app.result(builder); // Example usage with ID from search // Returns structured document: {title: "The Great Gatsby", authors: [{name: "F. Scott Fitzgerald"}], cover: Image, genre: ["Fiction"], publisher: "Scribner", published-date: Date, page-count: 180, isbn: "9780743273565"} ``` -------------------------------- ### Retrieve Game Details from IGDB API (JavaScript) Source: https://context7.com/risolvipro/collections/llms.txt Fetches complete game information from IGDB using a game ID. It retrieves title, cover art, platforms, genres, release date, and summary. The function returns undefined if the game is not found and builds a document with the game details. ```javascript // IGDB document (1.2) app.api.igdb.client_id = app.config.CLIENT_ID; app.api.igdb.client_secret = app.config.CLIENT_SECRET; let game = app.api.igdb.getGame(app.params.id); if(game == undefined) { app.fail(); } let builder = app.document.builder(); builder.setString(game.name, "title"); builder.setImage(game.requestCover(), "cover"); builder.setListItems(game.platforms, "platform"); builder.setListItems(game.genres, "genre"); builder.setDate(game.firstReleaseDate, "release-date"); builder.setString(game.summary, "summary"); app.result(builder); // Example with game ID 7346 (Zelda: Breath of the Wild) // Returns: {title: "The Legend of Zelda: Breath of the Wild", cover: Image, platform: [{name: "Nintendo Switch"}, {name: "Wii U"}], genre: [{name: "Role-playing (RPG)"}, {name: "Adventure"}], release-date: Date(2017-03-03), summary: "Step into a world of discovery..."} ``` -------------------------------- ### Retrieve TV Show Details using TMDB API Source: https://context7.com/risolvipro/collections/llms.txt Fetches comprehensive TV show information, including seasons, episodes, cast, poster, genres, overview, and first air date, from TMDB. It utilizes a builder pattern to construct a detailed document object from the retrieved TV show data. Requires the TV show ID and TMDB API configuration. ```javascript // TMDB TV document app.api.tmdb.api_key = app.config.API_KEY; app.api.tmdb.language = app.config.LANGUAGE; let tv = app.api.tmdb.getTV(app.params.id); if(tv == undefined) { app.fail(); } let builder = app.document.builder(); builder.setString(tv.name, "title"); builder.setString(tv.id, "tmdb-id"); builder.setImage(tv.requestPoster(), "poster"); builder.setString(tv.overview, "overview"); builder.setListItems(tv.genres, "genre"); builder.setDate(tv.firstAirDate, "first-air-date"); builder.setDocuments(tv.actors(10), "actors"); builder.setManagedDocuments(tv.seasons, "seasons"); app.result(builder); // Example with TV show ID 1396 (Breaking Bad) // Returns: {title: "Breaking Bad", tmdb-id: "1396", poster: Image, overview: "When Walter White...", genre: [{id: 18, name: "Drama"}], first-air-date: Date(2008-01-20), actors: [{name: "Bryan Cranston", tmdb-id: "17419"}, ...], seasons: [{name: "Season 1", season-number: 1, episodes: [{name: "Pilot", season-number: 1, episode-number: 1, runtime: 3480}, ...]}]} ``` -------------------------------- ### Search Movies Source: https://context7.com/risolvipro/collections/llms.txt Searches The Movie Database for movies based on a query string. Returns an array of search results, including movie titles, subtitles (year), and thumbnail images. ```APIDOC ## POST /search/movie ### Description Searches The Movie Database for movies based on a query string. Returns an array of search results, including movie titles, subtitles (year), and thumbnail images. ### Method `searchMovies(query)` ### Endpoint `/search/movie` ### Parameters #### Query Parameters - **query** (object) - Required - An object containing the search query. Expected to have a method `isText()` returning boolean and a `value` property. #### Request Body None ### Request Example ```javascript let query = {isText: () => true, value: "The Matrix"}; let results = app.api.tmdb.searchMovies(query); // Returns array of Matrix movie results with posters and release years ``` ### Response #### Success Response (200) - **searchResults** (array) - An array of objects, each representing a movie search result. - **title** (string) - The title of the movie. - **subtitle** (string) - The release year of the movie. - **imageURL** (string) - The URL of the movie's thumbnail image. - **params** (object) - Parameters for the movie, including 'id'. #### Response Example ```json [ { "title": "The Matrix", "subtitle": "1999", "imageURL": "https://image.tmdb.org/t/p/w500/...", "params": {"id": "60369"} } ] ``` ``` -------------------------------- ### Search Discogs Music Releases in JavaScript Source: https://context7.com/risolvipro/collections/llms.txt Searches the Discogs music database for releases based on a query, which can be text or a barcode. It returns formatted results including title, artist, image URL, and release ID. This function is part of the Discogs API integration. ```javascript // Discogs search (1.0) let results = app.api.discogs.search(app.query); app.result(results); // Example text search let query = app.query; // User types "Dark Side of the Moon" let results = app.api.discogs.search(query); // Returns: [{title: "The Dark Side Of The Moon (Vinyl)", subtitle: "Pink Floyd", imageURL: "https://...", params: {id: 123456}}] // Example barcode search with UPC let query = app.query; // User scans barcode let results = app.api.discogs.search(query); // Returns matching releases with barcode parameter preserved ``` -------------------------------- ### Search TMDB Movies (JavaScript) Source: https://context7.com/risolvipro/collections/llms.txt Searches The Movie Database (TMDB) for movies using a text query. It requires API key and language configuration and returns a list of movies with their titles, release years, and poster thumbnails. ```javascript // TMDB movies search (1.3) app.api.tmdb.api_key = app.config.API_KEY; app.api.tmdb.language = app.config.LANGUAGE; let results = app.api.tmdb.searchMovies(app.query); app.result(results); // Example usage with configuration // app.config.API_KEY = "your_tmdb_api_key"; // app.config.LANGUAGE = "en-US"; // User searches for "Inception" // Returns: [{title: "Inception", subtitle: "2010", imageURL: "https://image.tmdb.org/t/p/w500/...", params: {id: 27205}}] ``` -------------------------------- ### Extend IGDB Game Class with Additional Fields in JavaScript Source: https://context7.com/risolvipro/collections/llms.txt Extends the base IGDB game class to include developers, franchises, publishers, rating, and themes data. This enhancement allows for richer game object properties by adding getters for these specific fields, utilizing the existing IGDB API data structure. ```javascript app.library.collections.game = class extends app.classes.api.igdb.game { get developers() { if (!this.data.involved_companies) return []; return this.data.involved_companies .filter(({ developer }) => developer) .map(({ company }) => app.listItem.suggest(company.name, company.name)); } get franchises() { if (!this.data.franchises) return []; return this.data.franchises.map(({ name }) => app.listItem.suggest(name, name), ); } get publishers() { if (!this.data.involved_companies) return []; return this.data.involved_companies .filter(({ publisher }) => publisher) .map(({ company }) => app.listItem.suggest(company.name, company.name)); } get rating() { const { total_rating } = this.data; return total_rating ? (total_rating / 10).toFixed(1) : undefined; } get themes() { if (!this.data.themes) return []; return this.data.themes.map(({ name }) => app.listItem.suggest(name, name)); } }; // Usage in document builder app.api.igdb.gameClass = app.library.collections.game; let game = app.api.igdb.getGame(7346); // Now game object includes: game.developers, game.franchises, game.publishers, game.rating, game.themes ``` -------------------------------- ### Retrieve TMDB Movie Details (JavaScript) Source: https://context7.com/risolvipro/collections/llms.txt Fetches comprehensive movie details from TMDB using a movie ID. It constructs a document with information such as title, overview, poster, genres, release date, runtime, top actors, and directors. ```javascript // TMDB movies document (1.3) app.api.tmdb.api_key = app.config.API_KEY; app.api.tmdb.language = app.config.LANGUAGE; let movie = app.api.tmdb.getMovie(app.params.id); if(movie == undefined) { app.fail(); } let builder = app.document.builder(); builder.setString(movie.title, "title"); builder.setString(movie.id, "tmdb-id"); builder.setImage(movie.requestPoster(), "poster"); builder.setString(movie.overview, "overview"); builder.setListItems(movie.genres, "genre"); builder.setDate(movie.releaseDate, "release-date"); builder.setDecimal(movie.runtime, "runtime"); builder.setDocuments(movie.actors(10), "actors"); builder.setDocuments(movie.directors, "directors"); app.result(builder); // Example with movie ID 27205 (Inception) // Returns: {title: "Inception", tmdb-id: "27205", poster: Image, overview: "Cobb, a skilled thief...", genre: [{id: 28, name: "Action"}, {id: 878, name: "Science Fiction"}], release-date: Date(2010-07-16), runtime: 8880, actors: [{name: "Leonardo DiCaprio", tmdb-id: "6193"}, ...], directors: [{name: "Christopher Nolan", tmdb-id: "525"}]} ``` -------------------------------- ### Google Books API: Search Books Source: https://context7.com/risolvipro/collections/llms.txt Searches the Google Books API for books using text queries or ISBN barcodes. It returns formatted search results including book titles, authors, and thumbnail images. The function `app.api.googleBooks.search` is used for this purpose. ```javascript // Google Books search (1.0) let results = app.api.googleBooks.search(app.query); app.result(results); // Example text search let query = app.query; // User types "The Great Gatsby" let results = app.api.googleBooks.search(query); // Returns: [{title: "The Great Gatsby", subtitle: "F. Scott Fitzgerald", imageURL: "https://...", params: {id: "...", categories: ["Fiction"]}}] // Example barcode search let query = app.query; // User scans ISBN "9780743273565" let results = app.api.googleBooks.search(query); // Returns matching book with ISBN data ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.