File tree Expand file tree Collapse file tree 2 files changed +4
-31
lines changed
Expand file tree Collapse file tree 2 files changed +4
-31
lines changed Original file line number Diff line number Diff line change 11import { 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-
273export 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}
Original file line number Diff line number Diff line change 1- import { ToolboxApi , ToolRequest , ToolResponse } from './ToolboxApi' ;
1+ import { ToolboxApi } from './ToolboxApi' ;
22import { DiscoveryApi , FetchApi } from '@backstage/core-plugin-api' ;
33
44export 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' ,
You can’t perform that action at this time.
0 commit comments