/datum/apiHandler ![code/modules/goonhub/api/api.dm 8](git.png)
Handles queries to the Goonhub APIv2
Vars | |
apiRetryDelay | base delay between query attempts, gets multiplied by attempt number |
---|---|
debug | Is debug logging on? If true, detailed logs for each API request will be logged to debug |
emergency_shutoff_counter | how many api errors there have been since a successful one |
enabled | Is the api handler available for use? only set to false if we try a bunch of times and still fail |
lazy_concurrent_counter | lazy count of how many are up/down |
lazy_waiting_counter | number of how many are waiting |
maxApiRetries | how many times should a query attempt to run before giving up |
Procs | |
apiError | Build and throw an error exception |
debugLog | Log an API request |
queryAPI | Constructs a query to send to the goonhub web API |
retryApiQuery | Retries an API query in the event of failure |
trackRecentError | Increments or resets the recent error counter |
Var Details
apiRetryDelay ![code/modules/goonhub/api/api.dm 17](git.png)
base delay between query attempts, gets multiplied by attempt number
debug ![code/modules/goonhub/api/api.dm 12](git.png)
Is debug logging on? If true, detailed logs for each API request will be logged to debug
emergency_shutoff_counter ![code/modules/goonhub/api/api.dm 20](git.png)
how many api errors there have been since a successful one
enabled ![code/modules/goonhub/api/api.dm 10](git.png)
Is the api handler available for use? only set to false if we try a bunch of times and still fail
lazy_concurrent_counter ![code/modules/goonhub/api/api.dm 22](git.png)
lazy count of how many are up/down
lazy_waiting_counter ![code/modules/goonhub/api/api.dm 24](git.png)
number of how many are waiting
maxApiRetries ![code/modules/goonhub/api/api.dm 15](git.png)
how many times should a query attempt to run before giving up
Proc Details
apiError
Build and throw an error exception
debugLog
Log an API request
@method (string) HTTP method of the request @route (string) URL of the request @body (string) JSON encoded body of the request if applicable
queryAPI
Constructs a query to send to the goonhub web API
@route (/datum/apiRoute) requested route to call, ex. /datum/apiRoute/players/notes/get @attempt (int) number of times we've attempted this query @return (/datum/apiModel|boolean) model containing parsed data response from api, or boolean indicating success
retryApiQuery
Retries an API query in the event of failure
@route (/datum/apiRoute) requested route to call, ex. /datum/apiRoute/players/notes/get @attempt (int) number of times we've attempted this query @return (/datum/apiModel) model containing parsed data response from api
trackRecentError
Increments or resets the recent error counter
@reset (bool) reset the counter (eg successful request)