- Source:
Helper functions
Methods
(static) buildRawError(err) → {ErrorObj}
- Source:
When passed an error object, function will return a standardized error object that can be thrown. This is for the raw TMDB API calls.
Parameters:
Name | Type | Description |
---|---|---|
err |
* | error object from an TMDB API Call |
Returns:
- formatted error object { error, status, statusText, apiCall }
- Type
- ErrorObj
(static) callTMDB(apiCall) → {promise}
- Source:
Since all Raw TMDB Api calls return the same shape object this function wraps that functionality, so a raw API calls just needs the URL to be passed here.
Parameters:
Name | Type | Description |
---|---|---|
apiCall |
string |
Returns:
- Type
- promise
(static) apiTMDB(apiCall, config) → {promise}
- Source:
Since all Raw TMDB Api calls return the same shape object this function wraps that functionality. This call is enhanced by already have the Base URL and the API_KEY embedded in the call. You will just need to send the "apiCall", meaning the rest of the URL path ('/search/tv')... And the config object passing any parameters that you want included. Most likely you will send and object with the params property: { params: { page: 2, query: "watchment" } }
The params will be encoded for you via the axios module.
Parameters:
Name | Type | Description |
---|---|---|
apiCall |
string | the URL of the call to the TMDB api. This does NOT include the Base URL |
config |
string |
Returns:
- Type
- promise