Skip to main content

Mountain/RPC/CocoonService/GenericRequest/Commands/
UnregisterCommand.rs

1use serde_json::{Value, json};
2use tonic::Response;
3use CommonLibrary::Command::CommandExecutor::CommandExecutor;
4
5use crate::{Environment::MountainEnvironment::MountainEnvironment, Vine::Generated::GenericResponse};
6
7pub async fn Fn(RequestId:u64, Params:Value, Env:&MountainEnvironment) -> Response<GenericResponse> {
8	let ExtensionId = Params.get("extensionId").and_then(|V| V.as_str()).unwrap_or("").to_string();
9
10	let CommandId = Params.get("commandId").and_then(|V| V.as_str()).unwrap_or("").to_string();
11
12	match Env.UnregisterCommand(ExtensionId, CommandId).await {
13		Ok(()) => super::super::FileSystem::OkResponse(RequestId, &json!({ "success": true })),
14
15		Err(Error) => super::super::FileSystem::ErrResponse(RequestId, -32000, Error.to_string()),
16	}
17}