Skip to content

accept_match

accept_match(
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    ticket_id: Optional[MatchmakingIdStringModel] = None,
    player_ids: Optional[PlayerIdsForAcceptMatch] = None,
    acceptance_type: Optional[AcceptanceType] = None,
) -> AcceptMatchOutput

This API works with the following fleet types: EC2, Anywhere, Container

Registers a player's acceptance or rejection of a proposed FlexMatch match. A matchmaking configuration may require player acceptance; if so, then matches built with that configuration cannot be completed unless all players accept the proposed match within a specified time limit.

When FlexMatch builds a match, all the matchmaking tickets involved in the proposed match are placed into status REQUIRES_ACCEPTANCE. This is a trigger for your game to get acceptance from all players in each ticket. Calls to this action are only valid for tickets that are in this status; calls for tickets not in this status result in an error.

To register acceptance, specify the ticket ID, one or more players, and an acceptance response. When all players have accepted, Amazon GameLift Servers advances the matchmaking tickets to status PLACING, and attempts to create a new game session for the match.

If any player rejects the match, or if acceptances are not received before a specified timeout, the proposed match is dropped. Each matchmaking ticket in the failed match is handled as follows:

  • If the ticket has one or more players who rejected the match or failed to respond, the ticket status is set to CANCELLED and processing is terminated.

  • If all players in the ticket accepted the match, the ticket status is returned to SEARCHING to find a new match.

Learn more

Add FlexMatch to a game client

FlexMatch events (reference)

Parameters:

  • ticket_id (Optional[MatchmakingIdStringModel], default: None ) –

    A unique identifier for a matchmaking ticket. The ticket must be in status REQUIRES_ACCEPTANCE; otherwise this request will fail.

  • player_ids (Optional[PlayerIdsForAcceptMatch], default: None ) –

    A unique identifier for a player delivering the response. This parameter can include one or multiple player IDs.

  • acceptance_type (Optional[AcceptanceType], default: None ) –

    Player response to the proposed match.

Raises:

  • InternalServiceException –

    The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

  • InvalidRequestException –

    One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

  • NotFoundException –

    The requested resource was not found. The resource was either not created yet or deleted.

  • UnsupportedRegionException –

    The requested operation is not supported in the Region specified.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_gamelift/_services/game_lift.py
def accept_match(
    self,
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    ticket_id: Optional[
        "capo_gamelift.types.matchmaking_id_string_model.MatchmakingIdStringModel"
    ] = None,
    player_ids: Optional[
        "capo_gamelift.types.player_ids_for_accept_match.PlayerIdsForAcceptMatch"
    ] = None,
    acceptance_type: Optional[
        "capo_gamelift.types.acceptance_type.AcceptanceType"
    ] = None,
) -> "capo_gamelift.types.accept_match_output.AcceptMatchOutput":
    """<p> <b>This API works with the following fleet types:</b> EC2, Anywhere, Container</p> <p>Registers a player's acceptance or rejection of a proposed FlexMatch match. A matchmaking configuration may require player acceptance; if so, then matches built with that configuration cannot be completed unless all players accept the proposed match within a specified time limit. </p> <p>When FlexMatch builds a match, all the matchmaking tickets involved in the proposed match are placed into status <code>REQUIRES_ACCEPTANCE</code>. This is a trigger for your game to get acceptance from all players in each ticket. Calls to this action are only valid for tickets that are in this status; calls for tickets not in this status result in an error.</p> <p>To register acceptance, specify the ticket ID, one or more players, and an acceptance response. When all players have accepted, Amazon GameLift Servers advances the matchmaking tickets to status <code>PLACING</code>, and attempts to create a new game session for the match. </p> <p>If any player rejects the match, or if acceptances are not received before a specified timeout, the proposed match is dropped. Each matchmaking ticket in the failed match is handled as follows: </p> <ul> <li> <p>If the ticket has one or more players who rejected the match or failed to respond, the ticket status is set to <code>CANCELLED</code> and processing is terminated.</p> </li> <li> <p>If all players in the ticket accepted the match, the ticket status is returned to <code>SEARCHING</code> to find a new match. </p> </li> </ul> <p> <b>Learn more</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-client.html"> Add FlexMatch to a game client</a> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-events.html"> FlexMatch events</a> (reference)</p>

    Args:
        ticket_id: <p>A unique identifier for a matchmaking ticket. The ticket must be in status <code>REQUIRES_ACCEPTANCE</code>; otherwise this request will fail.</p>
        player_ids: <p>A unique identifier for a player delivering the response. This parameter can include one or multiple player IDs.</p>
        acceptance_type: <p>Player response to the proposed match.</p>

    Raises:
        capo_gamelift.errors.internal_service_exception.InternalServiceException: <p>The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.</p>
        capo_gamelift.errors.invalid_request_exception.InvalidRequestException: <p>One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.</p>
        capo_gamelift.errors.not_found_exception.NotFoundException: <p>The requested resource was not found. The resource was either not created yet or deleted.</p>
        capo_gamelift.errors.unsupported_region_exception.UnsupportedRegionException: <p>The requested operation is not supported in the Region specified.</p>
        capo_gamelift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_gamelift.types.accept_match_input.AcceptMatchInput]",
    ) -> OperationResponse[
        "capo_gamelift.types.accept_match_output.AcceptMatchOutput"
    ]:
        import capo_gamelift._operations.game_lift.accept_match

        output, http_response = (
            capo_gamelift._operations.game_lift.accept_match.accept_match(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_gamelift.types.accept_match_input.AcceptMatchInput",
    ) -> dict[str, Any]:
        import capo_gamelift.types.accept_match_input

        return capo_gamelift.types.accept_match_input.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("AcceptMatch", redact_input=_redact_input),
    )
    input_: capo_gamelift.types.accept_match_input.AcceptMatchInput = {}
    if ticket_id is not None:
        input_["ticket_id"] = ticket_id
    if player_ids is not None:
        input_["player_ids"] = player_ids
    if acceptance_type is not None:
        input_["acceptance_type"] = acceptance_type

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output