use crate::client::TrellisClientError;
pub struct AuthClient<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthClient<'a> {
pub fn new(inner: &'a crate::client::TrellisClient) -> Self {
Self { inner }
}
#[allow(dead_code)]
pub(crate) fn inner(&self) -> &'a crate::client::TrellisClient {
self.inner
}
pub fn rpc(&self) -> Rpc<'a> {
Rpc { _inner: self.inner }
}
pub fn event(&self) -> Event<'a> {
Event { _inner: self.inner }
}
pub fn feed(&self) -> Feed<'a> {
Feed { _inner: self.inner }
}
pub fn operation(&self) -> Operation<'a> {
Operation { _inner: self.inner }
}
}
pub struct Rpc<'a> {
pub(crate) _inner: &'a crate::client::TrellisClient,
}
impl<'a> Rpc<'a> {
pub fn auth(&self) -> AuthRpc<'a> {
AuthRpc { inner: self._inner }
}
}
pub struct AuthRpc<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthRpc<'a> {
pub async fn capabilities_list(
&self,
input: &super::types::AuthCapabilitiesListRequest,
) -> Result<super::types::AuthCapabilitiesListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthCapabilitiesListRpc>(input)
.await
}
pub async fn capability_groups_delete(
&self,
input: &super::types::AuthCapabilityGroupsDeleteRequest,
) -> Result<super::types::AuthCapabilityGroupsDeleteResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthCapabilityGroupsDeleteRpc>(input)
.await
}
pub async fn capability_groups_get(
&self,
input: &super::types::AuthCapabilityGroupsGetRequest,
) -> Result<super::types::AuthCapabilityGroupsGetResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthCapabilityGroupsGetRpc>(input)
.await
}
pub async fn capability_groups_list(
&self,
input: &super::types::AuthCapabilityGroupsListRequest,
) -> Result<super::types::AuthCapabilityGroupsListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthCapabilityGroupsListRpc>(input)
.await
}
pub async fn capability_groups_put(
&self,
input: &super::types::AuthCapabilityGroupsPutRequest,
) -> Result<super::types::AuthCapabilityGroupsPutResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthCapabilityGroupsPutRpc>(input)
.await
}
pub async fn catalog_issues_resolve(
&self,
input: &super::types::AuthCatalogIssuesResolveRequest,
) -> Result<super::types::AuthCatalogIssuesResolveResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthCatalogIssuesResolveRpc>(input)
.await
}
pub async fn connections_kick(
&self,
input: &super::types::AuthConnectionsKickRequest,
) -> Result<super::types::AuthConnectionsKickResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthConnectionsKickRpc>(input)
.await
}
pub async fn connections_list(
&self,
input: &super::types::AuthConnectionsListRequest,
) -> Result<super::types::AuthConnectionsListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthConnectionsListRpc>(input)
.await
}
pub async fn deployment_authority_accept_migration(
&self,
input: &super::types::AuthDeploymentAuthorityAcceptMigrationRequest,
) -> Result<super::types::AuthDeploymentAuthorityAcceptMigrationResponse, TrellisClientError>
{
self.inner
.call::<super::rpc::AuthDeploymentAuthorityAcceptMigrationRpc>(input)
.await
}
pub async fn deployment_authority_accept_update(
&self,
input: &super::types::AuthDeploymentAuthorityAcceptUpdateRequest,
) -> Result<super::types::AuthDeploymentAuthorityAcceptUpdateResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentAuthorityAcceptUpdateRpc>(input)
.await
}
pub async fn deployment_authority_get(
&self,
input: &super::types::AuthDeploymentAuthorityGetRequest,
) -> Result<super::types::AuthDeploymentAuthorityGetResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentAuthorityGetRpc>(input)
.await
}
pub async fn deployment_authority_grant_overrides_list(
&self,
input: &super::types::AuthDeploymentAuthorityGrantOverridesListRequest,
) -> Result<super::types::AuthDeploymentAuthorityGrantOverridesListResponse, TrellisClientError>
{
self.inner
.call::<super::rpc::AuthDeploymentAuthorityGrantOverridesListRpc>(input)
.await
}
pub async fn deployment_authority_grant_overrides_put(
&self,
input: &super::types::AuthDeploymentAuthorityGrantOverridesPutRequest,
) -> Result<super::types::AuthDeploymentAuthorityGrantOverridesPutResponse, TrellisClientError>
{
self.inner
.call::<super::rpc::AuthDeploymentAuthorityGrantOverridesPutRpc>(input)
.await
}
pub async fn deployment_authority_grant_overrides_remove(
&self,
input: &super::types::AuthDeploymentAuthorityGrantOverridesRemoveRequest,
) -> Result<super::types::AuthDeploymentAuthorityGrantOverridesRemoveResponse, TrellisClientError>
{
self.inner
.call::<super::rpc::AuthDeploymentAuthorityGrantOverridesRemoveRpc>(input)
.await
}
pub async fn deployment_authority_list(
&self,
input: &super::types::AuthDeploymentAuthorityListRequest,
) -> Result<super::types::AuthDeploymentAuthorityListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentAuthorityListRpc>(input)
.await
}
pub async fn deployment_authority_plan(
&self,
input: &super::types::AuthDeploymentAuthorityPlanRequest,
) -> Result<super::types::AuthDeploymentAuthorityPlanResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentAuthorityPlanRpc>(input)
.await
}
pub async fn deployment_authority_plans_get(
&self,
input: &super::types::AuthDeploymentAuthorityPlansGetRequest,
) -> Result<super::types::AuthDeploymentAuthorityPlansGetResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentAuthorityPlansGetRpc>(input)
.await
}
pub async fn deployment_authority_plans_list(
&self,
input: &super::types::AuthDeploymentAuthorityPlansListRequest,
) -> Result<super::types::AuthDeploymentAuthorityPlansListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentAuthorityPlansListRpc>(input)
.await
}
pub async fn deployment_authority_reconcile(
&self,
input: &super::types::AuthDeploymentAuthorityReconcileRequest,
) -> Result<super::types::AuthDeploymentAuthorityReconcileResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentAuthorityReconcileRpc>(input)
.await
}
pub async fn deployment_authority_reject(
&self,
input: &super::types::AuthDeploymentAuthorityRejectRequest,
) -> Result<super::types::AuthDeploymentAuthorityRejectResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentAuthorityRejectRpc>(input)
.await
}
pub async fn deployments_create(
&self,
input: &super::types::AuthDeploymentsCreateRequest,
) -> Result<super::types::AuthDeploymentsCreateResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentsCreateRpc>(input)
.await
}
pub async fn deployments_disable(
&self,
input: &super::types::AuthDeploymentsDisableRequest,
) -> Result<super::types::AuthDeploymentsDisableResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentsDisableRpc>(input)
.await
}
pub async fn deployments_enable(
&self,
input: &super::types::AuthDeploymentsEnableRequest,
) -> Result<super::types::AuthDeploymentsEnableResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentsEnableRpc>(input)
.await
}
pub async fn deployments_list(
&self,
input: &super::types::AuthDeploymentsListRequest,
) -> Result<super::types::AuthDeploymentsListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentsListRpc>(input)
.await
}
pub async fn deployments_remove(
&self,
input: &super::types::AuthDeploymentsRemoveRequest,
) -> Result<super::types::AuthDeploymentsRemoveResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeploymentsRemoveRpc>(input)
.await
}
pub async fn device_user_authorities_list(
&self,
input: &super::types::AuthDeviceUserAuthoritiesListRequest,
) -> Result<super::types::AuthDeviceUserAuthoritiesListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeviceUserAuthoritiesListRpc>(input)
.await
}
pub async fn device_user_authorities_reviews_decide(
&self,
input: &super::types::AuthDeviceUserAuthoritiesReviewsDecideRequest,
) -> Result<super::types::AuthDeviceUserAuthoritiesReviewsDecideResponse, TrellisClientError>
{
self.inner
.call::<super::rpc::AuthDeviceUserAuthoritiesReviewsDecideRpc>(input)
.await
}
pub async fn device_user_authorities_reviews_list(
&self,
input: &super::types::AuthDeviceUserAuthoritiesReviewsListRequest,
) -> Result<super::types::AuthDeviceUserAuthoritiesReviewsListResponse, TrellisClientError>
{
self.inner
.call::<super::rpc::AuthDeviceUserAuthoritiesReviewsListRpc>(input)
.await
}
pub async fn device_user_authorities_revoke(
&self,
input: &super::types::AuthDeviceUserAuthoritiesRevokeRequest,
) -> Result<super::types::AuthDeviceUserAuthoritiesRevokeResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDeviceUserAuthoritiesRevokeRpc>(input)
.await
}
pub async fn devices_connect_info_get(
&self,
input: &super::types::AuthDevicesConnectInfoGetRequest,
) -> Result<super::types::AuthDevicesConnectInfoGetResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDevicesConnectInfoGetRpc>(input)
.await
}
pub async fn devices_disable(
&self,
input: &super::types::AuthDevicesDisableRequest,
) -> Result<super::types::AuthDevicesDisableResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDevicesDisableRpc>(input)
.await
}
pub async fn devices_enable(
&self,
input: &super::types::AuthDevicesEnableRequest,
) -> Result<super::types::AuthDevicesEnableResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDevicesEnableRpc>(input)
.await
}
pub async fn devices_list(
&self,
input: &super::types::AuthDevicesListRequest,
) -> Result<super::types::AuthDevicesListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDevicesListRpc>(input)
.await
}
pub async fn devices_provision(
&self,
input: &super::types::AuthDevicesProvisionRequest,
) -> Result<super::types::AuthDevicesProvisionResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDevicesProvisionRpc>(input)
.await
}
pub async fn devices_remove(
&self,
input: &super::types::AuthDevicesRemoveRequest,
) -> Result<super::types::AuthDevicesRemoveResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthDevicesRemoveRpc>(input)
.await
}
pub async fn health(&self) -> Result<super::types::AuthHealthResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthHealthRpc>(&super::rpc::Empty {})
.await
}
pub async fn identities_list(
&self,
input: &super::types::AuthIdentitiesListRequest,
) -> Result<super::types::AuthIdentitiesListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthIdentitiesListRpc>(input)
.await
}
pub async fn identity_grants_list(
&self,
input: &super::types::AuthIdentityGrantsListRequest,
) -> Result<super::types::AuthIdentityGrantsListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthIdentityGrantsListRpc>(input)
.await
}
pub async fn identity_grants_revoke(
&self,
input: &super::types::AuthIdentityGrantsRevokeRequest,
) -> Result<super::types::AuthIdentityGrantsRevokeResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthIdentityGrantsRevokeRpc>(input)
.await
}
pub async fn portals_get(
&self,
input: &super::types::AuthPortalsGetRequest,
) -> Result<super::types::AuthPortalsGetResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthPortalsGetRpc>(input)
.await
}
pub async fn portals_list(
&self,
input: &super::types::AuthPortalsListRequest,
) -> Result<super::types::AuthPortalsListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthPortalsListRpc>(input)
.await
}
pub async fn portals_login_settings_get(
&self,
input: &super::types::AuthPortalsLoginSettingsGetRequest,
) -> Result<super::types::AuthPortalsLoginSettingsGetResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthPortalsLoginSettingsGetRpc>(input)
.await
}
pub async fn portals_login_settings_update(
&self,
input: &super::types::AuthPortalsLoginSettingsUpdateRequest,
) -> Result<super::types::AuthPortalsLoginSettingsUpdateResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthPortalsLoginSettingsUpdateRpc>(input)
.await
}
pub async fn portals_put(
&self,
input: &super::types::AuthPortalsPutRequest,
) -> Result<super::types::AuthPortalsPutResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthPortalsPutRpc>(input)
.await
}
pub async fn portals_remove(
&self,
input: &super::types::AuthPortalsRemoveRequest,
) -> Result<super::types::AuthPortalsRemoveResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthPortalsRemoveRpc>(input)
.await
}
pub async fn portals_routes_put(
&self,
input: &super::types::AuthPortalsRoutesPutRequest,
) -> Result<super::types::AuthPortalsRoutesPutResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthPortalsRoutesPutRpc>(input)
.await
}
pub async fn portals_routes_remove(
&self,
input: &super::types::AuthPortalsRoutesRemoveRequest,
) -> Result<super::types::AuthPortalsRoutesRemoveResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthPortalsRoutesRemoveRpc>(input)
.await
}
pub async fn requests_validate(
&self,
input: &super::types::AuthRequestsValidateRequest,
) -> Result<super::types::AuthRequestsValidateResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthRequestsValidateRpc>(input)
.await
}
pub async fn service_instances_disable(
&self,
input: &super::types::AuthServiceInstancesDisableRequest,
) -> Result<super::types::AuthServiceInstancesDisableResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthServiceInstancesDisableRpc>(input)
.await
}
pub async fn service_instances_enable(
&self,
input: &super::types::AuthServiceInstancesEnableRequest,
) -> Result<super::types::AuthServiceInstancesEnableResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthServiceInstancesEnableRpc>(input)
.await
}
pub async fn service_instances_list(
&self,
input: &super::types::AuthServiceInstancesListRequest,
) -> Result<super::types::AuthServiceInstancesListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthServiceInstancesListRpc>(input)
.await
}
pub async fn service_instances_provision(
&self,
input: &super::types::AuthServiceInstancesProvisionRequest,
) -> Result<super::types::AuthServiceInstancesProvisionResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthServiceInstancesProvisionRpc>(input)
.await
}
pub async fn service_instances_remove(
&self,
input: &super::types::AuthServiceInstancesRemoveRequest,
) -> Result<super::types::AuthServiceInstancesRemoveResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthServiceInstancesRemoveRpc>(input)
.await
}
pub async fn sessions_list(
&self,
input: &super::types::AuthSessionsListRequest,
) -> Result<super::types::AuthSessionsListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthSessionsListRpc>(input)
.await
}
pub async fn sessions_logout(
&self,
) -> Result<super::types::AuthSessionsLogoutResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthSessionsLogoutRpc>(&super::rpc::Empty {})
.await
}
pub async fn sessions_me(
&self,
) -> Result<super::types::AuthSessionsMeResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthSessionsMeRpc>(&super::rpc::Empty {})
.await
}
pub async fn sessions_revoke(
&self,
input: &super::types::AuthSessionsRevokeRequest,
) -> Result<super::types::AuthSessionsRevokeResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthSessionsRevokeRpc>(input)
.await
}
pub async fn user_identities_list(
&self,
input: &super::types::AuthUserIdentitiesListRequest,
) -> Result<super::types::AuthUserIdentitiesListResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthUserIdentitiesListRpc>(input)
.await
}
pub async fn user_identities_unlink(
&self,
input: &super::types::AuthUserIdentitiesUnlinkRequest,
) -> Result<super::types::AuthUserIdentitiesUnlinkResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthUserIdentitiesUnlinkRpc>(input)
.await
}
pub async fn users_create(
&self,
input: &super::types::AuthUsersCreateRequest,
) -> Result<super::types::AuthUsersCreateResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthUsersCreateRpc>(input)
.await
}
pub async fn users_get(
&self,
input: &super::types::AuthUsersGetRequest,
) -> Result<super::types::AuthUsersGetResponse, TrellisClientError> {
self.inner.call::<super::rpc::AuthUsersGetRpc>(input).await
}
pub async fn users_identity_link_create(
&self,
input: &super::types::AuthUsersIdentityLinkCreateRequest,
) -> Result<super::types::AuthUsersIdentityLinkCreateResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthUsersIdentityLinkCreateRpc>(input)
.await
}
pub async fn users_list(
&self,
input: &super::types::AuthUsersListRequest,
) -> Result<super::types::AuthUsersListResponse, TrellisClientError> {
self.inner.call::<super::rpc::AuthUsersListRpc>(input).await
}
pub async fn users_password_change(
&self,
input: &super::types::AuthUsersPasswordChangeRequest,
) -> Result<super::types::AuthUsersPasswordChangeResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthUsersPasswordChangeRpc>(input)
.await
}
pub async fn users_password_reset_create(
&self,
input: &super::types::AuthUsersPasswordResetCreateRequest,
) -> Result<super::types::AuthUsersPasswordResetCreateResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthUsersPasswordResetCreateRpc>(input)
.await
}
pub async fn users_update(
&self,
input: &super::types::AuthUsersUpdateRequest,
) -> Result<super::types::AuthUsersUpdateResponse, TrellisClientError> {
self.inner
.call::<super::rpc::AuthUsersUpdateRpc>(input)
.await
}
}
pub struct Event<'a> {
pub(crate) _inner: &'a crate::client::TrellisClient,
}
impl<'a> Event<'a> {
pub fn auth(&self) -> AuthEvent<'a> {
AuthEvent { inner: self._inner }
}
}
pub struct AuthEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthEvent<'a> {
pub fn connections_closed(&self) -> AuthConnectionsClosedEvent<'a> {
AuthConnectionsClosedEvent { inner: self.inner }
}
pub fn connections_kicked(&self) -> AuthConnectionsKickedEvent<'a> {
AuthConnectionsKickedEvent { inner: self.inner }
}
pub fn connections_opened(&self) -> AuthConnectionsOpenedEvent<'a> {
AuthConnectionsOpenedEvent { inner: self.inner }
}
pub fn device_user_authorities_approved(&self) -> AuthDeviceUserAuthoritiesApprovedEvent<'a> {
AuthDeviceUserAuthoritiesApprovedEvent { inner: self.inner }
}
pub fn device_user_authorities_requested(&self) -> AuthDeviceUserAuthoritiesRequestedEvent<'a> {
AuthDeviceUserAuthoritiesRequestedEvent { inner: self.inner }
}
pub fn device_user_authorities_resolved(&self) -> AuthDeviceUserAuthoritiesResolvedEvent<'a> {
AuthDeviceUserAuthoritiesResolvedEvent { inner: self.inner }
}
pub fn device_user_authorities_review_requested(
&self,
) -> AuthDeviceUserAuthoritiesReviewRequestedEvent<'a> {
AuthDeviceUserAuthoritiesReviewRequestedEvent { inner: self.inner }
}
pub fn sessions_revoked(&self) -> AuthSessionsRevokedEvent<'a> {
AuthSessionsRevokedEvent { inner: self.inner }
}
}
pub struct AuthConnectionsClosedEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthConnectionsClosedEvent<'a> {
pub async fn publish(
&self,
event: &super::types::AuthConnectionsClosedEvent,
) -> Result<(), TrellisClientError> {
self.inner
.publish::<super::events::AuthConnectionsClosedEventDescriptor>(event)
.await
}
pub async fn listen<F, Fut>(&self, handler: F) -> Result<(), TrellisClientError>
where
F: Fn(super::types::AuthConnectionsClosedEvent) -> Fut,
Fut: std::future::Future<Output = Result<(), TrellisClientError>>,
{
let mut stream = self
.inner
.subscribe_with_options::<super::events::AuthConnectionsClosedEventDescriptor>(
crate::client::EventSubscribeOptions {
mode: crate::client::EventSubscriptionMode::Ephemeral,
replay: crate::client::EventReplayPolicy::New,
durable_name: None,
},
)
.await?;
while let Some(event) = futures_util::StreamExt::next(&mut stream).await {
handler(event?).await?;
}
Ok(())
}
}
pub struct AuthConnectionsKickedEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthConnectionsKickedEvent<'a> {
pub async fn publish(
&self,
event: &super::types::AuthConnectionsKickedEvent,
) -> Result<(), TrellisClientError> {
self.inner
.publish::<super::events::AuthConnectionsKickedEventDescriptor>(event)
.await
}
pub async fn listen<F, Fut>(&self, handler: F) -> Result<(), TrellisClientError>
where
F: Fn(super::types::AuthConnectionsKickedEvent) -> Fut,
Fut: std::future::Future<Output = Result<(), TrellisClientError>>,
{
let mut stream = self
.inner
.subscribe_with_options::<super::events::AuthConnectionsKickedEventDescriptor>(
crate::client::EventSubscribeOptions {
mode: crate::client::EventSubscriptionMode::Ephemeral,
replay: crate::client::EventReplayPolicy::New,
durable_name: None,
},
)
.await?;
while let Some(event) = futures_util::StreamExt::next(&mut stream).await {
handler(event?).await?;
}
Ok(())
}
}
pub struct AuthConnectionsOpenedEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthConnectionsOpenedEvent<'a> {
pub async fn publish(
&self,
event: &super::types::AuthConnectionsOpenedEvent,
) -> Result<(), TrellisClientError> {
self.inner
.publish::<super::events::AuthConnectionsOpenedEventDescriptor>(event)
.await
}
pub async fn listen<F, Fut>(&self, handler: F) -> Result<(), TrellisClientError>
where
F: Fn(super::types::AuthConnectionsOpenedEvent) -> Fut,
Fut: std::future::Future<Output = Result<(), TrellisClientError>>,
{
let mut stream = self
.inner
.subscribe_with_options::<super::events::AuthConnectionsOpenedEventDescriptor>(
crate::client::EventSubscribeOptions {
mode: crate::client::EventSubscriptionMode::Ephemeral,
replay: crate::client::EventReplayPolicy::New,
durable_name: None,
},
)
.await?;
while let Some(event) = futures_util::StreamExt::next(&mut stream).await {
handler(event?).await?;
}
Ok(())
}
}
pub struct AuthDeviceUserAuthoritiesApprovedEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthDeviceUserAuthoritiesApprovedEvent<'a> {
pub async fn publish(
&self,
event: &super::types::AuthDeviceUserAuthoritiesApprovedEvent,
) -> Result<(), TrellisClientError> {
self.inner
.publish::<super::events::AuthDeviceUserAuthoritiesApprovedEventDescriptor>(event)
.await
}
pub async fn listen<F, Fut>(&self, handler: F) -> Result<(), TrellisClientError>
where
F: Fn(super::types::AuthDeviceUserAuthoritiesApprovedEvent) -> Fut,
Fut: std::future::Future<Output = Result<(), TrellisClientError>>,
{
let mut stream = self
.inner
.subscribe_with_options::<
super::events::AuthDeviceUserAuthoritiesApprovedEventDescriptor,
>(crate::client::EventSubscribeOptions {
mode: crate::client::EventSubscriptionMode::Ephemeral,
replay: crate::client::EventReplayPolicy::New,
durable_name: None,
})
.await?;
while let Some(event) = futures_util::StreamExt::next(&mut stream).await {
handler(event?).await?;
}
Ok(())
}
}
pub struct AuthDeviceUserAuthoritiesRequestedEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthDeviceUserAuthoritiesRequestedEvent<'a> {
pub async fn publish(
&self,
event: &super::types::AuthDeviceUserAuthoritiesRequestedEvent,
) -> Result<(), TrellisClientError> {
self.inner
.publish::<super::events::AuthDeviceUserAuthoritiesRequestedEventDescriptor>(event)
.await
}
pub async fn listen<F, Fut>(&self, handler: F) -> Result<(), TrellisClientError>
where
F: Fn(super::types::AuthDeviceUserAuthoritiesRequestedEvent) -> Fut,
Fut: std::future::Future<Output = Result<(), TrellisClientError>>,
{
let mut stream = self
.inner
.subscribe_with_options::<
super::events::AuthDeviceUserAuthoritiesRequestedEventDescriptor,
>(crate::client::EventSubscribeOptions {
mode: crate::client::EventSubscriptionMode::Ephemeral,
replay: crate::client::EventReplayPolicy::New,
durable_name: None,
})
.await?;
while let Some(event) = futures_util::StreamExt::next(&mut stream).await {
handler(event?).await?;
}
Ok(())
}
}
pub struct AuthDeviceUserAuthoritiesResolvedEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthDeviceUserAuthoritiesResolvedEvent<'a> {
pub async fn publish(
&self,
event: &super::types::AuthDeviceUserAuthoritiesResolvedEvent,
) -> Result<(), TrellisClientError> {
self.inner
.publish::<super::events::AuthDeviceUserAuthoritiesResolvedEventDescriptor>(event)
.await
}
pub async fn listen<F, Fut>(&self, handler: F) -> Result<(), TrellisClientError>
where
F: Fn(super::types::AuthDeviceUserAuthoritiesResolvedEvent) -> Fut,
Fut: std::future::Future<Output = Result<(), TrellisClientError>>,
{
let mut stream = self
.inner
.subscribe_with_options::<
super::events::AuthDeviceUserAuthoritiesResolvedEventDescriptor,
>(crate::client::EventSubscribeOptions {
mode: crate::client::EventSubscriptionMode::Ephemeral,
replay: crate::client::EventReplayPolicy::New,
durable_name: None,
})
.await?;
while let Some(event) = futures_util::StreamExt::next(&mut stream).await {
handler(event?).await?;
}
Ok(())
}
}
pub struct AuthDeviceUserAuthoritiesReviewRequestedEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthDeviceUserAuthoritiesReviewRequestedEvent<'a> {
pub async fn publish(
&self,
event: &super::types::AuthDeviceUserAuthoritiesReviewRequestedEvent,
) -> Result<(), TrellisClientError> {
self.inner
.publish::<super::events::AuthDeviceUserAuthoritiesReviewRequestedEventDescriptor>(
event,
)
.await
}
pub async fn listen<F, Fut>(&self, handler: F) -> Result<(), TrellisClientError>
where
F: Fn(super::types::AuthDeviceUserAuthoritiesReviewRequestedEvent) -> Fut,
Fut: std::future::Future<Output = Result<(), TrellisClientError>>,
{
let mut stream = self
.inner
.subscribe_with_options::<
super::events::AuthDeviceUserAuthoritiesReviewRequestedEventDescriptor,
>(crate::client::EventSubscribeOptions {
mode: crate::client::EventSubscriptionMode::Ephemeral,
replay: crate::client::EventReplayPolicy::New,
durable_name: None,
})
.await?;
while let Some(event) = futures_util::StreamExt::next(&mut stream).await {
handler(event?).await?;
}
Ok(())
}
}
pub struct AuthSessionsRevokedEvent<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthSessionsRevokedEvent<'a> {
pub async fn publish(
&self,
event: &super::types::AuthSessionsRevokedEvent,
) -> Result<(), TrellisClientError> {
self.inner
.publish::<super::events::AuthSessionsRevokedEventDescriptor>(event)
.await
}
pub async fn listen<F, Fut>(&self, handler: F) -> Result<(), TrellisClientError>
where
F: Fn(super::types::AuthSessionsRevokedEvent) -> Fut,
Fut: std::future::Future<Output = Result<(), TrellisClientError>>,
{
let mut stream = self
.inner
.subscribe_with_options::<super::events::AuthSessionsRevokedEventDescriptor>(
crate::client::EventSubscribeOptions {
mode: crate::client::EventSubscriptionMode::Ephemeral,
replay: crate::client::EventReplayPolicy::New,
durable_name: None,
},
)
.await?;
while let Some(event) = futures_util::StreamExt::next(&mut stream).await {
handler(event?).await?;
}
Ok(())
}
}
pub struct Feed<'a> {
pub(crate) _inner: &'a crate::client::TrellisClient,
}
impl<'a> Feed<'a> {}
pub struct Operation<'a> {
pub(crate) _inner: &'a crate::client::TrellisClient,
}
impl<'a> Operation<'a> {
pub fn auth(&self) -> AuthOperation<'a> {
AuthOperation { inner: self._inner }
}
}
pub struct AuthOperation<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthOperation<'a> {
pub fn device_user_authorities_resolve(&self) -> AuthDeviceUserAuthoritiesResolveOperation<'a> {
AuthDeviceUserAuthoritiesResolveOperation { inner: self.inner }
}
}
pub struct AuthDeviceUserAuthoritiesResolveOperation<'a> {
inner: &'a crate::client::TrellisClient,
}
impl<'a> AuthDeviceUserAuthoritiesResolveOperation<'a> {
pub async fn start(
&self,
input: &super::types::AuthDeviceUserAuthoritiesResolveInput,
) -> Result<
crate::client::OperationRef<
'a,
crate::client::TrellisClient,
super::operations::AuthDeviceUserAuthoritiesResolveOperation,
>,
TrellisClientError,
> {
self.inner
.operation::<super::operations::AuthDeviceUserAuthoritiesResolveOperation>()
.start(input)
.await
}
}