mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-17 23:13:51 +01:00
collection plugin actions
This commit is contained in:
@@ -57,6 +57,10 @@ export interface Context {
|
||||
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
|
||||
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
|
||||
render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse['httpRequest']>;
|
||||
list(args: { workspaceId?: string; folderId?: string }): Promise<Array<any>>;
|
||||
};
|
||||
folder: {
|
||||
list(args: { workspaceId?: string }): Promise<Array<any>>;
|
||||
};
|
||||
httpResponse: {
|
||||
find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse['httpResponses']>;
|
||||
@@ -64,6 +68,10 @@ export interface Context {
|
||||
templates: {
|
||||
render<T extends JsonValue>(args: TemplateRenderRequest & { data: T }): Promise<T>;
|
||||
};
|
||||
file: {
|
||||
writeText(filePath: string, content: string): Promise<void>;
|
||||
readText(filePath: string): Promise<string>;
|
||||
};
|
||||
plugin: {
|
||||
reload(): void;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Context } from './Context';
|
||||
import type { Folder, Workspace } from '../bindings/gen_models';
|
||||
import type { Icon } from '../bindings/gen_events';
|
||||
|
||||
export type HttpCollectionAction = { label: string; icon?: Icon };
|
||||
|
||||
export type CallHttpCollectionActionArgs = { folder?: Folder; workspace?: Workspace };
|
||||
|
||||
export type HttpCollectionActionPlugin = HttpCollectionAction & {
|
||||
onSelect(ctx: Context, args: CallHttpCollectionActionArgs): Promise<void> | void;
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import type { Context } from './Context';
|
||||
import type { FilterPlugin } from './FilterPlugin';
|
||||
import { GrpcRequestActionPlugin } from './GrpcRequestActionPlugin';
|
||||
import type { HttpRequestActionPlugin } from './HttpRequestActionPlugin';
|
||||
import type { HttpCollectionActionPlugin } from './HttpCollectionActionPlugin';
|
||||
import type { ImporterPlugin } from './ImporterPlugin';
|
||||
import type { TemplateFunctionPlugin } from './TemplateFunctionPlugin';
|
||||
import type { ThemePlugin } from './ThemePlugin';
|
||||
@@ -12,6 +13,7 @@ export type { Context };
|
||||
export type { DynamicTemplateFunctionArg } from './TemplateFunctionPlugin';
|
||||
export type { DynamicAuthenticationArg } from './AuthenticationPlugin';
|
||||
export type { TemplateFunctionPlugin };
|
||||
export type { HttpCollectionActionPlugin } from './HttpCollectionActionPlugin';
|
||||
|
||||
/**
|
||||
* The global structure of a Yaak plugin
|
||||
@@ -24,6 +26,7 @@ export type PluginDefinition = {
|
||||
filter?: FilterPlugin;
|
||||
authentication?: AuthenticationPlugin;
|
||||
httpRequestActions?: HttpRequestActionPlugin[];
|
||||
httpCollectionActions?: HttpCollectionActionPlugin[];
|
||||
grpcRequestActions?: GrpcRequestActionPlugin[];
|
||||
templateFunctions?: TemplateFunctionPlugin[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user