media

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 14 Imported by: 0

README

media-client

Go client for the Media API. Originally from in newswire.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheOptions

type CacheOptions struct {
	// TTL is how long a successful lookup is kept in the cache.
	// Defaults to 60 seconds.
	TTL time.Duration
	// Capacity is the maximum number of entries in the cache.
	// Defaults to 2048.
	Capacity uint64
}

CacheOptions configures the TTNINJS document cache.

type Media

type Media struct {
	// contains filtered or unexported fields
}

func NewMedia

func NewMedia(opts MediaOptions) *Media

func (*Media) GetRenderedTTNINJS

func (m *Media) GetRenderedTTNINJS(
	ctx context.Context, docURI string, _ []byte,
) (ttninjs.Document, error)

type MediaOptions

type MediaOptions struct {
	Logger *slog.Logger
	Client *http.Client
	Host   string
	// Cache enables TTNINJS document caching. If nil, no caching is performed.
	Cache *CacheOptions
}

MediaOptions configures the Media client.

type TTNINJSErrorCause

type TTNINJSErrorCause string
const (
	TTNINJSErrorCauseNotFound    TTNINJSErrorCause = "not_found"
	TTNINJSErrorCauseInvalidURI  TTNINJSErrorCause = "invalid_uri"
	TTNINJSErrorCauseInvalidDoc  TTNINJSErrorCause = "invalid_doc"
	TTNINJSErrorCauseInvalidBody TTNINJSErrorCause = "invalid_body"
)

type TTNINJSPermanentError

type TTNINJSPermanentError struct {
	Cause TTNINJSErrorCause
}

func (TTNINJSPermanentError) Error

func (err TTNINJSPermanentError) Error() string

Jump to

Keyboard shortcuts

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