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 1
1
[package ]
2
2
name = " podcast-api"
3
- version = " 1.1.0 "
3
+ version = " 1.1.1 "
4
4
authors = [
" Listen Notes, Inc. <[email protected] >" ]
5
5
edition = " 2018"
6
6
description = " 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
56
56
57
57
```toml
58
58
[dependencies]
59
- podcast-api = "1.1.0 "
59
+ podcast-api = "1.1.1 "
60
60
```
61
61
62
62
## Usage
@@ -122,7 +122,7 @@ Unsuccessful requests return errors.
122
122
| ------------- | ------------- |
123
123
| AuthenticationError | wrong api key or your account is suspended |
124
124
| 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 |
126
126
| NotFoundError | endpoint not exist, or podcast / episode not exist |
127
127
| ApiConnectionError | failed to connect to Listen API servers |
128
128
| 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"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
- podcast-api = { version = " ^1.1.0 " , path = " ../../" }
10
+ podcast-api = { version = " ^1.1.1 " , path = " ../../" }
11
11
reqwest = { version = " 0.11" , features = [" json" ] }
12
12
serde = { version = " 1" , features = [" derive" ] }
13
13
serde_json = " 1"
Original file line number Diff line number Diff line change @@ -90,17 +90,17 @@ impl Client<'_> {
90
90
/// Calls [`GET /spellcheck`](https://www.listennotes.com/api/docs/#get-api-v2-spellcheck) with supplied parameters.
91
91
pub async fn spellcheck ( & self , parameters : & Value ) -> Result < Response > {
92
92
self . get ( "spellcheck" , parameters) . await
93
- }
93
+ }
94
94
95
95
/// Calls [`GET /related_searches`](https://www.listennotes.com/api/docs/#get-api-v2-related_searches) with supplied parameters.
96
96
pub async fn fetch_related_searches ( & self , parameters : & Value ) -> Result < Response > {
97
97
self . get ( "related_searches" , parameters) . await
98
- }
99
-
98
+ }
99
+
100
100
/// Calls [`GET /trending_searches`](https://www.listennotes.com/api/docs/#get-api-v2-trending_searches) with supplied parameters.
101
101
pub async fn fetch_trending_searches ( & self , parameters : & Value ) -> Result < Response > {
102
102
self . get ( "trending_searches" , parameters) . await
103
- }
103
+ }
104
104
105
105
/// Calls [`GET /best_podcasts`](https://www.listennotes.com/api/docs/#get-api-v2-best_podcasts) with supplied parameters.
106
106
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 {
7
7
ApiConnectionError ,
8
8
/// Something wrong on your end (client side errors), e.g., missing required parameters.
9
9
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
11
12
RateLimitError ,
12
13
/// Endpoint not exist, or podcast / episode not exist.
13
14
NotFoundError ,
@@ -57,7 +58,12 @@ impl std::fmt::Display for Error {
57
58
)
58
59
}
59
60
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
+ )
61
67
}
62
68
Error :: NotFoundError => {
63
69
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 {
96
96
assert!( body. is_object( ) ) ;
97
97
assert!( body[ "tokens" ] . as_array( ) . unwrap( ) . len( ) > 0 ) ;
98
98
} ) ;
99
- }
99
+ }
100
100
101
101
#[ test]
102
102
fn related_searches ( ) {
@@ -118,20 +118,16 @@ mod mock {
118
118
assert!( body. is_object( ) ) ;
119
119
assert!( body[ "terms" ] . as_array( ) . unwrap( ) . len( ) > 0 ) ;
120
120
} ) ;
121
- }
121
+ }
122
122
123
123
#[ test]
124
124
fn trending_searches ( ) {
125
125
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( ) ;
131
127
// Request
132
128
assert_eq!( response. request. method( ) , http:: Method :: GET ) ;
133
129
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( ) ;
135
131
assert_eq!( p. count( ) , 0 ) ;
136
132
// Response
137
133
let body = response. json( ) . await . unwrap( ) ;
You can’t perform that action at this time.
0 commit comments