// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle<C, M, R = aws_smithy_client::retry::Standard> {
pub(crate) client: aws_smithy_client::Client<C, M, R>,
pub(crate) conf: crate::Config,
}
/// An ergonomic service client for `MatchmakerService`.
///
/// This client allows ergonomic access to a `MatchmakerService`-shaped service.
/// Each method corresponds to an endpoint defined in the service's Smithy model,
/// and the request and response shapes are auto-generated from that same model.
///
/// # Constructing a Client
///
/// To construct a client, you need a few different things:
///
/// - A [`Config`](crate::Config) that specifies additional configuration
/// required by the service.
/// - A connector (`C`) that specifies how HTTP requests are translated
/// into HTTP responses. This will typically be an HTTP client (like
/// `hyper`), though you can also substitute in your own, like a mock
/// mock connector for testing.
/// - A "middleware" (`M`) that modifies requests prior to them being
/// sent to the request. Most commonly, middleware will decide what
/// endpoint the requests should be sent to, as well as perform
/// authentication and authorization of requests (such as SigV4).
/// You can also have middleware that performs request/response
/// tracing, throttling, or other middleware-like tasks.
/// - A retry policy (`R`) that dictates the behavior for requests that
/// fail and should (potentially) be retried. The default type is
/// generally what you want, as it implements a well-vetted retry
/// policy implemented in [`RetryMode::Standard`](aws_smithy_types::retry::RetryMode::Standard).
///
/// To construct a client, you will generally want to call
/// [`Client::with_config`], which takes a [`aws_smithy_client::Client`] (a
/// Smithy client that isn't specialized to a particular service),
/// and a [`Config`](crate::Config). Both of these are constructed using
/// the [builder pattern] where you first construct a `Builder` type,
/// then configure it with the necessary parameters, and then call
/// `build` to construct the finalized output type. The
/// [`aws_smithy_client::Client`] builder is re-exported in this crate as
/// [`Builder`] for convenience.
///
/// In _most_ circumstances, you will want to use the following pattern
/// to construct a client:
///
/// ```
/// use rivet_matchmaker::{Builder, Client, Config};
/// let raw_client =
/// Builder::dyn_https()
/// # /*
/// .middleware(/* discussed below */)
/// # */
/// # .middleware_fn(|r| r)
/// .build();
/// let config = Config::builder().build();
/// let client = Client::with_config(raw_client, config);
/// ```
///
/// For the middleware, you'll want to use whatever matches the
/// routing, authentication and authorization required by the target
/// service. For example, for the standard AWS SDK which uses
/// [SigV4-signed requests], the middleware looks like this:
///
// Ignored as otherwise we'd need to pull in all these dev-dependencies.
/// ```rust,ignore
/// use aws_endpoint::AwsEndpointStage;
/// use aws_http::auth::CredentialsStage;
/// use aws_http::recursion_detection::RecursionDetectionStage;
/// use aws_http::user_agent::UserAgentStage;
/// use aws_sig_auth::middleware::SigV4SigningStage;
/// use aws_sig_auth::signer::SigV4Signer;
/// use aws_smithy_client::retry::Config as RetryConfig;
/// use aws_smithy_http_tower::map_request::{AsyncMapRequestLayer, MapRequestLayer};
/// use std::fmt::Debug;
/// use tower::layer::util::{Identity, Stack};
/// use tower::ServiceBuilder;
///
/// type AwsMiddlewareStack = Stack<
/// MapRequestLayer<RecursionDetectionStage>,
/// Stack<
/// MapRequestLayer<SigV4SigningStage>,
/// Stack<
/// AsyncMapRequestLayer<CredentialsStage>,
/// Stack<
/// MapRequestLayer<UserAgentStage>,
/// Stack<MapRequestLayer<AwsEndpointStage>, Identity>,
/// >,
/// >,
/// >,
/// >;
///
/// /// AWS Middleware Stack
/// ///
/// /// This implements the middleware stack for this service. It will:
/// /// 1. Load credentials asynchronously into the property bag
/// /// 2. Sign the request with SigV4
/// /// 3. Resolve an Endpoint for the request
/// /// 4. Add a user agent to the request
/// #[derive(Debug, Default, Clone)]
/// #[non_exhaustive]
/// pub struct AwsMiddleware;
///
/// impl AwsMiddleware {
/// /// Create a new `AwsMiddleware` stack
/// ///
/// /// Note: `AwsMiddleware` holds no state.
/// pub fn new() -> Self {
/// AwsMiddleware::default()
/// }
/// }
///
/// // define the middleware stack in a non-generic location to reduce code bloat.
/// fn base() -> ServiceBuilder<AwsMiddlewareStack> {
/// let credential_provider = AsyncMapRequestLayer::for_mapper(CredentialsStage::new());
/// let signer = MapRequestLayer::for_mapper(SigV4SigningStage::new(SigV4Signer::new()));
/// let endpoint_resolver = MapRequestLayer::for_mapper(AwsEndpointStage);
/// let user_agent = MapRequestLayer::for_mapper(UserAgentStage::new());
/// let recursion_detection = MapRequestLayer::for_mapper(RecursionDetectionStage::new());
/// // These layers can be considered as occurring in order, that is:
/// // 1. Resolve an endpoint
/// // 2. Add a user agent
/// // 3. Acquire credentials
/// // 4. Sign with credentials
/// // (5. Dispatch over the wire)
/// ServiceBuilder::new()
/// .layer(endpoint_resolver)
/// .layer(user_agent)
/// .layer(credential_provider)
/// .layer(signer)
/// .layer(recursion_detection)
/// }
///
/// impl<S> tower::Layer<S> for AwsMiddleware {
/// type Service = <AwsMiddlewareStack as tower::Layer<S>>::Service;
///
/// fn layer(&self, inner: S) -> Self::Service {
/// base().service(inner)
/// }
/// }
/// ```
///
/// # Using a Client
///
/// Once you have a client set up, you can access the service's endpoints
/// by calling the appropriate method on [`Client`]. Each such method
/// returns a request builder for that endpoint, with methods for setting
/// the various fields of the request. Once your request is complete, use
/// the `send` method to send the request. `send` returns a future, which
/// you then have to `.await` to get the service's response.
///
/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#c-builder
/// [SigV4-signed requests]: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
#[derive(std::fmt::Debug)]
pub struct Client<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<Handle<C, M, R>>,
}
impl<C, M, R> std::clone::Clone for Client<C, M, R> {
fn clone(&self) -> Self {
Self {
handle: self.handle.clone(),
}
}
}
#[doc(inline)]
pub use aws_smithy_client::Builder;
impl<C, M, R> From<aws_smithy_client::Client<C, M, R>> for Client<C, M, R> {
fn from(client: aws_smithy_client::Client<C, M, R>) -> Self {
Self::with_config(client, crate::Config::builder().build())
}
}
impl<C, M, R> Client<C, M, R> {
/// Creates a client with the given service configuration.
pub fn with_config(client: aws_smithy_client::Client<C, M, R>, conf: crate::Config) -> Self {
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
/// Returns the client's configuration.
pub fn conf(&self) -> &crate::Config {
&self.handle.conf
}
}
impl<C, M, R> Client<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Constructs a fluent builder for the [`FindLobby`](crate::client::fluent_builders::FindLobby) operation.
///
/// - The fluent builder is configurable:
/// - [`game_modes(Vec<String>)`](crate::client::fluent_builders::FindLobby::game_modes) / [`set_game_modes(Option<Vec<String>>)`](crate::client::fluent_builders::FindLobby::set_game_modes): Game modes to match lobbies against.
/// - [`regions(Vec<String>)`](crate::client::fluent_builders::FindLobby::regions) / [`set_regions(Option<Vec<String>>)`](crate::client::fluent_builders::FindLobby::set_regions): Regions to match lobbies against. If not specified, the optimal region will be determined and will attempt to find lobbies in that region.
/// - [`prevent_auto_create_lobby(bool)`](crate::client::fluent_builders::FindLobby::prevent_auto_create_lobby) / [`set_prevent_auto_create_lobby(Option<bool>)`](crate::client::fluent_builders::FindLobby::set_prevent_auto_create_lobby): Prevents a new lobby from being created when finding a lobby. If no lobby is found, a `MATCHMAKER_LOBBY_NOT_FOUND` error will be thrown.
/// - [`captcha(CaptchaConfig)`](crate::client::fluent_builders::FindLobby::captcha) / [`set_captcha(Option<CaptchaConfig>)`](crate::client::fluent_builders::FindLobby::set_captcha): Methods to verify a captcha.
/// - [`origin(impl Into<String>)`](crate::client::fluent_builders::FindLobby::origin) / [`set_origin(Option<String>)`](crate::client::fluent_builders::FindLobby::set_origin): (undocumented)
/// - On success, responds with [`FindLobbyOutput`](crate::output::FindLobbyOutput) with field(s):
/// - [`lobby(Option<MatchmakerLobbyJoinInfo>)`](crate::output::FindLobbyOutput::lobby): A matchmaker lobby.
/// - On failure, responds with [`SdkError<FindLobbyError>`](crate::error::FindLobbyError)
pub fn find_lobby(&self) -> fluent_builders::FindLobby<C, M, R> {
fluent_builders::FindLobby::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`JoinLobby`](crate::client::fluent_builders::JoinLobby) operation.
///
/// - The fluent builder is configurable:
/// - [`lobby_id(impl Into<String>)`](crate::client::fluent_builders::JoinLobby::lobby_id) / [`set_lobby_id(Option<String>)`](crate::client::fluent_builders::JoinLobby::set_lobby_id): A universally unique identifier.
/// - [`captcha(CaptchaConfig)`](crate::client::fluent_builders::JoinLobby::captcha) / [`set_captcha(Option<CaptchaConfig>)`](crate::client::fluent_builders::JoinLobby::set_captcha): Methods to verify a captcha.
/// - On success, responds with [`JoinLobbyOutput`](crate::output::JoinLobbyOutput) with field(s):
/// - [`lobby(Option<MatchmakerLobbyJoinInfo>)`](crate::output::JoinLobbyOutput::lobby): A matchmaker lobby.
/// - On failure, responds with [`SdkError<JoinLobbyError>`](crate::error::JoinLobbyError)
pub fn join_lobby(&self) -> fluent_builders::JoinLobby<C, M, R> {
fluent_builders::JoinLobby::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`ListLobbies`](crate::client::fluent_builders::ListLobbies) operation.
///
/// - The fluent builder takes no input, just [`send`](crate::client::fluent_builders::ListLobbies::send) it.
/// - On success, responds with [`ListLobbiesOutput`](crate::output::ListLobbiesOutput) with field(s):
/// - [`game_modes(Option<Vec<GameModeInfo>>)`](crate::output::ListLobbiesOutput::game_modes): (undocumented)
/// - [`regions(Option<Vec<RegionInfo>>)`](crate::output::ListLobbiesOutput::regions): (undocumented)
/// - [`lobbies(Option<Vec<LobbyInfo>>)`](crate::output::ListLobbiesOutput::lobbies): (undocumented)
/// - On failure, responds with [`SdkError<ListLobbiesError>`](crate::error::ListLobbiesError)
pub fn list_lobbies(&self) -> fluent_builders::ListLobbies<C, M, R> {
fluent_builders::ListLobbies::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`ListRegions`](crate::client::fluent_builders::ListRegions) operation.
///
/// - The fluent builder takes no input, just [`send`](crate::client::fluent_builders::ListRegions::send) it.
/// - On success, responds with [`ListRegionsOutput`](crate::output::ListRegionsOutput) with field(s):
/// - [`regions(Option<Vec<RegionInfo>>)`](crate::output::ListRegionsOutput::regions): (undocumented)
/// - On failure, responds with [`SdkError<ListRegionsError>`](crate::error::ListRegionsError)
pub fn list_regions(&self) -> fluent_builders::ListRegions<C, M, R> {
fluent_builders::ListRegions::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`LobbyReady`](crate::client::fluent_builders::LobbyReady) operation.
///
/// - The fluent builder takes no input, just [`send`](crate::client::fluent_builders::LobbyReady::send) it.
/// - On success, responds with [`LobbyReadyOutput`](crate::output::LobbyReadyOutput)
/// - On failure, responds with [`SdkError<LobbyReadyError>`](crate::error::LobbyReadyError)
pub fn lobby_ready(&self) -> fluent_builders::LobbyReady<C, M, R> {
fluent_builders::LobbyReady::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`PlayerConnected`](crate::client::fluent_builders::PlayerConnected) operation.
///
/// - The fluent builder is configurable:
/// - [`player_token(impl Into<String>)`](crate::client::fluent_builders::PlayerConnected::player_token) / [`set_player_token(Option<String>)`](crate::client::fluent_builders::PlayerConnected::set_player_token): A JSON Web Token. Slightly modified to include a description prefix and use Protobufs of JSON.
/// - On success, responds with [`PlayerConnectedOutput`](crate::output::PlayerConnectedOutput)
/// - On failure, responds with [`SdkError<PlayerConnectedError>`](crate::error::PlayerConnectedError)
pub fn player_connected(&self) -> fluent_builders::PlayerConnected<C, M, R> {
fluent_builders::PlayerConnected::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`PlayerDisconnected`](crate::client::fluent_builders::PlayerDisconnected) operation.
///
/// - The fluent builder is configurable:
/// - [`player_token(impl Into<String>)`](crate::client::fluent_builders::PlayerDisconnected::player_token) / [`set_player_token(Option<String>)`](crate::client::fluent_builders::PlayerDisconnected::set_player_token): A JSON Web Token. Slightly modified to include a description prefix and use Protobufs of JSON.
/// - On success, responds with [`PlayerDisconnectedOutput`](crate::output::PlayerDisconnectedOutput)
/// - On failure, responds with [`SdkError<PlayerDisconnectedError>`](crate::error::PlayerDisconnectedError)
pub fn player_disconnected(&self) -> fluent_builders::PlayerDisconnected<C, M, R> {
fluent_builders::PlayerDisconnected::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`SetLobbyClosed`](crate::client::fluent_builders::SetLobbyClosed) operation.
///
/// - The fluent builder is configurable:
/// - [`is_closed(bool)`](crate::client::fluent_builders::SetLobbyClosed::is_closed) / [`set_is_closed(Option<bool>)`](crate::client::fluent_builders::SetLobbyClosed::set_is_closed): (undocumented)
/// - On success, responds with [`SetLobbyClosedOutput`](crate::output::SetLobbyClosedOutput)
/// - On failure, responds with [`SdkError<SetLobbyClosedError>`](crate::error::SetLobbyClosedError)
pub fn set_lobby_closed(&self) -> fluent_builders::SetLobbyClosed<C, M, R> {
fluent_builders::SetLobbyClosed::new(self.handle.clone())
}
}
pub mod fluent_builders {
//!
//! Utilities to ergonomically construct a request to the service.
//!
//! Fluent builders are created through the [`Client`](crate::client::Client) by calling
//! one if its operation methods. After parameters are set using the builder methods,
//! the `send` method can be called to initiate the request.
//!
/// Fluent builder constructing a request to `FindLobby`.
///
/// Finds a lobby based on the given criteria. If a lobby is not found and `prevent_auto_create_lobby` is `true`, a new lobby will be created.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct FindLobby<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::find_lobby_input::Builder,
}
impl<C, M, R> FindLobby<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `FindLobby`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::FindLobbyOutput,
aws_smithy_http::result::SdkError<crate::error::FindLobbyError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::FindLobbyInputOperationOutputAlias,
crate::output::FindLobbyOutput,
crate::error::FindLobbyError,
crate::input::FindLobbyInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// Appends an item to `game_modes`.
///
/// To override the contents of this collection use [`set_game_modes`](Self::set_game_modes).
///
/// Game modes to match lobbies against.
pub fn game_modes(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.game_modes(input.into());
self
}
/// Game modes to match lobbies against.
pub fn set_game_modes(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.inner = self.inner.set_game_modes(input);
self
}
/// Appends an item to `regions`.
///
/// To override the contents of this collection use [`set_regions`](Self::set_regions).
///
/// Regions to match lobbies against. If not specified, the optimal region will be determined and will attempt to find lobbies in that region.
pub fn regions(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.regions(input.into());
self
}
/// Regions to match lobbies against. If not specified, the optimal region will be determined and will attempt to find lobbies in that region.
pub fn set_regions(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.inner = self.inner.set_regions(input);
self
}
/// Prevents a new lobby from being created when finding a lobby. If no lobby is found, a `MATCHMAKER_LOBBY_NOT_FOUND` error will be thrown.
pub fn prevent_auto_create_lobby(mut self, input: bool) -> Self {
self.inner = self.inner.prevent_auto_create_lobby(input);
self
}
/// Prevents a new lobby from being created when finding a lobby. If no lobby is found, a `MATCHMAKER_LOBBY_NOT_FOUND` error will be thrown.
pub fn set_prevent_auto_create_lobby(mut self, input: std::option::Option<bool>) -> Self {
self.inner = self.inner.set_prevent_auto_create_lobby(input);
self
}
/// Methods to verify a captcha.
pub fn captcha(mut self, input: crate::model::CaptchaConfig) -> Self {
self.inner = self.inner.captcha(input);
self
}
/// Methods to verify a captcha.
pub fn set_captcha(
mut self,
input: std::option::Option<crate::model::CaptchaConfig>,
) -> Self {
self.inner = self.inner.set_captcha(input);
self
}
#[allow(missing_docs)] // documentation missing in model
pub fn origin(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.origin(input.into());
self
}
#[allow(missing_docs)] // documentation missing in model
pub fn set_origin(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_origin(input);
self
}
}
/// Fluent builder constructing a request to `JoinLobby`.
///
/// Joins a specific lobby. This request will use the direct player count configured for the lobby group.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct JoinLobby<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::join_lobby_input::Builder,
}
impl<C, M, R> JoinLobby<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `JoinLobby`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::JoinLobbyOutput,
aws_smithy_http::result::SdkError<crate::error::JoinLobbyError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::JoinLobbyInputOperationOutputAlias,
crate::output::JoinLobbyOutput,
crate::error::JoinLobbyError,
crate::input::JoinLobbyInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// A universally unique identifier.
pub fn lobby_id(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.lobby_id(input.into());
self
}
/// A universally unique identifier.
pub fn set_lobby_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_lobby_id(input);
self
}
/// Methods to verify a captcha.
pub fn captcha(mut self, input: crate::model::CaptchaConfig) -> Self {
self.inner = self.inner.captcha(input);
self
}
/// Methods to verify a captcha.
pub fn set_captcha(
mut self,
input: std::option::Option<crate::model::CaptchaConfig>,
) -> Self {
self.inner = self.inner.set_captcha(input);
self
}
}
/// Fluent builder constructing a request to `ListLobbies`.
///
/// Lists all open lobbies.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct ListLobbies<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::list_lobbies_input::Builder,
}
impl<C, M, R> ListLobbies<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `ListLobbies`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::ListLobbiesOutput,
aws_smithy_http::result::SdkError<crate::error::ListLobbiesError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListLobbiesInputOperationOutputAlias,
crate::output::ListLobbiesOutput,
crate::error::ListLobbiesError,
crate::input::ListLobbiesInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
}
/// Fluent builder constructing a request to `ListRegions`.
///
/// Returns a list of regions available to this namespace. Regions are sorted by most optimal to least optimal. The player's IP address is used to calculate the regions' optimality.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct ListRegions<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::list_regions_input::Builder,
}
impl<C, M, R> ListRegions<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `ListRegions`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::ListRegionsOutput,
aws_smithy_http::result::SdkError<crate::error::ListRegionsError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListRegionsInputOperationOutputAlias,
crate::output::ListRegionsOutput,
crate::error::ListRegionsError,
crate::input::ListRegionsInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
}
/// Fluent builder constructing a request to `LobbyReady`.
///
/// Marks the current lobby as ready to accept connections. Players will not be able to connect to this lobby until the lobby is flagged as ready.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct LobbyReady<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::lobby_ready_input::Builder,
}
impl<C, M, R> LobbyReady<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `LobbyReady`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::LobbyReadyOutput,
aws_smithy_http::result::SdkError<crate::error::LobbyReadyError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::LobbyReadyInputOperationOutputAlias,
crate::output::LobbyReadyOutput,
crate::error::LobbyReadyError,
crate::input::LobbyReadyInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
}
/// Fluent builder constructing a request to `PlayerConnected`.
///
/// Validates the player token is valid and has not already been consumed then marks the player as connected. # Player Tokens and Reserved Slots Player tokens reserve a spot in the lobby until they expire. This allows for precise matchmaking up to exactly the lobby's player limit, which is important for games with small lobbies and a high influx of players. By calling this endpoint with the player token, the player's spot is marked as connected and will not expire. If this endpoint is never called, the player's token will expire and this spot will be filled by another player. # Anti-Botting Player tokens are only issued by caling `rivet.api.matchmaker#JoinLobby`, calling `rivet.api.matchmaker#FindLobby`, or from the `rivet.api.identity.common#GlobalEventMatchmakerLobbyJoin` event. These endpoints have anti-botting measures (i.e. enforcing max player limits, captchas, and detecting bots), so valid player tokens provide some confidence that the player is not a bot. Therefore, it's important to make sure the token is valid by waiting for this endpoint to return OK before allowing the connected socket to do anything else. If this endpoint returns an error, the socket should be disconnected immediately. # How to Transmit the Player Token The client is responsible for acquiring the player token by caling `rivet.api.matchmaker#JoinLobby`, calling `rivet.api.matchmaker#FindLobby`, or from the `rivet.api.identity.common#GlobalEventMatchmakerLobbyJoin` event. Beyond that, it's up to the developer how the player token is transmitted to the lobby. If using WebSockets, the player token can be transmitted as a query paramter. Otherwise, the player token will likely be automatically sent by the client once the socket opens. As mentioned above, nothing else should happen until the player token is validated.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct PlayerConnected<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::player_connected_input::Builder,
}
impl<C, M, R> PlayerConnected<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `PlayerConnected`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::PlayerConnectedOutput,
aws_smithy_http::result::SdkError<crate::error::PlayerConnectedError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::PlayerConnectedInputOperationOutputAlias,
crate::output::PlayerConnectedOutput,
crate::error::PlayerConnectedError,
crate::input::PlayerConnectedInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// A JSON Web Token. Slightly modified to include a description prefix and use Protobufs of JSON.
pub fn player_token(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.player_token(input.into());
self
}
/// A JSON Web Token. Slightly modified to include a description prefix and use Protobufs of JSON.
pub fn set_player_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_player_token(input);
self
}
}
/// Fluent builder constructing a request to `PlayerDisconnected`.
///
/// Marks a player as disconnected. # Ghost Players If players are not marked as disconnected, lobbies will result with "ghost players" that the matchmaker thinks exist but are no longer connected to the lobby.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct PlayerDisconnected<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::player_disconnected_input::Builder,
}
impl<C, M, R> PlayerDisconnected<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `PlayerDisconnected`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::PlayerDisconnectedOutput,
aws_smithy_http::result::SdkError<crate::error::PlayerDisconnectedError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::PlayerDisconnectedInputOperationOutputAlias,
crate::output::PlayerDisconnectedOutput,
crate::error::PlayerDisconnectedError,
crate::input::PlayerDisconnectedInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// A JSON Web Token. Slightly modified to include a description prefix and use Protobufs of JSON.
pub fn player_token(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.player_token(input.into());
self
}
/// A JSON Web Token. Slightly modified to include a description prefix and use Protobufs of JSON.
pub fn set_player_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_player_token(input);
self
}
}
/// Fluent builder constructing a request to `SetLobbyClosed`.
///
/// If `is_closed` is `true`, players will be prevented from joining the lobby. Does not shutdown the lobby.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct SetLobbyClosed<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::set_lobby_closed_input::Builder,
}
impl<C, M, R> SetLobbyClosed<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `SetLobbyClosed`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::SetLobbyClosedOutput,
aws_smithy_http::result::SdkError<crate::error::SetLobbyClosedError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::SetLobbyClosedInputOperationOutputAlias,
crate::output::SetLobbyClosedOutput,
crate::error::SetLobbyClosedError,
crate::input::SetLobbyClosedInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
#[allow(missing_docs)] // documentation missing in model
pub fn is_closed(mut self, input: bool) -> Self {
self.inner = self.inner.is_closed(input);
self
}
#[allow(missing_docs)] // documentation missing in model
pub fn set_is_closed(mut self, input: std::option::Option<bool>) -> Self {
self.inner = self.inner.set_is_closed(input);
self
}
}
}