本文整理汇总了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),
});
}