Fixing up integration-react as well
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/integration-react': patch
|
||||
---
|
||||
|
||||
Clean up the API exports
|
||||
@@ -65,7 +65,6 @@ export class ScmAuth implements ScmAuthApi {
|
||||
host?: string;
|
||||
},
|
||||
): ScmAuth;
|
||||
// (undocumented)
|
||||
getCredentials(options: ScmAuthTokenOptions): Promise<ScmAuthTokenResponse>;
|
||||
isUrlSupported(url: URL): boolean;
|
||||
static merge(...providers: ScmAuth[]): ScmAuthApi;
|
||||
@@ -79,7 +78,7 @@ export interface ScmAuthApi {
|
||||
// @public
|
||||
export const scmAuthApiRef: ApiRef<ScmAuthApi>;
|
||||
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export interface ScmAuthTokenOptions extends AuthRequestOptions {
|
||||
additionalScope?: {
|
||||
repoWrite?: boolean;
|
||||
@@ -87,7 +86,7 @@ export interface ScmAuthTokenOptions extends AuthRequestOptions {
|
||||
url: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export interface ScmAuthTokenResponse {
|
||||
headers: {
|
||||
[name: string]: string;
|
||||
@@ -95,25 +94,21 @@ export interface ScmAuthTokenResponse {
|
||||
token: string;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ScmIntegrationIcon" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const ScmIntegrationIcon: ({
|
||||
type,
|
||||
}: {
|
||||
type?: string | undefined;
|
||||
}) => JSX.Element;
|
||||
// @public
|
||||
export const ScmIntegrationIcon: (
|
||||
props: ScmIntegrationIconProps,
|
||||
) => JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ScmIntegrationsApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export type ScmIntegrationIconProps = {
|
||||
type?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class ScmIntegrationsApi {
|
||||
// (undocumented)
|
||||
static fromConfig(config: Config): ScmIntegrationRegistry;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "scmIntegrationsApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export const scmIntegrationsApiRef: ApiRef<ScmIntegrationRegistry>;
|
||||
```
|
||||
|
||||
@@ -254,6 +254,9 @@ export class ScmAuth implements ScmAuthApi {
|
||||
return url.host === this.#host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches credentials for the given resource.
|
||||
*/
|
||||
async getCredentials(
|
||||
options: ScmAuthTokenOptions,
|
||||
): Promise<ScmAuthTokenResponse> {
|
||||
|
||||
@@ -20,7 +20,11 @@ import {
|
||||
AuthRequestOptions,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
/** @public */
|
||||
/**
|
||||
* The options that control a {@link ScmAuthApi.getCredentials} call.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface ScmAuthTokenOptions extends AuthRequestOptions {
|
||||
/**
|
||||
* The URL of the SCM resource to be accessed.
|
||||
@@ -43,7 +47,11 @@ export interface ScmAuthTokenOptions extends AuthRequestOptions {
|
||||
};
|
||||
}
|
||||
|
||||
/** @public */
|
||||
/**
|
||||
* The response from a {@link ScmAuthApi.getCredentials} call.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface ScmAuthTokenResponse {
|
||||
/**
|
||||
* An authorization token that can be used to authenticate requests.
|
||||
|
||||
@@ -21,12 +21,27 @@ import {
|
||||
} from '@backstage/integration';
|
||||
import { ApiRef, createApiRef } from '@backstage/core-plugin-api';
|
||||
|
||||
/**
|
||||
* Factory class for creating {@link @backstage/integration#ScmIntegrationRegistry} instances.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class ScmIntegrationsApi {
|
||||
/**
|
||||
* Instantiates an {@link @backstage/integration#ScmIntegrationRegistry}.
|
||||
*
|
||||
* @param config - The root of the config hierarchy.
|
||||
*/
|
||||
static fromConfig(config: Config): ScmIntegrationRegistry {
|
||||
return ScmIntegrations.fromConfig(config);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The API that holds all configured SCM integrations.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const scmIntegrationsApiRef: ApiRef<ScmIntegrationRegistry> =
|
||||
createApiRef({
|
||||
id: 'integration.scmintegrations',
|
||||
|
||||
+19
-1
@@ -17,7 +17,25 @@ import CodeIcon from '@material-ui/icons/Code';
|
||||
import React from 'react';
|
||||
import { useApp } from '@backstage/core-plugin-api';
|
||||
|
||||
export const ScmIntegrationIcon = ({ type }: { type?: string }) => {
|
||||
/**
|
||||
* Props for {@link ScmIntegrationIcon}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type ScmIntegrationIconProps = {
|
||||
/**
|
||||
* The integration type, e.g. "github".
|
||||
*/
|
||||
type?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* An icon that represents a certain SCM integration.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const ScmIntegrationIcon = (props: ScmIntegrationIconProps) => {
|
||||
const { type } = props;
|
||||
const app = useApp();
|
||||
const DefaultIcon = CodeIcon;
|
||||
const Icon = type ? app.getSystemIcon(type) ?? DefaultIcon : DefaultIcon;
|
||||
|
||||
@@ -15,3 +15,4 @@
|
||||
*/
|
||||
|
||||
export { ScmIntegrationIcon } from './ScmIntegrationIcon';
|
||||
export type { ScmIntegrationIconProps } from './ScmIntegrationIcon';
|
||||
|
||||
Reference in New Issue
Block a user