Documentation
¶
Index ¶
- func InferKind[M any]() string
- func WithListOptions(ctx context.Context, options ListOptions) context.Context
- type HttpClient
- type ListOptions
- type MeshObjectClient
- func (c MeshObjectClient[M]) Delete(ctx context.Context, id string) (err error)
- func (c MeshObjectClient[M]) DeleteAtPath(ctx context.Context, id string, extraPath ...string) (err error)
- func (c MeshObjectClient[M]) Get(ctx context.Context, id string) (resp *M, err error)
- func (c MeshObjectClient[M]) GetAtPath[R any](ctx context.Context, id string, extraPath ...string) (R, error)
- func (c MeshObjectClient[M]) List(ctx context.Context, options ...http.RequestOption) ([]M, error)
- func (c MeshObjectClient[M]) ListSeq(ctx context.Context, options ...http.RequestOption) iter.Seq2[M, error]
- func (c MeshObjectClient[M]) ListSeqAs[T any](ctx context.Context, options ...http.RequestOption) iter.Seq2[T, error]
- func (c MeshObjectClient[M]) MeshObjectMimeType() string
- func (c MeshObjectClient[M]) Post[P any](ctx context.Context, payload P) (*M, error)
- func (c MeshObjectClient[M]) PostAtPath[R, P any](ctx context.Context, payload P, extraPath ...string) (R, error)
- func (c MeshObjectClient[M]) Put[P any](ctx context.Context, id string, payload P) (*M, error)
- type Page
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InferKind ¶
InferKind infers the meshObject kind from a struct type name using the same convention as the meshObject API: MeshWorkspace → "meshWorkspace", MeshBuildingBlockV2 → "meshBuildingBlock". Version suffixes (V\d+) are stripped. Tested when client.Kind is statically initialized.
func WithListOptions ¶ added in v0.2.0
func WithListOptions(ctx context.Context, options ListOptions) context.Context
Types ¶
type HttpClient ¶
type HttpClient struct {
http.AuthorizedClient
EndpointUrl xurl.URL
}
type ListOptions ¶ added in v0.2.0
func ListOptionsFrom ¶ added in v0.2.0
func ListOptionsFrom(ctx context.Context) ListOptions
type MeshObjectClient ¶
type MeshObjectClient[M any] struct { http.AuthorizedClient Kind string ApiVersion string ApiUrl *url.URL }
MeshObjectClient provides typed CRUD operations for meshStack API objects. It embeds http.AuthorizedClient and adds meshObject-specific functionality including automatic MIME type handling and pagination.
func NewMeshObjectClient ¶
func NewMeshObjectClient[M any](ctx context.Context, httpClient HttpClient, apiVersion string, explicitApiPathElems ...string) MeshObjectClient[M]
NewMeshObjectClient creates a new MeshObjectClient for a specific meshObject type with automatic URL path inference. The meshObject kind is inferred from type M. The API URL is constructed from explicitApiPathElems if provided, otherwise the pluralized and lowercased kind is used as a single element, a convention only the workspace and project user/group binding APIs break.
func (MeshObjectClient[M]) Delete ¶
func (c MeshObjectClient[M]) Delete(ctx context.Context, id string) (err error)
Delete removes a meshObject by ID.
func (MeshObjectClient[M]) DeleteAtPath ¶
func (MeshObjectClient[M]) Get ¶
func (c MeshObjectClient[M]) Get(ctx context.Context, id string) (resp *M, err error)
Get retrieves a meshObject by ID. Returns nil if not found.
func (MeshObjectClient[M]) List ¶
func (c MeshObjectClient[M]) List(ctx context.Context, options ...http.RequestOption) ([]M, error)
func (MeshObjectClient[M]) ListSeq ¶ added in v0.2.0
func (c MeshObjectClient[M]) ListSeq(ctx context.Context, options ...http.RequestOption) iter.Seq2[M, error]
ListSeq retrieves all meshObjects with automatic pagination handling, and yields each one as its page arrives.
func (MeshObjectClient[M]) ListSeqAs ¶ added in v0.2.0
func (c MeshObjectClient[M]) ListSeqAs[T any](ctx context.Context, options ...http.RequestOption) iter.Seq2[T, error]
func (MeshObjectClient[M]) MeshObjectMimeType ¶
func (c MeshObjectClient[M]) MeshObjectMimeType() string
func (MeshObjectClient[M]) Post ¶
func (c MeshObjectClient[M]) Post[P any](ctx context.Context, payload P) (*M, error)
Post creates a new meshObject with the given payload. Automatically injects apiVersion and kind into the JSON payload.