| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- export type Workspace = {
- id: number;
- name: string;
- };
- export type WorkspaceEntryType = "Request" | "Collection";
- export type WorkspaceEntry = WorkspaceEntryBase | WorkspaceRequest;
- export type WorkspaceEntryBase = {
- // Values from models
- id: number;
- workspace_id: number;
- parent_id: number | null;
- name: string;
- type: WorkspaceEntryType;
- auth: number | null;
- auth_inherit: boolean;
- // UI values,
- open?: boolean;
- };
- export type WorkspaceRequest = WorkspaceEntryBase & {
- method: string;
- url: string;
- body: RequestBody | null;
- headers: RequestHeader[];
- path: RequestPathParam[];
- auth: number | null;
- auth_inherit: boolean;
- // Display fields
- workingUrl?: RequestUrl;
- expandedUrl?: RequestUrl;
- };
- export type RequestUrl = {
- scheme: string;
- host: string;
- path: PathSegment[];
- query_params: string[][];
- has_query: boolean;
- };
- export type UrlErrorType = "Parse" | "DuplicatePath" | "Db";
- export type UrlError = {
- type: UrlErrorType;
- error: string;
- };
- export type RequestHeader = {
- id: number;
- name: string;
- value: string;
- };
- export type RequestPathParam = {
- position: number;
- name: string;
- value: string;
- };
- export type PathSegment = {
- type: "Static" | "Dynamic";
- value: string;
- };
- export type WorkspaceCreateCollection = {
- name: string;
- workspace_id: number;
- parent_id?: number;
- };
- export type WorkspaceCreateRequest = {
- name: string;
- workspace_id: number;
- parent_id?: number;
- method: string;
- url: string;
- };
- export type RequestBody = {
- id: number;
- content: string;
- ty: string;
- };
- export type WorkspaceEnvironment = {
- id: number;
- name: string;
- workspace_id: number;
- variables: EnvVariable[];
- };
- export type EnvVariable = {
- id: number;
- name: string;
- value: string;
- secret: boolean;
- };
- export type Authentication = {
- id: number;
- workspace_id: number;
- name: string;
- params: AuthParams;
- };
- export type AuthParams =
- | {
- type: "Token";
- value: {
- name: string;
- placement: "Header" | "Query";
- value: string;
- };
- }
- | { type: "Basic"; value: { user: string; password: string } }
- | {
- type: "OAuth";
- value: {
- token_name: string;
- callback_url: string;
- auth_url: string;
- token_url: string;
- refresh_url: string | null;
- client_id: string;
- client_secret: string;
- scope: string | null;
- state: string | null;
- grant_type:
- | {
- type: "AuthorizationCode";
- }
- | {
- type: "AuthorizationCodePKCE";
- value: { verifier: string | null };
- }
- | { type: "ClientCredentials" };
- };
- };
- export type AuthType = "Token" | "Basic" | "OAuth";
- export type HttpResponse = {
- status: number;
- headers: string[][];
- body: HttpResponseBody | null;
- };
- export type HttpResponseBody =
- | {
- type: "TextPlain";
- content: string;
- }
- | {
- type: "TextHtml";
- content: string;
- }
- | {
- type: "Json";
- content: string;
- };
- export type ResponseResult =
- | {
- type: "Ok";
- data: HttpResponse;
- }
- | { type: "Err"; data: string };
|