Documentation
¶
Index ¶
- func InferKind[M any]() string
- type HttpClient
- 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]) 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)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 (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)
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.