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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860
// 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
}
}
}