client

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapturedDiff

type CapturedDiff = dto.DiffPayload

CapturedDiff contains the computed difference between responses.

type CapturedRequest

type CapturedRequest = dto.CreateRequestPayload

CapturedRequest represents a complete request/response pair with diff. This is what gets sent from proxy to API.

func ConvertProxyToCapture

func ConvertProxyToCapture(
	req proxy.ProxyRequest,
	live, shadow proxy.ProxyResponse,
) *CapturedRequest

ConvertProxyToCapture converts proxy types to API types. Diff content is omitted — diff computation is handled server-side by mroki-api.

type CapturedResponse

type CapturedResponse = dto.ResponsePayload

CapturedResponse represents a single HTTP response (live or shadow).

type ClientOption

type ClientOption func(*MrokiClient)

ClientOption allows configuring the client

func WithHTTPClient

func WithHTTPClient(c *http.Client) ClientOption

func WithLogger

func WithLogger(l *slog.Logger) ClientOption

type MrokiClient

type MrokiClient struct {
	// contains filtered or unexported fields
}

func NewMrokiClient

func NewMrokiClient(apiURL *url.URL, gateID string, opts ...ClientOption) *MrokiClient

NewMrokiClient creates a new API client. Resilience (retries, circuit breaker) and auth are expected to be configured in the injected http.Client's transport layer.

func (*MrokiClient) GetGate

func (c *MrokiClient) GetGate(ctx context.Context) (*dto.Gate, error)

GetGate fetches gate configuration from the API Returns gate with live_url and shadow_url

func (*MrokiClient) SendRequest

func (c *MrokiClient) SendRequest(ctx context.Context, req *CapturedRequest) error

SendRequest sends a captured request to the API. Retry and circuit-breaker logic are handled by the HTTP transport layer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL