pub struct ParseClient {
pub server_url: String,
/* private fields */
}
Fields§
§server_url: String
Implementations§
Source§impl ParseClient
impl ParseClient
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>
Sourcepub fn session_token(&self) -> Option<&str>
pub fn session_token(&self) -> Option<&str>
Returns the current session token, if any.
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Checks if the client is currently authenticated (has a session token).
Sourcepub async fn upload_file(
&self,
file_name: &str,
data: Vec<u8>,
mime_type: &str,
) -> Result<FileField, ParseError>
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.
pub async fn execute_aggregate<T: DeserializeOwned + Send + 'static>( &self, class_name: &str, pipeline: Value, ) -> Result<Vec<T>, ParseError>
pub async fn delete_object_with_master_key( &self, endpoint: &str, ) -> Result<Value, ParseError>
Sourcepub async fn execute_query<T: DeserializeOwned + Send + Sync + 'static>(
&self,
query: &ParseQuery,
) -> Result<Vec<T>, ParseError>
pub async fn execute_query<T: DeserializeOwned + Send + Sync + 'static>( &self, query: &ParseQuery, ) -> Result<Vec<T>, ParseError>
Sourcepub async fn find_objects(
&self,
query: &ParseQuery,
) -> Result<Vec<ParseObject>, ParseError>
pub async fn find_objects( &self, query: &ParseQuery, ) -> Result<Vec<ParseObject>, ParseError>
Sourcepub async fn update_class_schema(
&self,
class_name: &str,
schema_payload: &Value,
) -> Result<Value, ParseError>
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
: Aserde_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
.
pub fn user(&mut self) -> ParseUserHandle<'_>
pub fn session(&self) -> ParseSessionHandle<'_>
pub fn cloud(&self) -> ParseCloud<'_>
Source§impl Parse
impl Parse
Sourcepub async fn get_config(&self) -> Result<ParseConfig, ParseError>
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
.
Sourcepub async fn update_config(
&self,
params_to_update: &HashMap<String, Value>,
) -> Result<UpdateConfigResponse, ParseError>
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
: AHashMap<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
impl ParseClient
pub async fn create_object<T: Serialize + Send + Sync>( &self, class_name: &str, data: &T, ) -> Result<CreateObjectResponse, ParseError>
pub async fn retrieve_object( &self, class_name: &str, object_id: &str, ) -> Result<RetrievedParseObject, ParseError>
pub async fn update_object<T: Serialize + Send + Sync>( &self, class_name: &str, object_id: &str, data: &T, ) -> Result<UpdateObjectResponse, ParseError>
pub async fn delete_object( &self, class_name: &str, object_id: &str, ) -> Result<(), ParseError>
Source§impl Parse
impl Parse
Sourcepub async fn add_to_relation(
&self,
parent_class_name: &str,
parent_object_id: &str,
relation_key: &str,
targets: &[Pointer],
) -> Result<ParseDate, ParseError>
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 ofPointer
s 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.
Sourcepub async fn remove_from_relation(
&self,
parent_class_name: &str,
parent_object_id: &str,
relation_key: &str,
targets: &[Pointer],
) -> Result<ParseDate, ParseError>
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 ofPointer
s 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
impl Parse
pub async fn get<R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, ) -> Result<R, ParseError>
pub async fn post<T: Serialize + Send + Sync, R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, data: &T, ) -> Result<R, ParseError>
pub async fn put<T: Serialize + Send + Sync, R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, data: &T, ) -> Result<R, ParseError>
pub async fn delete<R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, ) -> Result<R, ParseError>
Source§impl Parse
impl Parse
Sourcepub async fn create_role(
&self,
new_role: &NewParseRole,
) -> Result<ParseRole, ParseError>
pub async fn create_role( &self, new_role: &NewParseRole, ) -> Result<ParseRole, ParseError>
Creates a new Role on the Parse Server.
§Arguments
new_role
: ANewParseRole
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.
Sourcepub async fn delete_role(&self, object_id: &str) -> Result<(), ParseError>
pub async fn delete_role(&self, object_id: &str) -> Result<(), ParseError>
Sourcepub async fn add_users_to_role(
&self,
role_id: &str,
user_ids: &[&str],
) -> Result<ParseDate, ParseError>
pub async fn add_users_to_role( &self, role_id: &str, user_ids: &[&str], ) -> Result<ParseDate, ParseError>
Sourcepub async fn remove_users_from_role(
&self,
role_id: &str,
user_ids: &[&str],
) -> Result<ParseDate, ParseError>
pub async fn remove_users_from_role( &self, role_id: &str, user_ids: &[&str], ) -> Result<ParseDate, ParseError>
Sourcepub async fn add_child_roles_to_role(
&self,
role_id: &str,
child_role_ids: &[&str],
) -> Result<ParseDate, ParseError>
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.
Sourcepub async fn remove_child_roles_from_role(
&self,
role_id: &str,
child_role_ids: &[&str],
) -> Result<ParseDate, ParseError>
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
impl Clone for ParseClient
Source§fn clone(&self) -> ParseClient
fn clone(&self) -> ParseClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more