diff --git a/plugins/stack-overflow-backend/api-report.md b/plugins/stack-overflow-backend/api-report.md new file mode 100644 index 0000000000..e8743f1e30 --- /dev/null +++ b/plugins/stack-overflow-backend/api-report.md @@ -0,0 +1,52 @@ +## API Report File for "@backstage/plugin-stack-overflow-backend" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +/// + +import { Config } from '@backstage/config'; +import { DocumentCollatorFactory } from '@backstage/search-common'; +import { IndexableDocument } from '@backstage/search-common'; +import { Logger as Logger_2 } from 'winston'; +import { Readable } from 'stream'; + +// @public +export interface StackOverflowDocument extends IndexableDocument { + // (undocumented) + answers: number; + // (undocumented) + tags: string[]; +} + +// @public +export class StackOverflowQuestionsCollatorFactory + implements DocumentCollatorFactory +{ + // (undocumented) + execute(): AsyncGenerator; + // (undocumented) + static fromConfig( + config: Config, + options: StackOverflowQuestionsCollatorFactoryOptions, + ): StackOverflowQuestionsCollatorFactory; + // (undocumented) + getCollator(): Promise; + // (undocumented) + protected requestParams: StackOverflowQuestionsRequestParams; + // (undocumented) + readonly type: string; +} + +// @public +export type StackOverflowQuestionsCollatorFactoryOptions = { + baseUrl?: string; + requestParams: StackOverflowQuestionsRequestParams; + logger: Logger_2; +}; + +// @public +export type StackOverflowQuestionsRequestParams = { + [key: string]: string | string[] | number; +}; +``` diff --git a/plugins/stack-overflow-backend/src/index.ts b/plugins/stack-overflow-backend/src/index.ts index 9b7e7881fd..6e461b8183 100644 --- a/plugins/stack-overflow-backend/src/index.ts +++ b/plugins/stack-overflow-backend/src/index.ts @@ -14,4 +14,10 @@ * limitations under the License. */ -export { StackOverflowQuestionsCollatorFactory } from './search'; +/** + * Stack Overflow backend plugin + * + * @packageDocumentation + */ + +export * from './search'; diff --git a/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts b/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts index 85b0deee24..89b63b09c5 100644 --- a/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts +++ b/plugins/stack-overflow-backend/src/search/StackOverflowQuestionsCollatorFactory.ts @@ -24,21 +24,41 @@ import fetch from 'cross-fetch'; import qs from 'qs'; import { Logger } from 'winston'; -interface StackOverflowDocument extends IndexableDocument { +/** + * Extended IndexableDocument with stack overflow specific properties + * + * @public + */ +export interface StackOverflowDocument extends IndexableDocument { answers: number; tags: string[]; } -type StackOverflowQuestionsRequestParams = { +/** + * Type representing the request parameters accepted by the {@link StackOverflowQuestionsCollatorFactory} + * + * @public + */ +export type StackOverflowQuestionsRequestParams = { [key: string]: string | string[] | number; }; -type StackOverflowQuestionsCollatorFactoryOptions = { +/** + * Options for {@link StackOverflowQuestionsCollatorFactory} + * + * @public + */ +export type StackOverflowQuestionsCollatorFactoryOptions = { baseUrl?: string; requestParams: StackOverflowQuestionsRequestParams; logger: Logger; }; +/** + * Search collator responsible for collecting stack overflow questions to index. + * + * @public + */ export class StackOverflowQuestionsCollatorFactory implements DocumentCollatorFactory { diff --git a/plugins/stack-overflow-backend/src/search/index.ts b/plugins/stack-overflow-backend/src/search/index.ts index 875a945b44..ed3e05cb28 100644 --- a/plugins/stack-overflow-backend/src/search/index.ts +++ b/plugins/stack-overflow-backend/src/search/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export { StackOverflowQuestionsCollatorFactory } from './StackOverflowQuestionsCollatorFactory'; +export * from './StackOverflowQuestionsCollatorFactory'; diff --git a/plugins/stack-overflow/api-report.md b/plugins/stack-overflow/api-report.md new file mode 100644 index 0000000000..d8e944a35d --- /dev/null +++ b/plugins/stack-overflow/api-report.md @@ -0,0 +1,46 @@ +## API Report File for "@backstage/plugin-stack-overflow" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +/// + +import { BackstagePlugin } from '@backstage/core-plugin-api'; +import { ComponentRenderer } from '@backstage/plugin-home/src/extensions'; +import { ReactNode } from 'react'; + +// @public +export const HomePageStackOverflowQuestions: ( + props: ComponentRenderer & { + title?: string | undefined; + } & StackOverflowQuestionsContentProps, +) => JSX.Element; + +// @public +export const stackOverflowPlugin: BackstagePlugin<{}, {}>; + +// @public +export type StackOverflowQuestion = { + title: string; + link: string; + owner: Record; + tags: string[]; + answer_count: number; +}; + +// @public +export type StackOverflowQuestionsContentProps = { + requestParams: StackOverflowQuestionsRequestParams; +}; + +// @public +export type StackOverflowQuestionsRequestParams = { + [key: string]: string | string[] | number; +}; + +// @public +export const StackOverflowSearchResultListItem: (props: { + result: any; + icon?: ReactNode; +}) => JSX.Element; +``` diff --git a/plugins/stack-overflow/src/index.ts b/plugins/stack-overflow/src/index.ts index fd88491fc6..264a0d5d7c 100644 --- a/plugins/stack-overflow/src/index.ts +++ b/plugins/stack-overflow/src/index.ts @@ -13,9 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +/** + * Stack Overflow frontend plugin + * + * @packageDocumentation + */ export { stackOverflowPlugin, StackOverflowSearchResultListItem, HomePageStackOverflowQuestions, } from './plugin'; +export type { + StackOverflowQuestion, + StackOverflowQuestionsContentProps, + StackOverflowQuestionsRequestParams, +} from './types'; diff --git a/plugins/stack-overflow/src/plugin.ts b/plugins/stack-overflow/src/plugin.ts index 90a82da719..dee48cdf8e 100644 --- a/plugins/stack-overflow/src/plugin.ts +++ b/plugins/stack-overflow/src/plugin.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { createPlugin, createComponentExtension, @@ -20,6 +21,11 @@ import { import { createCardExtension } from '@backstage/plugin-home'; import { StackOverflowQuestionsContentProps } from './types'; +/** + * The Backstage plugin that holds stack overflow specific components + * + * @public + */ export const stackOverflowPlugin = createPlugin({ id: 'stack-overflow', }); @@ -29,7 +35,6 @@ export const stackOverflowPlugin = createPlugin({ * * @public */ - export const StackOverflowSearchResultListItem = stackOverflowPlugin.provide( createComponentExtension({ name: 'StackOverflowResultListItem', diff --git a/plugins/stack-overflow/src/types.ts b/plugins/stack-overflow/src/types.ts index a23585ed3c..c3fa08cc4f 100644 --- a/plugins/stack-overflow/src/types.ts +++ b/plugins/stack-overflow/src/types.ts @@ -14,6 +14,11 @@ * limitations under the License. */ +/** + * Type representing a stack overflow question + * + * @public + */ export type StackOverflowQuestion = { title: string; link: string; @@ -22,10 +27,20 @@ export type StackOverflowQuestion = { answer_count: number; }; +/** + * Props for HomePageStackOverflowQuestions + * + * @public + */ export type StackOverflowQuestionsContentProps = { requestParams: StackOverflowQuestionsRequestParams; }; +/** + * Type representing the request parameters accepted by the HomePageStackOverflowQuestions component + * + * @public + */ export type StackOverflowQuestionsRequestParams = { [key: string]: string | string[] | number; };