### Start Source: https://github.com/cubehouse/themeparks/blob/master/docs/CouchbaseChannel.html Starts the database puller. ```APIDOC ## Start ### Description Starts the database puller. ### Method Start() ``` -------------------------------- ### Install Mocha Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Install Mocha, a JavaScript test framework, globally using npm. ```bash npm install -g mocha ``` -------------------------------- ### Install Themeparks Library Source: https://github.com/cubehouse/themeparks/blob/master/README.md Install the Themeparks library using npm. This command saves the package as a dependency in your project. ```bash npm install themeparks --save ``` -------------------------------- ### Setup Global Cache Database Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Initializes the necessary tables for the global cache database. This is a prerequisite for using cache functionalities. ```javascript SetupDB() ``` -------------------------------- ### Run Project Linting Source: https://github.com/cubehouse/themeparks/wiki/Contributing Execute this command to check the project's code formatting according to the defined style guide. ```bash npm run lint ``` -------------------------------- ### CouchbaseChannelDisney Initialization and Event Handling Source: https://github.com/cubehouse/themeparks/blob/master/docs/CouchbaseChannelDisney.html Demonstrates how to initialize a CouchbaseChannelDisney instance, subscribe to 'updated' and 'error' events, and start the channel synchronization. This is useful for real-time updates of park status data. ```javascript const Channel = new CouchbaseChannelDisney({ dbName: `myDBName`, channel: `dlp.facilitystatus.1_0`, }); Channel.on('updated', (newDoc) => {}); Channel.on('error', (error) => {}); Channel.Start().then(() => { // ready }); ``` -------------------------------- ### Run Unit Tests Source: https://github.com/cubehouse/themeparks/blob/master/docs/index.html Installs mocha and runs the library's unit tests. This builds the library and executes functional offline unit tests. ```bash npm install -g mocha npm test ``` -------------------------------- ### Instantiate Park with Proxy Agent (Node.js) Source: https://github.com/cubehouse/themeparks/wiki/Migrating-from-4.x-to-5.x In version 5.x, you must create the proxy agent yourself and pass it to the park object constructor. This example shows how to use 'socks-proxy-agent'. ```javascript const SocksProxy = require("socks-proxy-agent"); const MyProxy = new SocksProxy("socks://socks-proxy-host", true); const Park = new themeparks.Parks.ThorpePark({ proxyAgent: MyProxy }); ``` -------------------------------- ### RegisterDevice Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Get an API token from cache or through registering a new device. ```APIDOC ## RegisterDevice() ### Description Get an API token from cache or through registering a new device. ### Method (Not specified, likely a method call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript // Example of calling the method instance.RegisterDevice(); ``` ### Response #### Success Response (200) Returns an API token. #### Response Example ```json { "token": "your_api_token" } ``` ### Inherited From MerlinPark#RegisterDevice ### Overrides MerlinPark#RegisterDevice ``` -------------------------------- ### Now Source: https://github.com/cubehouse/themeparks/blob/master/docs/Location.html Get the current date/time for the location. ```APIDOC ## Now ### Description Get Location's current date/time. ### Method Method ### Parameters None ### Response - **Moment**: Current date/time as a Moment object. ``` -------------------------------- ### Initialize and List Theme Parks Source: https://github.com/cubehouse/themeparks/blob/master/docs/index.html This snippet shows how to initialize all available theme park objects from the ThemeParks library and then iterate through them to print their names, locations, and timezones. It's useful for getting an overview of all parks the library supports. ```javascript const ThemeParks = require("themeparks"); // construct our park objects and keep them in memory for fast access later const Parks = {}; for (const park in ThemeParks.Parks) { Parks[park] = new ThemeParks.Parks[park](); } // print each park's name, current location, and timezone for (const park in Parks) { console.log(`* ${Parks[park].Name} [${Parks[park].LocationString}]: (${Parks[park].Timezone})`); } ``` -------------------------------- ### Initialize Park Objects Source: https://github.com/cubehouse/themeparks/blob/master/README.md Initializes all available park objects from the ThemeParks library and stores them in memory for quick access. This is a common setup step before interacting with individual parks. ```javascript const ThemeParks = require("themeparks"); // construct our park objects and keep them in memory for fast access later const Parks = {}; for (const park in ThemeParks.Parks) { Parks[park] = new ThemeParks.Parks[park](); } ``` -------------------------------- ### Wrap(key, setFunction, ttl) Source: https://github.com/cubehouse/themeparks/blob/master/docs/Cache.html Wraps a get request and provides a setter function to simplify cache boilerplate. ```APIDOC ## Wrap(key, setFunction [, ttl]) ### Description Wrap a get request and pass a setter to tidy up the usual get/set boilerplate ### Parameters #### Parameters - **key** (String) - Key to get/set - **setFunction** (function) - Function to set data if it is missing from the cache. setFunction should return a Promise - **ttl** (Number | function) - Optional - How long cached result should last. Can be a number (seconds) or a function that will return a value ``` -------------------------------- ### Get Global Cached Value Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Retrieve a globally cached value using its key. This is identical to the park-specific 'Get' method but operates at a library level. ```javascript GetGlobal(key) ``` -------------------------------- ### Database Operations Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Utilities for database management, including setup and upgrades. These are essential for data persistence. ```javascript SetupDB("sqlite3") UpgradeDB() ``` -------------------------------- ### UserAgent Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsHurricaneHarborOaxtepec.html Get the user-agent string for making network requests from Six Flags Hurricane Harbor Oaxtepec. ```APIDOC ## UserAgent ### Description Get this park's user-agent string for making network requests. This is usually randomly generated on object construction. ### Method N/A (Property Access) ### Endpoint N/A ### Parameters None ### Response #### Success Response - **UserAgentString** (String) - The user-agent string for network requests. ``` -------------------------------- ### Get Opening Times Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Fetches the opening times for Tokyo Disney Resort Magic Kingdom. ```APIDOC ## GET /openingTimes ### Description Fetches the opening times for Tokyo Disney Resort Magic Kingdom. ### Method GET ### Endpoint /openingTimes ### Response #### Success Response (200) - **openingTime** (String) - The opening time of the park. - **closingTime** (String) - The closing time of the park. #### Response Example { "openingTime": "08:00", "closingTime": "22:00" } ``` -------------------------------- ### Manage Global Settings Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Functions to get and set global configuration values. These operations affect the overall application state. ```javascript GetGlobal() SetGlobal() ClearCache() ``` -------------------------------- ### SetupDB Source: https://github.com/cubehouse/themeparks/blob/master/docs/global.html Initializes or sets up the global database. This is crucial for first-time use or database resets. ```APIDOC ## SetupDB ### Description Initializes or sets up the global database. ### Method Not specified (likely a function call in an SDK context). ### Endpoint Not applicable (SDK function). ### Parameters None specified. ### Request Example ``` SetupDB() ``` ### Response None specified. ``` -------------------------------- ### Name (Get) Source: https://github.com/cubehouse/themeparks/blob/master/docs/Location.html Gets this Location's name in a human-readable form. ```APIDOC ## Name (Get) ### Description Get this Location's name in a human-readable form. ### Method N/A (Property) ### Parameters None ### Response - **String**: The human-readable name of the location. ``` -------------------------------- ### SetupDB() Source: https://github.com/cubehouse/themeparks/blob/master/docs/global.html Sets up the necessary database tables for caching. ```APIDOC ## SetupDB() ### Description Sets up database tables. ### Method N/A (This is a method call, not an HTTP endpoint) ### Endpoint N/A ### Parameters None ### Response N/A (This is a method call, not an HTTP endpoint) ### Request Example ```javascript SetupDB() ``` ### Response Example N/A ``` -------------------------------- ### Get Ride Object Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Finds or creates a ride object with the given ID for Tokyo Disney Resort Magic Kingdom. ```APIDOC ## GET /rides/{rideId} ### Description Finds or creates a ride object with the given ID for Tokyo Disney Resort Magic Kingdom. ### Method GET ### Endpoint /rides/{rideId} ### Parameters #### Path Parameters - **rideId** (String) - Required - The ID of the ride to search for or create. ### Response #### Success Response (200) - **ride** (Object) - The ride object. #### Response Example { "ride": { "id": "ride1", "name": "Space Mountain", "waitTime": 45 } } ``` -------------------------------- ### Get Global Cache Wrapper Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Use the static DB() method to access the underlying SQLite database handle. This is useful for advanced database operations. ```javascript Cache.DB() ``` -------------------------------- ### Get Ride Object Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Finds or creates a ride object using its ID. Useful for accessing specific ride information. ```APIDOC ## GetRideObject(rideId) ### Description Finds or creates a ride object using its ID. Useful for accessing specific ride information. ### Parameters #### Path Parameters - **rideId** (string) - Required - The ID of the ride to find or create. ``` -------------------------------- ### Timezone Source: https://github.com/cubehouse/themeparks/blob/master/docs/Location.html Gets this location's Timezone. ```APIDOC ## Timezone ### Description Get this location's Timezone. ### Method N/A (Property) ### Parameters None ### Response - **String**: The timezone of the location. ``` -------------------------------- ### Wrap Cache Operations Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html The Wrap method is similar to WrapGlobal but operates on the instance level. It simplifies getting and setting data, providing a setter function if the cache entry is missing. ```javascript Wrap(key, setFunction [, ttl]) ``` -------------------------------- ### Cache.WrapGlobal(key, setFunction, ttl) Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Wraps a global cache get request. It takes a key and a setter function, and optionally a TTL. If the data is not found in the cache, the setter function is called to populate it. This is a static method. ```APIDOC ## Cache.WrapGlobal(key, setFunction, ttl) ### Description Wraps a global get request, providing a setter function to populate the cache if data is missing. This method is intended for global scope usage. ### Method static ### Parameters #### Path Parameters - **key** (String) - Required - The key to get or set in the cache. - **setFunction** (Function) - Required - A function that returns a Promise to set data if it's missing from the cache. - **ttl** (Number | Function) - Optional - The duration in seconds for which the cached result should last. Can be a number or a function that returns a value. ``` -------------------------------- ### GetAccessToken Source: https://github.com/cubehouse/themeparks/blob/master/docs/UniversalPark.html Gets the current access token. Returns a Promise. ```APIDOC ## GetAccessToken ### Description Gets the current access token. ### Method (Not specified, likely internal or inherited) ### Parameters (Not specified) ### Returns Type: Promise ``` -------------------------------- ### Bulk Get Cached Values Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Fetch multiple cached values simultaneously by providing an array of keys. An optional TTL can be specified for the duration the data should remain in the cache. ```javascript GetBulk(keys [, ttl]) ``` -------------------------------- ### Get Wait Times Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Retrieves wait times for rides in the park. This method can be used with a callback function for asynchronous handling or return a Promise for direct use. ```APIDOC ## GetWaitTimes() ### Description Get waiting times for rides from this park. If the last argument is a function, this will act as a callback. Callback will call with callback(error, data). Data will be null if error is present. If the last argument is not a function, this will return a Promise. ### Returns - **Promise** - An object containing wait times for rides. ``` -------------------------------- ### Cache Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsOverGeorgia.html Get the cache object for Six Flags Over Georgia. ```APIDOC ## Cache ### Description Get the cache object for this park. ### Method GET ### Endpoint /cache ### Parameters None ### Response #### Success Response (200) - **cache** (object) - The cache object associated with the park. ``` -------------------------------- ### Get Cached Value Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Retrieve a single cached value using its key. Returns a Promise that resolves with the data or null if the key is not found in the cache. ```javascript Get(key) ``` -------------------------------- ### Wrap Global Cache Operations Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html The WrapGlobal static method simplifies the process of getting and setting data in the global cache. It takes a key, a function to set the data if it's missing, and an optional TTL. ```javascript Cache.WrapGlobal(key, setFunction [, ttl]) ``` -------------------------------- ### Get(key) Source: https://github.com/cubehouse/themeparks/blob/master/docs/Cache.html Retrieves a cached value using its key. ```APIDOC ## Get(key) ### Description Get a cached value ### Parameters #### Parameters - **key** (String) - Key to request associated data for ### Returns Returns Promise with data (or null if not cached) Type Promise. ``` -------------------------------- ### Rebuild HTML Documentation Source: https://github.com/cubehouse/themeparks/wiki/Contributing Run this command to regenerate the project's HTML documentation. ```bash npm run docs ``` -------------------------------- ### Schedule Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsOverGeorgia.html Get the raw schedule object for Six Flags Over Georgia. ```APIDOC ## Schedule ### Description Retrieves this park's raw schedule object. ### Method GET ### Endpoint /schedule ### Parameters None ### Response #### Success Response (200) - **schedule** (object) - The raw schedule object for the park. The structure of this object is defined in Schedule.html. ``` -------------------------------- ### Create Cache Instance Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Instantiate the Cache class to manage caching for a specific park or context. Options can be provided to configure the cache, such as a prefix for keys. ```javascript new Cache( [options] ) ``` -------------------------------- ### Cache Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsGreatAmerica.html Get the cache object for Six Flags Great America. ```APIDOC ## Cache ### Description Get the cache object for this park. ### Method GET ### Endpoint /cache ### Parameters None ### Response #### Success Response (200) - **cacheObject** (object) - The cache object associated with the park. ``` -------------------------------- ### Run Online API Connection Tests Source: https://github.com/cubehouse/themeparks/blob/master/README.md Perform tests to ensure the library can still connect to park APIs correctly. ```bash npm run testonline ``` -------------------------------- ### GetNumScheduleDays Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsOverGeorgia.html Get the number of days for which the schedule is returned for Six Flags Over Georgia. ```APIDOC ## GetNumScheduleDays ### Description Retrieves the number of days for which the schedule is returned by this park. ### Method GET ### Endpoint /schedule/days ### Parameters None ### Response #### Success Response (200) - **numberOfDays** (integer) - The number of days the schedule covers. ``` -------------------------------- ### Schedule Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsGreatAmerica.html Get the raw schedule object for Six Flags Great America. ```APIDOC ## Schedule ### Description Retrieves the raw schedule object for this park. ### Method GET ### Endpoint /schedule ### Parameters None ### Response #### Success Response (200) - **scheduleData** (object) - The raw schedule object for the park. ``` -------------------------------- ### Basic Themeparks Usage Source: https://github.com/cubehouse/themeparks/blob/master/README.md Include the library, configure cache settings, and access wait times for a specific park. It's recommended to create park objects once and reuse them. ```javascript // include the Themeparks library const Themeparks = require("themeparks"); // configure where SQLite DB sits // optional - will be created in node working directory if not configured // Themeparks.Settings.Cache = __dirname + "/themeparks.db"; // access a specific park // Create this *ONCE* and re-use this object for the lifetime of your application // re-creating this every time you require access is very slow, and will fetch data repeatedly for no purpose const DisneyWorldMagicKingdom = new Themeparks.Parks.WaltDisneyWorldMagicKingdom(); // Access wait times by Promise const CheckWaitTimes = () => { DisneyWorldMagicKingdom.GetWaitTimes().then((rideTimes) => { rideTimes.forEach((ride) => { console.log(`${ride.name}: ${ride.waitTime} minutes wait (${ride.status})`); }); }).catch((error) => { console.error(error); }).then(() => { setTimeout(CheckWaitTimes, 1000 * 60 * 5); // refresh every 5 minutes }); }; CheckWaitTimes(); // you can also call GetOpeningTimes on themeparks objects to get park opening hours ``` -------------------------------- ### Configure Proxy for Park Access Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Include the Themeparks library and a proxy library. Create a proxy agent and pass it as an option when constructing the park object. ```javascript const Themeparks = require("themeparks"); const SocksProxyAgent = require('socks-proxy-agent'); const MyProxy = new SocksProxyAgent("socks://socks-proxy-host", true); const DisneyWorldMagicKingdom = new Themeparks.Parks.WaltDisneyWorldMagicKingdom({ proxyAgent: MyProxy }); ``` -------------------------------- ### UserAgent Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsOverGeorgia.html Get the user-agent string for making network requests for Six Flags Over Georgia. ```APIDOC ## UserAgent ### Description Get this park's user-agent string for making network requests. This is usually randomly generated on object construction. ### Method GET ### Endpoint /user-agent ### Parameters None ### Response #### Success Response (200) - **userAgent** (string) - The user-agent string for the park. ``` -------------------------------- ### Cache Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsWhiteWaterAtlanta.html Get the cache object for this park. This property is inherited and overridden from the Park class. ```APIDOC ## Cache ### Description Get the cache object for this park. ### Inherited From * [Park#Cache](Park.html#Cache) ### Overrides * [SixFlagsPark#Cache](SixFlagsPark.html#Cache) ``` -------------------------------- ### UniversalStudiosSingapore Constructor Source: https://github.com/cubehouse/themeparks/blob/master/docs/UniversalStudiosSingapore.html Initializes a new UniversalStudiosSingapore object. This constructor allows for setting up the API base URL and language for the results. ```APIDOC ## new UniversalStudiosSingapore(options) ### Description Creates a new UniversalStudiosSingapore object, allowing configuration of API access. ### Method `new UniversalStudiosSingapore(options)` ### Parameters #### Parameters - **options** (Object) - Optional configuration object. ##### Properties - **api_base** (String) - Optional. The base URL for the API. - **api_langauge** (String) - Optional. The language ID for API results. Defaults to '1'. ``` -------------------------------- ### Run Unit Tests on Source Files Source: https://github.com/cubehouse/themeparks/blob/master/README.md Execute unit tests directly on the source JavaScript files without a full build. ```bash npm run testdev ``` -------------------------------- ### Cache Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsHurricaneHarborOaxtepec.html Get the cache object associated with Six Flags Hurricane Harbor Oaxtepec. ```APIDOC ## Cache ### Description Get the cache object for this park. ### Method N/A (Property Access) ### Endpoint N/A ### Parameters None ### Response #### Success Response - **CacheObject** (Object) - The cache object for the park. ``` -------------------------------- ### APIBase Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsOverGeorgia.html Get the API base URL for making API requests for Six Flags Over Georgia. ```APIDOC ## APIBase ### Description Get the API base URL for making API requests. ### Method GET ### Endpoint /api/base ### Parameters None ### Response #### Success Response (200) - **url** (string) - The base URL for the API. ``` -------------------------------- ### FetchParkData() Source: https://github.com/cubehouse/themeparks/blob/master/docs/MerlinPark.html Fetches and synchronizes park data. Warning: a full sync can be approximately 30MB. ```APIDOC ## FetchParkData() ### Description Fetches and synchronizes park data. Warning: a full sync can be approximately 30MB. ### Method Not specified (likely internal or inherited) ### Parameters None ### Returns Type: Not specified (likely a Promise or data object) ``` -------------------------------- ### new TE2Park(options) Source: https://github.com/cubehouse/themeparks/blob/master/docs/TE2Park.html Creates a new TE2Park object. This constructor is intended to be extended for specific parks and should not be called directly. It initializes the park with provided options, including park ID, authentication token, API base URL, and ride types. ```APIDOC ## new TE2Park(options) ### Description Creates a new TE2Park object. This constructor is intended to be extended for specific parks and should not be called directly. It initializes the park with provided options, including park ID, authentication token, API base URL, and ride types. ### Parameters #### `options` (Object) ##### Properties - **`park_id`** (String) - Required - ID of the park to access the API for. - **`auth_token`** (String) - Optional - Auth token to use to connect to the API. - **`api_base`** (String) - Optional - Base URL to access the API. - **`ride_types`** (Array) - Optional - Array of types that denote rides at the park (to avoid listing restaurants/toilets etc. as rides). ### Extends * [Park](Park.html) ### Members #### APIBase : String Get this park's API Base URL. #### Cache Get the cache object for this park. Inherited From: * [Park#Cache](Park.html#Cache) Overrides: * [Park#Cache](Park.html#Cache) #### FastPass : Boolean Does this park offer fast-pass services? Inherited From: * [Park#FastPass](Park.html#FastPass) Overrides: * [Park#FastPass](Park.html#FastPass) #### FastPassReturnTimes : Boolean Does this park tell you the fast-pass return times? Inherited From: * [Park#FastPassReturnTimes](Park.html#FastPassReturnTimes) Overrides: * [Park#FastPassReturnTimes](Park.html#FastPassReturnTimes) #### GetNumScheduleDays How many days are returned by this park's schedule? Inherited From: * [Park#GetNumScheduleDays](Park.html#GetNumScheduleDays) Overrides: * [Park#GetNumScheduleDays](Park.html#GetNumScheduleDays) #### ParkID : String Get the park ID used by the SeaWorld/Cedar Fair API. #### Schedule : [Schedule](Schedule.html) Get this park's raw schedule object. Inherited From: * [Park#Schedule](Park.html#Schedule) Overrides: * [Park#Schedule](Park.html#Schedule) #### SupportsOpeningTimes : Boolean Does this park offer opening time information? Inherited From: * [Park#SupportsOpeningTimes](Park.html#SupportsOpeningTimes) Overrides: * [Park#SupportsOpeningTimes](Park.html#SupportsOpeningTimes) #### SupportsRideSchedules : Boolean Does this park offer opening times for rides? Inherited From: * [Park#SupportsRideSchedules](Park.html#SupportsRideSchedules) Overrides: * [Park#SupportsRideSchedules](Park.html#SupportsRideSchedules) #### SupportsWaitTimes : Boolean Does this park offer wait time information? Inherited From: * [Park#SupportsWaitTimes](Park.html#SupportsWaitTimes) Overrides: * [Park#SupportsWaitTimes](Park.html#SupportsWaitTimes) #### UserAgent : String Get this park's useragent string for making network requests. This is usually randomly generated on object construction. Inherited From: * [Park#UserAgent](Park.html#UserAgent) Overrides: * [Park#UserAgent](Park.html#UserAgent) ``` -------------------------------- ### Run Library Unit Tests Source: https://github.com/cubehouse/themeparks/blob/master/README.md Execute the library's unit tests. This command builds the library and runs offline functional tests. ```bash npm test ``` -------------------------------- ### UserAgent Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsGreatAmerica.html Get the user agent string for making network requests to Six Flags Great America. ```APIDOC ## UserAgent ### Description Get this park's user agent string for making network requests. This is usually randomly generated on object construction. ### Method GET ### Endpoint /useragent ### Parameters None ### Response #### Success Response (200) - **userAgentString** (string) - The user agent string for network requests. ``` -------------------------------- ### Park Constructor Source: https://github.com/cubehouse/themeparks/blob/master/docs/Park.html Creates a new Park object with configurable options for caching and network requests. ```APIDOC ## new Park(options) Create a new Park object ### Parameters: #### `options` (Object) - `cacheWaitTimesLength` (Number, , default: 300) - How long (in seconds) to cache wait times before fetching fresh data. - `cacheOpeningTimesLength` (Number, , default: 3600) - How long (in seconds) to cache opening times before fetching fresh data. - `useragent` (String, ) - Useragent to use when making HTTP requests. - `proxyAgent` (http.Agent, ) - A http.Agent object to use as a proxy when making HTTP requests for this park. ``` -------------------------------- ### APIBase Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsGreatAmerica.html Get the API base URL for making API requests to Six Flags Great America. ```APIDOC ## APIBase ### Description Get the API base URL for making API requests. ### Method GET ### Endpoint /api/base ### Parameters None ### Response #### Success Response (200) - **url** (string) - The base URL for API requests. ``` -------------------------------- ### Run Linting and Testing Source: https://github.com/cubehouse/themeparks/wiki/Contributing This command first checks code formatting and then runs unit tests, enabling debug output for the themeparks module. ```bash npm run lint && NODE_DEBUG=themeparks npm run test ``` -------------------------------- ### Get Schedule Object Source: https://github.com/cubehouse/themeparks/blob/master/docs/Phantasialand.html Retrieves the raw schedule object for this park. This property is inherited from the Park class. ```APIDOC ## Get Schedule Object ### Description Retrieves the raw schedule object for this park. ### Method GET ### Endpoint /parks/{parkId}/schedule ### Parameters #### Path Parameters - **parkId** (string) - Required - The unique identifier for the park. ### Response #### Success Response (200) - **schedule** (Schedule) - The raw schedule object for the park. ``` -------------------------------- ### UniversalStudiosJapan Constructor Source: https://github.com/cubehouse/themeparks/blob/master/docs/UniversalStudiosJapan.html Initializes a new UniversalStudiosJapan object. This constructor allows for setting up the API base URL and language for the results. ```APIDOC ## new UniversalStudiosJapan(options) ### Description Creates a new UniversalStudiosJapan object. This is the entry point for interacting with the Universal Studios Japan API. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### `options` (Object) - Optional This object allows for the configuration of the API client. ##### Properties - **`api_base`** (String) - Optional - The base URL for the API endpoint. - **`api_langauge`** (String) - Optional - The language ID for the API results. Defaults to '1'. ``` -------------------------------- ### Initialize Park Utilities Source: https://github.com/cubehouse/themeparks/blob/master/docs/CanadasWonderland.html This JavaScript code initializes various utility functions for the park's documentation interface. It handles ID replacements, code highlighting, anchor link management, table styling, and table of contents generation. ```javascript $( function () { $( "[id*='$']" ).each( function () { var $this = $( this ); $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) ); } ); $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { var $this = $( this ); var example = $this.find( "code" ); exampleText = example.html(); var lang = /{@lang (.*?)}/.exec( exampleText ); if ( lang && lang[1] ) { exampleText = exampleText.replace( lang[0], "" ); example.html( exampleText ); lang = lang[1]; } else { var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/); lang = langClassMatch ? langClassMatch[1] : "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : true, showMenu : true, enableDoclinks : true } ); $.catchAnchorLinks( { navbarOffset: 10 } ); $( "#toc" ).toc( { anchorName : function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", showAndHide : false, smoothScrolling: true } ); $( "#main span[id^='toc']" ).addClass( "toc-shim" ); $( '.dropdown-toggle' ).dropdown(); $( "table" ).each( function () { var $this = $( this ); $this.addClass('table'); } ); } ); ``` -------------------------------- ### APIBase Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsWhiteWaterAtlanta.html Get the API base URL for making API requests. This property is inherited and overridden from the SixFlagsPark class. ```APIDOC ## APIBase ### Description Get the API base URL for making API requests. ### Inherited From * [SixFlagsPark#APIBase](SixFlagsPark.html#APIBase) ### Overrides * [SixFlagsPark#APIBase](SixFlagsPark.html#APIBase) ``` -------------------------------- ### APIBase Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsHurricaneHarborOaxtepec.html Get the API base URL for making API requests to Six Flags Hurricane Harbor Oaxtepec. ```APIDOC ## APIBase ### Description Get the API base URL for making API requests. ### Method N/A (Property Access) ### Endpoint N/A ### Parameters None ### Response #### Success Response - **URL** (String) - The base URL for API requests. ``` -------------------------------- ### GetInitialState Source: https://github.com/cubehouse/themeparks/blob/master/docs/CouchbaseChannel.html Retrieves the initial state of the database. ```APIDOC ## GetInitialState ### Description Retrieves the initial state of the database. ### Method GetInitialState() ``` -------------------------------- ### EuropaPark Constructor Source: https://github.com/cubehouse/themeparks/blob/master/docs/EuropaPark.html Instantiate a new EuropaPark object. You can optionally provide configuration options to customize API requests. ```APIDOC ## new EuropaPark(options) ### Description Creates a new EuropaPark object. This object can be used to interact with the Europa Park API. ### Parameters #### options (Object) ##### Properties - **apiBase** (String) - Optional base URL for API requests. - **apiVersion** (String) - API Version to make requests to (default: 'api-5.2'). - **secretToken** (String) - Secret token to use to generate the wait times API access token. ``` -------------------------------- ### GetWaitTimes() Source: https://github.com/cubehouse/themeparks/blob/master/docs/DisneyTokyoPark.html Gets waiting times for rides from this park. If the last argument is a function, it acts as a callback. Otherwise, it returns a Promise. ```APIDOC ## GetWaitTimes() ### Description Gets waiting times for rides from this park. If the last argument is a function, it acts as a callback. Otherwise, it returns a Promise. ### Method (Not specified, likely internal or inherited) ### Endpoint (Not specified) ### Parameters (Not specified) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### HTTP() Source: https://github.com/cubehouse/themeparks/blob/master/docs/AltonTowers.html Makes an HTTP request using the park's configured user agent and HTTP settings. ```APIDOC ## HTTP() ### Description Make an HTTP request using this park's user agent and HTTP settings. ### Method GET (default, can be overridden) ### Endpoint / ### Note This is a generic method for making HTTP requests and may require further specific endpoint details depending on the intended operation. ``` -------------------------------- ### FetchOpeningTimes() Source: https://github.com/cubehouse/themeparks/blob/master/docs/Dollywood.html Fetches the opening times for this Herschend Park. ```APIDOC ## FetchOpeningTimes() ### Description Fetch this Herschend Park's opening times. ### Method (Not specified, likely internal or part of an inheritance chain) ### Returns Type: Promise ``` -------------------------------- ### FetchOpeningTimes Source: https://github.com/cubehouse/themeparks/blob/master/docs/Bellewaerde.html Requests the park opening times. ```APIDOC ## FetchOpeningTimes() ### Description Requests the park opening times. ### Method Not specified (likely internal or inherited) ### Endpoint Not specified ### Returns Type: Promise ``` -------------------------------- ### FetchOpeningTimes() Source: https://github.com/cubehouse/themeparks/blob/master/docs/ChessingtonWorldOfAdventures.html Fetches opening time data for Merlin Park. This method is inherited and may be overridden. ```APIDOC ## FetchOpeningTimes() ### Description Fetch Merlin Park opening time data. ### Inherited From * [MerlinPark#FetchOpeningTimes](MerlinPark.html#FetchOpeningTimes) ### Overrides * [MerlinPark#FetchOpeningTimes](MerlinPark.html#FetchOpeningTimes) ### Returns Type Promise ``` -------------------------------- ### RegisterDevice() Source: https://github.com/cubehouse/themeparks/blob/master/docs/AltonTowers.html Retrieves an API token, either from cache or by registering a new device. ```APIDOC ## RegisterDevice() ### Description Get an API token from cache or through registering a new device. ### Method POST (assumed, common for registration) ### Endpoint /registerDevice ``` -------------------------------- ### Code Highlighting and Formatting Source: https://github.com/cubehouse/themeparks/blob/master/docs/BuschGardensWilliamsburg.html Finds code blocks within tutorial, readme, or prettyprint sections and applies syntax highlighting based on language tags or class names. It also formats the code for display. ```javascript $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { var $this = $( this ); var example = $this.find( "code" ); exampleText = example.html(); var lang = /{@lang (.*?)}/.exec( exampleText ); if ( lang && lang[1] ) { exampleText = exampleText.replace( lang[0], "" ); example.html( exampleText ); lang = lang[1]; } else { var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/); lang = langClassMatch ? langClassMatch[1] : "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); ``` -------------------------------- ### GetWaitTimes() Source: https://github.com/cubehouse/themeparks/blob/master/docs/UniversalStudiosSingapore.html Gets the wait times for rides at Universal Studios Singapore. This method can optionally accept a callback function or return a Promise. ```APIDOC ## GetWaitTimes() ### Description Get waiting times for rides from this park. If the last argument is a function, this will act as a callback. Callback will call with callback(error, data). Data will be null if error is present. If the last argument is not a function, this will return a Promise. ### Method GET (assumed) ### Endpoint /UniversalStudiosSingapore/waittimes (assumed) ### Returns Type: Promise or Callback ### Inherited From Park#GetWaitTimes ``` -------------------------------- ### Initialize and Access Wait Times Source: https://github.com/cubehouse/themeparks/blob/master/docs/quicksearch.html Include the Themeparks library and create a park object. Access wait times using Promises and set up a recurring refresh. ```javascript const Themeparks = require("themeparks"); // optional - will be created in node working directory if not configured // Themeparks.Settings.Cache = __dirname + "/themeparks.db"; const DisneyWorldMagicKingdom = new Themeparks.Parks.WaltDisneyWorldMagicKingdom(); const CheckWaitTimes = () => { DisneyWorldMagicKingdom.GetWaitTimes().then((rideTimes) => { rideTimes.forEach((ride) => { console.log(`${ride.name}: ${ride.waitTime} minutes wait (${ride.status})`); }); }).catch((error) => { console.error(error); }).then(() => { setTimeout(CheckWaitTimes, 1000 * 60 * 5); // refresh every 5 minutes }); }; CheckWaitTimes(); ``` -------------------------------- ### HTTP() Source: https://github.com/cubehouse/themeparks/blob/master/docs/AsterixPark.html Makes an HTTP request using this park's user agent and HTTP settings. ```APIDOC ## HTTP() ### Description Make an HTTP request using this park's user agent and HTTP settings. ### Method (Not specified) ### Endpoint (Not specified) ### Parameters (Details not provided in source) ``` -------------------------------- ### Get Number of Schedule Days Source: https://github.com/cubehouse/themeparks/blob/master/docs/Phantasialand.html Retrieves the number of days for which the park's schedule is available. This method is inherited from the Park class. ```APIDOC ## Get Number of Schedule Days ### Description Retrieves the number of days covered by the park's schedule. ### Method GET ### Endpoint /parks/{parkId}/schedule/days ### Parameters #### Path Parameters - **parkId** (string) - Required - The unique identifier for the park. ### Response #### Success Response (200) - **numberOfScheduleDays** (integer) - The number of days for which schedule information is available. ``` -------------------------------- ### HTTP() Source: https://github.com/cubehouse/themeparks/blob/master/docs/DisneyTokyoPark.html Makes an HTTP request using this park's user agent and HTTP settings. ```APIDOC ## HTTP() ### Description Makes an HTTP request using this park's user agent and HTTP settings. ### Method (Not specified, likely internal or inherited) ### Endpoint (Not specified) ### Parameters (Not specified) ### Request Example (Not specified) ### Response (Not specified) ``` -------------------------------- ### WrapGlobal(key, setFunction, ttl) Source: https://github.com/cubehouse/themeparks/blob/master/docs/Cache.html Wraps a get request and provides a setter function to manage cache boilerplate. This function operates in the global scope. ```APIDOC ## WrapGlobal(key, setFunction [, ttl]) ### Description Wrap a get request and pass a setter to tidy up the usual get/set boilerplate. This version sits in the global scope, rather than per-park. ### Parameters #### Parameters - **key** (String) - Key to get/set - **setFunction** (function) - Function to set data if it is missing from the cache. setFunction should return a Promise - **ttl** (Number | function) - Optional - How long cached result should last. Can be a number (seconds) or a function that will return a value ``` -------------------------------- ### FetchParkData() Source: https://github.com/cubehouse/themeparks/blob/master/docs/ChessingtonWorldOfAdventures.html Fetches or synchronizes park data. Warning: a full sync can be approximately 30MB. This method is inherited and may be overridden. ```APIDOC ## FetchParkData() ### Description Fetch/Sync park data. Warning: full sync is ~30MB. ### Inherited From * [MerlinPark#FetchParkData](MerlinPark.html#FetchParkData) ### Overrides * [MerlinPark#FetchParkData](MerlinPark.html#FetchParkData) ``` -------------------------------- ### Initialize JSDoc and Theme Park Extensions Source: https://github.com/cubehouse/themeparks/blob/master/docs/FerrariLand.html This JavaScript code initializes JSDoc, processes theme park elements, and sets up various UI components like search, table styling, and navigation. ```javascript $( function () { $( "\[id\*='$'"\]" ).each( function () { var $this = $( this ); $this.attr( "id", $this.attr( "id" ).replace( "$", "\__" ) ); } ); $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { var $this = $( this ); var example = $this.find( "code" ); exampleText = example.html(); var lang = /\{@lang (.\*?)}\/.exec( exampleText ); if ( lang && lang\[1\] ) { exampleText = exampleText.replace( lang\[0\], "" ); example.html( exampleText ); lang = lang\[1\]; } else { var langClassMatch = example.parent()\[0\].className.match(/lang\-(\S+)/); lang = langClassMatch ? langClassMatch\[1\] : "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : true, showMenu : true, enableDoclinks : true } ); $.catchAnchorLinks( { navbarOffset: 10 } ); $( "#toc" ).toc( { anchorName : function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", showAndHide : false, smoothScrolling: true } ); $( "#main span\[id^='toc'"\]" ).addClass( "toc-shim" ); $( '.dropdown-toggle' ).dropdown(); $( "table" ).each( function () { var $this = $( this ); $this.addClass('table'); } ); } ); $(document).ready(function() { SearcherDisplay.init(); }); ``` -------------------------------- ### Anchor Link Handling Source: https://github.com/cubehouse/themeparks/blob/master/docs/BuschGardensWilliamsburg.html Initializes a plugin to handle anchor links, with a specified offset for the navigation bar. ```javascript $.catchAnchorLinks( { navbarOffset: 10 } ); ``` -------------------------------- ### FetchOpeningTimes Source: https://github.com/cubehouse/themeparks/blob/master/docs/UniversalPark.html Fetches this Universal Park's opening times. Returns a Promise. ```APIDOC ## FetchOpeningTimes ### Description Fetches this Universal Park's opening times. ### Method (Not specified, likely internal or inherited) ### Parameters (Not specified) ### Returns Type: Promise ``` -------------------------------- ### Code Highlighting and Initialization Source: https://github.com/cubehouse/themeparks/blob/master/docs/Efteling.html This snippet initializes code highlighting using Sunlight.js and sets up various interactive features like anchor link catching, table styling, and dropdown menus. ```javascript $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { var $this = $( this ); var example = $this.find( "code" ); exampleText = example.html(); var lang = /{@lang (.*?)}/.exec( exampleText ); if ( lang && lang[1] ) { exampleText = exampleText.replace( lang[0], "" ); example.html( exampleText ); lang = lang[1]; } else { var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/); lang = langClassMatch ? langClassMatch[1] : "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : true, showMenu : true, enableDoclinks : true } ); $.catchAnchorLinks( { navbarOffset: 10 } ); $( "#toc" ).toc( { anchorName : function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", showAndHide : false, smoothScrolling: true } ); $( "#main span[id^='toc']" ).addClass( "toc-shim" ); $( '.dropdown-toggle' ).dropdown(); $( "table" ).each( function () { var $this = $( this ); $this.addClass('table'); } ); } ); $(document).ready(function() { SearcherDisplay.init(); }); ``` -------------------------------- ### Get User Agent String Source: https://github.com/cubehouse/themeparks/blob/master/docs/Phantasialand.html Retrieves this park's user agent string, typically used for making network requests. This property is inherited from the Park class. ```APIDOC ## Get User Agent String ### Description Retrieves the user agent string for this park, used for network requests. ### Method GET ### Endpoint /parks/{parkId}/useragent ### Parameters #### Path Parameters - **parkId** (string) - Required - The unique identifier for the park. ### Response #### Success Response (200) - **userAgent** (string) - The user agent string for the park. ``` -------------------------------- ### SupportsOpeningTimes Source: https://github.com/cubehouse/themeparks/blob/master/docs/HerschendBase.html Indicates whether this park provides opening time information. This is an inherited property from the Park class. ```APIDOC ## SupportsOpeningTimes :Boolean ### Description Does this park offer opening time information? ### Type * Boolean ### Inherited From * [Park#SupportsOpeningTimes](Park.html#SupportsOpeningTimes) ### Overrides * [Park#SupportsOpeningTimes](Park.html#SupportsOpeningTimes) ``` -------------------------------- ### HTTP() Source: https://github.com/cubehouse/themeparks/blob/master/docs/SixFlagsHurricaneHarborJackson.html Makes an HTTP request using the park's user agent and HTTP settings. This method is inherited from the Park class and overridden in SixFlagsPark. ```APIDOC ## HTTP() ### Description Make an HTTP request using this park's user agent and HTTP settings. ### Method Not specified (likely internal or inherited) ### Parameters None. ### Returns Not specified. ```