WIP: Start implementing OAuth
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Nikolai Rodionov 2023-05-31 14:25:42 +02:00
parent 918b075b62
commit aa87ad7538
Signed by: allanger
GPG Key ID: 906851F91B1DA3EF
1 changed files with 16 additions and 0 deletions

View File

@ -126,3 +126,19 @@ impl FreesoundAPI {
```
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
```