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