Utility helpers for building API query strings and composing endpoint paths. Provides functions to construct URL query parameters and cache keys.
Promise.<Array>Gets analog dates for a specific forecast lead time.
Promise.<Array>Retrieves analogy criteria values for a forecast lead time.
Promise.<Object>Gets forecast values at a specific percentile for all entities.
Promise.<Array>Fetches reference (climatology) values for an entity.
Promise.<Object>Gets time series values for the best analog dates.
Promise.<Object>Retrieves time series values at specified percentiles.
Promise.<Object>Gets historical time series percentile values.
Promise.<Array>Fetches analog information for a specific entity and lead time.
Promise.<Array>Gets precipitation values for analog dates.
Promise.<Object>Retrieves analog values at specified percentiles.
Utility helpers for building API query strings and composing endpoint paths. Provides functions to construct URL query parameters and cache keys.
stringstringstringstringstringstringBuilds a query string with repeated parameters for the same key. Useful for APIs that accept multiple values like: ?key=val1&key=val2&key=val3
Kind: static method of services/apiHelpers
Returns: string - Query string with leading '?', or empty string if no values
| Param | Type | Description |
|---|---|---|
| key | string |
The query parameter key |
| values | Array.<*> |
Array of values to include |
Example
buildRepeatedParamQuery('percentiles', [10, 50, 90])
// Returns: "?percentiles=10&percentiles=50&percentiles=90"
stringBuilds a query string for percentile values. Convenience wrapper around buildRepeatedParamQuery for percentiles.
Kind: static method of services/apiHelpers
Returns: string - Query string like "?percentiles=10&percentiles=50&percentiles=90"
| Param | Type | Description |
|---|---|---|
| percentiles | Array.<number> |
Array of percentile values (e.g., [10, 50, 90]) |
Example
buildPercentilesQuery([10, 50, 90])
// Returns: "?percentiles=10&percentiles=50&percentiles=90"
stringBuilds a query string for the normalize parameter.
Kind: static method of services/apiHelpers
Returns: string - Query string like "?normalize=true", or empty string
| Param | Type | Description |
|---|---|---|
| normalize | boolean | string | null |
Normalize flag value |
Example
buildNormalizeQuery(true) // Returns: "?normalize=true"
buildNormalizeQuery(null) // Returns: ""
stringAppends a query string fragment to a path that may already contain a query. Intelligently handles existing query parameters by using '&' instead of '?'.
Kind: static method of services/apiHelpers
Returns: string - Combined path with query parameters
| Param | Type | Description |
|---|---|---|
| path | string |
The base URL path |
| query | string |
Query string to append (with or without leading '?') |
Example
appendQuery('/api/data', 'sort=asc') // Returns: "/api/data?sort=asc"
appendQuery('/api/data?page=1', 'sort=asc') // Returns: "/api/data?page=1&sort=asc"
appendQuery('/api/data', '?sort=asc') // Returns: "/api/data?sort=asc"
stringComposes a cache key from multiple parts by joining with '|' separator. Handles null/undefined values by converting to empty strings.
Kind: static method of services/apiHelpers
Returns: string - Composed cache key
| Param | Type | Description |
|---|---|---|
| ...parts | * |
Variable number of key parts to combine |
Example
composeKey('region', 'date', 123) // Returns: "region|date|123"
composeKey('user', null, 'action') // Returns: "user||action"
Promise.<Array>Gets analog dates for a specific forecast lead time.
Kind: global constant
Returns: Promise.<Array> - Array of analog date strings
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| lead | number |
Lead time index |
Promise.<Array>Retrieves analogy criteria values for a forecast lead time.
Kind: global constant
Returns: Promise.<Array> - Array of criteria values
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| lead | number |
Lead time index |
Promise.<Object>Gets forecast values at a specific percentile for all entities.
Kind: global constant
Returns: Promise.<Object> - Object mapping entity IDs to values
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| lead | number |
Lead time index |
| perc | number |
Percentile value (0-100) |
| normalize | boolean |
Whether to normalize values |
Promise.<Array>Fetches reference (climatology) values for an entity.
Kind: global constant
Returns: Promise.<Array> - Array of reference values
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| entity | string | number |
Entity identifier |
Promise.<Object>Gets time series values for the best analog dates.
Kind: global constant
Returns: Promise.<Object> - Time series data for best analogs
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| entity | string | number |
Entity identifier |
Promise.<Object>Retrieves time series values at specified percentiles.
Kind: global constant
Returns: Promise.<Object> - Time series percentile data
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| entity | string | number |
Entity identifier |
| percentiles | Array.<number> |
Array of percentile values |
Promise.<Object>Gets historical time series percentile values.
Kind: global constant
Returns: Promise.<Object> - Historical time series data
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| entity | string | number |
Entity identifier |
| number | number |
Number of historical forecasts to retrieve (default: 3) |
Promise.<Array>Fetches analog information for a specific entity and lead time.
Kind: global constant
Returns: Promise.<Array> - Array of analog objects
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| entity | string | number |
Entity identifier |
| lead | number |
Lead time index |
Promise.<Array>Gets precipitation values for analog dates.
Kind: global constant
Returns: Promise.<Array> - Array of analog precipitation values
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| entity | string | number |
Entity identifier |
| lead | number |
Lead time index |
Promise.<Object>Retrieves analog values at specified percentiles.
Kind: global constant
Returns: Promise.<Object> - Analog values at percentiles
| Param | Type | Description |
|---|---|---|
| region | string |
The region/workspace identifier |
| date | string |
ISO date string |
| methodId | string | number |
Method identifier |
| configId | string | number |
Configuration identifier |
| entity | string | number |
Entity identifier |
| lead | number |
Lead time index |
| percentiles | Array.<number> |
Array of percentile values |