pub struct Databases { /* private fields */ }Expand description
The Databases service allows you to create structured collections of documents, query and filter lists of documents
Implementations§
Source§impl Databases
impl Databases
pub fn new(client: &Client) -> Self
pub fn client(&self) -> &Client
Sourcepub async fn list(
&self,
queries: Option<Vec<String>>,
search: Option<&str>,
total: Option<bool>,
) -> Result<DatabaseList>
pub async fn list( &self, queries: Option<Vec<String>>, search: Option<&str>, total: Option<bool>, ) -> Result<DatabaseList>
Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
Sourcepub async fn create(
&self,
database_id: impl Into<String>,
name: impl Into<String>,
enabled: Option<bool>,
) -> Result<Database>
pub async fn create( &self, database_id: impl Into<String>, name: impl Into<String>, enabled: Option<bool>, ) -> Result<Database>
Create a new Database.
Sourcepub async fn list_transactions(
&self,
queries: Option<Vec<String>>,
) -> Result<TransactionList>
pub async fn list_transactions( &self, queries: Option<Vec<String>>, ) -> Result<TransactionList>
List transactions across all databases.
Sourcepub async fn create_transaction(&self, ttl: Option<i64>) -> Result<Transaction>
pub async fn create_transaction(&self, ttl: Option<i64>) -> Result<Transaction>
Create a new transaction.
Sourcepub async fn get_transaction(
&self,
transaction_id: impl Into<String>,
) -> Result<Transaction>
pub async fn get_transaction( &self, transaction_id: impl Into<String>, ) -> Result<Transaction>
Get a transaction by its unique ID.
Sourcepub async fn update_transaction(
&self,
transaction_id: impl Into<String>,
commit: Option<bool>,
rollback: Option<bool>,
) -> Result<Transaction>
pub async fn update_transaction( &self, transaction_id: impl Into<String>, commit: Option<bool>, rollback: Option<bool>, ) -> Result<Transaction>
Update a transaction, to either commit or roll back its operations.
Sourcepub async fn delete_transaction(
&self,
transaction_id: impl Into<String>,
) -> Result<()>
pub async fn delete_transaction( &self, transaction_id: impl Into<String>, ) -> Result<()>
Delete a transaction by its unique ID.
Sourcepub async fn create_operations(
&self,
transaction_id: impl Into<String>,
operations: Option<Vec<Value>>,
) -> Result<Transaction>
pub async fn create_operations( &self, transaction_id: impl Into<String>, operations: Option<Vec<Value>>, ) -> Result<Transaction>
Create multiple operations in a single transaction.
Sourcepub async fn get(&self, database_id: impl Into<String>) -> Result<Database>
pub async fn get(&self, database_id: impl Into<String>) -> Result<Database>
Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
Sourcepub async fn update(
&self,
database_id: impl Into<String>,
name: Option<&str>,
enabled: Option<bool>,
) -> Result<Database>
pub async fn update( &self, database_id: impl Into<String>, name: Option<&str>, enabled: Option<bool>, ) -> Result<Database>
Update a database by its unique ID.
Sourcepub async fn delete(&self, database_id: impl Into<String>) -> Result<()>
pub async fn delete(&self, database_id: impl Into<String>) -> Result<()>
Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
Sourcepub async fn list_collections(
&self,
database_id: impl Into<String>,
queries: Option<Vec<String>>,
search: Option<&str>,
total: Option<bool>,
) -> Result<CollectionList>
pub async fn list_collections( &self, database_id: impl Into<String>, queries: Option<Vec<String>>, search: Option<&str>, total: Option<bool>, ) -> Result<CollectionList>
Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
Sourcepub async fn create_collection(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
name: impl Into<String>,
permissions: Option<Vec<String>>,
document_security: Option<bool>,
enabled: Option<bool>,
attributes: Option<Vec<Value>>,
indexes: Option<Vec<Value>>,
) -> Result<Collection>
pub async fn create_collection( &self, database_id: impl Into<String>, collection_id: impl Into<String>, name: impl Into<String>, permissions: Option<Vec<String>>, document_security: Option<bool>, enabled: Option<bool>, attributes: Option<Vec<Value>>, indexes: Option<Vec<Value>>, ) -> Result<Collection>
Create a new Collection. Before using this route, you should create a new database resource using either a server integration API or directly from your database console.
Sourcepub async fn get_collection(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
) -> Result<Collection>
pub async fn get_collection( &self, database_id: impl Into<String>, collection_id: impl Into<String>, ) -> Result<Collection>
Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
Sourcepub async fn update_collection(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
name: Option<&str>,
permissions: Option<Vec<String>>,
document_security: Option<bool>,
enabled: Option<bool>,
purge: Option<bool>,
) -> Result<Collection>
pub async fn update_collection( &self, database_id: impl Into<String>, collection_id: impl Into<String>, name: Option<&str>, permissions: Option<Vec<String>>, document_security: Option<bool>, enabled: Option<bool>, purge: Option<bool>, ) -> Result<Collection>
Update a collection by its unique ID.
Sourcepub async fn delete_collection(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
) -> Result<()>
pub async fn delete_collection( &self, database_id: impl Into<String>, collection_id: impl Into<String>, ) -> Result<()>
Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
Sourcepub async fn list_attributes(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
queries: Option<Vec<String>>,
total: Option<bool>,
) -> Result<AttributeList>
pub async fn list_attributes( &self, database_id: impl Into<String>, collection_id: impl Into<String>, queries: Option<Vec<String>>, total: Option<bool>, ) -> Result<AttributeList>
List attributes in the collection.
Sourcepub async fn create_big_int_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
min: Option<i64>,
max: Option<i64>,
default: Option<i64>,
array: Option<bool>,
) -> Result<AttributeBigint>
pub async fn create_big_int_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, min: Option<i64>, max: Option<i64>, default: Option<i64>, array: Option<bool>, ) -> Result<AttributeBigint>
Create a bigint attribute. Optionally, minimum and maximum values can be provided.
Sourcepub async fn update_big_int_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<i64>,
min: Option<i64>,
max: Option<i64>,
new_key: Option<&str>,
) -> Result<AttributeBigint>
pub async fn update_big_int_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<i64>, min: Option<i64>, max: Option<i64>, new_key: Option<&str>, ) -> Result<AttributeBigint>
Update a bigint attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_boolean_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<bool>,
array: Option<bool>,
) -> Result<AttributeBoolean>
pub async fn create_boolean_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<bool>, array: Option<bool>, ) -> Result<AttributeBoolean>
Create a boolean attribute.
Sourcepub async fn update_boolean_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<bool>,
new_key: Option<&str>,
) -> Result<AttributeBoolean>
pub async fn update_boolean_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<bool>, new_key: Option<&str>, ) -> Result<AttributeBoolean>
Update a boolean attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_datetime_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeDatetime>
pub async fn create_datetime_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeDatetime>
Create a date time attribute according to the ISO 8601 standard.
Sourcepub async fn update_datetime_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
new_key: Option<&str>,
) -> Result<AttributeDatetime>
pub async fn update_datetime_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<AttributeDatetime>
Update a date time attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_email_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeEmail>
pub async fn create_email_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeEmail>
Create an email attribute.
Sourcepub async fn update_email_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
new_key: Option<&str>,
) -> Result<AttributeEmail>
pub async fn update_email_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<AttributeEmail>
Update an email attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_enum_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
elements: impl IntoIterator<Item = impl Into<String>>,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeEnum>
pub async fn create_enum_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, elements: impl IntoIterator<Item = impl Into<String>>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeEnum>
Create an enum attribute. The elements param acts as a white-list of
accepted values for this attribute.
Sourcepub async fn update_enum_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
elements: impl IntoIterator<Item = impl Into<String>>,
required: bool,
default: Option<&str>,
new_key: Option<&str>,
) -> Result<AttributeEnum>
pub async fn update_enum_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, elements: impl IntoIterator<Item = impl Into<String>>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<AttributeEnum>
Update an enum attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_float_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
min: Option<f64>,
max: Option<f64>,
default: Option<f64>,
array: Option<bool>,
) -> Result<AttributeFloat>
pub async fn create_float_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, min: Option<f64>, max: Option<f64>, default: Option<f64>, array: Option<bool>, ) -> Result<AttributeFloat>
Create a float attribute. Optionally, minimum and maximum values can be provided.
Sourcepub async fn update_float_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<f64>,
min: Option<f64>,
max: Option<f64>,
new_key: Option<&str>,
) -> Result<AttributeFloat>
pub async fn update_float_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<f64>, min: Option<f64>, max: Option<f64>, new_key: Option<&str>, ) -> Result<AttributeFloat>
Update a float attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_integer_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
min: Option<i64>,
max: Option<i64>,
default: Option<i64>,
array: Option<bool>,
) -> Result<AttributeInteger>
pub async fn create_integer_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, min: Option<i64>, max: Option<i64>, default: Option<i64>, array: Option<bool>, ) -> Result<AttributeInteger>
Create an integer attribute. Optionally, minimum and maximum values can be provided.
Sourcepub async fn update_integer_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<i64>,
min: Option<i64>,
max: Option<i64>,
new_key: Option<&str>,
) -> Result<AttributeInteger>
pub async fn update_integer_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<i64>, min: Option<i64>, max: Option<i64>, new_key: Option<&str>, ) -> Result<AttributeInteger>
Update an integer attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_ip_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeIp>
pub async fn create_ip_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeIp>
Create IP address attribute.
Sourcepub async fn update_ip_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
new_key: Option<&str>,
) -> Result<AttributeIp>
pub async fn update_ip_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<AttributeIp>
Update an ip attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_line_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<Vec<String>>,
) -> Result<AttributeLine>
pub async fn create_line_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, ) -> Result<AttributeLine>
Create a geometric line attribute.
Sourcepub async fn update_line_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<Vec<String>>,
new_key: Option<&str>,
) -> Result<AttributeLine>
pub async fn update_line_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, new_key: Option<&str>, ) -> Result<AttributeLine>
Update a line attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_longtext_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
array: Option<bool>,
encrypt: Option<bool>,
) -> Result<AttributeLongtext>
pub async fn create_longtext_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<AttributeLongtext>
Create a longtext attribute.
Sourcepub async fn update_longtext_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
new_key: Option<&str>,
) -> Result<AttributeLongtext>
pub async fn update_longtext_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<AttributeLongtext>
Update a longtext attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_mediumtext_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
array: Option<bool>,
encrypt: Option<bool>,
) -> Result<AttributeMediumtext>
pub async fn create_mediumtext_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<AttributeMediumtext>
Create a mediumtext attribute.
Sourcepub async fn update_mediumtext_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
new_key: Option<&str>,
) -> Result<AttributeMediumtext>
pub async fn update_mediumtext_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<AttributeMediumtext>
Update a mediumtext attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_point_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<Vec<String>>,
) -> Result<AttributePoint>
pub async fn create_point_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, ) -> Result<AttributePoint>
Create a geometric point attribute.
Sourcepub async fn update_point_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<Vec<String>>,
new_key: Option<&str>,
) -> Result<AttributePoint>
pub async fn update_point_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, new_key: Option<&str>, ) -> Result<AttributePoint>
Update a point attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_polygon_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<Vec<String>>,
) -> Result<AttributePolygon>
pub async fn create_polygon_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, ) -> Result<AttributePolygon>
Create a geometric polygon attribute.
Sourcepub async fn update_polygon_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<Vec<String>>,
new_key: Option<&str>,
) -> Result<AttributePolygon>
pub async fn update_polygon_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, new_key: Option<&str>, ) -> Result<AttributePolygon>
Update a polygon attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_relationship_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
related_collection_id: impl Into<String>,
type: RelationshipType,
two_way: Option<bool>,
key: Option<&str>,
two_way_key: Option<&str>,
on_delete: Option<RelationMutate>,
) -> Result<AttributeRelationship>
pub async fn create_relationship_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, related_collection_id: impl Into<String>, type: RelationshipType, two_way: Option<bool>, key: Option<&str>, two_way_key: Option<&str>, on_delete: Option<RelationMutate>, ) -> Result<AttributeRelationship>
Create relationship attribute. Learn more about relationship attributes.
Sourcepub async fn update_relationship_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
on_delete: Option<RelationMutate>,
new_key: Option<&str>,
) -> Result<AttributeRelationship>
pub async fn update_relationship_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, on_delete: Option<RelationMutate>, new_key: Option<&str>, ) -> Result<AttributeRelationship>
Update relationship attribute. Learn more about relationship attributes.
Sourcepub async fn create_string_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
size: i64,
required: bool,
default: Option<&str>,
array: Option<bool>,
encrypt: Option<bool>,
) -> Result<AttributeString>
pub async fn create_string_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, size: i64, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<AttributeString>
Create a string attribute.
Sourcepub async fn update_string_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
size: Option<i64>,
new_key: Option<&str>,
) -> Result<AttributeString>
pub async fn update_string_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, size: Option<i64>, new_key: Option<&str>, ) -> Result<AttributeString>
Update a string attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_text_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
array: Option<bool>,
encrypt: Option<bool>,
) -> Result<AttributeText>
pub async fn create_text_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<AttributeText>
Create a text attribute.
Sourcepub async fn update_text_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
new_key: Option<&str>,
) -> Result<AttributeText>
pub async fn update_text_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<AttributeText>
Update a text attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_url_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
array: Option<bool>,
) -> Result<AttributeUrl>
pub async fn create_url_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeUrl>
Create a URL attribute.
Sourcepub async fn update_url_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
new_key: Option<&str>,
) -> Result<AttributeUrl>
pub async fn update_url_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<AttributeUrl>
Update an url attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn create_varchar_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
size: i64,
required: bool,
default: Option<&str>,
array: Option<bool>,
encrypt: Option<bool>,
) -> Result<AttributeVarchar>
pub async fn create_varchar_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, size: i64, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<AttributeVarchar>
Create a varchar attribute.
Sourcepub async fn update_varchar_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
required: bool,
default: Option<&str>,
size: Option<i64>,
new_key: Option<&str>,
) -> Result<AttributeVarchar>
pub async fn update_varchar_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, size: Option<i64>, new_key: Option<&str>, ) -> Result<AttributeVarchar>
Update a varchar attribute. Changing the default value will not update
already existing documents.
Sourcepub async fn get_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
) -> Result<Value>
pub async fn get_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, ) -> Result<Value>
Get attribute by ID.
Sourcepub async fn delete_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
) -> Result<()>
pub async fn delete_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, ) -> Result<()>
Deletes an attribute.
Sourcepub async fn list_documents(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
queries: Option<Vec<String>>,
transaction_id: Option<&str>,
total: Option<bool>,
ttl: Option<i64>,
) -> Result<DocumentList>
pub async fn list_documents( &self, database_id: impl Into<String>, collection_id: impl Into<String>, queries: Option<Vec<String>>, transaction_id: Option<&str>, total: Option<bool>, ttl: Option<i64>, ) -> Result<DocumentList>
Get a list of all the user’s documents in a given collection. You can use the query params to filter your results.
Sourcepub async fn create_document(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
document_id: impl Into<String>,
data: Value,
permissions: Option<Vec<String>>,
transaction_id: Option<&str>,
) -> Result<Document>
pub async fn create_document( &self, database_id: impl Into<String>, collection_id: impl Into<String>, document_id: impl Into<String>, data: Value, permissions: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<Document>
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 async fn create_documents(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
documents: Vec<Value>,
transaction_id: Option<&str>,
) -> Result<DocumentList>
pub async fn create_documents( &self, database_id: impl Into<String>, collection_id: impl Into<String>, documents: Vec<Value>, transaction_id: Option<&str>, ) -> Result<DocumentList>
Create new Documents. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.
Sourcepub async fn upsert_documents(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
documents: Vec<Value>,
transaction_id: Option<&str>,
) -> Result<DocumentList>
pub async fn upsert_documents( &self, database_id: impl Into<String>, collection_id: impl Into<String>, documents: Vec<Value>, transaction_id: Option<&str>, ) -> Result<DocumentList>
Create or update Documents. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.
Sourcepub async fn update_documents(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
data: Option<Value>,
queries: Option<Vec<String>>,
transaction_id: Option<&str>,
) -> Result<DocumentList>
pub async fn update_documents( &self, database_id: impl Into<String>, collection_id: impl Into<String>, data: Option<Value>, queries: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<DocumentList>
Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.
Sourcepub async fn delete_documents(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
queries: Option<Vec<String>>,
transaction_id: Option<&str>,
) -> Result<DocumentList>
pub async fn delete_documents( &self, database_id: impl Into<String>, collection_id: impl Into<String>, queries: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<DocumentList>
Bulk delete documents using queries, if no queries are passed then all documents are deleted.
Sourcepub async fn get_document(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
document_id: impl Into<String>,
queries: Option<Vec<String>>,
transaction_id: Option<&str>,
) -> Result<Document>
pub async fn get_document( &self, database_id: impl Into<String>, collection_id: impl Into<String>, document_id: impl Into<String>, queries: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<Document>
Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
Sourcepub async fn upsert_document(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
document_id: impl Into<String>,
data: Option<Value>,
permissions: Option<Vec<String>>,
transaction_id: Option<&str>,
) -> Result<Document>
pub async fn upsert_document( &self, database_id: impl Into<String>, collection_id: impl Into<String>, document_id: impl Into<String>, data: Option<Value>, permissions: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<Document>
Create or update a 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 async fn update_document(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
document_id: impl Into<String>,
data: Option<Value>,
permissions: Option<Vec<String>>,
transaction_id: Option<&str>,
) -> Result<Document>
pub async fn update_document( &self, database_id: impl Into<String>, collection_id: impl Into<String>, document_id: impl Into<String>, data: Option<Value>, permissions: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<Document>
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
Sourcepub async fn delete_document(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
document_id: impl Into<String>,
transaction_id: Option<&str>,
) -> Result<()>
pub async fn delete_document( &self, database_id: impl Into<String>, collection_id: impl Into<String>, document_id: impl Into<String>, transaction_id: Option<&str>, ) -> Result<()>
Delete a document by its unique ID.
Sourcepub async fn decrement_document_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
document_id: impl Into<String>,
attribute: impl Into<String>,
value: Option<f64>,
min: Option<f64>,
transaction_id: Option<&str>,
) -> Result<Document>
pub async fn decrement_document_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, document_id: impl Into<String>, attribute: impl Into<String>, value: Option<f64>, min: Option<f64>, transaction_id: Option<&str>, ) -> Result<Document>
Decrement a specific attribute of a document by a given value.
Sourcepub async fn increment_document_attribute(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
document_id: impl Into<String>,
attribute: impl Into<String>,
value: Option<f64>,
max: Option<f64>,
transaction_id: Option<&str>,
) -> Result<Document>
pub async fn increment_document_attribute( &self, database_id: impl Into<String>, collection_id: impl Into<String>, document_id: impl Into<String>, attribute: impl Into<String>, value: Option<f64>, max: Option<f64>, transaction_id: Option<&str>, ) -> Result<Document>
Increment a specific attribute of a document by a given value.
Sourcepub async fn list_indexes(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
queries: Option<Vec<String>>,
total: Option<bool>,
) -> Result<IndexList>
pub async fn list_indexes( &self, database_id: impl Into<String>, collection_id: impl Into<String>, queries: Option<Vec<String>>, total: Option<bool>, ) -> Result<IndexList>
List indexes in the collection.
Sourcepub async fn create_index(
&self,
database_id: impl Into<String>,
collection_id: impl Into<String>,
key: impl Into<String>,
type: DatabasesIndexType,
attributes: impl IntoIterator<Item = impl Into<String>>,
orders: Option<Vec<OrderBy>>,
lengths: Option<Vec<i64>>,
) -> Result<Index>
pub async fn create_index( &self, database_id: impl Into<String>, collection_id: impl Into<String>, key: impl Into<String>, type: DatabasesIndexType, attributes: impl IntoIterator<Item = impl Into<String>>, orders: Option<Vec<OrderBy>>, lengths: Option<Vec<i64>>, ) -> Result<Index>
Creates an index on the attributes listed. Your index should include all
the attributes you will query in a single request.
Attributes can be key, fulltext, and unique.