WIP: Start implementing OAuth

This commit is contained in:
Nikolai Rodionov 2023-05-31 14:25:42 +02:00
parent 918b075b62
commit aa87ad7538
No known key found for this signature in database
GPG Key ID: 906851F91B1DA3EF

View File

@ -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
```