client

package
v0.267.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package client constructs a configured go-openfga client from resolved config.

Index

Constants

View Source
const DefaultRequestTimeout = 30 * time.Second

DefaultRequestTimeout bounds each HTTP exchange, including reading its body.

Variables

This section is empty.

Functions

func New

func New(r config.Resolved, opts ...Option) (*openfga.Client, error)

func ParseHeaders added in v0.267.0

func ParseHeaders(raw []string) (http.Header, error)

ParseHeaders turns repeated "Name: value" strings into an http.Header.

A later value for the same name replaces an earlier one, so a --header flag overrides the same header from the profile rather than sending both.

func ValidStoreID added in v0.267.0

func ValidStoreID(id string) bool

ValidStoreID reports whether id is a well-formed store ID.

func ValidateStoreID added in v0.267.0

func ValidateStoreID(id, source string) error

ValidateStoreID returns a usage error describing a malformed store ID, naming the configuration layer it came from so the user knows what to fix. source is config.Resolved's StoreIDSource.

Types

type Option

type Option func(*options)

Option configures optional client behavior layered on top of the resolved config (e.g. request capture for the TUI).

func WithCapture

func WithCapture(rec apilog.Sink) Option

WithCapture records every HTTP request/response into rec by wrapping the base transport. The playground passes a Recorder to back its API Logs view; the CLI passes a TraceWriter under --debug to stream the exchange to stderr.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the maximum duration of each HTTP exchange. Zero disables the deadline for callers that intentionally use a long-lived endpoint.

Jump to

Keyboard shortcuts

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