assets

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package assets is a minimal client for assets-web's authenticated asset store (GET/POST/DELETE /asset/<kind>/<id>), used to promote a staged cover/sample to live (or reclaim it) on volume edit session finalize/accept/reject. See durable-volume-editing in sweetrpg/platform.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client calls assets-web's asset store endpoints.

func NewClient

func NewClient(baseURL string) *Client

NewClient builds a Client against assets-web's base URL. An empty baseURL is accepted so the service can still start when ASSETS_WEB_URL isn't configured; every call will then fail with a transport error.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, kind, id string) error

Delete removes an asset. A missing asset (404) is treated as success - the end state (no asset at kind/id) is the same either way.

func (*Client) Get

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

Get downloads an asset's bytes and content type.

func (*Client) Promote

func (c *Client) Promote(ctx context.Context, fromKind, fromID, toKind, toID string) error

Promote copies a staged asset (fromKind/fromID) to a live one (toKind/toID), then deletes the staged copy - the promote-then-delete step every editor/admin finalize and accepted proposal performs for a referenced staged cover/sample.

func (*Client) Store

func (c *Client) Store(ctx context.Context, kind, id string, data []byte, contentType string) error

Store uploads an asset's bytes under kind/id, overwriting any existing asset there.

type NotFoundError

type NotFoundError struct{ Kind, ID string }

NotFoundError means assets-web has no asset at the given kind/id.

func (NotFoundError) Error

func (e NotFoundError) Error() string

Jump to

Keyboard shortcuts

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