Struct ParseClient

Source
pub struct ParseClient {
    pub server_url: String,
    /* private fields */
}

Fields§

§server_url: String

Implementations§

Source§

impl ParseClient

Source

pub fn new( server_url: &str, app_id: &str, javascript_key: Option<&str>, rest_api_key: Option<&str>, master_key: Option<&str>, ) -> Result<Self, ParseError>

Source

pub fn session_token(&self) -> Option<&str>

Returns the current session token, if any.

Source

pub fn is_authenticated(&self) -> bool

Checks if the client is currently authenticated (has a session token).

Source

pub async fn upload_file( &self, file_name: &str, data: Vec<u8>, mime_type: &str, ) -> Result<FileField, ParseError>

Uploads a file to the Parse Server.

§Arguments
  • file_name: The desired name for the file on the server.
  • data: The raw byte data of the file.
  • mime_type: The MIME type of the file (e.g., “image/jpeg”).
§Returns

A Result containing a FileField struct with the name and URL of the uploaded file, or a ParseError if the upload fails.

Source

pub async fn execute_aggregate<T: DeserializeOwned + Send + 'static>( &self, class_name: &str, pipeline: Value, ) -> Result<Vec<T>, ParseError>

Source

pub async fn delete_object_with_master_key( &self, endpoint: &str, ) -> Result<Value, ParseError>

Source

pub async fn execute_query<T: DeserializeOwned + Send + Sync + 'static>( &self, query: &ParseQuery, ) -> Result<Vec<T>, ParseError>

Executes a ParseQuery and returns a list of matching objects.

§Arguments
  • query: A reference to the ParseQuery to execute.
§Returns

A Result containing a Vec<T> of the deserialized objects or a ParseError.

Source

pub async fn find_objects( &self, query: &ParseQuery, ) -> Result<Vec<ParseObject>, ParseError>

Executes a ParseQuery and returns a list of ParseObject instances, ensuring the class_name field is populated for each object from the query.

§Arguments
  • query: A reference to the ParseQuery to execute.
§Returns

A Result containing a Vec<ParseObject> or a ParseError.

Source

pub async fn update_class_schema( &self, class_name: &str, schema_payload: &Value, ) -> Result<Value, ParseError>

Updates the schema for a given class, typically to set Class-Level Permissions. Requires the Master Key.

§Arguments
  • class_name: The name of the class whose schema is to be updated.
  • schema_payload: A serde_json::Value representing the schema update payload (e.g., CLPs).
§Returns

A Result containing the server’s response (typically the updated schema definition as serde_json::Value) or a ParseError.

Source

pub fn user(&mut self) -> ParseUserHandle<'_>

Source

pub fn session(&self) -> ParseSessionHandle<'_>

Source

pub fn cloud(&self) -> ParseCloud<'_>

Source§

impl Parse

Source

pub async fn get_config(&self) -> Result<ParseConfig, ParseError>

Retrieves the Parse Server configuration.

This operation requires the Master Key.

§Returns

A Result containing the ParseConfig or a ParseError.

Source

pub async fn update_config( &self, params_to_update: &HashMap<String, Value>, ) -> Result<UpdateConfigResponse, ParseError>

Updates the Parse Server configuration parameters.

This operation requires the Master Key. The params_to_update should contain only the parameters you wish to change.

§Arguments
  • params_to_update: A HashMap<String, Value> of parameters to update.
§Returns

A Result indicating success (typically an empty successful response or a confirmation) or a ParseError. The Parse Server responds with {"result": true} on successful update.

Source§

impl ParseClient

Source

pub async fn create_object<T: Serialize + Send + Sync>( &self, class_name: &str, data: &T, ) -> Result<CreateObjectResponse, ParseError>

Source

pub async fn retrieve_object( &self, class_name: &str, object_id: &str, ) -> Result<RetrievedParseObject, ParseError>

Source

pub async fn update_object<T: Serialize + Send + Sync>( &self, class_name: &str, object_id: &str, data: &T, ) -> Result<UpdateObjectResponse, ParseError>

Source

pub async fn delete_object( &self, class_name: &str, object_id: &str, ) -> Result<(), ParseError>

Source§

impl Parse

Source

pub async fn add_to_relation( &self, parent_class_name: &str, parent_object_id: &str, relation_key: &str, targets: &[Pointer], ) -> Result<ParseDate, ParseError>

Adds target objects to a relation field of a parent object.

§Arguments
  • parent_class_name: The class name of the parent object.
  • parent_object_id: The object ID of the parent object.
  • relation_key: The key (field name) of the relation on the parent object.
  • targets: A slice of Pointers representing the objects to add to the relation.
§Returns

A Result containing the ParseDate of the update or a ParseError. This operation typically requires the Master Key or appropriate ACLs.

Source

pub async fn remove_from_relation( &self, parent_class_name: &str, parent_object_id: &str, relation_key: &str, targets: &[Pointer], ) -> Result<ParseDate, ParseError>

Removes target objects from a relation field of a parent object.

§Arguments
  • parent_class_name: The class name of the parent object.
  • parent_object_id: The object ID of the parent object.
  • relation_key: The key (field name) of the relation on the parent object.
  • targets: A slice of Pointers representing the objects to remove from the relation.
§Returns

A Result containing the ParseDate of the update or a ParseError. This operation typically requires the Master Key or appropriate ACLs.

Source§

impl Parse

Source

pub async fn get<R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, ) -> Result<R, ParseError>

Source

pub async fn post<T: Serialize + Send + Sync, R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, data: &T, ) -> Result<R, ParseError>

Source

pub async fn put<T: Serialize + Send + Sync, R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, data: &T, ) -> Result<R, ParseError>

Source

pub async fn delete<R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, ) -> Result<R, ParseError>

Source§

impl Parse

Source

pub async fn create_role( &self, new_role: &NewParseRole, ) -> Result<ParseRole, ParseError>

Creates a new Role on the Parse Server.

§Arguments
  • new_role: A NewParseRole struct containing the name and ACL for the new role.
§Returns

A Result containing the created ParseRole or a ParseError. Note: The users and roles relations are not populated in the returned object. They need to be managed via separate relation operations or queries.

Source

pub async fn get_role(&self, object_id: &str) -> Result<ParseRole, ParseError>

Retrieves a specific Role by its objectId.

§Arguments
  • object_id: The objectId of the role to retrieve.
§Returns

A Result containing the ParseRole or a ParseError. Note: The users and roles relations are not populated by this call.

Source

pub async fn delete_role(&self, object_id: &str) -> Result<(), ParseError>

Deletes a specific Role by its objectId.

§Arguments
  • object_id: The objectId of the role to delete.
§Returns

A Result indicating success (Ok(())) or a ParseError. This operation typically requires the Master Key or appropriate user permissions.

Source

pub async fn add_users_to_role( &self, role_id: &str, user_ids: &[&str], ) -> Result<ParseDate, ParseError>

Adds users to a specific Role.

§Arguments
  • role_id: The objectId of the Role to modify.
  • user_ids: A slice of objectIds of the Users to add to the role.
§Returns

A Result containing the ParseDate of the update or a ParseError. This operation typically requires the Master Key.

Source

pub async fn remove_users_from_role( &self, role_id: &str, user_ids: &[&str], ) -> Result<ParseDate, ParseError>

Removes users from a specific Role.

§Arguments
  • role_id: The objectId of the Role to modify.
  • user_ids: A slice of objectIds of the Users to remove from the role.
§Returns

A Result containing the ParseDate of the update or a ParseError. This operation typically requires the Master Key.

Source

pub async fn add_child_roles_to_role( &self, role_id: &str, child_role_ids: &[&str], ) -> Result<ParseDate, ParseError>

Adds child roles to a specific (parent) Role.

§Arguments
  • role_id: The objectId of the parent Role to modify.
  • child_role_ids: A slice of objectIds of the child Roles to add to the parent role.
§Returns

A Result containing the ParseDate of the update or a ParseError. This operation typically requires the Master Key.

Source

pub async fn remove_child_roles_from_role( &self, role_id: &str, child_role_ids: &[&str], ) -> Result<ParseDate, ParseError>

Removes child roles from a specific (parent) Role.

§Arguments
  • role_id: The objectId of the parent Role to modify.
  • child_role_ids: A slice of objectIds of the child Roles to remove from the parent role.
§Returns

A Result containing the ParseDate of the update or a ParseError. This operation typically requires the Master Key.

Trait Implementations§

Source§

impl Clone for ParseClient

Source§

fn clone(&self) -> ParseClient

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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,