Documentation
¶
Index ¶
- type CreateBucketOption
- type CreateBucketOptions
- type CreateFileOption
- type CreateFileOptions
- type GetFileDownloadOption
- type GetFileDownloadOptions
- type GetFilePreviewOption
- type GetFilePreviewOptions
- type GetFileViewOption
- type GetFileViewOptions
- 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, optionalSetters ...GetFileDownloadOption) (*[]byte, error)
- func (srv *Storage) GetFilePreview(BucketId string, FileId string, optionalSetters ...GetFilePreviewOption) (*[]byte, error)
- func (srv *Storage) GetFileView(BucketId string, FileId string, optionalSetters ...GetFileViewOption) (*[]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)
- func (srv *Storage) WithCreateBucketAllowedFileExtensions(v []string) CreateBucketOption
- func (srv *Storage) WithCreateBucketAntivirus(v bool) CreateBucketOption
- func (srv *Storage) WithCreateBucketCompression(v string) CreateBucketOption
- func (srv *Storage) WithCreateBucketEnabled(v bool) CreateBucketOption
- func (srv *Storage) WithCreateBucketEncryption(v bool) CreateBucketOption
- func (srv *Storage) WithCreateBucketFileSecurity(v bool) CreateBucketOption
- func (srv *Storage) WithCreateBucketMaximumFileSize(v int) CreateBucketOption
- func (srv *Storage) WithCreateBucketPermissions(v []string) CreateBucketOption
- func (srv *Storage) WithCreateFilePermissions(v []string) CreateFileOption
- func (srv *Storage) WithGetFileDownloadToken(v string) GetFileDownloadOption
- func (srv *Storage) WithGetFilePreviewBackground(v string) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewBorderColor(v string) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewBorderRadius(v int) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewBorderWidth(v int) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewGravity(v string) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewHeight(v int) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewOpacity(v float64) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewOutput(v string) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewQuality(v int) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewRotation(v int) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewToken(v string) GetFilePreviewOption
- func (srv *Storage) WithGetFilePreviewWidth(v int) GetFilePreviewOption
- func (srv *Storage) WithGetFileViewToken(v string) GetFileViewOption
- func (srv *Storage) WithListBucketsQueries(v []string) ListBucketsOption
- func (srv *Storage) WithListBucketsSearch(v string) ListBucketsOption
- func (srv *Storage) WithListFilesQueries(v []string) ListFilesOption
- func (srv *Storage) WithListFilesSearch(v string) ListFilesOption
- func (srv *Storage) WithUpdateBucketAllowedFileExtensions(v []string) UpdateBucketOption
- func (srv *Storage) WithUpdateBucketAntivirus(v bool) UpdateBucketOption
- func (srv *Storage) WithUpdateBucketCompression(v string) UpdateBucketOption
- func (srv *Storage) WithUpdateBucketEnabled(v bool) UpdateBucketOption
- func (srv *Storage) WithUpdateBucketEncryption(v bool) UpdateBucketOption
- func (srv *Storage) WithUpdateBucketFileSecurity(v bool) UpdateBucketOption
- func (srv *Storage) WithUpdateBucketMaximumFileSize(v int) UpdateBucketOption
- func (srv *Storage) WithUpdateBucketPermissions(v []string) UpdateBucketOption
- func (srv *Storage) WithUpdateFileName(v string) UpdateFileOption
- func (srv *Storage) WithUpdateFilePermissions(v []string) UpdateFileOption
- type 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)
type CreateBucketOptions ¶
type CreateBucketOptions struct {
Permissions []string
FileSecurity bool
Enabled bool
MaximumFileSize int
AllowedFileExtensions []string
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)
type CreateFileOptions ¶
type CreateFileOptions struct {
Permissions []string
// contains filtered or unexported fields
}
func (CreateFileOptions) New ¶
func (options CreateFileOptions) New() *CreateFileOptions
type GetFileDownloadOption ¶ added in v0.7.0
type GetFileDownloadOption func(*GetFileDownloadOptions)
type GetFileDownloadOptions ¶ added in v0.7.0
type GetFileDownloadOptions struct {
Token string
// contains filtered or unexported fields
}
func (GetFileDownloadOptions) New ¶ added in v0.7.0
func (options GetFileDownloadOptions) New() *GetFileDownloadOptions
type GetFilePreviewOption ¶
type GetFilePreviewOption func(*GetFilePreviewOptions)
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
Token string
// contains filtered or unexported fields
}
func (GetFilePreviewOptions) New ¶
func (options GetFilePreviewOptions) New() *GetFilePreviewOptions
type GetFileViewOption ¶ added in v0.7.0
type GetFileViewOption func(*GetFileViewOptions)
type GetFileViewOptions ¶ added in v0.7.0
type GetFileViewOptions struct {
Token string
// contains filtered or unexported fields
}
func (GetFileViewOptions) New ¶ added in v0.7.0
func (options GetFileViewOptions) New() *GetFileViewOptions
type ListBucketsOption ¶
type ListBucketsOption func(*ListBucketsOptions)
type ListBucketsOptions ¶
type ListBucketsOptions struct {
Queries []string
Search string
// contains filtered or unexported fields
}
func (ListBucketsOptions) New ¶
func (options ListBucketsOptions) New() *ListBucketsOptions
type ListFilesOption ¶
type ListFilesOption func(*ListFilesOptions)
type ListFilesOptions ¶
type ListFilesOptions struct {
Queries []string
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 (*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 ¶
func (srv *Storage) GetFileDownload(BucketId string, FileId string, optionalSetters ...GetFileDownloadOption) (*[]byte, error)
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 ¶
func (srv *Storage) GetFileView(BucketId string, FileId string, optionalSetters ...GetFileViewOption) (*[]byte, error)
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.
func (*Storage) WithCreateBucketAllowedFileExtensions ¶
func (srv *Storage) WithCreateBucketAllowedFileExtensions(v []string) CreateBucketOption
func (*Storage) WithCreateBucketAntivirus ¶
func (srv *Storage) WithCreateBucketAntivirus(v bool) CreateBucketOption
func (*Storage) WithCreateBucketCompression ¶
func (srv *Storage) WithCreateBucketCompression(v string) CreateBucketOption
func (*Storage) WithCreateBucketEnabled ¶
func (srv *Storage) WithCreateBucketEnabled(v bool) CreateBucketOption
func (*Storage) WithCreateBucketEncryption ¶
func (srv *Storage) WithCreateBucketEncryption(v bool) CreateBucketOption
func (*Storage) WithCreateBucketFileSecurity ¶
func (srv *Storage) WithCreateBucketFileSecurity(v bool) CreateBucketOption
func (*Storage) WithCreateBucketMaximumFileSize ¶
func (srv *Storage) WithCreateBucketMaximumFileSize(v int) CreateBucketOption
func (*Storage) WithCreateBucketPermissions ¶
func (srv *Storage) WithCreateBucketPermissions(v []string) CreateBucketOption
func (*Storage) WithCreateFilePermissions ¶
func (srv *Storage) WithCreateFilePermissions(v []string) CreateFileOption
func (*Storage) WithGetFileDownloadToken ¶ added in v0.7.0
func (srv *Storage) WithGetFileDownloadToken(v string) GetFileDownloadOption
func (*Storage) WithGetFilePreviewBackground ¶
func (srv *Storage) WithGetFilePreviewBackground(v string) GetFilePreviewOption
func (*Storage) WithGetFilePreviewBorderColor ¶
func (srv *Storage) WithGetFilePreviewBorderColor(v string) GetFilePreviewOption
func (*Storage) WithGetFilePreviewBorderRadius ¶
func (srv *Storage) WithGetFilePreviewBorderRadius(v int) GetFilePreviewOption
func (*Storage) WithGetFilePreviewBorderWidth ¶
func (srv *Storage) WithGetFilePreviewBorderWidth(v int) GetFilePreviewOption
func (*Storage) WithGetFilePreviewGravity ¶
func (srv *Storage) WithGetFilePreviewGravity(v string) GetFilePreviewOption
func (*Storage) WithGetFilePreviewHeight ¶
func (srv *Storage) WithGetFilePreviewHeight(v int) GetFilePreviewOption
func (*Storage) WithGetFilePreviewOpacity ¶
func (srv *Storage) WithGetFilePreviewOpacity(v float64) GetFilePreviewOption
func (*Storage) WithGetFilePreviewOutput ¶
func (srv *Storage) WithGetFilePreviewOutput(v string) GetFilePreviewOption
func (*Storage) WithGetFilePreviewQuality ¶
func (srv *Storage) WithGetFilePreviewQuality(v int) GetFilePreviewOption
func (*Storage) WithGetFilePreviewRotation ¶
func (srv *Storage) WithGetFilePreviewRotation(v int) GetFilePreviewOption
func (*Storage) WithGetFilePreviewToken ¶ added in v0.7.0
func (srv *Storage) WithGetFilePreviewToken(v string) GetFilePreviewOption
func (*Storage) WithGetFilePreviewWidth ¶
func (srv *Storage) WithGetFilePreviewWidth(v int) GetFilePreviewOption
func (*Storage) WithGetFileViewToken ¶ added in v0.7.0
func (srv *Storage) WithGetFileViewToken(v string) GetFileViewOption
func (*Storage) WithListBucketsQueries ¶
func (srv *Storage) WithListBucketsQueries(v []string) ListBucketsOption
func (*Storage) WithListBucketsSearch ¶
func (srv *Storage) WithListBucketsSearch(v string) ListBucketsOption
func (*Storage) WithListFilesQueries ¶
func (srv *Storage) WithListFilesQueries(v []string) ListFilesOption
func (*Storage) WithListFilesSearch ¶
func (srv *Storage) WithListFilesSearch(v string) ListFilesOption
func (*Storage) WithUpdateBucketAllowedFileExtensions ¶
func (srv *Storage) WithUpdateBucketAllowedFileExtensions(v []string) UpdateBucketOption
func (*Storage) WithUpdateBucketAntivirus ¶
func (srv *Storage) WithUpdateBucketAntivirus(v bool) UpdateBucketOption
func (*Storage) WithUpdateBucketCompression ¶
func (srv *Storage) WithUpdateBucketCompression(v string) UpdateBucketOption
func (*Storage) WithUpdateBucketEnabled ¶
func (srv *Storage) WithUpdateBucketEnabled(v bool) UpdateBucketOption
func (*Storage) WithUpdateBucketEncryption ¶
func (srv *Storage) WithUpdateBucketEncryption(v bool) UpdateBucketOption
func (*Storage) WithUpdateBucketFileSecurity ¶
func (srv *Storage) WithUpdateBucketFileSecurity(v bool) UpdateBucketOption
func (*Storage) WithUpdateBucketMaximumFileSize ¶
func (srv *Storage) WithUpdateBucketMaximumFileSize(v int) UpdateBucketOption
func (*Storage) WithUpdateBucketPermissions ¶
func (srv *Storage) WithUpdateBucketPermissions(v []string) UpdateBucketOption
func (*Storage) WithUpdateFileName ¶
func (srv *Storage) WithUpdateFileName(v string) UpdateFileOption
func (*Storage) WithUpdateFilePermissions ¶
func (srv *Storage) WithUpdateFilePermissions(v []string) UpdateFileOption
type UpdateBucketOption ¶
type UpdateBucketOption func(*UpdateBucketOptions)
type UpdateBucketOptions ¶
type UpdateBucketOptions struct {
Permissions []string
FileSecurity bool
Enabled bool
MaximumFileSize int
AllowedFileExtensions []string
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)
type UpdateFileOptions ¶
type UpdateFileOptions struct {
Name string
Permissions []string
// contains filtered or unexported fields
}
func (UpdateFileOptions) New ¶
func (options UpdateFileOptions) New() *UpdateFileOptions