1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

extern crate serde;
#[macro_use] extern crate serde_derive;
extern crate serde_json;
extern crate serde_qs;
extern crate http;
extern crate mime;
extern crate reqwest;

mod client;
mod util;
mod error;
mod stripe;

pub use client::Client;
//pub use client::UriType;
pub use error::*;
pub use stripe::*;

use error::Error;
use serde_json::{Value, map::Map};

pub type Result<T> = ::std::result::Result<T, Error>;

pub trait StripeService {
    fn service_path() -> UrlPath { UrlPath::Other(String::new())}

    fn uri(&self, path: UrlPath, param: &stripe::StripePath) -> String {
        format!("https://api.stripe.com/v1{}{}", path, param)
    }

    fn object() -> Value {
        Value::Object(Map::new())
    }

    fn empty(&self) -> Value {
        Self::object()
    }

}

impl StripeService for Value {}

//#[derive(Serialize, Deserialize, Debug)]
//pub struct ObjectEmpty(Value);
//
//impl StripeService for ObjectEmpty {}