GoodMem
ReferenceClient SDKsGo SDK

Ping API

Ping API documentation for Go SDK

The default url is http://localhost:8080

MethodHTTP requestDescription
PingOncePost /v1/ping:onceRun a single ping probe
PingStreamPost /v1/ping:streamStream 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

NameTypeDescriptionNotes
pingOnceRequestPingOnceRequestSingle ping probe request

Return type

PingResult

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

NameTypeDescriptionNotes
pingStreamRequestPingStreamRequestPing stream configuration
acceptstringResponse format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON

Return type

PingEvent

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/x-ndjson, text/event-stream

↑ Back to Go SDK ↑ Back to Go SDK ↑ Back to Go SDK