Skip to content

Commit c35af5f

Browse files
committed
fix: get rid of types req/resp
1 parent c8486f5 commit c35af5f

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

plugins/toolbox/src/api/ToolboxApi.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,9 @@
11
import { createApiRef } from '@backstage/core-plugin-api';
22

3-
export type ToolRequest = {
4-
method?: string;
5-
headers?: Record<string, string>;
6-
body?:
7-
| string
8-
| ArrayBuffer
9-
| SharedArrayBuffer
10-
| ArrayBufferView
11-
| Blob
12-
| FormData
13-
| URLSearchParams
14-
| ReadableStream<Uint8Array>
15-
| null;
16-
};
17-
18-
export type ToolResponse = {
19-
readonly status: number;
20-
readonly statusText: string;
21-
readonly ok: boolean;
22-
readonly json: () => Promise<unknown>;
23-
readonly text: () => Promise<string>;
24-
readonly arrayBuffer: () => Promise<ArrayBuffer>;
25-
};
26-
273
export interface ToolboxApi {
284
getBackendTools(): Promise<string[]>;
295

30-
toolRequest(toolName: string, request: ToolRequest): Promise<ToolResponse>;
6+
toolRequest(toolName: string, request: any): Promise<any>;
317

328
toolJsonRequest(toolName: string, data: any): Promise<unknown>;
339
}

plugins/toolbox/src/api/ToolboxClient.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ToolboxApi, ToolRequest, ToolResponse } from './ToolboxApi';
1+
import { ToolboxApi } from './ToolboxApi';
22
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
33

44
export class ToolboxClient implements ToolboxApi {
@@ -25,10 +25,7 @@ export class ToolboxClient implements ToolboxApi {
2525
}
2626
}
2727

28-
async toolRequest(
29-
toolName: string,
30-
request: ToolRequest,
31-
): Promise<ToolResponse> {
28+
async toolRequest(toolName: string, request: any): Promise<any> {
3229
const url = `${await this.getBaseUrl()}/${toolName}`;
3330
const response = await this.fetchApi.fetch(url, request);
3431
if (response.ok) {
@@ -38,7 +35,7 @@ export class ToolboxClient implements ToolboxApi {
3835
}
3936

4037
async toolJsonRequest(toolName: string, data: any): Promise<unknown> {
41-
const request: ToolRequest = {
38+
const request = {
4239
method: 'POST',
4340
headers: {
4441
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)