Updated documentation

Added comments to exports. Updated READMEs for the adr-backend and adr plugins.

Signed-off-by: Robert Bunning <rbunning@webstaurantstore.com>
This commit is contained in:
Robert Bunning
2022-12-19 11:24:03 -05:00
parent fc1d240190
commit 99fea85ddf
5 changed files with 55 additions and 1 deletions
+27
View File
@@ -40,14 +40,36 @@ const useAdrApi = (
};
};
/**
* Represents something that is capable of fetching a listing of adr files at a provided url
* and fetching the contents of an adr file at a provided url.
*
* @public
*/
export interface AdrFileFetcher {
/**
* A hook to get a listing of adr files that exist at the provided url
*
* @param url The url to get files from
*/
useGetAdrFilesAtUrl: (url: string) => any;
/**
* A hook to get the contents of the adr file at the provided url
*
* @param url The url of the adr file
*/
useReadAdrFileAtUrl: (url: string) => any;
}
const getAdrFilesEndpoint = 'getAdrFilesAtUrl';
const readAdrFileEndpoint = 'readAdrFileAtUrl';
/**
* An AdrFileFetcher that uses UrlReaders to fetch adr files
*
* @public
*/
export const urlReaderAdrFileFetcher: AdrFileFetcher = {
useGetAdrFilesAtUrl: function (url: string) {
const discoveryApi = useApi(discoveryApiRef);
@@ -63,6 +85,11 @@ export const urlReaderAdrFileFetcher: AdrFileFetcher = {
},
};
/**
* An AdrFileFetcher that uses the useOctokitRequest hook for fetching adr files
*
* @public
*/
export const octokitAdrFileFetcher: AdrFileFetcher = {
useGetAdrFilesAtUrl: (url: string) => useOctokitRequest(url),
useReadAdrFileAtUrl: (url: string) => useOctokitRequest(url),
+1
View File
@@ -22,3 +22,4 @@ export { isAdrAvailable } from '@backstage/plugin-adr-common';
export * from './components/AdrReader';
export { adrPlugin, EntityAdrContent } from './plugin';
export * from './search';
export * from './hooks/adrFileFetcher';