api

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0 Imports: 7 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) Ping added in v0.0.11

func (c Client) Ping() (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

func (GateKeeper) NewMultiClient added in v0.0.14

func (gk GateKeeper) NewMultiClient(uploadToken UploadToken, buckets ...string) (MultiClient, error)

type ListResponse

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

type MetaInfo

type MetaInfo map[string]string

type MultiClient added in v0.0.14

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

func (MultiClient) Bucket added in v0.0.14

func (mc MultiClient) Bucket(bucket string) (c Client)

func (MultiClient) Check added in v0.0.14

func (mc MultiClient) Check(bucket string) (ok bool)

type UploadAuthenticationRequest

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

type UploadResponse

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

type UploadToken

type UploadToken string

Directories

Path Synopsis
go-statika module

Jump to

Keyboard shortcuts

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