File tree Expand file tree Collapse file tree 6 files changed +20
-18
lines changed Expand file tree Collapse file tree 6 files changed +20
-18
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " podcast-api"
3- version = " 1.1.0 "
3+ version = " 1.1.1 "
44authors = [" Listen Notes, Inc. <hello@listennotes.com>" ]
55edition = " 2018"
66description = " Rust bindings for the Listen Notes Podcast API"
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ Install [podcast-api from crates.io](https://crates.io/crates/podcast-api). Add
5656
5757```toml
5858[dependencies]
59- podcast-api = "1.1.0 "
59+ podcast-api = "1.1.1 "
6060```
6161
6262## Usage
@@ -122,7 +122,7 @@ Unsuccessful requests return errors.
122122| ------------- | ------------- |
123123| AuthenticationError | wrong api key or your account is suspended |
124124| InvalidRequestError | something wrong on your end (client side errors), e.g., missing required parameters |
125- | RateLimitError | you are using FREE plan and you exceed the quota limit |
125+ | RateLimitError | for FREE plan, exceeding the quota limit; or for all plans, sending too many requests too fast and exceeding the rate limit |
126126| NotFoundError | endpoint not exist, or podcast / episode not exist |
127127| ApiConnectionError | failed to connect to Listen API servers |
128128| ListenApiError | something wrong on our end (unexpected server errors) |
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ edition = "2018"
77# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88
99[dependencies ]
10- podcast-api = { version = " ^1.1.0 " , path = " ../../" }
10+ podcast-api = { version = " ^1.1.1 " , path = " ../../" }
1111reqwest = { version = " 0.11" , features = [" json" ] }
1212serde = { version = " 1" , features = [" derive" ] }
1313serde_json = " 1"
Original file line number Diff line number Diff line change @@ -90,17 +90,17 @@ impl Client<'_> {
9090 /// Calls [`GET /spellcheck`](https://www.listennotes.com/api/docs/#get-api-v2-spellcheck) with supplied parameters.
9191 pub async fn spellcheck ( & self , parameters : & Value ) -> Result < Response > {
9292 self . get ( "spellcheck" , parameters) . await
93- }
93+ }
9494
9595 /// Calls [`GET /related_searches`](https://www.listennotes.com/api/docs/#get-api-v2-related_searches) with supplied parameters.
9696 pub async fn fetch_related_searches ( & self , parameters : & Value ) -> Result < Response > {
9797 self . get ( "related_searches" , parameters) . await
98- }
99-
98+ }
99+
100100 /// Calls [`GET /trending_searches`](https://www.listennotes.com/api/docs/#get-api-v2-trending_searches) with supplied parameters.
101101 pub async fn fetch_trending_searches ( & self , parameters : & Value ) -> Result < Response > {
102102 self . get ( "trending_searches" , parameters) . await
103- }
103+ }
104104
105105 /// Calls [`GET /best_podcasts`](https://www.listennotes.com/api/docs/#get-api-v2-best_podcasts) with supplied parameters.
106106 pub async fn fetch_best_podcasts ( & self , parameters : & Value ) -> Result < Response > {
Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ pub enum Error {
77 ApiConnectionError ,
88 /// Something wrong on your end (client side errors), e.g., missing required parameters.
99 InvalidRequestError ,
10- /// You are using FREE plan and you exceed the quota limit.
10+ /// For FREE plan, exceeding the quota limit; or for all plans, sending too many requests
11+ /// too fast and exceeding the rate limit - https://www.listennotes.com/api/faq/#faq17
1112 RateLimitError ,
1213 /// Endpoint not exist, or podcast / episode not exist.
1314 NotFoundError ,
@@ -57,7 +58,12 @@ impl std::fmt::Display for Error {
5758 )
5859 }
5960 Error :: RateLimitError => {
60- write ! ( f, "You are using FREE plan and you exceed the quota limit." )
61+ write ! (
62+ f,
63+ "For FREE plan, exceeding the quota limit; or for all plans, sending too many
64+ requests too fast and exceeding the rate limit
65+ - https://www.listennotes.com/api/faq/#faq17"
66+ )
6167 }
6268 Error :: NotFoundError => {
6369 write ! ( f, "Endpoint not exist, or podcast / episode not exist." )
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ mod mock {
9696 assert!( body. is_object( ) ) ;
9797 assert!( body[ "tokens" ] . as_array( ) . unwrap( ) . len( ) > 0 ) ;
9898 } ) ;
99- }
99+ }
100100
101101 #[ test]
102102 fn related_searches ( ) {
@@ -118,20 +118,16 @@ mod mock {
118118 assert!( body. is_object( ) ) ;
119119 assert!( body[ "terms" ] . as_array( ) . unwrap( ) . len( ) > 0 ) ;
120120 } ) ;
121- }
121+ }
122122
123123 #[ test]
124124 fn trending_searches ( ) {
125125 b ! ( async {
126- let response = client( )
127- . fetch_trending_searches( & json!( {
128- } ) )
129- . await
130- . unwrap( ) ;
126+ let response = client( ) . fetch_trending_searches( & json!( { } ) ) . await . unwrap( ) ;
131127 // Request
132128 assert_eq!( response. request. method( ) , http:: Method :: GET ) ;
133129 assert_eq!( response. request. url( ) . path( ) , "/api/v2/trending_searches" ) ;
134- let mut p = response. request. url( ) . query_pairs( ) ;
130+ let p = response. request. url( ) . query_pairs( ) ;
135131 assert_eq!( p. count( ) , 0 ) ;
136132 // Response
137133 let body = response. json( ) . await . unwrap( ) ;
You can’t perform that action at this time.
0 commit comments