diff --git a/plugins/jenkins/api-report.md b/plugins/jenkins/api-report.md index 05ebd1fd03..5db5fd0dfe 100644 --- a/plugins/jenkins/api-report.md +++ b/plugins/jenkins/api-report.md @@ -10,7 +10,6 @@ import { BackstagePlugin } from '@backstage/core-plugin-api'; import { DiscoveryApi } from '@backstage/core-plugin-api'; import { Entity } from '@backstage/catalog-model'; import type { EntityName } from '@backstage/catalog-model'; -import type { EntityRef } from '@backstage/catalog-model'; import { IdentityApi } from '@backstage/core-plugin-api'; import { InfoCardVariants } from '@backstage/core-components'; import { RouteRef } from '@backstage/core-plugin-api'; @@ -55,7 +54,7 @@ export interface JenkinsApi { }): Promise; // Warning: (ae-forgotten-export) The symbol "Project" needs to be exported by the entry point index.d.ts getProjects(options: { - entity: EntityRef; + entity: EntityName; filter: { branch?: string; }; @@ -82,31 +81,20 @@ export class JenkinsClient implements JenkinsApi { identityApi: IdentityApi; }); // (undocumented) - getBuild({ - entity, - jobFullName, - buildNumber, - }: { + getBuild(options: { entity: EntityName; jobFullName: string; buildNumber: string; }): Promise; // (undocumented) - getProjects({ - entity, - filter, - }: { + getProjects(options: { entity: EntityName; filter: { branch?: string; }; }): Promise; // (undocumented) - retry({ - entity, - jobFullName, - buildNumber, - }: { + retry(options: { entity: EntityName; jobFullName: string; buildNumber: string; diff --git a/plugins/jenkins/src/api/JenkinsApi.ts b/plugins/jenkins/src/api/JenkinsApi.ts index 65ac79b62b..dd169de78b 100644 --- a/plugins/jenkins/src/api/JenkinsApi.ts +++ b/plugins/jenkins/src/api/JenkinsApi.ts @@ -19,7 +19,7 @@ import { DiscoveryApi, IdentityApi, } from '@backstage/core-plugin-api'; -import type { EntityName, EntityRef } from '@backstage/catalog-model'; +import type { EntityName } from '@backstage/catalog-model'; import { ResponseError } from '@backstage/errors'; export const jenkinsApiRef = createApiRef({ @@ -80,7 +80,7 @@ export interface JenkinsApi { */ getProjects(options: { /** the entity whose jobs should be retrieved. */ - entity: EntityRef; + entity: EntityName; /** a filter on jobs. Currently this just takes a branch (and assumes certain structures in jenkins) */ filter: { branch?: string }; }): Promise; @@ -117,13 +117,11 @@ export class JenkinsClient implements JenkinsApi { this.identityApi = options.identityApi; } - async getProjects({ - entity, - filter, - }: { + async getProjects(options: { entity: EntityName; filter: { branch?: string }; }): Promise { + const { entity, filter } = options; const url = new URL( `${await this.discoveryApi.getBaseUrl( 'jenkins', @@ -158,15 +156,12 @@ export class JenkinsClient implements JenkinsApi { ); } - async getBuild({ - entity, - jobFullName, - buildNumber, - }: { + async getBuild(options: { entity: EntityName; jobFullName: string; buildNumber: string; }): Promise { + const { entity, jobFullName, buildNumber } = options; const url = `${await this.discoveryApi.getBaseUrl( 'jenkins', )}/v1/entity/${encodeURIComponent(entity.namespace)}/${encodeURIComponent( @@ -186,15 +181,12 @@ export class JenkinsClient implements JenkinsApi { return (await response.json()).build; } - async retry({ - entity, - jobFullName, - buildNumber, - }: { + async retry(options: { entity: EntityName; jobFullName: string; buildNumber: string; }): Promise { + const { entity, jobFullName, buildNumber } = options; const url = `${await this.discoveryApi.getBaseUrl( 'jenkins', )}/v1/entity/${encodeURIComponent(entity.namespace)}/${encodeURIComponent(