本文整理匯總了TypeScript中ui/kfetch.kfetch函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript kfetch函數的具體用法?TypeScript kfetch怎麽用?TypeScript kfetch使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了kfetch函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: requestRepositorySearch
function requestRepositorySearch(q: string) {
return kfetch({
pathname: `/api/code/search/repo`,
method: 'get',
query: { q },
});
}
示例2: requestImportRepo
function requestImportRepo(uri: string) {
return kfetch({
pathname: '/api/code/repo',
method: 'post',
body: JSON.stringify({ url: uri }),
});
}
示例3: putProjectConfig
function putProjectConfig(repoUri: string, config: RepositoryConfig) {
return kfetch({
pathname: `/api/code/repo/config/${repoUri}`,
method: 'PUT',
body: JSON.stringify(config),
});
}
示例4: fetchOptionsWithDebug
export async function callApi<T = void>(
fetchOptions: KFetchOptions,
options?: KFetchKibanaOptions
): Promise<T> {
const combinedFetchOptions = fetchOptionsWithDebug(fetchOptions);
return await kfetch(combinedFetchOptions, options);
}
示例5: requestRepoInitCmd
function requestRepoInitCmd(repoUri: string) {
return kfetch({
pathname: `/api/code/workspace/${repoUri}/master`,
query: { force: true },
method: 'post',
});
}
示例6: requestFindReferences
function requestFindReferences(params: TextDocumentPositionParams) {
return kfetch({
pathname: `/api/code/lsp/findReferences`,
method: 'POST',
body: JSON.stringify(params),
});
}
示例7: fetchOptionsWithDebug
export async function callApi<T = void>(
fetchOptions: KFetchOptions,
{ camelcase = true, prependBasePath = true } = {}
): Promise<T> {
const combinedFetchOptions = fetchOptionsWithDebug(fetchOptions);
const res = await kfetch(combinedFetchOptions, { prependBasePath });
return camelcase ? camelizeKeys(res) : res;
}
示例8: handleQname
async function handleQname(qname: string) {
const res: any = await kfetch({ pathname: `/api/code/lsp/symbol/${qname}` });
if (res.symbols) {
return res.symbols.map((s: DetailSymbolInformation) =>
handleLocation(s.symbolInformation.location)
);
}
return [];
}
示例9: findSymbolByQname
public static async findSymbolByQname(qname: string) {
try {
const response = await kfetch({
pathname: `/api/code/lsp/symbol/${qname}`,
method: 'GET',
});
return response as SymbolSearchResult;
} catch (e) {
const error = e.body;
throw new ResponseError<any>(error.code, error.message, error.data);
}
}
示例10: changePassword
public static async changePassword(username: string, password: string, currentPassword: string) {
const data: Record<string, string> = {
newPassword: password,
};
if (currentPassword) {
data.password = currentPassword;
}
await kfetch({
pathname: `${usersUrl}/${encodeURIComponent(username)}/password`,
method: 'POST',
body: JSON.stringify(data),
});
}