mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-27 03:41:11 +01:00
collection plugin actions
This commit is contained in:
@@ -10,6 +10,7 @@ use crate::events::{
|
||||
FilterRequest, FilterResponse, GetGrpcRequestActionsResponse,
|
||||
GetHttpAuthenticationConfigRequest, GetHttpAuthenticationConfigResponse,
|
||||
GetHttpAuthenticationSummaryResponse, GetHttpRequestActionsResponse,
|
||||
GetHttpCollectionActionsResponse, CallHttpCollectionActionRequest,
|
||||
GetTemplateFunctionConfigRequest, GetTemplateFunctionConfigResponse,
|
||||
GetTemplateFunctionSummaryResponse, GetThemesRequest, GetThemesResponse, ImportRequest,
|
||||
ImportResponse, InternalEvent, InternalEventPayload, JsonPrimitive, PluginContext,
|
||||
@@ -482,6 +483,27 @@ impl PluginManager {
|
||||
Ok(all_actions)
|
||||
}
|
||||
|
||||
pub async fn get_http_collection_actions<R: Runtime>(
|
||||
&self,
|
||||
window: &WebviewWindow<R>,
|
||||
) -> Result<Vec<GetHttpCollectionActionsResponse>> {
|
||||
let reply_events = self
|
||||
.send_and_wait(
|
||||
&PluginContext::new(window),
|
||||
&InternalEventPayload::GetHttpCollectionActionsRequest(EmptyPayload {}),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let mut all_actions = Vec::new();
|
||||
for event in reply_events {
|
||||
if let InternalEventPayload::GetHttpCollectionActionsResponse(resp) = event.payload {
|
||||
all_actions.push(resp.clone());
|
||||
}
|
||||
}
|
||||
|
||||
Ok(all_actions)
|
||||
}
|
||||
|
||||
pub async fn get_template_function_config<R: Runtime>(
|
||||
&self,
|
||||
window: &WebviewWindow<R>,
|
||||
@@ -564,6 +586,23 @@ impl PluginManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn call_http_collection_action<R: Runtime>(
|
||||
&self,
|
||||
window: &WebviewWindow<R>,
|
||||
req: CallHttpCollectionActionRequest,
|
||||
) -> Result<()> {
|
||||
let ref_id = req.plugin_ref_id.clone();
|
||||
let plugin =
|
||||
self.get_plugin_by_ref_id(ref_id.as_str()).await.ok_or(PluginNotFoundErr(ref_id))?;
|
||||
let event = plugin.build_event_to_send(
|
||||
&PluginContext::new(window),
|
||||
&InternalEventPayload::CallHttpCollectionActionRequest(req),
|
||||
None,
|
||||
);
|
||||
plugin.send(&event).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn call_grpc_request_action<R: Runtime>(
|
||||
&self,
|
||||
window: &WebviewWindow<R>,
|
||||
|
||||
Reference in New Issue
Block a user