From aa87ad75388a10f29ab1f792aa6e9d67d6cc1054 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 31 May 2023 14:25:42 +0200 Subject: [PATCH] WIP: Start implementing OAuth --- .../developing-a-free-alternative-for-splice.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/content/posts/developing-a-free-alternative-for-splice.md b/src/content/posts/developing-a-free-alternative-for-splice.md index 457616c..1eadfde 100644 --- a/src/content/posts/developing-a-free-alternative-for-splice.md +++ b/src/content/posts/developing-a-free-alternative-for-splice.md @@ -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 +```