{"id":13409929,"url":"https://github.com/sreedevk/pocketbase-sdk-rust","last_synced_at":"2025-03-14T15:31:21.440Z","repository":{"id":60842376,"uuid":"545956977","full_name":"sreedevk/pocketbase-sdk-rust","owner":"sreedevk","description":"Rust SDK for Pocketbase","archived":false,"fork":false,"pushed_at":"2024-05-03T00:07:05.000Z","size":15039,"stargazers_count":54,"open_issues_count":3,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-11T19:36:45.023Z","etag":null,"topics":["pocketbase","rust","sdk-rust","webasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sreedevk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-05T09:15:01.000Z","updated_at":"2024-10-09T01:12:39.000Z","dependencies_parsed_at":"2024-10-26T05:50:08.734Z","dependency_job_id":"58c9c4f5-1bf1-4d58-a207-59c6d8669e7b","html_url":"https://github.com/sreedevk/pocketbase-sdk-rust","commit_stats":{"total_commits":54,"total_committers":4,"mean_commits":13.5,"dds":0.07407407407407407,"last_synced_commit":"413f97dfe2339b651ed417aa3b19d438988840ca"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sreedevk%2Fpocketbase-sdk-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sreedevk%2Fpocketbase-sdk-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sreedevk%2Fpocketbase-sdk-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sreedevk%2Fpocketbase-sdk-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sreedevk","download_url":"https://codeload.github.com/sreedevk/pocketbase-sdk-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243600602,"owners_count":20317306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pocketbase","rust","sdk-rust","webasm","webassembly"],"created_at":"2024-07-30T20:01:04.099Z","updated_at":"2025-03-14T15:31:21.150Z","avatar_url":"https://github.com/sreedevk.png","language":"Rust","funding_links":[],"categories":["Unofficial PocketBase Clients (SDKs)","Rust"],"sub_categories":["Node.js"],"readme":"### Pocketbase SDK\n\nA Rust SDK for Pocketbase Clients. Pocketbase is an open source backend for your SaaS \u0026 Mobile Applications. The Goal of this project is to create a wrapper around the APIs that Pocketbase exposes to abstract away unnecessary details of implementation, so that you can focus on building your app and not worry about integration with pocketbase.  \n\n#### Currently Compatible with Pocketbase Version 0.15.1\n\n#### NOTE\nVersion 0.1.1 of pocketbase SDK is complete reimplementation and is not compatible with the previous versions. The sytax has modified to be more minimalistic. This has been done to make pocketbase-sdk more user-friendly \u0026 to facilitate continued maintenance of pocketbase-sdk.  \n\n# Installation\n\n```bash\n  $ cargo add pocketbase-sdk\n  $ cargo add serde\n```\nor add the following to your `Cargo.toml`\n\n```toml\n[dependencies]\npocketbase-sdk = \"0.1.1\"\nserde = { version = \"1.0.145\", features = [\"derive\"] }\n```\n\n# Usage\n\n```rust\nuse anyhow::Result;\nuse pocketbase_sdk::admin::Admin;\n\nfn main() -\u003e Result\u003c()\u003e {\n    env_logger::init();\n\n    // admin authentication\n    let authenticated_admin_client = Admin::new(\"http://localhost:8090\")\n        .auth_with_password(\"sreedev@icloud.com\", \"Sreedev123\")?;\n\n    // collections list + Filter\n    let collections = authenticated_admin_client\n        .collections()\n        .list()\n        .page(1)\n        .per_page(100)\n        .call()?;\n\n    dbg!(collections);\n\n    // view collection\n    let user_collection = authenticated_admin_client\n        .collections()\n        .view(\"users\")\n        .call()?;\n\n    dbg!(user_collection);\n\n    Ok(())\n}\n```\n\n### Records\n```rust\nuse anyhow::Result;\nuse pocketbase_sdk::client::Client;\nuse serde::{Deserialize, Serialize};\n\n#[derive(Debug, Clone, Deserialize, Default)]\npub struct Product {\n    pub id: String,\n    pub name: String,\n    pub count: i32,\n}\n\n#[derive(Debug, Clone, Serialize)]\npub struct NewProduct {\n    pub name: String,\n    pub count: i32,\n}\n\nfn main() -\u003e Result\u003c()\u003e {\n    env_logger::init();\n\n    /* Authenticate Client */\n    let authenticated_client = Client::new(\"http://localhost:8090\").auth_with_password(\n        \"users\",\n        \"sreedev@icloud.com\",\n        \"Sreedev123\",\n    )?;\n\n    /* List Products */\n    let products = authenticated_client\n        .records(\"products\")\n        .list()\n        .call::\u003cProduct\u003e()?;\n    dbg!(products);\n\n    /* View Product */\n    let product = authenticated_client\n        .records(\"products\")\n        .view(\"jme4ixxqie2f9ho\")\n        .call::\u003cProduct\u003e()?;\n    dbg!(product);\n\n    /* Create Product */\n    let new_product = NewProduct {\n        name: String::from(\"bingo\"),\n        count: 69420,\n    };\n    let create_response = authenticated_client\n        .records(\"products\")\n        .create(new_product)\n        .call()?;\n    dbg!(\u0026create_response);\n\n    /* Update Product */\n    let updated_product = NewProduct {\n        name: String::from(\"bango\"),\n        count: 69420,\n    };\n    let update_response = authenticated_client\n        .records(\"products\")\n        .update(create_response.id.as_str(), updated_product)\n        .call()?;\n\n    dbg!(update_response);\n\n    /* Delete Product */\n    authenticated_client\n        .records(\"products\")\n        .destroy(create_response.id.as_str())\n        .call()?;\n\n    Ok(())\n}\n```\n\n### Logs\n\n```rust\nuse anyhow::Result;\nuse pocketbase_sdk::admin::Admin;\n\nfn main() -\u003e Result\u003c()\u003e {\n    env_logger::init();\n\n    // admin authentication\n    let admin = Admin::new(\"http://localhost:8090\")\n        .auth_with_password(\"sreedev@icloud.com\", \"Sreedev123\")?;\n\n    // list logs\n    let logs = admin.logs().list().page(1).per_page(10).call()?;\n    dbg!(\u0026logs);\n\n    // view log\n    let somelogid = \u0026logs.items[0].id;\n    let logitem = admin.logs().view(somelogid).call()?;\n    dbg!(logitem);\n\n    // view log statistics data points\n    let logstats = admin.logs().statistics().call()?;\n    dbg!(logstats);\n\n    Ok(())\n}\n```\n\n### HealthCheck\n\n```rust\nuse anyhow::Result;\nuse pocketbase_sdk::client::Client;\n\nfn main() -\u003e Result\u003c()\u003e {\n    let client = Client::new(\"http://localhost:8090\");\n    let health_check_response = client.health_check()?;\n    dbg!(health_check_response);\n\n    Ok(())\n}\n```\n\n# Development TODOs\n* [ ] Improve Test Coverage\n* [ ] Collections\n    * [x] List Collections\n    * [x] View Collection\n    * [ ] Create Collection\n    * [ ] Auth Refresh\n    * [ ] Request Password Reset\n    * [ ] Confirm Password Reset\n    * [ ] List Admins\n    * [ ] View Admin\n    * [ ] Create Admin\n    * [ ] Update Admin\n    * [ ] Delete Admin\n* [ ] Files\n    * [ ] Download / Fetch File\n    * [ ] Generate Protected File Token\n* [ ] Records\n    * [x] Create Records\n    * [x] Update Records\n    * [x] Delete Records\n    * [ ] Bulk Delete Records\n    * [ ] List Auth Methods\n    * [ ] Auth with OAuth2\n    * [ ] Auth Refresh\n    * [ ] Request Verification\n    * [ ] Confirm Verification\n    * [ ] Request Password Reset\n    * [ ] Request Email Change\n    * [ ] Confirm Email Change\n    * [ ] List Linked External Auth Providers\n    * [ ] Unlink External Auth Provider\n* [ ] Real Time APIs\n* [ ] WebAsm Support\n* [ ] Settings\n    * [ ] List\n    * [ ] Update\n* [x] Health Check\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsreedevk%2Fpocketbase-sdk-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsreedevk%2Fpocketbase-sdk-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsreedevk%2Fpocketbase-sdk-rust/lists"}