This module contains utility functions.
- Source:
Methods
(inner) assembleUrl_(url, queryParameters) → {string}
Takes a URL and a dictionary of query parameters and turns them into a full URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The base URL to append the query parameters to. |
queryParameters |
object | An object having the parameter names as keys and their values as values. The values will get converted to strings and url-encoded. |
- Source:
Returns:
- A full URL including query parameters.
- Type
- string
(inner) constructParamsObject_(fromDateopt, toDateopt, intervalopt, descopt, skipopt, takeopt) → {object}
Takes some query parameters and adds them to a dictionary, if they're defined.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fromDate |
Date |
<optional> |
The earliest date for which data shall be returned. |
toDate |
Date |
<optional> |
The latest date for which data shall be returned. |
interval |
Interval | string |
<optional> |
Return the data from the specified time frame in hourly (value: "hour"), daily (value: "day", last Collection of a day) or monthly (value: "month", last Collection of a month) interval. |
desc |
boolean |
<optional> |
Return the results in descending order by timestamp. |
skip |
integer |
<optional> |
Skip this number of results from the result set. |
take |
integer |
<optional> |
Limit the number of results returned. |
- Source:
Returns:
- An object containing the keys and values for each of the parameters provided. The object may have no keys, if no parameter was provided.
- Type
- object
(inner) convertDateToParameter_(date) → {string|null}
Takes a Date and converts it to a string to be used as a parameter in a call to the PSS Fleet Data API.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date | string | The date to get converted. |
- Source:
Returns:
- A Date converted to an ISO-8601 string, if the input value is of type Date. The input, if the input is of type string. Else, null.
- Type
- string | null
(inner) convertIntervalToParameter_(interval) → {string|null}
Takes an Interval and converts it to a string to be used as a parameter in a call to the PSS Fleet Data API.
Parameters:
Name | Type | Description |
---|---|---|
interval |
Interval | string | The interval to get converted. |
- Source:
Returns:
- A Interval converted to its string representation, if the input value is of type Interval. The input, if the input is of type string. Else, null.
- Type
- string | null
(inner) decodeFleetRank_(fleetRank) → {AllianceMembership|null}
Converts an integer as returned from the PSS Fleet Data API to an AllianceMembership enum value.
Parameters:
Name | Type | Description |
---|---|---|
fleetRank |
integer | The fleet rank value as returned by the PSS Fleet Data API. |
- Source:
Returns:
- The AllianceMembership enum value matching the input. Returns null, if the provided fleetRank doesn't match an enum value.
- Type
- AllianceMembership | null
(inner) decodeTimestamp_(secondsSincePssStartopt) → {Date}
Converts an integer as returned from the PSS Fleet Data API to a Date object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
secondsSincePssStart |
integer |
<optional> |
The number of seconds that passed since Jan 6th, 2016. |
- Source:
Returns:
- A Date object representing a specific point in time since PSS started, if secondsSincePssStart is truthy. Else, null.
- Type
- Date
(inner) formatDateUTC_(datetime) → {string|null}
Takes a Date object and converts it to a string representing the UTC portion of it.
Parameters:
Name | Type | Description |
---|---|---|
datetime |
Date | The Date object to convert. |
- Source:
Returns:
- A string representing the UTC portion of the provided Date, if it's defined. Else, null. The resulting string resembles an ISO-8601 string without the 'T' separator nor timezone information.
- Type
- string | null
(inner) getFromApiUrl_(path, allianceIdopt, collectionIdopt, userIdopt, fromDateopt, toDateopt, intervalopt, descopt, skipopt, takeopt) → {HTTPResponse}
Makes a GET call to the PSS Fleet Data API endpoint specified by the given path, passing the specified parameters.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | The url path to the endpoint to get data from. Does not include protocol or domain of the PSS Fleet Data API server. |
|
allianceId |
integer |
<optional> |
The allianceId parameter for the API endpoint. Replaces an {allianceId} placeholder in the path parameter. |
collectionId |
integer |
<optional> |
The collectionId parameter for the API endpoint. Replaces a {collectionId} placeholder in the path parameter. |
userId |
integer |
<optional> |
The userId parameter for the API endpoint. Replaces a {userId} placeholder in the path parameter. |
fromDate |
Date |
<optional> |
The earliest date for which data shall be returned. |
toDate |
Date |
<optional> |
The latest date for which data shall be returned. |
interval |
Interval |
<optional> |
Return the data from the specified time frame in hourly, daily (last Collection of a day) or monthly (last Collection of a month) interval. |
desc |
boolean |
<optional> |
Return the results in descending order by timestamp. |
skip |
integer |
<optional> |
Skip this number of results from the result set. |
take |
integer |
<optional> |
Limit the number of results returned. |
- Source:
Returns:
- An object representing the response of the PSS Fleet Data API server.
- Type
- HTTPResponse
(inner) getFromUrl_(url) → {HTTPResponse}
Makes a GET call to a server represented by the given URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to get. |
- Source:
Returns:
- An object representing the response of the requested server.
- Type
- HTTPResponse
(inner) newDate_(year, monthopt, dayopt, houropt, minuteopt, secondopt) → {Date}
Creates a new Date object with the UTC timezone regardless of the client's configured timezone.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
year |
integer | The year of the Date to be created. |
||
month |
integer |
<optional> |
0 | The month of the Date to be created. Defaults to 0. |
day |
integer |
<optional> |
1 | The month of the Date to be created. Defaults to 1. |
hour |
integer |
<optional> |
0 | The hour of the Date to be created. Defaults to 0. |
minute |
integer |
<optional> |
0 | The minute of the Date to be created. Defaults to 0. |
second |
integer |
<optional> |
0 | The second of the Date to be created. Defaults to 0. |
- Source:
Returns:
- A Date with the provided values and in UTC timezone.
- Type
- Date
(inner) padInt_(i, padCount) → {string}
Pads an integer with leading 0s.
Parameters:
Name | Type | Description |
---|---|---|
i |
integer | The integer to be padded. |
padCount |
integer | The maximum number of leading 0s to pad the integer with. |
- Source:
Returns:
- A string representing an integer padded with leading 0s.
- Type
- string