Documentation
¶
Overview ¶
Package cloud contains API clients for Mocklet cloud services.
Index ¶
- func IsKind(err error, kind ErrorKind) bool
- type AuthClient
- func (c *AuthClient) ExchangeGoogleCLI(ctx context.Context, oneTimeCode string) (GoogleCLIExchange, error)
- func (c *AuthClient) Login(ctx context.Context, email, password string) (LoginResult, error)
- func (c *AuthClient) StartGoogleCLI(ctx context.Context) (GoogleCLIStart, error)
- func (c *AuthClient) WhoAmI(ctx context.Context) (UserIdentity, error)
- type ClientConfig
- type CreateMockFileOptions
- type CreateMockRawOptions
- type CreateMockResult
- type DomainMockInfo
- type Error
- type ErrorKind
- type GoogleCLIExchange
- type GoogleCLIStart
- type ListMocksOptions
- type ListMocksResult
- type LoginResult
- type ManagementClient
- func (c *ManagementClient) CreateMockFile(ctx context.Context, path string, options CreateMockFileOptions) (CreateMockResult, error)
- func (c *ManagementClient) CreateMockRaw(ctx context.Context, payload []byte, options CreateMockRawOptions) (CreateMockResult, error)
- func (c *ManagementClient) DeleteMock(ctx context.Context, mockID string) error
- func (c *ManagementClient) GetMock(ctx context.Context, mockID string) (MockSummary, error)
- func (c *ManagementClient) GetMockStats(ctx context.Context, mockID string, historyLimit *int) (*openapi.MockStatsResponse, error)
- func (c *ManagementClient) ListMocks(ctx context.Context, options ListMocksOptions) (ListMocksResult, error)
- func (c *ManagementClient) RestartMock(ctx context.Context, mockID string) (RestartMockResult, error)
- func (c *ManagementClient) ValidateHARFile(ctx context.Context, path string) (*openapi.HarValidationResult, error)
- func (c *ManagementClient) ValidateHARRaw(ctx context.Context, payload openapi.HarDocument) (*openapi.HarValidationResult, error)
- func (c *ManagementClient) ValidateHARRawBytes(ctx context.Context, payload []byte) (*openapi.HarValidationResult, error)
- type MockSummary
- type RestartMockResult
- type UserIdentity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthClient ¶
type AuthClient struct {
// contains filtered or unexported fields
}
AuthClient is a thin wrapper around auth endpoints.
func NewAuthClient ¶
func NewAuthClient(cfg ClientConfig) (*AuthClient, error)
NewAuthClient constructs an auth client from transport config.
func NewAuthClientWithGeneratedClient ¶
func NewAuthClientWithGeneratedClient(client openapi.ClientWithResponsesInterface) *AuthClient
NewAuthClientWithGeneratedClient wires an already constructed generated client.
func (*AuthClient) ExchangeGoogleCLI ¶
func (c *AuthClient) ExchangeGoogleCLI(ctx context.Context, oneTimeCode string) (GoogleCLIExchange, error)
ExchangeGoogleCLI exchanges one-time-code polling state for final token.
func (*AuthClient) Login ¶
func (c *AuthClient) Login(ctx context.Context, email, password string) (LoginResult, error)
Login authenticates a user using email/password credentials.
func (*AuthClient) StartGoogleCLI ¶
func (c *AuthClient) StartGoogleCLI(ctx context.Context) (GoogleCLIStart, error)
StartGoogleCLI starts one-time-code OAuth flow.
func (*AuthClient) WhoAmI ¶
func (c *AuthClient) WhoAmI(ctx context.Context) (UserIdentity, error)
WhoAmI returns identity information for the current token.
type ClientConfig ¶
type ClientConfig struct {
BaseURL string
Token string
RequestID string
Timeout time.Duration
UserAgent string
HTTPClient *http.Client
}
ClientConfig controls HTTP transport and request metadata.
type CreateMockFileOptions ¶
type CreateMockFileOptions struct {
TTLSeconds int
SSLEnabled *bool
LatencyEmulation *bool
ReplaceLinks *bool
CrossDomainMainDomain *string
MatchingRulesRaw []byte
}
CreateMockFileOptions defines parameters for multipart mock creation.
type CreateMockRawOptions ¶
type CreateMockRawOptions struct {
TTLSeconds int
SSLEnabled *bool
LatencyEmulation *bool
ReplaceLinks *bool
CrossDomainMainDomain *string
MatchingRulesRaw []byte
}
CreateMockRawOptions defines parameters for raw JSON mock creation.
type CreateMockResult ¶
type CreateMockResult struct {
MockID string
BaseURL string
ExpiresAt *time.Time
HarSizeBytes *int
TTLSeconds *int
SSLEnabled *bool
LatencyEmulation *bool
DomainMap []DomainMockInfo
}
CreateMockResult is a normalized creation response.
type DomainMockInfo ¶
DomainMockInfo describes one domain-specific mock entry from cross-domain mode.
type ErrorKind ¶
type ErrorKind string
ErrorKind is a stable cloud transport failure class.
const ( ErrorKindAuth ErrorKind = "auth_failure" ErrorKindValidation ErrorKind = "validation_failure" ErrorKindNotFound ErrorKind = "not_found" ErrorKindConflict ErrorKind = "conflict" ErrorKindRateLimit ErrorKind = "rate_limit" ErrorKindTimeout ErrorKind = "timeout" ErrorKindNetwork ErrorKind = "network_error" ErrorKindServer ErrorKind = "server_error" ErrorKindUnknown ErrorKind = "unknown_error" )
type GoogleCLIExchange ¶
type GoogleCLIExchange struct {
Pending bool
RetryAfterSeconds int
Login *LoginResult
}
GoogleCLIExchange reports either a pending poll or final login response.
type GoogleCLIStart ¶
type GoogleCLIStart struct {
OneTimeCode string
AuthorizationURL string
IntervalSeconds int
ExpiresAt string
}
GoogleCLIStart is a normalized start response for one-time-code OAuth.
type ListMocksOptions ¶
ListMocksOptions configures list endpoint query parameters.
type ListMocksResult ¶
type ListMocksResult struct {
Items []MockSummary
NextCursor string
Totals *openapi.UserTotals
}
ListMocksResult is a normalized list response.
type LoginResult ¶
LoginResult is an internal auth login model independent from generated response envelopes.
type ManagementClient ¶
type ManagementClient struct {
// contains filtered or unexported fields
}
ManagementClient is a thin wrapper around management endpoints.
func NewManagementClient ¶
func NewManagementClient(cfg ClientConfig) (*ManagementClient, error)
NewManagementClient constructs a management client from transport config.
func NewManagementClientWithGeneratedClient ¶
func NewManagementClientWithGeneratedClient(client openapi.ClientWithResponsesInterface) *ManagementClient
NewManagementClientWithGeneratedClient wires an existing generated client.
func (*ManagementClient) CreateMockFile ¶
func (c *ManagementClient) CreateMockFile(ctx context.Context, path string, options CreateMockFileOptions) (CreateMockResult, error)
CreateMockFile uploads HAR file and creates a mock.
func (*ManagementClient) CreateMockRaw ¶
func (c *ManagementClient) CreateMockRaw(ctx context.Context, payload []byte, options CreateMockRawOptions) (CreateMockResult, error)
CreateMockRaw creates a mock using raw JSON HAR payload.
func (*ManagementClient) DeleteMock ¶
func (c *ManagementClient) DeleteMock(ctx context.Context, mockID string) error
DeleteMock removes mock by id.
func (*ManagementClient) GetMock ¶
func (c *ManagementClient) GetMock(ctx context.Context, mockID string) (MockSummary, error)
GetMock returns one mock by id.
func (*ManagementClient) GetMockStats ¶
func (c *ManagementClient) GetMockStats(ctx context.Context, mockID string, historyLimit *int) (*openapi.MockStatsResponse, error)
GetMockStats returns full mock stats payload.
func (*ManagementClient) ListMocks ¶
func (c *ManagementClient) ListMocks(ctx context.Context, options ListMocksOptions) (ListMocksResult, error)
ListMocks returns normalized mock summaries.
func (*ManagementClient) RestartMock ¶
func (c *ManagementClient) RestartMock(ctx context.Context, mockID string) (RestartMockResult, error)
RestartMock resets sequence state for a mock.
func (*ManagementClient) ValidateHARFile ¶
func (c *ManagementClient) ValidateHARFile(ctx context.Context, path string) (*openapi.HarValidationResult, error)
ValidateHARFile validates a HAR file upload.
func (*ManagementClient) ValidateHARRaw ¶
func (c *ManagementClient) ValidateHARRaw(ctx context.Context, payload openapi.HarDocument) (*openapi.HarValidationResult, error)
ValidateHARRaw validates HAR JSON payload.
func (*ManagementClient) ValidateHARRawBytes ¶
func (c *ManagementClient) ValidateHARRawBytes(ctx context.Context, payload []byte) (*openapi.HarValidationResult, error)
ValidateHARRawBytes validates HAR JSON payload provided as raw bytes.
type MockSummary ¶
type MockSummary struct {
MockID string
BaseURL string
Status string
CreatedAt *time.Time
ExpiresAt *time.Time
LastSeenAt *time.Time
ParentMockID *string
RequestsHit *int
RequestsMiss *int
RequestsTotal *int
HarSizeBytes *int
TTLSeconds *int
SSLEnabled *bool
LatencyEmulation *bool
}
MockSummary is an internal representation for list/get outputs.
type RestartMockResult ¶
RestartMockResult represents restart endpoint payload.
type UserIdentity ¶
UserIdentity is a normalized auth/me response.