Help us shape the future of Go! Take the 2026 Go Developer Survey

internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferKind

func InferKind[M any]() string

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.

Types

type HttpClient

type HttpClient struct {
	http.AuthorizedClient

	EndpointUrl xurl.URL
}

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 (c MeshObjectClient[M]) DeleteAtPath(ctx context.Context, id string, extraPath ...string) (err error)

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]) GetAtPath

func (c MeshObjectClient[M]) GetAtPath[R any](ctx context.Context, id string, extraPath ...string) (R, error)

func (MeshObjectClient[M]) List

func (c MeshObjectClient[M]) List(ctx context.Context, options ...http.RequestOption) ([]M, error)

List retrieves all meshObjects with automatic pagination handling. Accepts optional http.RequestOption parameters for filtering and querying.

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.

func (MeshObjectClient[M]) PostAtPath

func (c MeshObjectClient[M]) PostAtPath[R, P any](ctx context.Context, payload P, extraPath ...string) (R, error)

func (MeshObjectClient[M]) Put

func (c MeshObjectClient[M]) Put[P any](ctx context.Context, id string, payload P) (*M, error)

Put updates an existing meshObject by ID with the given payload. Automatically injects apiVersion and kind into the JSON payload.

Jump to

Keyboard shortcuts

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