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-correlation-id")]
10  XCorrelationID,
11  #[display("x-ip-address")]
12  XIPAddress,
13  #[display("x-forwarded-for")]
14  XForwardedFor,
15  #[display("x-forwarded-proto")]
16  XForwardedProto,
17  #[display("x-forwarded-host")]
18  XForwardedHost,
19  #[display("x-client-version")]
20  XClientVersion,
21  #[display("x-client-id")]
22  XClientID,
23  #[display("x-device-id")]
24  XDeviceID,
25  #[display("x-session-id")]
26  XSessionID,
27  #[display("x-user-id")]
28  XUserID,
29  #[display("x-trace-id")]
30  XTraceID,
31  #[display("x-span-id")]
32  XSpanID,
33  #[display("x-roles")]
34  XRoles,
35  #[display("x-is-oauth")]
36  XIsOAuth,
37  #[display("x-session-created-at")]
38  XSessionCreatedAt,
39  #[display("x-session-expires-at")]
40  XSessionExpiresAt,
41  #[display("x-last-activity-at")]
42  XLastActivityAt,
43  #[display("x-timezone")]
44  XTimezone,
45  #[display("x-props")]
46  XProps,
47  #[display("x-api-key")]
48  XAPIKey,
49  #[display("x-csrf-token")]
50  XCSRFToken,
51  #[display("x-rate-limit-limit")]
52  XRateLimitLimit,
53  #[display("x-rate-limit-remaining")]
54  XRateLimitRemaining,
55  #[display("x-rate-limit-reset")]
56  XRateLimitReset,
57  // Standard headers
58  #[display("content-type")]
59  ContentType,
60  #[display("user-agent")]
61  UserAgent,
62  #[display("accept")]
63  Accept,
64  #[display("accept-language")]
65  AcceptLanguage,
66  #[display("accept-encoding")]
67  AcceptEncoding,
68  #[display("cache-control")]
69  CacheControl,
70  // gRPC specific
71  #[display("x-grpc-web")]
72  GRPCWeb,
73  #[display("grpc-encoding")]
74  GRPCEncoding,
75  #[display("grpc-message")]
76  GRPCMessage,
77  #[display("grpc-status")]
78  GRPCStatus,
79}
80
81impl Header {
82  pub const fn as_str(&self) -> &'static str {
83    match self {
84      Self::Authorization => "authorization",
85      Self::XRequestID => "x-request-id",
86      Self::XCorrelationID => "x-correlation-id",
87      Self::XIPAddress => "x-ip-address",
88      Self::XForwardedFor => "x-forwarded-for",
89      Self::XForwardedProto => "x-forwarded-proto",
90      Self::XForwardedHost => "x-forwarded-host",
91      Self::XClientVersion => "x-client-version",
92      Self::XClientID => "x-client-id",
93      Self::XDeviceID => "x-device-id",
94      Self::XSessionID => "x-session-id",
95      Self::XUserID => "x-user-id",
96      Self::XTraceID => "x-trace-id",
97      Self::XSpanID => "x-span-id",
98      Self::XRoles => "x-roles",
99      Self::XIsOAuth => "x-is-oauth",
100      Self::XSessionCreatedAt => "x-session-created-at",
101      Self::XSessionExpiresAt => "x-session-expires-at",
102      Self::XLastActivityAt => "x-last-activity-at",
103      Self::XTimezone => "x-timezone",
104      Self::XProps => "x-props",
105      Self::XAPIKey => "x-api-key",
106      Self::XCSRFToken => "x-csrf-token",
107      Self::XRateLimitLimit => "x-rate-limit-limit",
108      Self::XRateLimitRemaining => "x-rate-limit-remaining",
109      Self::XRateLimitReset => "x-rate-limit-reset",
110      Self::ContentType => "content-type",
111      Self::UserAgent => "user-agent",
112      Self::Accept => "accept",
113      Self::AcceptLanguage => "accept-language",
114      Self::AcceptEncoding => "accept-encoding",
115      Self::CacheControl => "cache-control",
116      Self::GRPCWeb => "x-grpc-web",
117      Self::GRPCEncoding => "grpc-encoding",
118      Self::GRPCMessage => "grpc-message",
119      Self::GRPCStatus => "grpc-status",
120    }
121  }
122}