client

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoFiles          = errors.New("no files specified")
	ErrFilenameNotFound = errors.New("file not found in content-disposition")
)

Functions

func CreateMultiFormFile

func CreateMultiFormFile(
	writer *multipart.Writer,
	fieldName string,
	file *File,
	multiple bool,
) error

func CreateUpdateMultiForm

func CreateUpdateMultiForm(file *File) (io.Reader, string, error)

func CreateUploadMultiForm

func CreateUploadMultiForm(files ...*File) (io.Reader, string, error)

func WithMetadata added in v0.4.0

func WithMetadata(metdata map[string]any) func(file *File)

func WithUUID

func WithUUID(id string) func(file *File)

Types

type APIResponseError

type APIResponseError struct {
	StatusCode int `json:"statusCode"`
	*controller.ErrorResponse
	Response interface{} `json:"response"`
}

func (*APIResponseError) Error

func (err *APIResponseError) Error() string

type Client

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

func New

func New(baseURL, jwt string) *Client

func (*Client) DeleteFile

func (c *Client) DeleteFile(
	ctx context.Context,
	fileID string,
) error

func (*Client) GetFile

func (*Client) GetFileInformation

func (c *Client) GetFileInformation(
	ctx context.Context,
	fileID string,
	opts ...GetFileInformationOpt,
) (*FileInformationHeader, error)

func (*Client) GetFilePresignedURL

func (c *Client) GetFilePresignedURL(
	ctx context.Context,
	fileID string,
) (*controller.GetFilePresignedURLResponse, error)

func (*Client) UpdateFile

func (c *Client) UpdateFile(
	ctx context.Context,
	fileID string,
	file *File,
) (*controller.UpdateFileResponse, error)

func (*Client) UploadFile

func (c *Client) UploadFile(
	ctx context.Context,
	files ...*File,
) (*controller.UploadFileResponse, error)

type File

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

func NewFile

func NewFile(name string, r io.ReadSeeker, opts ...fileOptions) *File

type FileInformationHeader

type FileInformationHeader struct {
	CacheControl  string
	ContentLength int
	ContentType   string
	Etag          string
	LastModified  string
	Error         string
	StatusCode    int
}

type FileInformationHeaderWithReader

type FileInformationHeaderWithReader struct {
	*FileInformationHeader
	Filename string
	Body     io.ReadCloser
}

type GetFileInformationOpt

type GetFileInformationOpt func(req *http.Request)

func WithIfMatch

func WithIfMatch(etags ...string) GetFileInformationOpt

func WithIfModifiedSince

func WithIfModifiedSince(modifiedSince string) GetFileInformationOpt

func WithIfUnmodifiedSince

func WithIfUnmodifiedSince(modifiedSince string) GetFileInformationOpt

func WithImageBlur

func WithImageBlur(blur int) GetFileInformationOpt

func WithImageQuality

func WithImageQuality(quality int) GetFileInformationOpt

func WithImageSize

func WithImageSize(newSizeX, newSizeY int) GetFileInformationOpt

func WithNoneMatch

func WithNoneMatch(etags ...string) GetFileInformationOpt

func WithRange added in v0.2.0

func WithRange(rangeV string) GetFileInformationOpt

Jump to

Keyboard shortcuts

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