aiway_protocol/gateway/
plugin.rs1use serde::{Deserialize, Serialize};
2use std::fmt::{Display, Formatter};
3
4#[derive(Debug, Serialize, Eq, PartialEq, Deserialize)]
8pub struct Plugin {
9 pub name: String,
11 pub url: String,
15 pub version: String,
17}
18
19#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
24pub struct ConfiguredPlugin {
25 pub name: String,
27 pub config: serde_json::Value,
29}
30
31impl Plugin {
32 #[inline]
36 pub fn build_url_with_console(&self, console_addr: &str) -> String {
37 format!("http://{}{}", console_addr, self.url)
38 }
39
40 #[inline]
42 pub fn is_relative_download_url(&self) -> bool {
43 !self.url.starts_with("http://") && !self.url.starts_with("https://")
44 }
45}