feat(catalog): add analyze location endpoint to client
Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "workspace:^",
|
||||
"@backstage/plugin-catalog-common": "workspace:^",
|
||||
"msw": "^1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,10 @@ import {
|
||||
} from './types/api';
|
||||
import { isQueryEntitiesInitialRequest, splitRefsIntoChunks } from './utils';
|
||||
import { DefaultApiClient, TypedResponse } from './schema/openapi';
|
||||
import type {
|
||||
AnalyzeLocationRequest,
|
||||
AnalyzeLocationResponse,
|
||||
} from '@backstage/plugin-catalog-common';
|
||||
|
||||
/**
|
||||
* A frontend and backend compatible client for communicating with the Backstage
|
||||
@@ -431,6 +435,27 @@ export class CatalogClient implements CatalogApi {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc CatalogApi.analyzeLocation}
|
||||
*/
|
||||
async analyzeLocation(
|
||||
request: AnalyzeLocationRequest,
|
||||
options?: CatalogRequestOptions,
|
||||
): Promise<AnalyzeLocationResponse> {
|
||||
const response = await this.apiClient.analyzeLocation(
|
||||
{
|
||||
body: request,
|
||||
},
|
||||
options,
|
||||
);
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw await ResponseError.fromResponse(response);
|
||||
}
|
||||
|
||||
return response.json() as Promise<AnalyzeLocationResponse>;
|
||||
}
|
||||
|
||||
//
|
||||
// Private methods
|
||||
//
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
import { CompoundEntityRef, Entity } from '@backstage/catalog-model';
|
||||
import { SerializedError } from '@backstage/errors';
|
||||
import type {
|
||||
AnalyzeLocationRequest,
|
||||
AnalyzeLocationResponse,
|
||||
} from '@backstage/plugin-catalog-common';
|
||||
|
||||
/**
|
||||
* This symbol can be used in place of a value when passed to filters in e.g.
|
||||
@@ -677,4 +681,15 @@ export interface CatalogApi {
|
||||
locationRef: string,
|
||||
options?: CatalogRequestOptions,
|
||||
): Promise<ValidateEntityResponse>;
|
||||
|
||||
/**
|
||||
* Validate a given location.
|
||||
*
|
||||
* @param location - Request parameters
|
||||
* @param options - Additional options
|
||||
*/
|
||||
analyzeLocation(
|
||||
location: AnalyzeLocationRequest,
|
||||
options?: CatalogRequestOptions,
|
||||
): Promise<AnalyzeLocationResponse>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user