mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-20 07:41:22 +02:00
gRPC Support (#20)
This commit is contained in:
@@ -1,13 +1,30 @@
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
import type { CookieJar, Environment, Folder, HttpRequest, Settings, Workspace } from './models';
|
||||
import type {
|
||||
CookieJar,
|
||||
Environment,
|
||||
Folder,
|
||||
GrpcRequest,
|
||||
HttpRequest,
|
||||
Settings,
|
||||
Workspace,
|
||||
} from './models';
|
||||
|
||||
export async function getSettings(): Promise<Settings> {
|
||||
return invoke('get_settings', {});
|
||||
return invoke('cmd_get_settings', {});
|
||||
}
|
||||
|
||||
export async function getRequest(id: string | null): Promise<HttpRequest | null> {
|
||||
export async function getGrpcRequest(id: string | null): Promise<GrpcRequest | null> {
|
||||
if (id === null) return null;
|
||||
const request: HttpRequest = (await invoke('get_request', { id })) ?? null;
|
||||
const request: GrpcRequest = (await invoke('cmd_get_grpc_request', { id })) ?? null;
|
||||
if (request == null) {
|
||||
return null;
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
export async function getHttpRequest(id: string | null): Promise<HttpRequest | null> {
|
||||
if (id === null) return null;
|
||||
const request: HttpRequest = (await invoke('cmd_get_http_request', { id })) ?? null;
|
||||
if (request == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -16,7 +33,7 @@ export async function getRequest(id: string | null): Promise<HttpRequest | null>
|
||||
|
||||
export async function getEnvironment(id: string | null): Promise<Environment | null> {
|
||||
if (id === null) return null;
|
||||
const environment: Environment = (await invoke('get_environment', { id })) ?? null;
|
||||
const environment: Environment = (await invoke('cmd_get_environment', { id })) ?? null;
|
||||
if (environment == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -25,7 +42,7 @@ export async function getEnvironment(id: string | null): Promise<Environment | n
|
||||
|
||||
export async function getFolder(id: string | null): Promise<Folder | null> {
|
||||
if (id === null) return null;
|
||||
const folder: Folder = (await invoke('get_folder', { id })) ?? null;
|
||||
const folder: Folder = (await invoke('cmd_get_folder', { id })) ?? null;
|
||||
if (folder == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -34,7 +51,7 @@ export async function getFolder(id: string | null): Promise<Folder | null> {
|
||||
|
||||
export async function getWorkspace(id: string | null): Promise<Workspace | null> {
|
||||
if (id === null) return null;
|
||||
const workspace: Workspace = (await invoke('get_workspace', { id })) ?? null;
|
||||
const workspace: Workspace = (await invoke('cmd_get_workspace', { id })) ?? null;
|
||||
if (workspace == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -43,7 +60,7 @@ export async function getWorkspace(id: string | null): Promise<Workspace | null>
|
||||
|
||||
export async function getCookieJar(id: string | null): Promise<CookieJar | null> {
|
||||
if (id === null) return null;
|
||||
const cookieJar: CookieJar = (await invoke('get_cookie_jar', { id })) ?? null;
|
||||
const cookieJar: CookieJar = (await invoke('cmd_get_cookie_jar', { id })) ?? null;
|
||||
if (cookieJar == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user