playit_api_client/
lib.rs

1use crate::api::PlayitApiClient;
2use crate::http_client::HttpClient;
3
4// mod api is auto generated
5pub mod api;
6pub mod http_client;
7pub mod ip_resource;
8
9pub type PlayitApi = PlayitApiClient<HttpClient>;
10
11impl PlayitApi {
12    pub fn create(api_base: String, secret: Option<String>) -> Self {
13        PlayitApiClient::new(HttpClient::new(api_base, secret.map(|v| format!("Agent-Key {}", v.trim()))))
14    }
15}
16
17impl api::PortType {
18    pub fn matches(&self, port: api::PortType) -> bool {
19        match *self {
20            api::PortType::Both => true,
21            other => other == port
22        }
23    }
24}
25
26impl api::PortRange {
27	pub fn contains(&self, port: u16) -> bool {
28		self.from <= port && port < self.to
29	}
30}
31