From 713be06b2bd26a2460732ca2e7d523aab0aa9821 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Thu, 19 May 2022 14:43:41 -0400 Subject: [PATCH 01/12] Added apikey config for StackOverflow backend Signed-off-by: Matt Mulligan --- .changeset/few-monkeys-grab.md | 5 +++++ plugins/stack-overflow-backend/CHANGELOG.md | 6 ++++++ plugins/stack-overflow-backend/README.md | 10 ++++++++++ plugins/stack-overflow-backend/package.json | 2 +- .../StackOverflowQuestionsCollatorFactory.ts | 15 +++++++++++++-- 5 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .changeset/few-monkeys-grab.md diff --git a/.changeset/few-monkeys-grab.md b/.changeset/few-monkeys-grab.md new file mode 100644 index 0000000000..b841445b68 --- /dev/null +++ b/.changeset/few-monkeys-grab.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-stack-overflow-backend': patch +--- + +Added an apiKey configuration to app-config.yaml to prevent encoding the api key when passed to a private stack overflow instance diff --git a/plugins/stack-overflow-backend/CHANGELOG.md b/plugins/stack-overflow-backend/CHANGELOG.md index 1483589528..bca947fecb 100644 --- a/plugins/stack-overflow-backend/CHANGELOG.md +++ b/plugins/stack-overflow-backend/CHANGELOG.md @@ -1,5 +1,11 @@ # @backstage/plugin-stack-overflow-backend +## 0.1.2 + +### Patch Changes + +- Added apiKey configuration to prevent encoding the key value + ## 0.1.1 ### Patch Changes diff --git a/plugins/stack-overflow-backend/README.md b/plugins/stack-overflow-backend/README.md index f2eaf660c2..62115b889c 100644 --- a/plugins/stack-overflow-backend/README.md +++ b/plugins/stack-overflow-backend/README.md @@ -15,6 +15,16 @@ stackoverflow: baseUrl: https://api.stackexchange.com/2.2 # alternative: your internal stack overflow instance ``` +### Stack Overflow for Teams (private stack overflow instance) + +If you have a private stack overflow instance you will need to supply an API key as well. You can read more about how to set this up by going to [Stack Overflows Help Page](https://stackoverflow.help/en/articles/4385859-stack-overflow-for-teams-api) + +```yaml +stackoverflow: + baseUrl: https://api.stackexchange.com/2.2 # alternative: your internal stack overflow instance + apiKey: $STACK_OVERFLOW_API_KEY +``` + ## Areas of Responsibility This stack overflow backend plugin is primarily responsible for the following: diff --git a/plugins/stack-overflow-backend/package.json b/plugins/stack-overflow-backend/package.json index dd842ba01e..c4416be8b6 100644 --- a/plugins/stack-overflow-backend/package.json +++ b/plugins/stack-overflow-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-stack-overflow-backend", - "version": "0.1.1", + "version": "0.1.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", diff --git a/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts b/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts index 98fc86c2ea..55de71b7c7 100644 --- a/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts +++ b/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts @@ -52,6 +52,7 @@ export type StackOverflowQuestionsCollatorFactoryOptions = { baseUrl?: string; requestParams: StackOverflowQuestionsRequestParams; logger: Logger; + config: Config; }; /** @@ -65,12 +66,14 @@ export class StackOverflowQuestionsCollatorFactory protected requestParams: StackOverflowQuestionsRequestParams; private readonly baseUrl: string | undefined; private readonly logger: Logger; + private readonly config: Config; public readonly type: string = 'stack-overflow'; private constructor(options: StackOverflowQuestionsCollatorFactoryOptions) { this.baseUrl = options.baseUrl; this.requestParams = options.requestParams; this.logger = options.logger; + this.config = options.config; } static fromConfig( @@ -80,7 +83,11 @@ export class StackOverflowQuestionsCollatorFactory const baseUrl = config.getOptionalString('stackoverflow.baseUrl') || 'https://api.stackexchange.com/2.2'; - return new StackOverflowQuestionsCollatorFactory({ ...options, baseUrl }); + return new StackOverflowQuestionsCollatorFactory({ + ...options, + baseUrl, + config, + }); } async getCollator() { @@ -93,12 +100,16 @@ export class StackOverflowQuestionsCollatorFactory `No stackoverflow.baseUrl configured in your app-config.yaml`, ); } + const params = qs.stringify(this.requestParams, { arrayFormat: 'comma', addQueryPrefix: true, }); - const res = await fetch(`${this.baseUrl}/questions${params}`); + const apiKey = this.config.getOptionalString('stackoverflow.apiKey'); + const apiKeyParam = apiKey ? `${params ? '&' : '?'}key=${apiKey}` : ''; + + const res = await fetch(`${this.baseUrl}/questions${params}${apiKeyParam}`); const data = await res.json(); for (const question of data.items) { From 3e0df2aee84019513f0d09b76f511cda41ec8d78 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Mon, 20 Jun 2022 22:21:38 -0400 Subject: [PATCH 02/12] Changed to pass apiKey as param in config options Signed-off-by: Matt Mulligan --- .../StackOverflowQuestionsCollatorFactory.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts b/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts index 55de71b7c7..15bf34a71c 100644 --- a/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts +++ b/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts @@ -50,9 +50,9 @@ export type StackOverflowQuestionsRequestParams = { */ export type StackOverflowQuestionsCollatorFactoryOptions = { baseUrl?: string; + apiKey?: string; requestParams: StackOverflowQuestionsRequestParams; logger: Logger; - config: Config; }; /** @@ -65,28 +65,29 @@ export class StackOverflowQuestionsCollatorFactory { protected requestParams: StackOverflowQuestionsRequestParams; private readonly baseUrl: string | undefined; + private readonly apiKey: string | undefined; private readonly logger: Logger; - private readonly config: Config; public readonly type: string = 'stack-overflow'; private constructor(options: StackOverflowQuestionsCollatorFactoryOptions) { this.baseUrl = options.baseUrl; this.requestParams = options.requestParams; this.logger = options.logger; - this.config = options.config; + this.apiKey = options.apiKey; } static fromConfig( config: Config, options: StackOverflowQuestionsCollatorFactoryOptions, ) { + const apiKey = config.getOptionalString('stackoverflow.apiKey'); const baseUrl = config.getOptionalString('stackoverflow.baseUrl') || 'https://api.stackexchange.com/2.2'; return new StackOverflowQuestionsCollatorFactory({ ...options, baseUrl, - config, + apiKey, }); } @@ -101,13 +102,16 @@ export class StackOverflowQuestionsCollatorFactory ); } + this.logger.warn(`${JSON.stringify(this.requestParams)}`); + const params = qs.stringify(this.requestParams, { arrayFormat: 'comma', addQueryPrefix: true, }); - const apiKey = this.config.getOptionalString('stackoverflow.apiKey'); - const apiKeyParam = apiKey ? `${params ? '&' : '?'}key=${apiKey}` : ''; + const apiKeyParam = this.apiKey + ? `${params ? '&' : '?'}key=${this.apiKey}` + : ''; const res = await fetch(`${this.baseUrl}/questions${params}${apiKeyParam}`); const data = await res.json(); From 7bf05c18e045fb7128d07db4850ef6ed090eba75 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Mon, 20 Jun 2022 22:40:45 -0400 Subject: [PATCH 03/12] Updated api-report.md Signed-off-by: Matt Mulligan --- plugins/stack-overflow-backend/api-report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/stack-overflow-backend/api-report.md b/plugins/stack-overflow-backend/api-report.md index fc4c610d3e..1a21ff34ac 100644 --- a/plugins/stack-overflow-backend/api-report.md +++ b/plugins/stack-overflow-backend/api-report.md @@ -41,6 +41,7 @@ export class StackOverflowQuestionsCollatorFactory // @public export type StackOverflowQuestionsCollatorFactoryOptions = { baseUrl?: string; + apiKey?: string; requestParams: StackOverflowQuestionsRequestParams; logger: Logger; }; From 7cf7b1e4e79096870ca8df9b66a8b39c422b3393 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Mon, 20 Jun 2022 22:42:58 -0400 Subject: [PATCH 04/12] Updated config.d.ts to include apiKey Signed-off-by: Matt Mulligan --- plugins/stack-overflow-backend/config.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/stack-overflow-backend/config.d.ts b/plugins/stack-overflow-backend/config.d.ts index 7e7211ca33..3ce37f3396 100644 --- a/plugins/stack-overflow-backend/config.d.ts +++ b/plugins/stack-overflow-backend/config.d.ts @@ -24,5 +24,11 @@ export interface Config { * @visibility backend */ baseUrl: string; + + /** + * The api key to authenticate to Stack Overflow API + * @visibility backend + */ + apiKey: string; }; } From 547a573e990e6672da0e7764197dc37db3a67710 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Mon, 20 Jun 2022 22:47:23 -0400 Subject: [PATCH 05/12] Added check for if key is provided in request params Signed-off-by: Matt Mulligan --- .../search/StackOverflowQuestionsCollatorFactory.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts b/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts index 15bf34a71c..45261ce546 100644 --- a/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts +++ b/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts @@ -71,9 +71,9 @@ export class StackOverflowQuestionsCollatorFactory private constructor(options: StackOverflowQuestionsCollatorFactoryOptions) { this.baseUrl = options.baseUrl; + this.apiKey = options.apiKey; this.requestParams = options.requestParams; this.logger = options.logger; - this.apiKey = options.apiKey; } static fromConfig( @@ -102,7 +102,16 @@ export class StackOverflowQuestionsCollatorFactory ); } - this.logger.warn(`${JSON.stringify(this.requestParams)}`); + try { + if (Object.keys(this.requestParams).indexOf('key') >= 0) { + this.logger.warn( + 'The API Key should be passed as a seperate param to bypass encoding', + ); + delete this.requestParams.key; + } + } catch (e) { + this.logger.error(`Caught ${e}`); + } const params = qs.stringify(this.requestParams, { arrayFormat: 'comma', From ea5631a8b2281a97005d099903f3d442e68c0d9a Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Wed, 22 Jun 2022 10:55:28 -0400 Subject: [PATCH 06/12] updated the frontend plugin to accept apikey config Signed-off-by: Matt Mulligan --- .changeset/friendly-sheep-flash.md | 5 +++++ plugins/stack-overflow/README.md | 10 ++++++++++ plugins/stack-overflow/config.d.ts | 6 ++++++ .../src/home/StackOverflowQuestions/Content.tsx | 17 +++++++++++++++-- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .changeset/friendly-sheep-flash.md diff --git a/.changeset/friendly-sheep-flash.md b/.changeset/friendly-sheep-flash.md new file mode 100644 index 0000000000..27fd383f82 --- /dev/null +++ b/.changeset/friendly-sheep-flash.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-stack-overflow': patch +--- + +Added API key configuration to bypass encoding diff --git a/plugins/stack-overflow/README.md b/plugins/stack-overflow/README.md index 96a8f524e3..637afd0494 100644 --- a/plugins/stack-overflow/README.md +++ b/plugins/stack-overflow/README.md @@ -15,6 +15,16 @@ stackoverflow: baseUrl: https://api.stackexchange.com/2.2 # alternative: your internal stack overflow instance ``` +### Stack Overflow for Teams (private stack overflow instance) + +If you have a private stack overflow instance you will need to supply an API key as well. You can read more about how to set this up by going to [Stack Overflows Help Page](https://stackoverflow.help/en/articles/4385859-stack-overflow-for-teams-api) + +```yaml +stackoverflow: + baseUrl: https://api.stackexchange.com/2.2 # alternative: your internal stack overflow instance + apiKey: $STACK_OVERFLOW_API_KEY +``` + ## Areas of Responsibility This stack overflow frontend plugin is primarily responsible for the following: diff --git a/plugins/stack-overflow/config.d.ts b/plugins/stack-overflow/config.d.ts index 811893231e..5ea62be2bd 100644 --- a/plugins/stack-overflow/config.d.ts +++ b/plugins/stack-overflow/config.d.ts @@ -24,5 +24,11 @@ export interface Config { * @visibility frontend */ baseUrl: string; + + /** + * The api key to authenticate to Stack Overflow API + * @visibility backend + */ + apiKey: string; }; } diff --git a/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx b/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx index fbc3a90a9d..8b954f5cf4 100644 --- a/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx +++ b/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx @@ -42,6 +42,7 @@ import { export const Content = (props: StackOverflowQuestionsContentProps) => { const { requestParams } = props; const configApi = useApi(configApiRef); + const apiKey = configApi.getOptionalString('stackoverflow.apiKey'); const baseUrl = configApi.getOptionalString('stackoverflow.baseUrl') || 'https://api.stackexchange.com/2.2'; @@ -49,8 +50,20 @@ export const Content = (props: StackOverflowQuestionsContentProps) => { const { value, loading, error } = useAsync(async (): Promise< StackOverflowQuestion[] > => { - const params = qs.stringify(requestParams, { addQueryPrefix: true }); - const response = await fetch(`${baseUrl}/questions${params}`); + try { + if (Object.keys(requestParams).indexOf('key') >= 0) { + delete requestParams.key; + } + } catch (e) { + // console.log("Failed to remove key from params"); + } + + const params = qs.stringify(requestParams, { + arrayFormat: 'comma', + addQueryPrefix: true, + }); + const apiKeyParam = apiKey ? `${params ? '&' : '?'}key=${apiKey}` : ''; + const response = await fetch(`${baseUrl}/questions${params}${apiKeyParam}`); const data = await response.json(); return data.items; }, []); From 1ce878fad435bb57399bf7e293eb8edf208e2e4d Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Thu, 23 Jun 2022 08:56:36 -0400 Subject: [PATCH 07/12] Visibility matters. Signed-off-by: Matt Mulligan --- plugins/stack-overflow/config.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stack-overflow/config.d.ts b/plugins/stack-overflow/config.d.ts index 7bd55c6eb6..181f196312 100644 --- a/plugins/stack-overflow/config.d.ts +++ b/plugins/stack-overflow/config.d.ts @@ -27,7 +27,7 @@ export interface Config { /** * The api key to authenticate to Stack Overflow API - * @visibility backend + * @visibility frontend */ apiKey?: string; }; From daabe780e0328c949cf14d73b388f28f6e7183fc Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Thu, 23 Jun 2022 09:08:08 -0400 Subject: [PATCH 08/12] Removed second changeset file Signed-off-by: Matt Mulligan --- .changeset/few-monkeys-grab.md | 5 ----- .changeset/friendly-sheep-flash.md | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 .changeset/few-monkeys-grab.md diff --git a/.changeset/few-monkeys-grab.md b/.changeset/few-monkeys-grab.md deleted file mode 100644 index b841445b68..0000000000 --- a/.changeset/few-monkeys-grab.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-stack-overflow-backend': patch ---- - -Added an apiKey configuration to app-config.yaml to prevent encoding the api key when passed to a private stack overflow instance diff --git a/.changeset/friendly-sheep-flash.md b/.changeset/friendly-sheep-flash.md index 27fd383f82..83df13b290 100644 --- a/.changeset/friendly-sheep-flash.md +++ b/.changeset/friendly-sheep-flash.md @@ -1,5 +1,6 @@ --- '@backstage/plugin-stack-overflow': patch +'@backstage/plugin-stack-overflow-backend': patch --- -Added API key configuration to bypass encoding +Added API key as separate configuration From 17a65d285d13740b15cd3903ffb913fd65383b02 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Thu, 23 Jun 2022 10:35:29 -0400 Subject: [PATCH 09/12] Removed front end changes Signed-off-by: Matt Mulligan --- .changeset/friendly-sheep-flash.md | 1 - plugins/stack-overflow/config.d.ts | 2 +- .../src/home/StackOverflowQuestions/Content.tsx | 12 +----------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.changeset/friendly-sheep-flash.md b/.changeset/friendly-sheep-flash.md index 83df13b290..58ae309bf1 100644 --- a/.changeset/friendly-sheep-flash.md +++ b/.changeset/friendly-sheep-flash.md @@ -1,5 +1,4 @@ --- -'@backstage/plugin-stack-overflow': patch '@backstage/plugin-stack-overflow-backend': patch --- diff --git a/plugins/stack-overflow/config.d.ts b/plugins/stack-overflow/config.d.ts index 181f196312..cf50241ec9 100644 --- a/plugins/stack-overflow/config.d.ts +++ b/plugins/stack-overflow/config.d.ts @@ -27,7 +27,7 @@ export interface Config { /** * The api key to authenticate to Stack Overflow API - * @visibility frontend + * @visibility secret */ apiKey?: string; }; diff --git a/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx b/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx index 8b954f5cf4..6d2ef9856a 100644 --- a/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx +++ b/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx @@ -42,7 +42,6 @@ import { export const Content = (props: StackOverflowQuestionsContentProps) => { const { requestParams } = props; const configApi = useApi(configApiRef); - const apiKey = configApi.getOptionalString('stackoverflow.apiKey'); const baseUrl = configApi.getOptionalString('stackoverflow.baseUrl') || 'https://api.stackexchange.com/2.2'; @@ -50,20 +49,11 @@ export const Content = (props: StackOverflowQuestionsContentProps) => { const { value, loading, error } = useAsync(async (): Promise< StackOverflowQuestion[] > => { - try { - if (Object.keys(requestParams).indexOf('key') >= 0) { - delete requestParams.key; - } - } catch (e) { - // console.log("Failed to remove key from params"); - } - const params = qs.stringify(requestParams, { arrayFormat: 'comma', addQueryPrefix: true, }); - const apiKeyParam = apiKey ? `${params ? '&' : '?'}key=${apiKey}` : ''; - const response = await fetch(`${baseUrl}/questions${params}${apiKeyParam}`); + const response = await fetch(`${baseUrl}/questions${params}`); const data = await response.json(); return data.items; }, []); From b04f689cd02a25019c9b34b5477c7b2ddf63ea1b Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Thu, 23 Jun 2022 10:36:33 -0400 Subject: [PATCH 10/12] Added frontend for patch to add secret config Signed-off-by: Matt Mulligan --- .changeset/friendly-sheep-flash.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.changeset/friendly-sheep-flash.md b/.changeset/friendly-sheep-flash.md index 58ae309bf1..83df13b290 100644 --- a/.changeset/friendly-sheep-flash.md +++ b/.changeset/friendly-sheep-flash.md @@ -1,4 +1,5 @@ --- +'@backstage/plugin-stack-overflow': patch '@backstage/plugin-stack-overflow-backend': patch --- From 335bfb727c7b08aa3d24cd095d0a5ebf1a3f8a40 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Sat, 23 Jul 2022 09:56:10 -0400 Subject: [PATCH 11/12] Removed frontend changes Signed-off-by: Matt Mulligan --- .changeset/friendly-sheep-flash.md | 1 - plugins/stack-overflow/README.md | 10 ---------- plugins/stack-overflow/config.d.ts | 6 ------ .../src/home/StackOverflowQuestions/Content.tsx | 5 +---- 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/.changeset/friendly-sheep-flash.md b/.changeset/friendly-sheep-flash.md index 83df13b290..58ae309bf1 100644 --- a/.changeset/friendly-sheep-flash.md +++ b/.changeset/friendly-sheep-flash.md @@ -1,5 +1,4 @@ --- -'@backstage/plugin-stack-overflow': patch '@backstage/plugin-stack-overflow-backend': patch --- diff --git a/plugins/stack-overflow/README.md b/plugins/stack-overflow/README.md index 637afd0494..96a8f524e3 100644 --- a/plugins/stack-overflow/README.md +++ b/plugins/stack-overflow/README.md @@ -15,16 +15,6 @@ stackoverflow: baseUrl: https://api.stackexchange.com/2.2 # alternative: your internal stack overflow instance ``` -### Stack Overflow for Teams (private stack overflow instance) - -If you have a private stack overflow instance you will need to supply an API key as well. You can read more about how to set this up by going to [Stack Overflows Help Page](https://stackoverflow.help/en/articles/4385859-stack-overflow-for-teams-api) - -```yaml -stackoverflow: - baseUrl: https://api.stackexchange.com/2.2 # alternative: your internal stack overflow instance - apiKey: $STACK_OVERFLOW_API_KEY -``` - ## Areas of Responsibility This stack overflow frontend plugin is primarily responsible for the following: diff --git a/plugins/stack-overflow/config.d.ts b/plugins/stack-overflow/config.d.ts index cf50241ec9..c0638e3c19 100644 --- a/plugins/stack-overflow/config.d.ts +++ b/plugins/stack-overflow/config.d.ts @@ -24,11 +24,5 @@ export interface Config { * @visibility frontend */ baseUrl?: string; - - /** - * The api key to authenticate to Stack Overflow API - * @visibility secret - */ - apiKey?: string; }; } diff --git a/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx b/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx index 6d2ef9856a..fbc3a90a9d 100644 --- a/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx +++ b/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx @@ -49,10 +49,7 @@ export const Content = (props: StackOverflowQuestionsContentProps) => { const { value, loading, error } = useAsync(async (): Promise< StackOverflowQuestion[] > => { - const params = qs.stringify(requestParams, { - arrayFormat: 'comma', - addQueryPrefix: true, - }); + const params = qs.stringify(requestParams, { addQueryPrefix: true }); const response = await fetch(`${baseUrl}/questions${params}`); const data = await response.json(); return data.items; From 4a9a2c3cfe136f5b23e9f25a36ca07f190a0efe9 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Sat, 23 Jul 2022 10:09:10 -0400 Subject: [PATCH 12/12] Changed visibility of ApiKey to secret Signed-off-by: Matt Mulligan --- plugins/stack-overflow-backend/config.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stack-overflow-backend/config.d.ts b/plugins/stack-overflow-backend/config.d.ts index 96505917cd..d329a4389f 100644 --- a/plugins/stack-overflow-backend/config.d.ts +++ b/plugins/stack-overflow-backend/config.d.ts @@ -27,7 +27,7 @@ export interface Config { /** * The api key to authenticate to Stack Overflow API - * @visibility backend + * @visibility secret */ apiKey?: string; };