1use std::fmt;
2
3macro_rules! credential {
4 ($(#[$meta:meta])* $name:ident) => {
5 $(#[$meta])*
6 #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
7 pub struct $name(String);
8
9 impl $name {
10 pub fn new(value: impl Into<String>) -> Self {
11 Self(value.into())
12 }
13
14 pub fn as_str(&self) -> &str {
15 &self.0
16 }
17 }
18
19 impl fmt::Display for $name {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 f.write_str(&self.0)
22 }
23 }
24 };
25}
26
27credential! {
28 SessionId
30}
31
32#[cfg(feature = "v4")]
33credential! {
34 AccessToken
36}
37
38credential! {
39 GuestSessionId
41}