1pub mod access;
2pub mod basin;
3pub mod config;
4pub mod error;
5pub mod location;
6pub mod metrics;
7pub mod stream;
8
9use s2_common::types::{self, resources::RequestToken};
10
11#[rustfmt::skip]
12#[derive(Debug)]
13#[cfg_attr(feature = "utoipa", derive(utoipa::IntoParams))]
14#[cfg_attr(feature = "utoipa", into_params(parameter_in = Header))]
15pub struct S2RequestTokenHeader {
16 #[cfg_attr(feature = "utoipa", param(required = false, rename = "s2-request-token"))]
18 pub s2_request_token: RequestToken,
19}
20
21#[rustfmt::skip]
22#[derive(Debug)]
23#[cfg_attr(feature = "utoipa", derive(utoipa::IntoParams))]
24#[cfg_attr(feature = "utoipa", into_params(parameter_in = Path))]
25pub struct AccessTokenIdPathSegment {
26 pub id: types::access::AccessTokenId,
28}
29
30#[rustfmt::skip]
31#[derive(Debug)]
32#[cfg_attr(feature = "utoipa", derive(utoipa::IntoParams))]
33#[cfg_attr(feature = "utoipa", into_params(parameter_in = Path))]
34pub struct BasinNamePathSegment {
35 pub basin: types::basin::BasinName,
37}
38
39#[rustfmt::skip]
40#[derive(Debug)]
41#[cfg_attr(feature = "utoipa", derive(utoipa::IntoParams))]
42#[cfg_attr(feature = "utoipa", into_params(parameter_in = Path))]
43pub struct StreamNamePathSegment {
44 pub stream: types::stream::StreamName,
46}
47
48macro_rules! impl_list_request_conversions {
49 ($name:ident, $prefix:ty, $start_after:ty) => {
50 impl TryFrom<$name> for types::resources::ListItemsRequest<$prefix, $start_after> {
51 type Error = types::ValidationError;
52
53 fn try_from(value: $name) -> Result<Self, Self::Error> {
54 let $name {
55 prefix,
56 start_after,
57 limit,
58 } = value;
59
60 Ok(Self {
61 prefix: prefix.unwrap_or_default(),
62 start_after: start_after.unwrap_or_default(),
63 limit: limit.map(Into::into).unwrap_or_default(),
64 })
65 }
66 }
67 };
68}
69
70pub(crate) use impl_list_request_conversions;