Skip to content

Commit

Permalink
Merge pull request #6 from sreedevk/v005
Browse files Browse the repository at this point in the history
Version 0.0.5
  • Loading branch information
sreedevk authored Oct 9, 2022
2 parents b4bfde2 + 05ecd0b commit 98965ac
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 82 deletions.
7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[workspace]
members = ["pocketbase-derive"]

[package]
name = "pocketbase-sdk"
version = "0.0.4"
version = "0.0.5"
edition = "2021"
authors = ["Sreedev Kodichath <sreedev@icloud.com>"]
license = "MIT"
Expand All @@ -25,9 +22,7 @@ reqwest = { version = "0.11", features = ["json", "blocking"] }
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
url = "2.3.1"
pocketbase_derive = { version = "0.0.1", path = "./pocketbase-derive" }

[dev-dependencies]
httpmock = "0.6"
pocketbase_derive = { version = "0.0.1", path = "./pocketbase-derive" }
tokio = { version = "1", features = ["full"] }
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ serde = { version = "1.0.145", features = ["derive"] }
use serde::{Serialize, Deserialize}
use pocketbase_sdk::client::Client;
use pocketbase_sdk::user::UserTypes;
use pocketbase_sdk::records::Recordable;
use pocketbase_sdk::records::operations::{
list, view, delete, create
};

#[derive(Recordable, Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug)]
struct Post {
id: String,
title: String,
Expand Down Expand Up @@ -94,12 +93,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
use serde::{Serialize, Deserialize}
use pocketbase_sdk::client::SyncClient;
use pocketbase_sdk::user::UserTypes;
use pocketbase_sdk::records::Recordable;
use pocketbase_sdk::records::operations::{
sync_list, sycn_view, sync_delete, sync_create
};

#[derive(Recordable, Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug)]
struct Post {
id: String,
title: String,
Expand Down Expand Up @@ -166,3 +164,4 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2. Add Log Interface
3. Add Admin Settings Interface
4. Realtime API Options
5. WebAsm Support
25 changes: 0 additions & 25 deletions pocketbase-derive/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions pocketbase-derive/README.md

This file was deleted.

29 changes: 0 additions & 29 deletions pocketbase-derive/src/lib.rs

This file was deleted.

3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#[macro_use]
extern crate pocketbase_derive;

pub mod client;
pub mod user;
pub mod records;
1 change: 0 additions & 1 deletion src/records/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ pub use sync_operations::sync_delete;
pub use sync_operations::sync_update;
pub use sync_operations::sync_view;

pub trait Recordable {}
pub trait Changeset {}
3 changes: 1 addition & 2 deletions src/records/operations/list.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::HashMap;
use super::super::Recordable;
use crate::client::Client;
use std::error::Error;
use serde::{Serialize, Deserialize, de::DeserializeOwned};
Expand Down Expand Up @@ -29,7 +28,7 @@ pub enum ListResponse<T> {
SuccessResponse(PaginatedRecordList<T>)
}

pub async fn records<T: Recordable + DeserializeOwned>(collection: &str, client: &Client) -> Result<ListResponse<T>, Box<dyn Error>> {
pub async fn records<T: DeserializeOwned>(collection: &str, client: &Client) -> Result<ListResponse<T>, Box<dyn Error>> {
let list_response = client.get(
format!("collections/{}/records", collection),
None
Expand Down
3 changes: 1 addition & 2 deletions src/records/sync_operations/sync_list.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::HashMap;
use super::super::Recordable;
use crate::client::SyncClient;
use std::error::Error;
use serde::{Serialize, Deserialize, de::DeserializeOwned};
Expand Down Expand Up @@ -29,7 +28,7 @@ pub enum ListResponse<T> {
SuccessResponse(PaginatedRecordList<T>)
}

pub fn records<T: Recordable + DeserializeOwned>(collection: &str, client: &SyncClient) -> Result<ListResponse<T>, Box<dyn Error>> {
pub fn records<T: DeserializeOwned>(collection: &str, client: &SyncClient) -> Result<ListResponse<T>, Box<dyn Error>> {
let list_response = client.get(
format!("collections/{}/records", collection),
None
Expand Down
3 changes: 1 addition & 2 deletions tests/async_record/test_records_list.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use pocketbase_sdk::records::Recordable;
use httpmock::prelude::*;
use pocketbase_sdk::records::list;
use pocketbase_sdk::client::Client;
use serde::{Serialize, Deserialize};
use serde_json::json;

#[derive(Serialize, Deserialize, Debug, Recordable)]
#[derive(Serialize, Deserialize, Debug)]
struct Post {
title: String,
content: String
Expand Down
3 changes: 0 additions & 3 deletions tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#[macro_use]
extern crate pocketbase_derive;

mod async_client;
mod async_record;
mod sync_record;
Expand Down
3 changes: 1 addition & 2 deletions tests/sync_record/test_records_list.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use pocketbase_sdk::records::Recordable;
use httpmock::prelude::*;
use pocketbase_sdk::records::sync_list;
use pocketbase_sdk::client::SyncClient;
use serde::{Serialize, Deserialize};
use serde_json::json;

#[derive(Serialize, Deserialize, Debug, Recordable)]
#[derive(Serialize, Deserialize, Debug)]
struct Post {
title: String,
content: String
Expand Down

0 comments on commit 98965ac

Please sign in to comment.