Ping API
Ping API documentation for Go SDK
The default url is http://localhost:8080
| Method | HTTP request | Description |
|---|---|---|
| PingOnce | Post /v1/ping:once | Run a single ping probe |
| PingStream | Post /v1/ping:stream | Stream ping probe results |
PingOnce
PingResult PingOnce(ctx).PingOnceRequest(pingOnceRequest).Execute()
Run a single ping probe
Example
package main
import (
"context"
"fmt"
"os"
goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)
func main() {
pingOnceRequest := *goodmem_client.NewPingOnceRequest("550e8400-e29b-41d4-a716-446655440000") // PingOnceRequest | Single ping probe request
configuration := goodmem_client.NewConfiguration()
apiClient := goodmem_client.NewAPIClient(configuration)
resp, r, err := apiClient.PingAPI.PingOnce(context.Background()).PingOnceRequest(pingOnceRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PingAPI.PingOnce``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PingOnce`: PingResult
fmt.Fprintf(os.Stdout, "Response from `PingAPI.PingOnce`: %v\n", resp)
}Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiPingOnceRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| pingOnceRequest | PingOnceRequest | Single ping probe request |
Return type
Authorization
No authorization required
HTTP request headers
- Content-Type: application/json
- Accept: application/json
↑ Back to Go SDK ↑ Back to Go SDK ↑ Back to Go SDK
PingStream
PingEvent PingStream(ctx).PingStreamRequest(pingStreamRequest).Accept(accept).Execute()
Stream ping probe results
Example
package main
import (
"context"
"fmt"
"os"
goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)
func main() {
pingStreamRequest := *goodmem_client.NewPingStreamRequest("550e8400-e29b-41d4-a716-446655440000") // PingStreamRequest | Ping stream configuration
accept := "application/x-ndjson" // string | Response format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON (optional)
configuration := goodmem_client.NewConfiguration()
apiClient := goodmem_client.NewAPIClient(configuration)
resp, r, err := apiClient.PingAPI.PingStream(context.Background()).PingStreamRequest(pingStreamRequest).Accept(accept).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PingAPI.PingStream``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PingStream`: PingEvent
fmt.Fprintf(os.Stdout, "Response from `PingAPI.PingStream`: %v\n", resp)
}Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiPingStreamRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| pingStreamRequest | PingStreamRequest | Ping stream configuration | |
| accept | string | Response format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON |
Return type
Authorization
No authorization required
HTTP request headers
- Content-Type: application/json
- Accept: application/x-ndjson, text/event-stream