mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-19 17:50:12 +00:00
30 lines
982 B
Go
30 lines
982 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
)
|
|
|
|
type IOStreamState struct {
|
|
Count int `json:"count"`
|
|
Generation uint64 `json:"generation"`
|
|
}
|
|
|
|
type IOStreamStateExpectation struct {
|
|
ExpectedCount *int `json:"expected_count,omitempty"`
|
|
PresentStreamID string `json:"present_stream_id,omitempty"`
|
|
AbsentStreamID string `json:"absent_stream_id,omitempty"`
|
|
}
|
|
|
|
func ExpectedIOStreamCount(count int) *int {
|
|
return &count
|
|
}
|
|
|
|
func (client *Client) IOStreamState(ctx context.Context) (IOStreamState, error) {
|
|
return DoREST[struct{}, IOStreamState](ctx, client, RESTRequest[struct{}]{Method: http.MethodGet, Path: "/agentcompat/io-stream-state"})
|
|
}
|
|
|
|
func (client *Client) WaitForIOStreamState(ctx context.Context, expectation IOStreamStateExpectation) (IOStreamState, error) {
|
|
return DoREST[IOStreamStateExpectation, IOStreamState](ctx, client, RESTRequest[IOStreamStateExpectation]{Method: http.MethodPost, Path: "/agentcompat/io-stream-state", Body: &expectation})
|
|
}
|