From 4ab164dd8626b9d84845a65f2c69ed6a499d983e Mon Sep 17 00:00:00 2001 From: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Date: Mon, 1 Apr 2024 10:24:47 -0400 Subject: [PATCH] fix api reports Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Signed-off-by: aramissennyeydd --- .../src/types/generated.ts | 6 +- packages/catalog-client/api-report-alpha.md | 302 ++++++++---------- .../src/generated/apis/DefaultApi.client.ts | 112 +++++-- .../typescript-backstage-client/api.mustache | 7 +- .../typescript-backstage-server/api.mustache | 27 +- .../src/generated/apis/DefaultApi.server.ts | 173 ++-------- 6 files changed, 263 insertions(+), 364 deletions(-) diff --git a/packages/backend-openapi-utils/src/types/generated.ts b/packages/backend-openapi-utils/src/types/generated.ts index 31c1f7c28f..842158e477 100644 --- a/packages/backend-openapi-utils/src/types/generated.ts +++ b/packages/backend-openapi-utils/src/types/generated.ts @@ -19,11 +19,9 @@ import { PathTemplate, ValueOf } from './common'; export type EndpointMap = Record< string, - { query?: object; body?: object; response: object | void; path?: object } + { query?: object; body?: object; response?: object; path?: object } >; -type UnknownIfVoid = T extends void ? unknown : T; - // OpenAPI generator doesn't emit regular lowercase 'delete'. type HttpMethods = 'all' | 'put' | 'get' | 'post' | '_delete'; @@ -51,7 +49,7 @@ type ResponseBody< Method extends DocEndpointMethod, > = `#${Method}|${Endpoint}` extends keyof Doc ? 'response' extends keyof Doc[`#${Method}|${Endpoint}`] - ? UnknownIfVoid + ? Doc[`#${Method}|${Endpoint}`]['response'] : unknown : unknown; type QuerySchema< diff --git a/packages/catalog-client/api-report-alpha.md b/packages/catalog-client/api-report-alpha.md index 94d87512d4..cfbbed9335 100644 --- a/packages/catalog-client/api-report-alpha.md +++ b/packages/catalog-client/api-report-alpha.md @@ -3,8 +3,11 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -// Warning: (ae-missing-release-tag) "AnalyzeLocationEntityField" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type AnalyzeLocation = { + body: AnalyzeLocationRequest; +}; + // @public (undocumented) export interface AnalyzeLocationEntityField { description: string; @@ -14,16 +17,12 @@ export interface AnalyzeLocationEntityField { value: string | null; } -// Warning: (ae-missing-release-tag) "AnalyzeLocationEntityFieldStateEnum" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type AnalyzeLocationEntityFieldStateEnum = | 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput'; -// Warning: (ae-missing-release-tag) "AnalyzeLocationExistingEntity" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface AnalyzeLocationExistingEntity { // (undocumented) @@ -34,8 +33,6 @@ export interface AnalyzeLocationExistingEntity { location: LocationSpec; } -// Warning: (ae-missing-release-tag) "AnalyzeLocationGenerateEntity" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface AnalyzeLocationGenerateEntity { // (undocumented) @@ -44,8 +41,6 @@ export interface AnalyzeLocationGenerateEntity { fields: Array; } -// Warning: (ae-missing-release-tag) "AnalyzeLocationRequest" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface AnalyzeLocationRequest { // (undocumented) @@ -54,8 +49,6 @@ export interface AnalyzeLocationRequest { location: LocationInput; } -// Warning: (ae-missing-release-tag) "AnalyzeLocationResponse" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface AnalyzeLocationResponse { // (undocumented) @@ -64,8 +57,14 @@ export interface AnalyzeLocationResponse { generateEntities: Array; } -// Warning: (ae-missing-release-tag) "CreateLocation201Response" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type CreateLocation = { + body: CreateLocationRequest; + query: { + dryRun?: string; + }; +}; + // @public (undocumented) export interface CreateLocation201Response { // (undocumented) @@ -76,8 +75,6 @@ export interface CreateLocation201Response { location: Location_2; } -// Warning: (ae-missing-release-tag) "CreateLocationRequest" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface CreateLocationRequest { // (undocumented) @@ -100,38 +97,23 @@ export class DefaultApiClient { }); // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen analyzeLocation( - request: { - body: AnalyzeLocationRequest; - }, + request: AnalyzeLocation, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen createLocation( - request: { - body: CreateLocationRequest; - query: { - dryRun?: string; - }; - }, + request: CreateLocation, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen deleteEntityByUid( - request: { - path: { - uid: string; - }; - }, + request: DeleteEntityByUid, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen deleteLocation( - request: { - path: { - id: string; - }; - }, + request: DeleteLocation, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen @@ -141,16 +123,7 @@ export class DefaultApiClient { // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getEntities( - request: { - query: { - fields?: Array; - limit?: number; - filter?: Array; - offset?: number; - after?: string; - order?: Array; - }; - }, + request: GetEntities, options?: RequestOptions, ): Promise>>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen @@ -161,127 +134,87 @@ export class DefaultApiClient { // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getEntitiesByQuery( - request: { - query: { - fields?: Array; - limit?: number; - orderField?: Array; - cursor?: string; - filter?: Array; - fullTextFilterTerm?: string; - fullTextFilterFields?: Array; - }; - }, + request: GetEntitiesByQuery, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getEntitiesByRefs( - request: { - body: GetEntitiesByRefsRequest; - query: { - filter?: Array; - }; - }, + request: GetEntitiesByRefs, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getEntityAncestryByName( - request: { - path: { - kind: string; - namespace: string; - name: string; - }; - }, + request: GetEntityAncestryByName, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getEntityByName( - request: { - path: { - kind: string; - namespace: string; - name: string; - }; - }, + request: GetEntityByName, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getEntityByUid( - request: { - path: { - uid: string; - }; - }, + request: GetEntityByUid, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getEntityFacets( - request: { - query: { - facet: Array; - filter?: Array; - }; - }, + request: GetEntityFacets, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getLocation( - request: { - path: { - id: string; - }; - }, + request: GetLocation, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen getLocationByEntity( - request: { - path: { - kind: string; - namespace: string; - name: string; - }; - }, + request: GetLocationByEntity, options?: RequestOptions, ): Promise>; getLocations( - request: {}, + request: GetLocations, options?: RequestOptions, ): Promise>>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen refreshEntity( - request: { - body: RefreshEntityRequest; - }, + request: RefreshEntity, options?: RequestOptions, ): Promise>; // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen validateEntity( - request: { - body: ValidateEntityRequest; - }, + request: ValidateEntity, options?: RequestOptions, ): Promise>; } -// Warning: (ae-missing-release-tag) "EntitiesBatchResponse" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type DeleteEntityByUid = { + path: { + uid: string; + }; +}; + +// @public (undocumented) +export type DeleteLocation = { + path: { + id: string; + }; +}; + // @public (undocumented) export interface EntitiesBatchResponse { items: Array; } -// Warning: (ae-missing-release-tag) "EntitiesQueryResponse" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface EntitiesQueryResponse { items: Array; @@ -291,16 +224,12 @@ export interface EntitiesQueryResponse { totalItems: number; } -// Warning: (ae-missing-release-tag) "EntitiesQueryResponsePageInfo" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface EntitiesQueryResponsePageInfo { nextCursor?: string; prevCursor?: string; } -// Warning: (ae-missing-release-tag) "Entity" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface Entity { apiVersion: string; @@ -313,8 +242,6 @@ export interface Entity { }; } -// Warning: (ae-missing-release-tag) "EntityAncestryResponse" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface EntityAncestryResponse { // (undocumented) @@ -323,8 +250,6 @@ export interface EntityAncestryResponse { rootEntityRef: string; } -// Warning: (ae-missing-release-tag) "EntityAncestryResponseItemsInner" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface EntityAncestryResponseItemsInner { // (undocumented) @@ -333,8 +258,6 @@ export interface EntityAncestryResponseItemsInner { parentEntityRefs: Array; } -// Warning: (ae-missing-release-tag) "EntityFacet" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface EntityFacet { // (undocumented) @@ -343,8 +266,6 @@ export interface EntityFacet { value: string; } -// Warning: (ae-missing-release-tag) "EntityFacetsResponse" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface EntityFacetsResponse { // (undocumented) @@ -353,8 +274,6 @@ export interface EntityFacetsResponse { }; } -// Warning: (ae-missing-release-tag) "EntityLink" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface EntityLink { icon?: string; @@ -363,8 +282,6 @@ export interface EntityLink { url: string; } -// Warning: (ae-missing-release-tag) "EntityMeta" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface EntityMeta { // (undocumented) @@ -385,16 +302,12 @@ export interface EntityMeta { uid?: string; } -// Warning: (ae-missing-release-tag) "EntityRelation" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface EntityRelation { targetRef: string; type: string; } -// Warning: (ae-missing-release-tag) "ErrorError" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface ErrorError { // (undocumented) @@ -407,8 +320,6 @@ export interface ErrorError { stack?: string; } -// Warning: (ae-missing-release-tag) "ErrorRequest" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface ErrorRequest { // (undocumented) @@ -417,16 +328,45 @@ export interface ErrorRequest { url: string; } -// Warning: (ae-missing-release-tag) "ErrorResponse" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface ErrorResponse { // (undocumented) statusCode: number; } -// Warning: (ae-missing-release-tag) "GetEntitiesByRefsRequest" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type GetEntities = { + query: { + fields?: Array; + limit?: number; + filter?: Array; + offset?: number; + after?: string; + order?: Array; + }; +}; + +// @public (undocumented) +export type GetEntitiesByQuery = { + query: { + fields?: Array; + limit?: number; + orderField?: Array; + cursor?: string; + filter?: Array; + fullTextFilterTerm?: string; + fullTextFilterFields?: Array; + }; +}; + +// @public (undocumented) +export type GetEntitiesByRefs = { + body: GetEntitiesByRefsRequest; + query: { + filter?: Array; + }; +}; + // @public (undocumented) export interface GetEntitiesByRefsRequest { // (undocumented) @@ -435,16 +375,64 @@ export interface GetEntitiesByRefsRequest { fields?: Array; } -// Warning: (ae-missing-release-tag) "GetLocations200ResponseInner" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type GetEntityAncestryByName = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; + +// @public (undocumented) +export type GetEntityByName = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; + +// @public (undocumented) +export type GetEntityByUid = { + path: { + uid: string; + }; +}; + +// @public (undocumented) +export type GetEntityFacets = { + query: { + facet: Array; + filter?: Array; + }; +}; + +// @public (undocumented) +export type GetLocation = { + path: { + id: string; + }; +}; + +// @public (undocumented) +export type GetLocationByEntity = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; + +// @public (undocumented) +export type GetLocations = {}; + // @public (undocumented) export interface GetLocations200ResponseInner { // (undocumented) data: Location_2; } -// Warning: (ae-missing-release-tag) "Location" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public interface Location_2 { // (undocumented) @@ -456,8 +444,6 @@ interface Location_2 { } export { Location_2 as Location }; -// Warning: (ae-missing-release-tag) "LocationInput" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface LocationInput { // (undocumented) @@ -466,8 +452,6 @@ export interface LocationInput { type: string; } -// Warning: (ae-missing-release-tag) "LocationSpec" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface LocationSpec { // (undocumented) @@ -476,8 +460,6 @@ export interface LocationSpec { type: string; } -// Warning: (ae-missing-release-tag) "ModelError" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface ModelError { // (undocumented) @@ -490,8 +472,6 @@ export interface ModelError { response: ErrorResponse; } -// Warning: (ae-missing-release-tag) "NullableEntity" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export type NullableEntity = { relations?: Array; @@ -503,8 +483,6 @@ export type NullableEntity = { apiVersion: string; } | null; -// Warning: (ae-missing-release-tag) "RecursivePartialEntity" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface RecursivePartialEntity { apiVersion?: string; @@ -517,8 +495,6 @@ export interface RecursivePartialEntity { }; } -// Warning: (ae-missing-release-tag) "RecursivePartialEntityMeta" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface RecursivePartialEntityMeta { annotations?: { @@ -537,8 +513,6 @@ export interface RecursivePartialEntityMeta { uid?: string; } -// Warning: (ae-missing-release-tag) "RecursivePartialEntityMetaAllOf" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface RecursivePartialEntityMetaAllOf { annotations?: { @@ -557,16 +531,17 @@ export interface RecursivePartialEntityMetaAllOf { uid?: string; } -// Warning: (ae-missing-release-tag) "RecursivePartialEntityRelation" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export interface RecursivePartialEntityRelation { targetRef?: string; type?: string; } -// Warning: (ae-missing-release-tag) "RefreshEntityRequest" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type RefreshEntity = { + body: RefreshEntityRequest; +}; + // @public export interface RefreshEntityRequest { // (undocumented) @@ -585,16 +560,17 @@ export type TypedResponse = Omit & { json: () => Promise; }; -// Warning: (ae-missing-release-tag) "ValidateEntity400Response" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type ValidateEntity = { + body: ValidateEntityRequest; +}; + // @public (undocumented) export interface ValidateEntity400Response { // (undocumented) errors: Array; } -// Warning: (ae-missing-release-tag) "ValidateEntity400ResponseErrorsInner" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface ValidateEntity400ResponseErrorsInner { // (undocumented) @@ -605,8 +581,6 @@ export interface ValidateEntity400ResponseErrorsInner { name: string; } -// Warning: (ae-missing-release-tag) "ValidateEntityRequest" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface ValidateEntityRequest { // (undocumented) diff --git a/packages/catalog-client/src/generated/apis/DefaultApi.client.ts b/packages/catalog-client/src/generated/apis/DefaultApi.client.ts index 873f33e553..2c97e48303 100644 --- a/packages/catalog-client/src/generated/apis/DefaultApi.client.ts +++ b/packages/catalog-client/src/generated/apis/DefaultApi.client.ts @@ -56,26 +56,41 @@ export interface RequestOptions { token?: string; } -export type analyzeLocationRequest = { +/** + * @public + */ +export type AnalyzeLocation = { body: AnalyzeLocationRequest; }; -export type createLocationRequest = { +/** + * @public + */ +export type CreateLocation = { body: CreateLocationRequest; query: { dryRun?: string; }; }; -export type deleteEntityByUidRequest = { +/** + * @public + */ +export type DeleteEntityByUid = { path: { uid: string; }; }; -export type deleteLocationRequest = { +/** + * @public + */ +export type DeleteLocation = { path: { id: string; }; }; -export type getEntitiesRequest = { +/** + * @public + */ +export type GetEntities = { query: { fields?: Array; limit?: number; @@ -85,7 +100,10 @@ export type getEntitiesRequest = { order?: Array; }; }; -export type getEntitiesByQueryRequest = { +/** + * @public + */ +export type GetEntitiesByQuery = { query: { fields?: Array; limit?: number; @@ -96,54 +114,84 @@ export type getEntitiesByQueryRequest = { fullTextFilterFields?: Array; }; }; -export type getEntitiesByRefsRequest = { +/** + * @public + */ +export type GetEntitiesByRefs = { body: GetEntitiesByRefsRequest; query: { filter?: Array; }; }; -export type getEntityAncestryByNameRequest = { +/** + * @public + */ +export type GetEntityAncestryByName = { path: { kind: string; namespace: string; name: string; }; }; -export type getEntityByNameRequest = { +/** + * @public + */ +export type GetEntityByName = { path: { kind: string; namespace: string; name: string; }; }; -export type getEntityByUidRequest = { +/** + * @public + */ +export type GetEntityByUid = { path: { uid: string; }; }; -export type getEntityFacetsRequest = { +/** + * @public + */ +export type GetEntityFacets = { query: { facet: Array; filter?: Array; }; }; -export type getLocationRequest = { +/** + * @public + */ +export type GetLocation = { path: { id: string; }; }; -export type getLocationByEntityRequest = { +/** + * @public + */ +export type GetLocationByEntity = { path: { kind: string; namespace: string; name: string; }; }; -export type getLocationsRequest = {}; -export type refreshEntityRequest = { +/** + * @public + */ +export type GetLocations = {}; +/** + * @public + */ +export type RefreshEntity = { body: RefreshEntityRequest; }; -export type validateEntityRequest = { +/** + * @public + */ +export type ValidateEntity = { body: ValidateEntityRequest; }; @@ -168,7 +216,7 @@ export class DefaultApiClient { */ public async analyzeLocation( // @ts-ignore - request: analyzeLocationRequest, + request: AnalyzeLocation, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -194,7 +242,7 @@ export class DefaultApiClient { */ public async createLocation( // @ts-ignore - request: createLocationRequest, + request: CreateLocation, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -221,7 +269,7 @@ export class DefaultApiClient { */ public async deleteEntityByUid( // @ts-ignore - request: deleteEntityByUidRequest, + request: DeleteEntityByUid, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -247,7 +295,7 @@ export class DefaultApiClient { */ public async deleteLocation( // @ts-ignore - request: deleteLocationRequest, + request: DeleteLocation, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -278,7 +326,7 @@ export class DefaultApiClient { */ public async getEntities( // @ts-ignore - request: getEntitiesRequest, + request: GetEntities, options?: RequestOptions, ): Promise>> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -310,7 +358,7 @@ export class DefaultApiClient { */ public async getEntitiesByQuery( // @ts-ignore - request: getEntitiesByQueryRequest, + request: GetEntitiesByQuery, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -337,7 +385,7 @@ export class DefaultApiClient { */ public async getEntitiesByRefs( // @ts-ignore - request: getEntitiesByRefsRequest, + request: GetEntitiesByRefs, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -366,7 +414,7 @@ export class DefaultApiClient { */ public async getEntityAncestryByName( // @ts-ignore - request: getEntityAncestryByNameRequest, + request: GetEntityAncestryByName, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -396,7 +444,7 @@ export class DefaultApiClient { */ public async getEntityByName( // @ts-ignore - request: getEntityByNameRequest, + request: GetEntityByName, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -424,7 +472,7 @@ export class DefaultApiClient { */ public async getEntityByUid( // @ts-ignore - request: getEntityByUidRequest, + request: GetEntityByUid, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -451,7 +499,7 @@ export class DefaultApiClient { */ public async getEntityFacets( // @ts-ignore - request: getEntityFacetsRequest, + request: GetEntityFacets, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -477,7 +525,7 @@ export class DefaultApiClient { */ public async getLocation( // @ts-ignore - request: getLocationRequest, + request: GetLocation, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -505,7 +553,7 @@ export class DefaultApiClient { */ public async getLocationByEntity( // @ts-ignore - request: getLocationByEntityRequest, + request: GetLocationByEntity, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -532,7 +580,7 @@ export class DefaultApiClient { */ public async getLocations( // @ts-ignore - request: getLocationsRequest, + request: GetLocations, options?: RequestOptions, ): Promise>> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -556,7 +604,7 @@ export class DefaultApiClient { */ public async refreshEntity( // @ts-ignore - request: refreshEntityRequest, + request: RefreshEntity, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); @@ -581,7 +629,7 @@ export class DefaultApiClient { */ public async validateEntity( // @ts-ignore - request: validateEntityRequest, + request: ValidateEntity, options?: RequestOptions, ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); diff --git a/packages/repo-tools/templates/typescript-backstage-client/api.mustache b/packages/repo-tools/templates/typescript-backstage-client/api.mustache index df1d97e1ef..4421f7acf1 100644 --- a/packages/repo-tools/templates/typescript-backstage-client/api.mustache +++ b/packages/repo-tools/templates/typescript-backstage-client/api.mustache @@ -30,7 +30,10 @@ export interface RequestOptions { } {{#operation}} -export type {{nickname}}Request = { +/** + * @public + */ +export type {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}} = { {{#hasPathParams}} path: { {{#pathParams}} @@ -89,7 +92,7 @@ export class {{classname}}Client { */ public async {{nickname}}( // @ts-ignore - request: {{nickname}}Request, + request: {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}}, options?: RequestOptions ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); diff --git a/packages/repo-tools/templates/typescript-backstage-server/api.mustache b/packages/repo-tools/templates/typescript-backstage-server/api.mustache index 4289f00800..d41ca85c19 100644 --- a/packages/repo-tools/templates/typescript-backstage-server/api.mustache +++ b/packages/repo-tools/templates/typescript-backstage-server/api.mustache @@ -1,8 +1,10 @@ {{>licenseInfo}} import type { -{{#imports}} - {{classname}}, -{{/imports}} + {{#operations}} + {{#operation}} + {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}}, + {{/operation}} + {{/operations}} } from '{{clientImport}}'; @@ -15,24 +17,7 @@ import type { export type EndpointMap = { {{#operation}} - '#{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}|{{path}}': { - path: { - {{#pathParams}} - {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, - {{/pathParams}} - }, - query: { - {{#queryParams}} - {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, - {{/queryParams}} - }, - {{#bodyParam}} - body: {{{dataType}}}, - {{/bodyParam}} - {{#returnType}} - response: {{{returnType}}}, - {{/returnType}} - }, + '#{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}|{{path}}': {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}}, {{/operation}} } diff --git a/plugins/catalog-backend/src/generated/apis/DefaultApi.server.ts b/plugins/catalog-backend/src/generated/apis/DefaultApi.server.ts index 4de2d4e4ce..3d03476a47 100644 --- a/plugins/catalog-backend/src/generated/apis/DefaultApi.server.ts +++ b/plugins/catalog-backend/src/generated/apis/DefaultApi.server.ts @@ -18,20 +18,22 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import type { - AnalyzeLocationRequest, - AnalyzeLocationResponse, - CreateLocation201Response, - CreateLocationRequest, - EntitiesBatchResponse, - EntitiesQueryResponse, - Entity, - EntityAncestryResponse, - EntityFacetsResponse, - GetEntitiesByRefsRequest, - GetLocations200ResponseInner, - Location, - RefreshEntityRequest, - ValidateEntityRequest, + AnalyzeLocation, + CreateLocation, + DeleteEntityByUid, + DeleteLocation, + GetEntities, + GetEntitiesByQuery, + GetEntitiesByRefs, + GetEntityAncestryByName, + GetEntityByName, + GetEntityByUid, + GetEntityFacets, + GetLocation, + GetLocationByEntity, + GetLocations, + RefreshEntity, + ValidateEntity, } from '@backstage/catalog-client/alpha'; /** @@ -39,146 +41,35 @@ import type { */ export type EndpointMap = { - '#post|/analyze-location': { - path: {}; - query: {}; - body: AnalyzeLocationRequest; - response: AnalyzeLocationResponse; - }; + '#post|/analyze-location': AnalyzeLocation; - '#post|/locations': { - path: {}; - query: { - dryRun?: string; - }; - body: CreateLocationRequest; - response: CreateLocation201Response; - }; + '#post|/locations': CreateLocation; - '#_delete|/entities/by-uid/{uid}': { - path: { - uid: string; - }; - query: {}; - response: void; - }; + '#_delete|/entities/by-uid/{uid}': DeleteEntityByUid; - '#_delete|/locations/{id}': { - path: { - id: string; - }; - query: {}; - response: void; - }; + '#_delete|/locations/{id}': DeleteLocation; - '#get|/entities': { - path: {}; - query: { - fields?: Array; - limit?: number; - filter?: Array; - offset?: number; - after?: string; - order?: Array; - }; - response: Array; - }; + '#get|/entities': GetEntities; - '#get|/entities/by-query': { - path: {}; - query: { - fields?: Array; - limit?: number; - orderField?: Array; - cursor?: string; - filter?: Array; - fullTextFilterTerm?: string; - fullTextFilterFields?: Array; - }; - response: EntitiesQueryResponse; - }; + '#get|/entities/by-query': GetEntitiesByQuery; - '#post|/entities/by-refs': { - path: {}; - query: { - filter?: Array; - }; - body: GetEntitiesByRefsRequest; - response: EntitiesBatchResponse; - }; + '#post|/entities/by-refs': GetEntitiesByRefs; - '#get|/entities/by-name/{kind}/{namespace}/{name}/ancestry': { - path: { - kind: string; - namespace: string; - name: string; - }; - query: {}; - response: EntityAncestryResponse; - }; + '#get|/entities/by-name/{kind}/{namespace}/{name}/ancestry': GetEntityAncestryByName; - '#get|/entities/by-name/{kind}/{namespace}/{name}': { - path: { - kind: string; - namespace: string; - name: string; - }; - query: {}; - response: Entity; - }; + '#get|/entities/by-name/{kind}/{namespace}/{name}': GetEntityByName; - '#get|/entities/by-uid/{uid}': { - path: { - uid: string; - }; - query: {}; - response: Entity; - }; + '#get|/entities/by-uid/{uid}': GetEntityByUid; - '#get|/entity-facets': { - path: {}; - query: { - facet: Array; - filter?: Array; - }; - response: EntityFacetsResponse; - }; + '#get|/entity-facets': GetEntityFacets; - '#get|/locations/{id}': { - path: { - id: string; - }; - query: {}; - response: Location; - }; + '#get|/locations/{id}': GetLocation; - '#get|/locations/by-entity/{kind}/{namespace}/{name}': { - path: { - kind: string; - namespace: string; - name: string; - }; - query: {}; - response: Location; - }; + '#get|/locations/by-entity/{kind}/{namespace}/{name}': GetLocationByEntity; - '#get|/locations': { - path: {}; - query: {}; - response: Array; - }; + '#get|/locations': GetLocations; - '#post|/refresh': { - path: {}; - query: {}; - body: RefreshEntityRequest; - response: void; - }; + '#post|/refresh': RefreshEntity; - '#post|/validate-entity': { - path: {}; - query: {}; - body: ValidateEntityRequest; - response: void; - }; + '#post|/validate-entity': ValidateEntity; };