mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-21 02:30:14 +00:00
test(agentcompat): add protocol clients
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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})
|
||||
}
|
||||
Reference in New Issue
Block a user