-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmod.rs
40 lines (35 loc) · 1.28 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! RBAC endpoints.
use poem_openapi::{param::Query, OpenApi};
use crate::service::common::{
auth::none_or_rbac::NoneOrRBAC,
tags::ApiTags,
types::{cardano::query::cat_id_or_stake::CatIdOrStake, generic::boolean::BooleanFlag},
};
mod registrations_get;
/// Cardano RBAC API Endpoints
pub(crate) struct Api;
#[OpenApi(tag = "ApiTags::Cardano")]
impl Api {
#[oai(
path = "/draft/rbac/registration",
method = "get",
operation_id = "rbacRegistrations"
)]
/// Get RBAC registrations
///
/// This endpoint returns RBAC registrations by provided auth Catalyst Id credentials
/// or by the `lookup` argument if provided.
async fn rbac_registrations_get(
&self,
/// Stake address or Catalyst ID to get the RBAC registration for.
Query(lookup): Query<Option<CatIdOrStake>>,
/// A flag which enables returning all corresponded Cip509 registrations
Query(detailed): Query<Option<BooleanFlag>>,
/// No Authorization required, but Token permitted.
auth: NoneOrRBAC,
) -> registrations_get::AllResponses {
let detailed = detailed.unwrap_or_default();
let auth_catalyst_id = auth.into();
registrations_get::endpoint(lookup, auth_catalyst_id, detailed.into()).await
}
}