@@ -9,13 +9,22 @@ import {
99 SearchRequest ,
1010 SearchResponse ,
1111} from "@/features/search/types" ;
12+ import {
13+ FindRelatedSymbolsRequest ,
14+ FindRelatedSymbolsResponse ,
15+ } from "@/features/codeNav/types" ;
16+ import {
17+ GetFilesRequest ,
18+ GetFilesResponse ,
19+ GetTreeRequest ,
20+ GetTreeResponse ,
21+ } from "@/features/fileTree/types" ;
1222
13- export const search = async ( body : SearchRequest , domain : string ) : Promise < SearchResponse | ServiceError > => {
23+ export const search = async ( body : SearchRequest ) : Promise < SearchResponse | ServiceError > => {
1424 const result = await fetch ( "/api/search" , {
1525 method : "POST" ,
1626 headers : {
1727 "Content-Type" : "application/json" ,
18- "X-Org-Domain" : domain ,
1928 } ,
2029 body : JSON . stringify ( body ) ,
2130 } ) . then ( response => response . json ( ) ) ;
@@ -27,12 +36,11 @@ export const search = async (body: SearchRequest, domain: string): Promise<Searc
2736 return result as SearchResponse | ServiceError ;
2837}
2938
30- export const fetchFileSource = async ( body : FileSourceRequest , domain : string ) : Promise < FileSourceResponse | ServiceError > => {
39+ export const getFileSource = async ( body : FileSourceRequest ) : Promise < FileSourceResponse | ServiceError > => {
3140 const result = await fetch ( "/api/source" , {
3241 method : "POST" ,
3342 headers : {
3443 "Content-Type" : "application/json" ,
35- "X-Org-Domain" : domain ,
3644 } ,
3745 body : JSON . stringify ( body ) ,
3846 } ) . then ( response => response . json ( ) ) ;
@@ -60,3 +68,35 @@ export const getVersion = async (): Promise<GetVersionResponse> => {
6068 } ) . then ( response => response . json ( ) ) ;
6169 return result as GetVersionResponse ;
6270}
71+
72+ export const findSearchBasedSymbolReferences = async ( body : FindRelatedSymbolsRequest ) : Promise < FindRelatedSymbolsResponse | ServiceError > => {
73+ const result = await fetch ( "/api/find_references" , {
74+ method : "POST" ,
75+ body : JSON . stringify ( body ) ,
76+ } ) . then ( response => response . json ( ) ) ;
77+ return result as FindRelatedSymbolsResponse | ServiceError ;
78+ }
79+
80+ export const findSearchBasedSymbolDefinitions = async ( body : FindRelatedSymbolsRequest ) : Promise < FindRelatedSymbolsResponse | ServiceError > => {
81+ const result = await fetch ( "/api/find_definitions" , {
82+ method : "POST" ,
83+ body : JSON . stringify ( body ) ,
84+ } ) . then ( response => response . json ( ) ) ;
85+ return result as FindRelatedSymbolsResponse | ServiceError ;
86+ }
87+
88+ export const getTree = async ( body : GetTreeRequest ) : Promise < GetTreeResponse | ServiceError > => {
89+ const result = await fetch ( "/api/tree" , {
90+ method : "POST" ,
91+ body : JSON . stringify ( body ) ,
92+ } ) . then ( response => response . json ( ) ) ;
93+ return result as GetTreeResponse | ServiceError ;
94+ }
95+
96+ export const getFiles = async ( body : GetFilesRequest ) : Promise < GetFilesResponse | ServiceError > => {
97+ const result = await fetch ( "/api/files" , {
98+ method : "POST" ,
99+ body : JSON . stringify ( body ) ,
100+ } ) . then ( response => response . json ( ) ) ;
101+ return result as GetFilesResponse | ServiceError ;
102+ }
0 commit comments