Appwrite C++ SDK
Auto-generated API documentation for the Appwrite C++ SDK
|
Provides methods to interact with Appwrite's Storage service. More...
#include <Storage.hpp>
Public Member Functions | |
std::string | createBucket (const std::string &bucketId, const std::string &name, const std::vector< std::string > &permissions={}, bool fileSecurity=false, bool enabled=true, int maximumFileSize=0, const std::vector< std::string > &allowedFileExtensions={}, const std::string &compression="none", bool encryption=false, bool antivirus=false) |
Creates a new storage bucket. | |
std::string | createFile (const std::string &bucketId, const std::string &fileName, const std::string &fileContent, const std::vector< std::string > &permissions) |
Uploads a file to the specified bucket. | |
std::string | deleteBucket (std::string &bucketId) |
Deletes a storage bucket. | |
std::string | deleteFile (const std::string &bucketId, const std::string &fileId) |
Deletes a file from the bucket. | |
std::string | getBucket (std::string &bucketId) |
Retrieves metadata of a specific bucket. | |
std::string | getFile (const std::string &bucketId, const std::string &fileId) |
Retrieves metadata of a specific file. | |
std::string | getFileDownload (const std::string &bucketId, const std::string &fileId) |
Returns a downloadable URL for a file. | |
std::string | getFileView (const std::string &bucketId, const std::string &fileId) |
Returns a file preview URL. | |
std::string | listBuckets () |
Lists all buckets in the project. | |
Storage (const std::string &projectId, const std::string &apiKey) | |
Constructs the Storage client with given project ID and API key. | |
std::string | updateBucket (const std::string &bucketId, const std::string &name, const std::vector< std::string > &permissions={}, bool fileSecurity=false, bool enabled=true, int maximumFileSize=0, const std::vector< std::string > &allowedFileExtensions={}, const std::string &compression="none", bool encryption=false, bool antivirus=false) |
Updates an existing storage bucket. | |
std::string | updateFile (const std::string &bucketId, const std::string &fileId, const std::string &name="", const std::vector< std::string > &permissions={}) |
Updates file metadata and permissions. | |
Provides methods to interact with Appwrite's Storage service.
Enables management of buckets and files including creation, retrieval, update, and deletion.
Definition at line 19 of file Storage.hpp.
Storage::Storage | ( | const std::string & | projectId, |
const std::string & | apiKey | ||
) |
std::string Storage::createBucket | ( | const std::string & | bucketId, |
const std::string & | name, | ||
const std::vector< std::string > & | permissions = {} , |
||
bool | fileSecurity = false , |
||
bool | enabled = true , |
||
int | maximumFileSize = 0 , |
||
const std::vector< std::string > & | allowedFileExtensions = {} , |
||
const std::string & | compression = "none" , |
||
bool | encryption = false , |
||
bool | antivirus = false |
||
) |
Creates a new storage bucket.
bucketId | Unique ID for the bucket. |
name | Name of the bucket. |
permissions | Optional permissions list. |
fileSecurity | Flag for enabling file-level security. |
enabled | Enables or disables the bucket. |
maximumFileSize | Optional max file size limit. |
allowedFileExtensions | Optional list of allowed file extensions. |
compression | Compression type ("none", "gzip", etc.). |
encryption | Enable server-side encryption. |
antivirus | Enable antivirus scanning. |
std::string Storage::createFile | ( | const std::string & | bucketId, |
const std::string & | fileName, | ||
const std::string & | fileContent, | ||
const std::vector< std::string > & | permissions | ||
) |
Uploads a file to the specified bucket.
bucketId | Target bucket ID. |
fileName | Name to give the file. |
fileContent | File content (base64 or raw). |
permissions | Optional permissions list. |
std::string Storage::deleteBucket | ( | std::string & | bucketId | ) |
Deletes a storage bucket.
bucketId | ID of the bucket to delete. |
std::string Storage::deleteFile | ( | const std::string & | bucketId, |
const std::string & | fileId | ||
) |
Deletes a file from the bucket.
bucketId | Bucket ID. |
fileId | File ID. |
std::string Storage::getBucket | ( | std::string & | bucketId | ) |
Retrieves metadata of a specific bucket.
bucketId | ID of the bucket to retrieve. |
std::string Storage::getFile | ( | const std::string & | bucketId, |
const std::string & | fileId | ||
) |
Retrieves metadata of a specific file.
bucketId | Bucket ID where file is stored. |
fileId | Unique file identifier. |
std::string Storage::getFileDownload | ( | const std::string & | bucketId, |
const std::string & | fileId | ||
) |
Returns a downloadable URL for a file.
bucketId | Bucket ID. |
fileId | File ID. |
std::string Storage::getFileView | ( | const std::string & | bucketId, |
const std::string & | fileId | ||
) |
Returns a file preview URL.
bucketId | Bucket ID. |
fileId | File ID. |
std::string Storage::listBuckets | ( | ) |
Lists all buckets in the project.
std::string Storage::updateBucket | ( | const std::string & | bucketId, |
const std::string & | name, | ||
const std::vector< std::string > & | permissions = {} , |
||
bool | fileSecurity = false , |
||
bool | enabled = true , |
||
int | maximumFileSize = 0 , |
||
const std::vector< std::string > & | allowedFileExtensions = {} , |
||
const std::string & | compression = "none" , |
||
bool | encryption = false , |
||
bool | antivirus = false |
||
) |
Updates an existing storage bucket.
bucketId | Unique ID of the bucket. |
name | New name for the bucket. |
permissions | Updated permissions list. |
fileSecurity | Updated file-level security flag. |
enabled | Whether the bucket is enabled. |
maximumFileSize | Updated max file size limit. |
allowedFileExtensions | Updated list of allowed extensions. |
compression | Updated compression type. |
encryption | Toggle encryption. |
antivirus | Toggle antivirus. |
std::string Storage::updateFile | ( | const std::string & | bucketId, |
const std::string & | fileId, | ||
const std::string & | name = "" , |
||
const std::vector< std::string > & | permissions = {} |
||
) |
Updates file metadata and permissions.
bucketId | Bucket ID. |
fileId | File ID. |
name | New name for the file (optional). |
permissions | New permissions list. |