Skip to content

Commit

Permalink
Fix API report
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Guymer <[email protected]>
  • Loading branch information
ScottGuymer committed Sep 19, 2024
1 parent 91c9210 commit 3e41595
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
24 changes: 24 additions & 0 deletions workspaces/copilot/plugins/copilot-backend/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,26 @@ import { BackendFeatureCompat } from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
import { DatabaseService } from '@backstage/backend-plugin-api';
import express from 'express';
import { ExtensionPoint } from '@backstage/backend-plugin-api';
import { GithubCredentials } from '@backstage/integration';
import { LoggerService } from '@backstage/backend-plugin-api';
import { SchedulerService } from '@backstage/backend-plugin-api';
import { SchedulerServiceTaskScheduleDefinition } from '@backstage/backend-plugin-api';

// @public
export interface CopilotCredentialsProvider {
getCredentials(): Promise<GithubInfo>;
}

// @public
export interface CopilotExtensionPoint {
// (undocumented)
useCredentialsProvider(provider: CopilotCredentialsProvider): void;
}

// @public
export const copilotExtensionPoint: ExtensionPoint<CopilotExtensionPoint>;

// @public
const copilotPlugin: BackendFeatureCompat;
export default copilotPlugin;
Expand All @@ -20,6 +36,13 @@ export function createRouterFromConfig(
routerOptions: RouterOptions,
): Promise<express.Router>;

// @public
export type GithubInfo = {
credentials: GithubCredentials;
apiBaseUrl: string;
enterprise: string;
};

// @public
export interface PluginOptions {
schedule?: SchedulerServiceTaskScheduleDefinition;
Expand All @@ -28,6 +51,7 @@ export interface PluginOptions {
// @public
export interface RouterOptions {
config: Config;
credentialsProvider: CopilotCredentialsProvider;
database: DatabaseService;
logger: LoggerService;
scheduler: SchedulerService;
Expand Down
6 changes: 5 additions & 1 deletion workspaces/copilot/plugins/copilot-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
*/

export * from './service/router';
export { copilotPlugin as default, copilotExtensionPoint } from './plugin';
export {
copilotPlugin as default,
copilotExtensionPoint,
type CopilotExtensionPoint,
} from './plugin';
export {
type CopilotCredentialsProvider,
type GithubInfo,
Expand Down
10 changes: 10 additions & 0 deletions workspaces/copilot/plugins/copilot-backend/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,20 @@ import {
DefaultCopilotCredentialsProvider,
} from './utils/CopilotCredentialsProvider';

/**
* Interface for providing credentials for accessing the Copilot API.
*
* @public
*/
export interface CopilotExtensionPoint {
useCredentialsProvider(provider: CopilotCredentialsProvider): void;
}

/**
* Extension point for providing credentials for accessing the Copilot API.
*
* @public
*/
export const copilotExtensionPoint =
createExtensionPoint<CopilotExtensionPoint>({
id: 'copliot.credentials',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,28 @@ import {
ScmIntegrations,
} from '@backstage/integration';

/**
* Information required to access the GitHub API
*
* @public
*/
export type GithubInfo = {
credentials: GithubCredentials;
apiBaseUrl: string;
enterprise: string;
};

/**
* Interface for providing credentials for accessing the copilot API
*
* @public
*/
export interface CopilotCredentialsProvider {
/**
* Retrieve the credentials required to access the copilot API
*
* @public
*/
getCredentials(): Promise<GithubInfo>;
}

Expand Down

0 comments on commit 3e41595

Please sign in to comment.