pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
pub fn new(client: &Client) -> Self
Sourcepub fn list_collections(
&self,
search: Option<&str>,
limit: Option<i64>,
offset: Option<i64>,
cursor: Option<&str>,
cursor_direction: Option<&str>,
order_type: Option<&str>,
) -> Result<CollectionList, AppwriteException>
pub fn list_collections( &self, search: Option<&str>, limit: Option<i64>, offset: Option<i64>, cursor: Option<&str>, cursor_direction: Option<&str>, order_type: Option<&str>, ) -> Result<CollectionList, AppwriteException>
Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project’s collections. Learn more about different API modes.
Sourcepub fn create_collection(
&self,
collection_id: &str,
name: &str,
permission: &str,
read: &[&str],
write: &[&str],
) -> Result<Collection, AppwriteException>
pub fn create_collection( &self, collection_id: &str, name: &str, permission: &str, read: &[&str], write: &[&str], ) -> Result<Collection, AppwriteException>
Create a new Collection.
Sourcepub fn get_collection(
&self,
collection_id: &str,
) -> Result<Collection, AppwriteException>
pub fn get_collection( &self, collection_id: &str, ) -> Result<Collection, AppwriteException>
Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
Sourcepub fn update_collection(
&self,
collection_id: &str,
name: &str,
permission: &str,
read: Option<&[&str]>,
write: Option<&[&str]>,
enabled: Option<bool>,
) -> Result<Collection, AppwriteException>
pub fn update_collection( &self, collection_id: &str, name: &str, permission: &str, read: Option<&[&str]>, write: Option<&[&str]>, enabled: Option<bool>, ) -> Result<Collection, AppwriteException>
Update a collection by its unique ID.
Sourcepub fn delete_collection(
&self,
collection_id: &str,
) -> Result<Value, AppwriteException>
pub fn delete_collection( &self, collection_id: &str, ) -> Result<Value, AppwriteException>
Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
pub fn list_attributes( &self, collection_id: &str, ) -> Result<AttributeList, AppwriteException>
Sourcepub fn create_boolean_attribute(
&self,
collection_id: &str,
key: &str,
required: bool,
default: Option<bool>,
array: Option<bool>,
) -> Result<AttributeBoolean, AppwriteException>
pub fn create_boolean_attribute( &self, collection_id: &str, key: &str, required: bool, default: Option<bool>, array: Option<bool>, ) -> Result<AttributeBoolean, AppwriteException>
Create a boolean attribute.
Sourcepub fn create_email_attribute(
&self,
collection_id: &str,
key: &str,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeEmail, AppwriteException>
pub fn create_email_attribute( &self, collection_id: &str, key: &str, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeEmail, AppwriteException>
Create an email attribute.
pub fn create_enum_attribute( &self, collection_id: &str, key: &str, elements: &[&str], required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeEnum, AppwriteException>
Sourcepub fn create_float_attribute(
&self,
collection_id: &str,
key: &str,
required: bool,
min: Option<f64>,
max: Option<f64>,
default: Option<f64>,
array: Option<bool>,
) -> Result<AttributeFloat, AppwriteException>
pub fn create_float_attribute( &self, collection_id: &str, key: &str, required: bool, min: Option<f64>, max: Option<f64>, default: Option<f64>, array: Option<bool>, ) -> Result<AttributeFloat, AppwriteException>
Create a float attribute. Optionally, minimum and maximum values can be provided.
Sourcepub fn create_integer_attribute(
&self,
collection_id: &str,
key: &str,
required: bool,
min: Option<i64>,
max: Option<i64>,
default: Option<i64>,
array: Option<bool>,
) -> Result<AttributeInteger, AppwriteException>
pub fn create_integer_attribute( &self, collection_id: &str, key: &str, required: bool, min: Option<i64>, max: Option<i64>, default: Option<i64>, array: Option<bool>, ) -> Result<AttributeInteger, AppwriteException>
Create an integer attribute. Optionally, minimum and maximum values can be provided.
Sourcepub fn create_ip_attribute(
&self,
collection_id: &str,
key: &str,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeIp, AppwriteException>
pub fn create_ip_attribute( &self, collection_id: &str, key: &str, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeIp, AppwriteException>
Create IP address attribute.
Sourcepub fn create_string_attribute(
&self,
collection_id: &str,
key: &str,
size: i64,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeString, AppwriteException>
pub fn create_string_attribute( &self, collection_id: &str, key: &str, size: i64, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeString, AppwriteException>
Create a string attribute.
Sourcepub fn create_url_attribute(
&self,
collection_id: &str,
key: &str,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeUrl, AppwriteException>
pub fn create_url_attribute( &self, collection_id: &str, key: &str, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeUrl, AppwriteException>
Create a URL attribute.
pub fn get_attribute( &self, collection_id: &str, key: &str, ) -> Result<Value, AppwriteException>
pub fn delete_attribute( &self, collection_id: &str, key: &str, ) -> Result<Value, AppwriteException>
Sourcepub fn list_documents(
&self,
collection_id: &str,
queries: Option<&[&str]>,
limit: Option<i64>,
offset: Option<i64>,
cursor: Option<&str>,
cursor_direction: Option<&str>,
order_attributes: Option<&[&str]>,
order_types: Option<&[&str]>,
) -> Result<DocumentList, AppwriteException>
pub fn list_documents( &self, collection_id: &str, queries: Option<&[&str]>, limit: Option<i64>, offset: Option<i64>, cursor: Option<&str>, cursor_direction: Option<&str>, order_attributes: Option<&[&str]>, order_types: Option<&[&str]>, ) -> Result<DocumentList, AppwriteException>
Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project’s documents. Learn more about different API modes.
Sourcepub fn create_document(
&self,
collection_id: &str,
document_id: &str,
data: Option<HashMap<String, ParamType>>,
read: Option<&[&str]>,
write: Option<&[&str]>,
) -> Result<Document, AppwriteException>
pub fn create_document( &self, collection_id: &str, document_id: &str, data: Option<HashMap<String, ParamType>>, read: Option<&[&str]>, write: Option<&[&str]>, ) -> Result<Document, AppwriteException>
Create a new Document. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.
Sourcepub fn get_document(
&self,
collection_id: &str,
document_id: &str,
) -> Result<Document, AppwriteException>
pub fn get_document( &self, collection_id: &str, document_id: &str, ) -> Result<Document, AppwriteException>
Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
Sourcepub fn update_document(
&self,
collection_id: &str,
document_id: &str,
data: Option<HashMap<String, ParamType>>,
read: Option<&[&str]>,
write: Option<&[&str]>,
) -> Result<Document, AppwriteException>
pub fn update_document( &self, collection_id: &str, document_id: &str, data: Option<HashMap<String, ParamType>>, read: Option<&[&str]>, write: Option<&[&str]>, ) -> Result<Document, AppwriteException>
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
Sourcepub fn delete_document(
&self,
collection_id: &str,
document_id: &str,
) -> Result<Value, AppwriteException>
pub fn delete_document( &self, collection_id: &str, document_id: &str, ) -> Result<Value, AppwriteException>
Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents will not be deleted.
Sourcepub fn list_document_logs(
&self,
collection_id: &str,
document_id: &str,
limit: Option<i64>,
offset: Option<i64>,
) -> Result<LogList, AppwriteException>
pub fn list_document_logs( &self, collection_id: &str, document_id: &str, limit: Option<i64>, offset: Option<i64>, ) -> Result<LogList, AppwriteException>
Get the document activity logs list by its unique ID.
pub fn list_indexes( &self, collection_id: &str, ) -> Result<IndexList, AppwriteException>
pub fn create_index( &self, collection_id: &str, key: &str, xtype: &str, attributes: &[&str], orders: Option<&[&str]>, ) -> Result<Index, AppwriteException>
pub fn get_index( &self, collection_id: &str, key: &str, ) -> Result<Index, AppwriteException>
pub fn delete_index( &self, collection_id: &str, key: &str, ) -> Result<Value, AppwriteException>
Sourcepub fn list_collection_logs(
&self,
collection_id: &str,
limit: Option<i64>,
offset: Option<i64>,
) -> Result<LogList, AppwriteException>
pub fn list_collection_logs( &self, collection_id: &str, limit: Option<i64>, offset: Option<i64>, ) -> Result<LogList, AppwriteException>
Get the collection activity logs list by its unique ID.