Expand description
pocketbase-rs is a Rust wrapper around PocketBase’s REST API.
§Usage
ⓘ
use std::error::Error;
use pocketbase_rs::{PocketBase, Collection, RequestError};
use serde::Deserialize;
#[derive(Default, Deserialize, Clone)]
struct Article {
title: String,
content: String,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut pb = PocketBase::new("http://localhost:8090");
let auth_data = pb
.collection("users")
.auth_with_password("YOUR_EMAIL_OR_USERNAME", "YOUR_PASSWORD")
.await?;
let article: Article = pb
.collection("articles")
.get_one::<Article>("record_id_123")
.call()
.await?;
println!("Article Title: {}", article.title);
Ok(())
}Re-exports§
pub use error::*;
Modules§
- error
- Various errors module.
Structs§
- Auth
Store - Stores authentication details for a
PocketBaseuser. - Auth
Store Record - Represents the details of an authenticated user’s record.
- Collection
- Represents a specific collection in a
PocketBasedatabase. - Form
- An async multipart/form-data request.
- Part
- A field in a multipart form.
- Pocket
Base - A
PocketBaseclient for sending requests to aPocketBaseinstance. - Record
List - Represents a paginated list of records retrieved from a
PocketBasecollection.