MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / parse_token

Method parse_token

chirpstack/src/integration/blynk.rs:108–128  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

106 }
107
108 fn parse_token(&self) -> Result<(String, String)> {
109 let token_b = BASE64_STANDARD.decode(&self.token).context("Parse token")?;
110 let token_str = String::from_utf8(token_b).context("Parse token")?;
111 let token_url = Url::parse(&token_str).context("Parse token")?;
112
113 let integration_url = format!(
114 "{}://{}{}{}",
115 token_url.scheme(),
116 token_url.host_str().unwrap_or_default(),
117 token_url
118 .port()
119 .map(|v| format!(":{}", v))
120 .unwrap_or_default(),
121 token_url.path()
122 );
123 let params: HashMap<String, String> = token_url.query_pairs().into_owned().collect();
124 Ok((
125 integration_url,
126 params.get("token").cloned().unwrap_or_default(),
127 ))
128 }
129
130 async fn post_event<T>(&self, event: &str, pl: &T) -> Result<()>
131 where

Callers 1

post_eventMethod · 0.80

Calls 2

decodeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected