From e1960e91ca107475128b30290942a3ff3c0f29eb Mon Sep 17 00:00:00 2001 From: Ola Date: Wed, 29 Nov 2023 07:52:06 +0100 Subject: [PATCH] draft: Search through podcast episodes #3 --- package-lock.json | 41 ++++++++++++++++++++++++++++++++ package.json | 3 +++ src/components/SearchEpisodes.js | 17 +++++++++++++ src/pages/index.astro | 1 + 4 files changed, 62 insertions(+) create mode 100644 src/components/SearchEpisodes.js diff --git a/package-lock.json b/package-lock.json index 12e68a2..09f6d16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,9 @@ "": { "name": "mixpod-astro", "version": "0.0.1", + "dependencies": { + "podcast-api": "^2.0.4" + }, "devDependencies": { "@astrojs/netlify": "^3.0.4", "astro": "^3.4.3", @@ -1255,6 +1258,14 @@ "sharp": "^0.32.5" } }, + "node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, "node_modules/b4a": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", @@ -2099,6 +2110,25 @@ "pkg-dir": "^4.2.0" } }, + "node_modules/follow-redirects": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", @@ -4398,6 +4428,17 @@ "node": ">=8" } }, + "node_modules/podcast-api": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/podcast-api/-/podcast-api-2.0.4.tgz", + "integrity": "sha512-VidsB9YZoHwLwdP6fuDxPw36509XzEkn1ll/zD8prznvs7xYZA3U3gZZ3ZMU4S9xLsBJbo+onm4ul6oTt7grJw==", + "dependencies": { + "axios": "^0.21.1" + }, + "engines": { + "node": ">=10.*" + } + }, "node_modules/postcss": { "version": "8.4.31", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", diff --git a/package.json b/package.json index 5d9052c..e54a409 100644 --- a/package.json +++ b/package.json @@ -16,5 +16,8 @@ "astro": "^3.4.3", "prettier": "^3.0.3", "prettier-plugin-astro": "^0.12.0" + }, + "dependencies": { + "podcast-api": "^2.0.4" } } diff --git a/src/components/SearchEpisodes.js b/src/components/SearchEpisodes.js new file mode 100644 index 0000000..6120c11 --- /dev/null +++ b/src/components/SearchEpisodes.js @@ -0,0 +1,17 @@ +const { Client } = require("podcast-api"); + +// See 1Password for apiKey or +// If apiKey is null, then we will connect to a mock server +// that returns fake data for testing purposes. +const client = Client({ apiKey: import.meta.env.PUBLIC_BLEH }); +client + .searchEpisodeTitles({ + q: "Dev-Life", + }) + .then((response) => { + // Get response json data here + console.log(response.data); + }) + .catch((error) => { + console.log(error); + }); diff --git a/src/pages/index.astro b/src/pages/index.astro index 26492ee..13df886 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -77,6 +77,7 @@ import SignUp from "../components/SignUp.astro"; +