diff --git a/plugins/adr-backend/api-report.md b/plugins/adr-backend/api-report.md index 24e54e8eb5..d5645ad3a7 100644 --- a/plugins/adr-backend/api-report.md +++ b/plugins/adr-backend/api-report.md @@ -7,6 +7,7 @@ import { AdrDocument } from '@backstage/plugin-adr-common'; import { AdrFilePathFilterFn } from '@backstage/plugin-adr-common'; +import { CacheClient } from '@backstage/backend-common'; import { CatalogApi } from '@backstage/catalog-client'; import { Config } from '@backstage/config'; import { DocumentCollatorFactory } from '@backstage/plugin-search-common'; @@ -42,11 +43,20 @@ export type AdrParserContext = { path: string; }; +// @public (undocumented) +export type AdrRouterOptions = { + reader: UrlReader; + cacheClient: CacheClient; + logger: Logger; +}; + // @public export const createMadrParser: (options?: MadrParserOptions) => AdrParser; // @public (undocumented) -export function createRouter(reader: UrlReader): Promise; +export function createRouter( + options: AdrRouterOptions, +): Promise; // @public export class DefaultAdrCollatorFactory implements DocumentCollatorFactory { diff --git a/plugins/adr-backend/src/service/index.ts b/plugins/adr-backend/src/service/index.ts index 434446cf3f..3736acb188 100644 --- a/plugins/adr-backend/src/service/index.ts +++ b/plugins/adr-backend/src/service/index.ts @@ -15,3 +15,4 @@ */ export { createRouter } from './router'; +export type { AdrRouterOptions } from './router'; diff --git a/plugins/adr-backend/src/service/router.ts b/plugins/adr-backend/src/service/router.ts index 9c21b03d04..e6603ab346 100644 --- a/plugins/adr-backend/src/service/router.ts +++ b/plugins/adr-backend/src/service/router.ts @@ -20,6 +20,7 @@ import { Logger } from 'winston'; import express from 'express'; import Router from 'express-promise-router'; +/** @public */ export type AdrRouterOptions = { reader: UrlReader; cacheClient: CacheClient; diff --git a/plugins/adr/api-report.md b/plugins/adr/api-report.md index 2a49e89b2d..d6480cd090 100644 --- a/plugins/adr/api-report.md +++ b/plugins/adr/api-report.md @@ -7,11 +7,37 @@ import { AdrDocument } from '@backstage/plugin-adr-common'; import { AdrFilePathFilterFn } from '@backstage/plugin-adr-common'; +import { ApiRef } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; +import { DiscoveryApi } from '@backstage/core-plugin-api'; import { isAdrAvailable } from '@backstage/plugin-adr-common'; import { ResultHighlight } from '@backstage/plugin-search-common'; import { RouteRef } from '@backstage/core-plugin-api'; +// @public +export interface AdrApi { + listAdrs(url: string): Promise; + readAdr(url: string): Promise; +} + +// @public +export const adrApiRef: ApiRef; + +// @public +export class AdrClient implements AdrApi { + constructor(options: AdrClientOptions); + // (undocumented) + listAdrs(url: string): Promise; + // (undocumented) + readAdr(url: string): Promise; +} + +// @public +export interface AdrClientOptions { + // (undocumented) + discoveryApi: DiscoveryApi; +} + // @public export type AdrContentDecorator = (adrInfo: { baseUrl: string; @@ -21,10 +47,16 @@ export type AdrContentDecorator = (adrInfo: { }; // @public -export interface AdrFileFetcher { - useGetAdrFilesAtUrl: (url: string) => any; - useReadAdrFileAtUrl: (url: string) => any; -} +export type AdrFileInfo = { + type: string; + path: string; + name: string; +}; + +// @public +export type AdrListResult = { + data: AdrFileInfo[]; +}; // @public export const adrPlugin: BackstagePlugin< @@ -37,17 +69,18 @@ export const adrPlugin: BackstagePlugin< // @public export const AdrReader: { - (props: { - adr: string; - decorators?: AdrContentDecorator[]; - adrFileFetcher?: AdrFileFetcher; - }): JSX.Element; + (props: { adr: string; decorators?: AdrContentDecorator[] }): JSX.Element; decorators: Readonly<{ createRewriteRelativeLinksDecorator(): AdrContentDecorator; createRewriteRelativeEmbedsDecorator(): AdrContentDecorator; }>; }; +// @public +export type AdrReadResult = { + data: string; +}; + // @public export function AdrSearchResultListItem(props: { lineClamp?: number; @@ -60,14 +93,7 @@ export function AdrSearchResultListItem(props: { export const EntityAdrContent: (props: { contentDecorators?: AdrContentDecorator[] | undefined; filePathFilterFn?: AdrFilePathFilterFn | undefined; - adrFileFetcher?: AdrFileFetcher | undefined; }) => JSX.Element; export { isAdrAvailable }; - -// @public -export const octokitAdrFileFetcher: AdrFileFetcher; - -// @public -export const urlReaderAdrFileFetcher: AdrFileFetcher; ```