Documentation
¶
Index ¶
- type CreateBucketOption
- func WithCreateBucketAllowedFileExtensions(v []interface{}) CreateBucketOption
- func WithCreateBucketAntivirus(v bool) CreateBucketOption
- func WithCreateBucketCompression(v string) CreateBucketOption
- func WithCreateBucketEnabled(v bool) CreateBucketOption
- func WithCreateBucketEncryption(v bool) CreateBucketOption
- func WithCreateBucketFileSecurity(v bool) CreateBucketOption
- func WithCreateBucketMaximumFileSize(v int) CreateBucketOption
- func WithCreateBucketPermissions(v []interface{}) CreateBucketOption
- type CreateBucketOptions
- type CreateFileOption
- type CreateFileOptions
- type GetFilePreviewOption
- func WithGetFilePreviewBackground(v string) GetFilePreviewOption
- func WithGetFilePreviewBorderColor(v string) GetFilePreviewOption
- func WithGetFilePreviewBorderRadius(v int) GetFilePreviewOption
- func WithGetFilePreviewBorderWidth(v int) GetFilePreviewOption
- func WithGetFilePreviewGravity(v string) GetFilePreviewOption
- func WithGetFilePreviewHeight(v int) GetFilePreviewOption
- func WithGetFilePreviewOpacity(v float64) GetFilePreviewOption
- func WithGetFilePreviewOutput(v string) GetFilePreviewOption
- func WithGetFilePreviewQuality(v int) GetFilePreviewOption
- func WithGetFilePreviewRotation(v int) GetFilePreviewOption
- func WithGetFilePreviewWidth(v int) GetFilePreviewOption
- type GetFilePreviewOptions
- type ListBucketsOption
- type ListBucketsOptions
- type ListFilesOption
- type ListFilesOptions
- type Storage
- func (srv *Storage) CreateBucket(BucketId string, Name string, optionalSetters ...CreateBucketOption) (*models.Bucket, error)
- func (srv *Storage) CreateFile(BucketId string, FileId string, File file.InputFile, ...) (*models.File, error)
- func (srv *Storage) DeleteBucket(BucketId string) (*interface{}, error)
- func (srv *Storage) DeleteFile(BucketId string, FileId string) (*interface{}, error)
- func (srv *Storage) GetBucket(BucketId string) (*models.Bucket, error)
- func (srv *Storage) GetFile(BucketId string, FileId string) (*models.File, error)
- func (srv *Storage) GetFileDownload(BucketId string, FileId string) (*[]byte, error)
- func (srv *Storage) GetFilePreview(BucketId string, FileId string, optionalSetters ...GetFilePreviewOption) (*[]byte, error)
- func (srv *Storage) GetFileView(BucketId string, FileId string) (*[]byte, error)
- func (srv *Storage) ListBuckets(optionalSetters ...ListBucketsOption) (*models.BucketList, error)
- func (srv *Storage) ListFiles(BucketId string, optionalSetters ...ListFilesOption) (*models.FileList, error)
- func (srv *Storage) UpdateBucket(BucketId string, Name string, optionalSetters ...UpdateBucketOption) (*models.Bucket, error)
- func (srv *Storage) UpdateFile(BucketId string, FileId string, optionalSetters ...UpdateFileOption) (*models.File, error)
- type UpdateBucketOption
- func WithUpdateBucketAllowedFileExtensions(v []interface{}) UpdateBucketOption
- func WithUpdateBucketAntivirus(v bool) UpdateBucketOption
- func WithUpdateBucketCompression(v string) UpdateBucketOption
- func WithUpdateBucketEnabled(v bool) UpdateBucketOption
- func WithUpdateBucketEncryption(v bool) UpdateBucketOption
- func WithUpdateBucketFileSecurity(v bool) UpdateBucketOption
- func WithUpdateBucketMaximumFileSize(v int) UpdateBucketOption
- func WithUpdateBucketPermissions(v []interface{}) UpdateBucketOption
- type UpdateBucketOptions
- type UpdateFileOption
- type UpdateFileOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateBucketOption ¶
type CreateBucketOption func(*CreateBucketOptions)
func WithCreateBucketAllowedFileExtensions ¶
func WithCreateBucketAllowedFileExtensions(v []interface{}) CreateBucketOption
func WithCreateBucketAntivirus ¶
func WithCreateBucketAntivirus(v bool) CreateBucketOption
func WithCreateBucketCompression ¶
func WithCreateBucketCompression(v string) CreateBucketOption
func WithCreateBucketEnabled ¶
func WithCreateBucketEnabled(v bool) CreateBucketOption
func WithCreateBucketEncryption ¶
func WithCreateBucketEncryption(v bool) CreateBucketOption
func WithCreateBucketFileSecurity ¶
func WithCreateBucketFileSecurity(v bool) CreateBucketOption
func WithCreateBucketMaximumFileSize ¶
func WithCreateBucketMaximumFileSize(v int) CreateBucketOption
func WithCreateBucketPermissions ¶
func WithCreateBucketPermissions(v []interface{}) CreateBucketOption
type CreateBucketOptions ¶
type CreateBucketOptions struct {
Permissions []interface{}
FileSecurity bool
Enabled bool
MaximumFileSize int
AllowedFileExtensions []interface{}
Compression string
Encryption bool
Antivirus bool
// contains filtered or unexported fields
}
func (CreateBucketOptions) New ¶
func (options CreateBucketOptions) New() *CreateBucketOptions
type CreateFileOption ¶
type CreateFileOption func(*CreateFileOptions)
func WithCreateFilePermissions ¶
func WithCreateFilePermissions(v []interface{}) CreateFileOption
type CreateFileOptions ¶
type CreateFileOptions struct {
Permissions []interface{}
// contains filtered or unexported fields
}
func (CreateFileOptions) New ¶
func (options CreateFileOptions) New() *CreateFileOptions
type GetFilePreviewOption ¶
type GetFilePreviewOption func(*GetFilePreviewOptions)
func WithGetFilePreviewBackground ¶
func WithGetFilePreviewBackground(v string) GetFilePreviewOption
func WithGetFilePreviewBorderColor ¶
func WithGetFilePreviewBorderColor(v string) GetFilePreviewOption
func WithGetFilePreviewBorderRadius ¶
func WithGetFilePreviewBorderRadius(v int) GetFilePreviewOption
func WithGetFilePreviewBorderWidth ¶
func WithGetFilePreviewBorderWidth(v int) GetFilePreviewOption
func WithGetFilePreviewGravity ¶
func WithGetFilePreviewGravity(v string) GetFilePreviewOption
func WithGetFilePreviewHeight ¶
func WithGetFilePreviewHeight(v int) GetFilePreviewOption
func WithGetFilePreviewOpacity ¶
func WithGetFilePreviewOpacity(v float64) GetFilePreviewOption
func WithGetFilePreviewOutput ¶
func WithGetFilePreviewOutput(v string) GetFilePreviewOption
func WithGetFilePreviewQuality ¶
func WithGetFilePreviewQuality(v int) GetFilePreviewOption
func WithGetFilePreviewRotation ¶
func WithGetFilePreviewRotation(v int) GetFilePreviewOption
func WithGetFilePreviewWidth ¶
func WithGetFilePreviewWidth(v int) GetFilePreviewOption
type GetFilePreviewOptions ¶
type GetFilePreviewOptions struct {
Width int
Height int
Gravity string
Quality int
BorderWidth int
BorderColor string
BorderRadius int
Opacity float64
Rotation int
Background string
Output string
// contains filtered or unexported fields
}
func (GetFilePreviewOptions) New ¶
func (options GetFilePreviewOptions) New() *GetFilePreviewOptions
type ListBucketsOption ¶
type ListBucketsOption func(*ListBucketsOptions)
func WithListBucketsQueries ¶
func WithListBucketsQueries(v []interface{}) ListBucketsOption
func WithListBucketsSearch ¶
func WithListBucketsSearch(v string) ListBucketsOption
type ListBucketsOptions ¶
type ListBucketsOptions struct {
Queries []interface{}
Search string
// contains filtered or unexported fields
}
func (ListBucketsOptions) New ¶
func (options ListBucketsOptions) New() *ListBucketsOptions
type ListFilesOption ¶
type ListFilesOption func(*ListFilesOptions)
func WithListFilesQueries ¶
func WithListFilesQueries(v []interface{}) ListFilesOption
func WithListFilesSearch ¶
func WithListFilesSearch(v string) ListFilesOption
type ListFilesOptions ¶
type ListFilesOptions struct {
Queries []interface{}
Search string
// contains filtered or unexported fields
}
func (ListFilesOptions) New ¶
func (options ListFilesOptions) New() *ListFilesOptions
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage service
func NewStorage ¶
func (*Storage) CreateBucket ¶
func (srv *Storage) CreateBucket(BucketId string, Name string, optionalSetters ...CreateBucketOption) (*models.Bucket, error)
CreateBucket create a new storage bucket.
func (*Storage) CreateFile ¶
func (srv *Storage) CreateFile(BucketId string, FileId string, File file.InputFile, optionalSetters ...CreateFileOption) (*models.File, error)
CreateFile create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
func (*Storage) DeleteBucket ¶
DeleteBucket delete a storage bucket by its unique ID.
func (*Storage) DeleteFile ¶
DeleteFile delete a file by its unique ID. Only users with write permissions have access to delete this resource.
func (*Storage) GetBucket ¶
GetBucket get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
func (*Storage) GetFile ¶
GetFile get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
func (*Storage) GetFileDownload ¶
GetFileDownload get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
func (*Storage) GetFilePreview ¶
func (srv *Storage) GetFilePreview(BucketId string, FileId string, optionalSetters ...GetFilePreviewOption) (*[]byte, error)
GetFilePreview get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
func (*Storage) GetFileView ¶
GetFileView get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
func (*Storage) ListBuckets ¶
func (srv *Storage) ListBuckets(optionalSetters ...ListBucketsOption) (*models.BucketList, error)
ListBuckets get a list of all the storage buckets. You can use the query params to filter your results.
func (*Storage) ListFiles ¶
func (srv *Storage) ListFiles(BucketId string, optionalSetters ...ListFilesOption) (*models.FileList, error)
ListFiles get a list of all the user files. You can use the query params to filter your results.
func (*Storage) UpdateBucket ¶
func (srv *Storage) UpdateBucket(BucketId string, Name string, optionalSetters ...UpdateBucketOption) (*models.Bucket, error)
UpdateBucket update a storage bucket by its unique ID.
func (*Storage) UpdateFile ¶
func (srv *Storage) UpdateFile(BucketId string, FileId string, optionalSetters ...UpdateFileOption) (*models.File, error)
UpdateFile update a file by its unique ID. Only users with write permissions have access to update this resource.
type UpdateBucketOption ¶
type UpdateBucketOption func(*UpdateBucketOptions)
func WithUpdateBucketAllowedFileExtensions ¶
func WithUpdateBucketAllowedFileExtensions(v []interface{}) UpdateBucketOption
func WithUpdateBucketAntivirus ¶
func WithUpdateBucketAntivirus(v bool) UpdateBucketOption
func WithUpdateBucketCompression ¶
func WithUpdateBucketCompression(v string) UpdateBucketOption
func WithUpdateBucketEnabled ¶
func WithUpdateBucketEnabled(v bool) UpdateBucketOption
func WithUpdateBucketEncryption ¶
func WithUpdateBucketEncryption(v bool) UpdateBucketOption
func WithUpdateBucketFileSecurity ¶
func WithUpdateBucketFileSecurity(v bool) UpdateBucketOption
func WithUpdateBucketMaximumFileSize ¶
func WithUpdateBucketMaximumFileSize(v int) UpdateBucketOption
func WithUpdateBucketPermissions ¶
func WithUpdateBucketPermissions(v []interface{}) UpdateBucketOption
type UpdateBucketOptions ¶
type UpdateBucketOptions struct {
Permissions []interface{}
FileSecurity bool
Enabled bool
MaximumFileSize int
AllowedFileExtensions []interface{}
Compression string
Encryption bool
Antivirus bool
// contains filtered or unexported fields
}
func (UpdateBucketOptions) New ¶
func (options UpdateBucketOptions) New() *UpdateBucketOptions
type UpdateFileOption ¶
type UpdateFileOption func(*UpdateFileOptions)
func WithUpdateFileName ¶
func WithUpdateFileName(v string) UpdateFileOption
func WithUpdateFilePermissions ¶
func WithUpdateFilePermissions(v []interface{}) UpdateFileOption
type UpdateFileOptions ¶
type UpdateFileOptions struct {
Name string
Permissions []interface{}
// contains filtered or unexported fields
}
func (UpdateFileOptions) New ¶
func (options UpdateFileOptions) New() *UpdateFileOptions