types

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeConfig

type BridgeConfig struct {
	// Provider is the name of the cloud storage service to use.
	Provider Provider
	// Zone is the service zone to use for storage.
	// This is only implemented by some providers (e.g. S3).
	Zone string
	// DefaultBucket is the default storage bucket to use for storing.
	// This is only implemented by some providers (e.g. Google Cloud Storage, S3).
	DefaultBucket string
	// CredentialsFile is the path to the credentials file.
	// This is only implemented by some providers (e.g. Google Cloud Storage).
	CredentialsFile string
	// SecretKey is the secret key for IAM authentication.
	SecretKey string
	// AccessKey is the access key for IAM authentication.
	AccessKey string
	// Region is the service region to use for storing.
	// This is only implemented by some providers (e.g. S3, Google Cloud Storage).
	Region string
	// DefaultTimeout is the time-to-live for time-dependent storage operations.
	DefaultTimeout int64
	// EnableDebug enables debug logging.
	EnableDebug bool
	// Project is the cloud project to use for storage.
	// This is only implemented by some providers (e.g. Google Cloud Storage).
	Project string
	// PublicRead enables public read access to uploaded files.
	PublicRead bool
	// UseAsync enables asynchronous operations with go routines.
	UseAsync bool
	// PinataJWT is the JWT generated for your Pinata cloud account
	PinataJWT string
	// Buckets specifics the list of bucket names to interact with
	Buckets []string
	// Object specifics an object name in a bucket to interact with
	Object string
}

type DeleteFile added in v0.0.8

type DeleteFile struct {
	// Handle is the handle to the file.
	Handle io.Reader
	// Filename is the name stored with the provider.
	Filename string `json:"filename"`
	// Buckets is the name stored with the provider.
	Buckets []string `json:"buckets"`
	// Options is a map of options to store along with each file.
	Options map[string]interface{} `json:"options"`
}

DeleeFile is the struct for Deleting a single file.

type File

type File struct {
	// Handle is the handle to the file.
	Handle io.Reader
	// Path is the path to file.
	Path string `json:"path"`
	// Filename is the name to store the file as with the provider.
	Filename string `json:"filename"`
	// Options is a map of options to store along with each file.
	Options map[string]interface{} `json:"options"`
}

File is the struct for uploading a single file.

func (*File) Validate added in v0.0.7

func (f *File) Validate() error

Validate validates the File struct.

type MultiFile

type MultiFile struct {
	// Files is a list of files to upload.
	Files []File `json:"files"`
	// GlobalOptions is a map of options to store along with all the files.
	// say 3 of 4 files need to share the same option, you can set globally for those 3 files and set the 4th file's option separately, bifrost won't override the option
	GlobalOptions map[string]interface{} `json:"global_options"`
}

MultiFile is the struct for uploading multiple files. Along with options, you can also set global options that will be applied to all files.

func (*MultiFile) Validate added in v0.0.7

func (m *MultiFile) Validate() error

Validate validates the MultiFile struct.

type Param

type Param struct {
	// Files is a list of files to upload.
	Files []ParamFile
	// Data is a list of data to upload along with the files.
	Data []ParamData
}

Param is the struct used to pass parameters to request methods.

type ParamData

type ParamData struct {
	// Key is the key to use for the data.
	Key string
	// Value is the value to use for the data.
	Value string
}

ParamData is the struct for uploading data along with files in a multipart request.

type ParamFile

type ParamFile struct {
	// Name is the name of the file.
	Name string
	// Handle is the handle to the file.
	Handle io.Reader
	// Path is the path to the file.
	Path string
	// Key is the key to use for the file.
	Key string
}

ParamFile is the struct for uploading a single file in a multipart request.

type PinataAuthResponse

type PinataAuthResponse struct {
	Error struct {
		Reason  string `json:"reason"`
		Details string `json:"details"`
	} `json:"error"`
	Message string `json:"message"`
}

PinataAuthResponse is the response from Pinata Cloud when authenticating.

type PinataPinFileResponse

type PinataPinFileResponse struct {
	IpfsHash  string `json:"IpfsHash"`
	Timestamp string `json:"Timestamp"`
	PinSize   int64  `json:"PinSize"`
	Error     string `json:"error"`
}

PinataPinFileResponse is the response from Pinata Cloud when pinning a file.

type Provider added in v0.0.7

type Provider string

Provider is the cloud provider type

func (Provider) String added in v0.0.7

func (p Provider) String() string

String returns the string representation of the provider

func (Provider) ToLowerCase added in v0.0.7

func (p Provider) ToLowerCase() string

ToLowerCase returns the lowercase representation of the provider

type UploadedFile

type UploadedFile struct {
	// Name is the name of the file.
	Name string
	// Bucket is the bucket the file was uploaded to.
	Bucket string
	// Path is the local path to the file.
	Path string
	// Size is the size of the file in bytes.
	Size int64
	// URL is the location of the file in the cloud.
	URL string
	// Preview is the URL to a preview of the file.
	Preview string
	// ProviderObject is the object returned by the cloud storage provider.
	// You need to type assert this to the correct type to use it.
	ProviderObject interface{}
	// Done sends a message to signal when an async process is complete.
	Done chan bool
	// Quit receives a message to signal for the exit of an async process.
	Quit chan bool
	// CID is the content identifier for the file.
	// This is only implemented by some providers (e.g. Pinata Cloud).
	CID string
	// Error is the error returned by the provider. This is only used for async operations and multi file uploads.
	Error error
}

UploadedFile is the struct representing a completed file/files upload.

Jump to

Keyboard shortcuts

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