From e4fe3c5779a821ab46c0b9bbc117bcae9145e71c Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:39:51 +0200 Subject: [PATCH] feat: update according to spec --- pkgr/src/api/mod.rs | 54 ++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/pkgr/src/api/mod.rs b/pkgr/src/api/mod.rs index 3cec172..a46a4d0 100644 --- a/pkgr/src/api/mod.rs +++ b/pkgr/src/api/mod.rs @@ -1,27 +1,45 @@ -use reqwest::blocking::Response; +use std::collections::HashMap; -pub struct APITransaction { - /// Query made to API. - query: String, //TODO: enum - /// Response struct from abstracted library - _response: Option -} - -impl APITransaction { - pub fn new(_response: Option) -> Self { - APITransaction { - query: String::default(), - _response - } +enum Query { + Pull { + name: String, + version: Option, + tags: Vec + }, + Push { + _data: Vec } } -pub struct API { - base_url: String, +struct Request { + version: u32, + id: String, token: Option, - history: Vec + query: HashMap } -impl API { +struct DataErrorDetails { + actor: String, + detailed_cause: String, + recovery_options: Vec, +} +struct DataError { + name: String, + cause: Option, + details: Option +} + +enum Data { + Pull { + _data: Option>, + } +} + +struct Response { + version: u32, + id: String, + reply_to: String, + errors: HashMap, + data: HashMap } \ No newline at end of file