pub struct Databases;Implementations§
Source§impl Databases
impl Databases
Sourcepub async fn list(
client: &Client,
args: HashMap<String, Value>,
) -> Result<DatabaseList, Error>
pub async fn list( client: &Client, args: HashMap<String, Value>, ) -> Result<DatabaseList, Error>
List databases
Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
- queries => vec(string)?
- search => string?
Sourcepub async fn create(
client: &Client,
args: HashMap<String, Value>,
) -> Result<Database, Error>
pub async fn create( client: &Client, args: HashMap<String, Value>, ) -> Result<Database, Error>
Create database
Create a new Database.
- databaseId => string
- name => string
- enabled => bool?
Sourcepub async fn get(client: &Client, database_id: &str) -> Result<Database, Error>
pub async fn get(client: &Client, database_id: &str) -> Result<Database, Error>
Get database
Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
Sourcepub async fn update(
client: &Client,
database_id: &str,
args: HashMap<String, Value>,
) -> Result<Database, Error>
pub async fn update( client: &Client, database_id: &str, args: HashMap<String, Value>, ) -> Result<Database, Error>
Update database
Update a database by its unique ID.
- name => string
- enabled => bool?
Sourcepub async fn delete(client: &Client, database_id: &str) -> Result<(), Error>
pub async fn delete(client: &Client, database_id: &str) -> Result<(), Error>
Delete database
Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
Sourcepub async fn list_collections(
client: &Client,
database_id: &str,
args: HashMap<String, Value>,
) -> Result<CollectionList, Error>
pub async fn list_collections( client: &Client, database_id: &str, args: HashMap<String, Value>, ) -> Result<CollectionList, Error>
List collections
Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
- search => string?
- queries => vec(string)?
Sourcepub async fn create_collection(
client: &Client,
database_id: &str,
args: HashMap<String, Value>,
) -> Result<Collection, Error>
pub async fn create_collection( client: &Client, database_id: &str, args: HashMap<String, Value>, ) -> Result<Collection, Error>
Create 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.
- collectionId => string
- name => string
- permissions => option(vec)?
- documentSecurity => bool?
- enabled => bool?
Sourcepub async fn get_collection(
client: &Client,
database_id: &str,
collection_id: &str,
) -> Result<Collection, Error>
pub async fn get_collection( client: &Client, database_id: &str, collection_id: &str, ) -> Result<Collection, Error>
Get collection
Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
Sourcepub async fn update_collection(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<Collection, Error>
pub async fn update_collection( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<Collection, Error>
Update collection
Update a collection by its unique ID.
- name => string
- permissions => vec(string)?
- documentSecurity => bool?
- enabled => bool?
Sourcepub async fn delete_collection(
client: &Client,
database_id: &str,
collection_id: &str,
) -> Result<(), Error>
pub async fn delete_collection( client: &Client, database_id: &str, collection_id: &str, ) -> Result<(), Error>
Delete collection
Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
Sourcepub async fn list_attributes(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeList, Error>
pub async fn list_attributes( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeList, Error>
List attributes
List attributes in the collection.
- queries => vec(string)?
Sourcepub async fn create_boolean_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeBoolean, Error>
pub async fn create_boolean_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeBoolean, Error>
Create boolean attribute
Create a boolean attribute.
- key => string
- required => bool
- default => bool?
- array => bool?
Sourcepub async fn update_boolean_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeBoolean, Error>
pub async fn update_boolean_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeBoolean, Error>
Update boolean attribute
Update a boolean attribute. Changing the default value will not update
already existing documents.
- required => bool
- default => bool?
Sourcepub async fn create_date_time_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeDateTime, Error>
pub async fn create_date_time_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeDateTime, Error>
Create datetime attribute
Create a date time attribute according to the ISO 8601 standard.
- key => string
- required => bool
- default => bool?
- array => bool?
Sourcepub async fn update_date_time_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeDateTime, Error>
pub async fn update_date_time_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeDateTime, Error>
Update dateTime attribute
Update a date time attribute. Changing the default value will not update
already existing documents.
- required => bool
- default => bool?
Sourcepub async fn create_email_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeEmail, Error>
pub async fn create_email_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeEmail, Error>
Create email attribute
Create an email attribute.
- key => string
- required => bool
- default => bool?
- array => bool?
Sourcepub async fn update_email_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeEmail, Error>
pub async fn update_email_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeEmail, Error>
Update email attribute
Update an email attribute. Changing the default value will not update
already existing documents.
- required => bool
- default => string?
Sourcepub async fn create_enum_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeEnum, Error>
pub async fn create_enum_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeEnum, Error>
Create enum attribute
- key => string
- elements => vec(string)
- required => bool
- default => bool?
- array => bool?
Sourcepub async fn update_enum_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeEnum, Error>
pub async fn update_enum_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeEnum, Error>
Update enum attribute
Update an enum attribute. Changing the default value will not update
already existing documents.
- elements => vec(string)
- required => bool
- default => bool?
Sourcepub async fn create_float_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeFloat, Error>
pub async fn create_float_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeFloat, Error>
Create float attribute
Create a float attribute. Optionally, minimum and maximum values can be provided.
- key => string
- required => bool
- min => float?
- max => float?
- default => float?
- array => bool?
Sourcepub async fn update_float_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeFloat, Error>
pub async fn update_float_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeFloat, Error>
Update float attribute
Update a float attribute. Changing the default value will not update
already existing documents.
- required => bool
- min => float?
- max => float?
- default => float?
Sourcepub async fn create_integer_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeInteger, Error>
pub async fn create_integer_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeInteger, Error>
Create integer attribute
Create an integer attribute. Optionally, minimum and maximum values can be provided.
- key => string
- required => bool
- min => number?
- max => number?
- default => number?
- array => bool?
Sourcepub async fn update_integer_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeInteger, Error>
pub async fn update_integer_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeInteger, Error>
Update integer attribute
Update an integer attribute. Changing the default value will not update
already existing documents.
- required => bool
- min => number?
- max => number?
- default => number?
Sourcepub async fn create_ip_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeIp, Error>
pub async fn create_ip_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeIp, Error>
Create IP address attribute
Create IP address attribute.
- key => string
- required => bool
- default => string?
- array => bool?
Sourcepub async fn update_ip_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeIp, Error>
pub async fn update_ip_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeIp, Error>
Update IP address attribute
Update an ip attribute. Changing the default value will not update
already existing documents.
- required => bool
- default => string?
Sourcepub async fn create_relationship_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeRelationship, Error>
pub async fn create_relationship_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeRelationship, Error>
Create relationship attribute
Create relationship attribute. Learn more about relationship attributes.
- relatedCollectionId => string
- type => RelationshipType
- twoWay => bool?
- key => string?
- twoWayKey => string?
- onDelete => RelationMutate?
Sourcepub async fn create_string_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeString, Error>
pub async fn create_string_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeString, Error>
Create string attribute
Create a string attribute.
- key => string
- size => number
- required => bool
- default => string?
- array => bool?
- encrypt => bool?
Sourcepub async fn update_string_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeString, Error>
pub async fn update_string_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeString, Error>
Update string attribute
Update a string attribute. Changing the default value will not update
already existing documents.
- required => bool
- default => string?
Sourcepub async fn create_url_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<AttributeUrl, Error>
pub async fn create_url_attribute( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<AttributeUrl, Error>
Create URL attribute
Create a URL attribute.
- key => string
- required => bool
- default => string?
- array => bool?
Sourcepub async fn update_url_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeUrl, Error>
pub async fn update_url_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeUrl, Error>
Update URL attribute
Update an url attribute. Changing the default value will not update
already existing documents.
- required => bool
- default => string?
Sourcepub async fn get_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
) -> Result<Value, Error>
pub async fn get_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, ) -> Result<Value, Error>
Get attribute
Get attribute by ID.
Sourcepub async fn delete_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
) -> Result<(), Error>
pub async fn delete_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, ) -> Result<(), Error>
Delete attribute
Deletes an attribute.
Sourcepub async fn update_relationship_attribute(
client: &Client,
database_id: &str,
collection_id: &str,
key: &str,
args: HashMap<String, Value>,
) -> Result<AttributeRelationship, Error>
pub async fn update_relationship_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, args: HashMap<String, Value>, ) -> Result<AttributeRelationship, Error>
Update relationship attribute
Update relationship attribute. Learn more about relationship attributes.
- onDelete => RelationMutate?
Sourcepub async fn list_documents(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<DocumentList, Error>
pub async fn list_documents( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<DocumentList, Error>
List documents
Get a list of all the user’s documents in a given collection. You can use the query params to filter your results.
- queries => vec(string)?
Sourcepub async fn create_documents(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<Document, Error>
pub async fn create_documents( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<Document, Error>
Create 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.
- documentId => string
- data => HashMap<String, Value>
- permissions => vec(string)?
Sourcepub async fn get_document(
client: &Client,
database_id: &str,
collection_id: &str,
document_id: &str,
args: HashMap<String, Value>,
) -> Result<Document, Error>
pub async fn get_document( client: &Client, database_id: &str, collection_id: &str, document_id: &str, args: HashMap<String, Value>, ) -> Result<Document, Error>
Get document
Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
- queries => vec(string)?
Sourcepub async fn update_document(
client: &Client,
database_id: &str,
collection_id: &str,
document_id: &str,
args: HashMap<String, Value>,
) -> Result<Document, Error>
pub async fn update_document( client: &Client, database_id: &str, collection_id: &str, document_id: &str, args: HashMap<String, Value>, ) -> Result<Document, Error>
Update document
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
- data => HashMap<String,Value>?
- permissions => vec(string)?
Sourcepub async fn delete_document(
client: &Client,
database_id: &str,
collection_id: &str,
document_id: &str,
) -> Result<(), Error>
pub async fn delete_document( client: &Client, database_id: &str, collection_id: &str, document_id: &str, ) -> Result<(), Error>
Delete document
Delete a document by its unique ID.
Sourcepub async fn list_indexes(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<IndexList, Error>
pub async fn list_indexes( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<IndexList, Error>
List indexes
List indexes in the collection.
- queries => vec(string)?
Sourcepub async fn create_index(
client: &Client,
database_id: &str,
collection_id: &str,
args: HashMap<String, Value>,
) -> Result<Index, Error>
pub async fn create_index( client: &Client, database_id: &str, collection_id: &str, args: HashMap<String, Value>, ) -> Result<Index, Error>
Create 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.
- key => string
- type => IndexType
- attributes => vec(string)
- orders => vec(string)?