WIP: Start implementing OAuth
This commit is contained in:
parent
918b075b62
commit
aa87ad7538
@ -126,3 +126,19 @@ impl FreesoundAPI {
|
|||||||
```
|
```
|
||||||
|
|
||||||
I also need a library for making API calls `cargo add reqwest`
|
I also need a library for making API calls `cargo add reqwest`
|
||||||
|
|
||||||
|
```rust
|
||||||
|
pub(crate) fn search(&self) {
|
||||||
|
let client = reqwest::blocking::Client::builder().build().unwrap();
|
||||||
|
let res = client.get("https://freesound.org/apiv2/search/text")
|
||||||
|
.query(&[("token", self.token.as_str()), ("query", "dogs")])
|
||||||
|
.send().unwrap();
|
||||||
|
println!("{:?}", res.text());
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Let's leave it like this for a moment, and try to implement the `download` method. Freesound API sais that we need to use `Oauth` to download sounds. Let's try.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo add oauth2
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user