parse_rs/
lib.rs

1//!
2//! # Parse SDK for Rust (parse-rs)
3//!
4//! A modern, asynchronous, and unofficial Rust SDK for interacting with [Parse Server](https://parseplatform.org/) backends.
5//! This crate provides a type-safe and ergonomic way to perform operations such as user authentication,
6//! object management (CRUD), querying, file handling, and executing Cloud Code functions.
7//!
8//! ## Overview
9//!
10
11//! `parse-rs` is built with `async/await` for non-blocking operations and leverages popular Rust libraries
12//! like `reqwest` for HTTP communication and `serde` for JSON serialization/deserialization.
13//!
14//! For detailed setup, prerequisites, and advanced usage, please refer to the
15//! [README.md](https://github.com/tbraun96/parse-rs/blob/main/README.md) file in the repository.
16//!
17//! ## Quick Start Example
18//!
19//! ```rust,no_run
20//! use parse_rs::{Parse, ParseError, ParseObject, object::CreateObjectResponse};
21//! use serde_json::Value;
22//! use std::collections::HashMap;
23//!
24//! #[tokio::main]
25//! async fn main() -> Result<(), ParseError> {
26//!     // Initialize the Parse client.
27//!     // Ensure PARSE_SERVER_URL, PARSE_APP_ID, and PARSE_MASTER_KEY (or other keys)
28//!     // are set in your environment or provide them directly.
29//!     let server_url = std::env::var("PARSE_SERVER_URL").unwrap_or_else(|_| "http://localhost:1338/parse".to_string());
30//!     let app_id = std::env::var("PARSE_APP_ID").unwrap_or_else(|_| "myAppId".to_string());
31//!     let master_key = std::env::var("PARSE_MASTER_KEY").unwrap_or_else(|_| "myMasterKey".to_string());
32//!
33//!     let mut client = Parse::new(
34//!         &server_url,
35//!         &app_id,
36//!         None, // javascript_key
37//!         None, // rest_api_key
38//!         Some(&master_key),
39//!     )?;
40//!
41//!     // Create a new ParseObject
42//!     let mut game_score_data = HashMap::new();
43//!     game_score_data.insert("score".to_string(), Value::Number(1337.into()));
44//!     game_score_data.insert("playerName".to_string(), Value::String("Sean Plott".to_string()));
45//!
46//!     let mut new_score = ParseObject::new("GameScore");
47//!     let created_object: CreateObjectResponse = client.create_object("GameScore", &new_score).await?;
48//!
49//!     println!("Successfully created GameScore with objectId: {}", created_object.object_id);
50//!     Ok(())
51//! }
52//! ```
53//!
54//! For more examples and detailed API documentation, please explore the individual modules.
55
56pub mod acl;
57pub mod analytics;
58pub mod client;
59pub mod cloud;
60pub mod config;
61pub mod error;
62pub mod file;
63pub mod geopoint;
64pub mod installation;
65pub mod object;
66pub mod query;
67pub mod relations;
68pub mod requests;
69pub mod role;
70/// Module for defining Parse Server class schemas and their fields.
71pub mod schema;
72pub mod session;
73pub mod types;
74pub mod user;
75
76/// Represents a Parse Access Control List. See [`acl::ParseACL`](acl/struct.ParseACL.html) for details.
77pub use acl::ParseACL;
78/// The main client for interacting with a Parse Server.
79/// See [`client::Parse`](client/struct.Parse.html) for detailed API methods and usage examples.
80pub use client::Parse;
81/// Handler for Parse Cloud Code functions. See [`cloud::ParseCloud`](cloud/struct.ParseCloud.html) for details on how to call functions.
82pub use cloud::ParseCloud;
83/// Represents server configuration retrievable via the Parse API. See [`config::ParseConfig`](config/struct.ParseConfig.html).
84pub use config::ParseConfig;
85/// Represents errors that can occur when interacting with Parse Server.
86/// See [`error::ParseError`](error/enum.ParseError.html) for different error variants and their meanings.
87pub use error::ParseError;
88/// Represents a file stored in Parse Server. See [`file::ParseFile`](file/struct.ParseFile.html) for details on uploading and managing files.
89pub use file::{FileField, ParseFile};
90/// Represents a generic Parse Object, the fundamental data unit in Parse.
91/// See [`object::ParseObject`](object/struct.ParseObject.html) for details on creating, retrieving, updating, and deleting objects.
92pub use object::{ParseObject, RetrievedParseObject};
93/// Used to construct and execute queries against Parse Server.
94/// See [`query::ParseQuery`](query/struct.ParseQuery.html) for building complex queries with various constraints.
95pub use query::ParseQuery;
96/// Represents a Parse Role, used for managing groups of users and their permissions.
97/// See [`role::ParseRole`](role/struct.ParseRole.html) for details.
98pub use role::{NewParseRole, ParseRole};
99/// Structs and enums related to Parse Server class schemas.
100/// See the [`schema`](schema/index.html) module for more information.
101pub use schema::{
102    ClassLevelPermissionsSchema, FieldSchema, FieldType, GetAllSchemasResponse, ParseSchema,
103};
104/// Represents a Parse Session, linking a user to their logged-in state.
105/// See [`session::ParseSession`](session/struct.ParseSession.html) for details.
106pub use session::ParseSession;
107/// Contains common Parse-specific data types like `ParseDate` and `Pointer`.
108/// See the [`types`](types/index.html) module for more information.
109pub use types::{
110    Endpoint, ParseDate, ParseRelation, Pointer, QueryParams, RelationOp, Results,
111    UpdateResponseData,
112};
113/// Represents a Parse User, handling authentication and user-specific data.
114/// See [`user::ParseUser`](user/struct.ParseUser.html) for details.
115pub use user::{LoginRequest, ParseUser, PasswordResetRequest, SignupRequest, SignupResponse};