api

package
v0.0.0-...-8fbeb48 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeySize     = 16
	KeyHashSize = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(key Key) *Client

func (*Client) Upload

func (c *Client) Upload(uri string, extension string, encrypted bool, r io.Reader) (*UploadResponse, error)

type Key

type Key [KeySize]byte

func GenerateKey

func GenerateKey() (Key, error)

func ParseKey

func ParseKey(keyString []byte) (Key, error)

func (Key) MarshalText

func (k Key) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Key) String

func (k Key) String() string

String implements the fmt.Stringer interface.

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type KeyHash

type KeyHash [KeyHashSize]byte

func HashKey

func HashKey(key Key) KeyHash

HashKey calculates a SHA-256 hash of the given key and returns it.

func ParseKeyHash

func ParseKeyHash(hashString []byte) (KeyHash, error)

func (KeyHash) MarshalText

func (h KeyHash) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (KeyHash) String

func (h KeyHash) String() string

String implements the fmt.Stringer interface.

func (*KeyHash) UnmarshalText

func (h *KeyHash) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type Response

type Response struct {
	Success bool            `json:"success"`
	Error   string          `json:"error"`
	Content json.RawMessage `json:"content"`
}

Response represents the base API response structure.

type UploadResponse

type UploadResponse struct {
	Filename string `json:"filename"`
}

UploadResponse represents the structure of an upload response.

Jump to

Keyboard shortcuts

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