client

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package client defines the capability-agnostic transport boundary used by APIGen's generated typed clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHeader

func AddHeader(headers http.Header, name string, value any)

AddHeader appends a typed header value. Nil pointers are omitted and slices are emitted as repeated header fields.

func AddQuery

func AddQuery(query url.Values, name string, value any, explode bool)

AddQuery appends a typed query value. Nil pointers are omitted. Slices are emitted as repeated values when explode is true and comma-delimited otherwise.

func FormatValue

func FormatValue(value any) string

FormatValue renders a path parameter using its wire representation.

Types

type Request

type Request struct {
	OperationID string
	Method      string
	Path        string
	PathParams  map[string]string
	Query       url.Values
	Headers     http.Header
	Body        any
	ContentType string
	Accept      string
}

Request is the transport-ready wire request produced by a generated client. Body and response decoding remain generic only at this infrastructure boundary; generated client methods expose concrete request and response types.

type Response

type Response struct {
	StatusCode  int
	Headers     http.Header
	ContentType string
}

Response contains transport metadata shared by every generated operation.

type Transport

type Transport interface {
	DoAPIGen(context.Context, Request, any) (Response, error)
}

Transport executes a generated request and decodes a successful response into response. A nil response denotes a bodyless success contract.

Jump to

Keyboard shortcuts

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