Skip to main content

new GoodchargeStation(options)

OptionDefaultMeaning
apiKeyrequiredThe station's key. Throws invalid_api_key if malformed.
baseUrlhttps://api.goodcharge.appAPI origin.
timeoutMs10000Per attempt. Must be a positive integer.
maxRetries3Retries after 429, 5xx, a timeout or a network error. Must be a non-negative integer.
fetchglobal fetchCustom fetch implementation.
metricsLabelkey prefix (gc_XXXXXXXX)The station label in metrics. 1 to 64 characters, no control characters. See Monitoring with Prometheus.

A non-integer or out-of-range timeoutMs or maxRetries, or an invalid metricsLabel, throws invalid_option synchronously, from the constructor, before any request is made.