glatus
Types
pub type ConditionResult {
ConditionResult(condition: String, success: Bool)
}
Constructors
-
ConditionResult(condition: String, success: Bool)
pub type Endpoint {
Endpoint(
name: String,
key: String,
results: List(StatusResult),
events: List(StatusEvent),
)
}
Constructors
-
Endpoint( name: String, key: String, results: List(StatusResult), events: List(StatusEvent), )
Arguments
-
events
This field is not populated by the
/api/v1/endpoints/statuses
endpoint. It is populated by then/api/v1/endpoints/:key/statuses
endpoint.
-
pub type Error {
UnexpectedResonse(status: Int, body: String)
UnexpectedPayload(json.DecodeError)
}
Constructors
-
UnexpectedResonse(status: Int, body: String)
-
UnexpectedPayload(json.DecodeError)
pub type StatusEvent {
StatusEvent(type_: StatusEventType, timestamp: String)
}
Constructors
-
StatusEvent(type_: StatusEventType, timestamp: String)
pub type StatusEventType {
Start
Healthly
Unhealthly
}
Constructors
-
Start
-
Healthly
-
Unhealthly
This field is not populated by the /api/v1/endpoints/statuses
endpoint.
It is populated by then /api/v1/endpoints/:key/statuses
endpoint.
pub type StatusResult {
StatusResult(
status: Int,
hostname: String,
duration: Int,
condition_results: List(ConditionResult),
success: Bool,
timestamp: String,
)
}
Constructors
-
StatusResult( status: Int, hostname: String, duration: Int, condition_results: List(ConditionResult), success: Bool, timestamp: String, )
Functions
pub fn decode_endpoint(
data: Dynamic,
) -> Result(Endpoint, List(DecodeError))
pub fn decode_endpoints(
data: Dynamic,
) -> Result(List(Endpoint), List(DecodeError))
Decode a list of Endpoint
s from Dynamic
.
pub fn endpoint_request(
host host: String,
endpoint_key key: String,
page page: Int,
) -> Request(String)
Create a request to fetch the status information from a specific Endpoint
.
Send this request with a HTTP client such as gleam_httpc
or gleam_fetch
and handle the result with the handle_endpoint_response
function.
pub fn handle_endpoint_response(
response: Response(String),
) -> Result(Endpoint, Error)
Check and decode a response from the /api/v1/endpoints/statuses
endpoint.
pub fn handle_statuses_response(
response: Response(String),
) -> Result(List(Endpoint), Error)
Check and decode a response from the /api/v1/endpoints/statuses
endpoint.
pub fn statuses_request(
host host: String,
page page: Int,
) -> Request(String)
Create a request to fetch a list of all Endpoint
s from a Gatus instance.
Send this request with a HTTP client such as gleam_httpc
or gleam_fetch
and handle the result with the handle_statuses_response
function.