Databases

Struct Databases 

Source
pub struct Databases;

Implementations§

Source§

impl Databases

Source

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?
Source

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?
Source

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.

Source

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?
Source

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.

Source

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)?
Source

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?
Source

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.

Source

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?
Source

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.

Source

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)?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

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?
Source

pub async fn get_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, ) -> Result<Value, Error>

Get attribute

Get attribute by ID.

Source

pub async fn delete_attribute( client: &Client, database_id: &str, collection_id: &str, key: &str, ) -> Result<(), Error>

Delete attribute

Deletes an attribute.

Source

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?
Source

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)?
Source

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)?
Source

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)?
Source

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)?
Source

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.

Source

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)?
Source

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)?
Source

pub async fn get_index( client: &Client, database_id: &str, collection_id: &str, key: &str, ) -> Result<Index, Error>

Get index

Get index by ID.

Source

pub async fn delete_index( client: &Client, database_id: &str, collection_id: &str, key: &str, ) -> Result<(), Error>

Delete index

Delete an index.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,