File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ Support as many flavours and special cases out there in different Rest APIs with
15
15
## todo
16
16
17
17
- [x] proof of concept
18
+ - [ ] string results
18
19
- [ ] define base url in attribute
19
20
- [ ] support url parameters
21
+ - [ ] support query parameters
20
22
- [ ] support post using json
21
23
- [ ] allow serializable types in api
Original file line number Diff line number Diff line change @@ -147,4 +147,14 @@ mod tests {
147
147
148
148
assert_eq ! ( get_endpoint_attr( a) , None ) ;
149
149
}
150
+ #[ test]
151
+ fn test_endpoint_some ( ) {
152
+ let a: syn:: TraitItemMethod = syn:: parse2 ( quote ! {
153
+ #[ endpoint( "foo" ) ]
154
+ fn foo( ) { }
155
+ } )
156
+ . unwrap ( ) ;
157
+
158
+ assert_eq ! ( get_endpoint_attr( a) , Some ( "foo" . to_owned( ) ) ) ;
159
+ }
150
160
}
Original file line number Diff line number Diff line change @@ -4,9 +4,18 @@ use std::env;
4
4
//TODO: #[api_root("base_url")]
5
5
#[ api]
6
6
trait AlpacaApi {
7
+ /// see https://docs.alpaca.markets/api-documentation/api-v2/account/
7
8
#[ endpoint( "account" ) ]
8
9
fn get_account ( & self ) -> Result < serde_json:: Value , Box < dyn std:: error:: Error > > ;
9
- fn account ( & self ) -> Result < serde_json:: Value , Box < dyn std:: error:: Error > > ;
10
+
11
+ /// see https://docs.alpaca.markets/api-documentation/api-v2/account-activities/
12
+ #[ endpoint( "account/activities/FILL" ) ]
13
+ fn account_activities (
14
+ & self , //activity_type: String,
15
+ ) -> Result < serde_json:: Value , Box < dyn std:: error:: Error > > ;
16
+
17
+ /// see https://docs.alpaca.markets/api-documentation/api-v2/clock/
18
+ fn clock ( & self ) -> Result < serde_json:: Value , Box < dyn std:: error:: Error > > ;
10
19
}
11
20
12
21
fn main ( ) {
@@ -30,5 +39,11 @@ fn main() {
30
39
31
40
println ! ( "{:#?}" , acc) ;
32
41
33
- assert_eq ! ( acc, api. account( ) . unwrap( ) ) ;
42
+ let act = api. account_activities ( ) . unwrap ( ) ;
43
+
44
+ println ! ( "{:#?}" , act) ;
45
+
46
+ let clc = api. clock ( ) . unwrap ( ) ;
47
+
48
+ println ! ( "{:#?}" , clc) ;
34
49
}
You can’t perform that action at this time.
0 commit comments