storageapi

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ClientID is the application's ID.
	ClientID string

	// ClientSecret is the application's secret.
	ClientSecret string

	// OidcProviderURL is the OpenID Connect Provider's
	// URL. This is a constant specific to each server.
	OidcProviderURL string

	// StorageApiURL is the Storage API's URL.
	StorageApiURL string
}

type DeleteResponse

type DeleteResponse struct {
	FileID  string         `json:"file_id"`
	Info    FileInfo       `json:"info"`
	Message string         `json:"message,omitempty"`
	Status  responseStatus `json:"status"`
}

func (DeleteResponse) IsOk

func (u DeleteResponse) IsOk() bool

type FileInfo

type FileInfo struct {
	FileExt      string `json:"file_ext"`
	FileID       string `json:"file_id"`
	FileMimetype string `json:"file_mimetype"`
	FileName     string `json:"file_name"`
	FileSize     int    `json:"file_size"`
	PublicLink   string `json:"public_link"`
	Tag          string `json:"tag"`
	Timestamp    string `json:"timestamp"`
}

type GetResponse

type GetResponse struct {
	Data    string         `json:"data"`
	Info    FileInfo       `json:"info"`
	Message string         `json:"message,omitempty"`
	Status  responseStatus `json:"status"`
}

func (GetResponse) IsOk

func (u GetResponse) IsOk() bool

type StorageApi

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

func NewStorageApi

func NewStorageApi(ctx context.Context, config Config) (*StorageApi, error)

func (*StorageApi) Delete

func (s *StorageApi) Delete(ctx context.Context, fileId string) (DeleteResponse, error)

func (*StorageApi) Get

func (s *StorageApi) Get(ctx context.Context, fileId string) (GetResponse, error)

func (*StorageApi) Upload

func (s *StorageApi) Upload(ctx context.Context, fileHeader *multipart.FileHeader) (UploadResponse, error)

type UploadBody

type UploadBody struct {
	FileName      string `json:"file_name"`
	FileExt       string `json:"file_ext"`
	FileMimetype  string `json:"mime_type"`
	BinaryDataB64 string `json:"binary_data_b64"`
}

type UploadResponse

type UploadResponse struct {
	FileID  string         `json:"file_id"`
	Info    FileInfo       `json:"info"`
	Message string         `json:"message,omitempty"`
	Status  responseStatus `json:"status"`
}

func (UploadResponse) IsOk

func (u UploadResponse) IsOk() bool

Jump to

Keyboard shortcuts

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