statika

package module
v0.0.0-...-a2ed6f7 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

Golang API for Statika

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationResponse

type AuthenticationResponse struct {
	Token   string `json:"token"`
	Expires int64  `json:"expires"`
}

type Client

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

func (Client) DeleteFile

func (c Client) DeleteFile(fileName string) (err error)

func (Client) DeleteMeta

func (c Client) DeleteMeta(fileName string) (err error)

func (Client) GetMeta

func (c Client) GetMeta(fileName string) (meta MetaInfo, err error)

func (Client) ListFiles

func (c Client) ListFiles() (f []FileEntry, err error)

func (Client) SetMeta

func (c Client) SetMeta(fileName string, meta MetaInfo) (err error)

func (Client) UploadFile

func (c Client) UploadFile(fileName string, reader io.Reader) (ur UploadResponse, err error)

type FileEntry

type FileEntry struct {
	FileName string `json:"filename"`
}

type GateKeeper

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

This "class" provides methods for tokens management

func NewGateKeeper

func NewGateKeeper(endpoint string, masterKey string, uploadKey string) (GateKeeper, error)

This function creates new Statika GateKeeper client, it's responsible

func (GateKeeper) IssueClient

func (gk GateKeeper) IssueClient(bucket string) (Client, error)

IssueClient This method gets new upload token from Statika server, and returns a client instance with this token

func (GateKeeper) IssueUploadToken

func (gk GateKeeper) IssueUploadToken(bucket string) (token UploadToken, err error)

func (GateKeeper) NewClient

func (gk GateKeeper) NewClient(bucket string, uploadToken UploadToken) (Client, error)

NewClient This method creates new client with existing upload token

type ListResponse

type ListResponse struct {
	Bucket string      `json:"bucket"`
	Files  []FileEntry `json:"files"`
}

type MetaInfo

type MetaInfo map[string]string

type UploadAuthenticationRequest

type UploadAuthenticationRequest struct {
	Token  string `json:"token"`  // Auth token. Must match whatever was set in UPLOAD_TOKEN env var
	Bucket string `json:"bucket"` // Target folder for this key. Other buckets will be hidden and unavailable.
}

type UploadResponse

type UploadResponse struct {
	Id       string `json:"id"`
	FileName string `json:"filename"`
}

type UploadToken

type UploadToken string

Jump to

Keyboard shortcuts

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