grantclient

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package grantclient provides provider-neutral temporary-grant HTTP mechanics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client[T any] struct {
	// contains filtered or unexported fields
}

Client owns request, lookup, wait, cancel, and revoke transport mechanics.

func New

func New[T any](options Options[T]) (*Client[T], error)

New validates and constructs a grant client.

func (*Client[T]) Cancel

func (c *Client[T]) Cancel(ctx context.Context, id string) (T, error)

Cancel closes one pending grant owned by the authenticated client.

func (*Client[T]) Get

func (c *Client[T]) Get(ctx context.Context, id string) (T, error)

Get retrieves one grant by its opaque handle.

func (*Client[T]) Request

func (c *Client[T]) Request(ctx context.Context, input any) (T, error)

Request creates or replays one provider-classified temporary grant.

func (*Client[T]) Revoke

func (c *Client[T]) Revoke(ctx context.Context, id string) (T, error)

Revoke closes one active grant owned by the authenticated client.

func (*Client[T]) Wait

func (c *Client[T]) Wait(ctx context.Context, id string) (T, error)

Wait polls a durable grant until it reaches a terminal or active state.

type Decoder

type Decoder[T any] func([]byte) (T, error)

Decoder converts one successful broker response into a provider projection.

type Error

type Error struct{ Status int }

Error is a bounded HTTP failure without response-body disclosure.

func (*Error) Error

func (e *Error) Error() string

type Options

type Options[T any] struct {
	BaseURL      string
	Credential   string
	HTTPClient   *http.Client
	Decode       Decoder[T]
	Terminal     func(T) bool
	PollInterval time.Duration
}

Options configures a temporary-grant client.

Jump to

Keyboard shortcuts

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