megacommerce_shared/models/
network.rs

1use derive_more::Display;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Display)]
4pub enum Header {
5  #[display("authorization")]
6  Authorization,
7  #[display("x-request-id")]
8  XRequestId,
9  #[display("x-ip-address")]
10  XIpAddress,
11  #[display("x-forwarded-for")]
12  XForwardedFor,
13  #[display("path")]
14  Path,
15  #[display("user-agent")]
16  UserAgent,
17  #[display("accept-language")]
18  AcceptLanguage,
19  #[display("session-id")]
20  SessionId,
21  #[display("token")]
22  Token,
23  #[display("created-at")]
24  CreatedAt,
25  #[display("expires-at")]
26  ExpiresAt,
27  #[display("last-activity-at")]
28  LastActivityAt,
29  #[display("user-id")]
30  UserId,
31  #[display("device-id")]
32  DeviceId,
33  #[display("roles")]
34  Roles,
35  #[display("is-oauth")]
36  IsOauth,
37  #[display("props")]
38  Props,
39}
40
41impl Header {
42  pub const fn as_str(&self) -> &'static str {
43    match self {
44      Self::Authorization => "authorization",
45      Self::XRequestId => "x-request-id",
46      Self::XIpAddress => "x-ip-address",
47      Self::XForwardedFor => "x-forwarded-for",
48      Self::Path => "path",
49      Self::UserAgent => "user-agent",
50      Self::AcceptLanguage => "accept-language",
51      Self::SessionId => "session-id",
52      Self::Token => "token",
53      Self::CreatedAt => "created-at",
54      Self::ExpiresAt => "expires-at",
55      Self::LastActivityAt => "last-activity-at",
56      Self::UserId => "user-id",
57      Self::DeviceId => "device-id",
58      Self::Roles => "roles",
59      Self::IsOauth => "is-oauth",
60      Self::Props => "props",
61    }
62  }
63}