@@ -21,7 +21,7 @@ use crate::Str;
21
21
22
22
/// A GET request to be made to the /v2/stocks/quotes/latest endpoint.
23
23
#[ derive( Clone , Debug , Eq , PartialEq , Serialize ) ]
24
- pub struct LastQuoteReq {
24
+ pub struct LastQuotesReq {
25
25
/// The symbols to retrieve the last quote for.
26
26
#[ serde( rename = "symbols" , serialize_with = "string_slice_to_str" ) ]
27
27
pub symbols : Vec < String > ,
@@ -31,25 +31,25 @@ pub struct LastQuoteReq {
31
31
}
32
32
33
33
34
- /// A helper for initializing [`LastQuoteReq `] objects.
34
+ /// A helper for initializing [`LastQuotesReq `] objects.
35
35
#[ derive( Clone , Debug , Default , Eq , PartialEq ) ]
36
36
#[ allow( missing_copy_implementations) ]
37
- pub struct LastQuoteReqInit {
38
- /// See `LastQuoteReq ::feed`.
37
+ pub struct LastQuotesReqInit {
38
+ /// See `LastQuotesReq ::feed`.
39
39
pub feed : Option < Feed > ,
40
40
#[ doc( hidden) ]
41
41
pub _non_exhaustive : ( ) ,
42
42
}
43
43
44
- impl LastQuoteReqInit {
45
- /// Create a [`LastQuoteReq `] from a `LastQuoteReqInit `.
44
+ impl LastQuotesReqInit {
45
+ /// Create a [`LastQuotesReq `] from a `LastQuotesReqInit `.
46
46
#[ inline]
47
- pub fn init < I , S > ( self , symbols : I ) -> LastQuoteReq
47
+ pub fn init < I , S > ( self , symbols : I ) -> LastQuotesReq
48
48
where
49
49
I : IntoIterator < Item = S > ,
50
50
S : Into < String > ,
51
51
{
52
- LastQuoteReq {
52
+ LastQuotesReq {
53
53
symbols : symbols. into_iter ( ) . map ( S :: into) . collect ( ) ,
54
54
feed : self . feed ,
55
55
}
@@ -83,7 +83,7 @@ pub struct Quote {
83
83
EndpointNoParse ! {
84
84
/// The representation of a GET request to the
85
85
/// /v2/stocks/quotes/latest endpoint.
86
- pub Get ( LastQuoteReq ) ,
86
+ pub Get ( LastQuotesReq ) ,
87
87
Ok => Vec <( String , Quote ) >, [
88
88
/// The last quotes were retrieved successfully.
89
89
/* 200 */ OK ,
@@ -216,7 +216,7 @@ mod tests {
216
216
let api_info = ApiInfo :: from_env ( ) . unwrap ( ) ;
217
217
let client = Client :: new ( api_info) ;
218
218
219
- let req = LastQuoteReqInit :: default ( ) . init ( [ "SPY" ] ) ;
219
+ let req = LastQuotesReqInit :: default ( ) . init ( [ "SPY" ] ) ;
220
220
let quotes = client. issue :: < Get > ( & req) . await . unwrap ( ) ;
221
221
assert_eq ! ( quotes. len( ) , 1 ) ;
222
222
assert_eq ! ( quotes[ 0 ] . 0 , "SPY" ) ;
@@ -232,7 +232,7 @@ mod tests {
232
232
let api_info = ApiInfo :: from_env ( ) . unwrap ( ) ;
233
233
let client = Client :: new ( api_info) ;
234
234
235
- let req = LastQuoteReqInit :: default ( ) . init ( [ "MSFT" , "SPY" , "AAPL" ] ) ;
235
+ let req = LastQuotesReqInit :: default ( ) . init ( [ "MSFT" , "SPY" , "AAPL" ] ) ;
236
236
let quotes = client. issue :: < Get > ( & req) . await . unwrap ( ) ;
237
237
assert_eq ! ( quotes. len( ) , 3 ) ;
238
238
@@ -251,7 +251,7 @@ mod tests {
251
251
let api_info = ApiInfo :: from_env ( ) . unwrap ( ) ;
252
252
let client = Client :: new ( api_info) ;
253
253
254
- let req = LastQuoteReqInit {
254
+ let req = LastQuotesReqInit {
255
255
feed : Some ( Feed :: SIP ) ,
256
256
..Default :: default ( )
257
257
}
@@ -274,7 +274,7 @@ mod tests {
274
274
let api_info = ApiInfo :: from_env ( ) . unwrap ( ) ;
275
275
let client = Client :: new ( api_info) ;
276
276
277
- let req = LastQuoteReqInit :: default ( ) . init ( [ "ABC123" ] ) ;
277
+ let req = LastQuotesReqInit :: default ( ) . init ( [ "ABC123" ] ) ;
278
278
let err = client. issue :: < Get > ( & req) . await . unwrap_err ( ) ;
279
279
match err {
280
280
RequestError :: Endpoint ( GetError :: InvalidInput ( _) ) => ( ) ,
@@ -289,7 +289,7 @@ mod tests {
289
289
let api_info = ApiInfo :: from_env ( ) . unwrap ( ) ;
290
290
let client = Client :: new ( api_info) ;
291
291
292
- let req = LastQuoteReqInit :: default ( ) . init ( [ "SPY" , "NOSUCHSYMBOL" ] ) ;
292
+ let req = LastQuotesReqInit :: default ( ) . init ( [ "SPY" , "NOSUCHSYMBOL" ] ) ;
293
293
let quotes = client. issue :: < Get > ( & req) . await . unwrap ( ) ;
294
294
assert_eq ! ( quotes. len( ) , 1 ) ;
295
295
}
0 commit comments