Nhận WaitEstimates cho một người bán, dịch vụ và quy mô nhóm được yêu cầu. Hệ thống phụ trợ của đối tác xác minh rằng thông tin ước tính thời gian chờ được yêu cầu là có sẵn và cung cấp trạng thái danh sách chờ cùng với thời gian chờ trong phản hồi.
Yêu cầu
BatchGetWaitEstimatesRequest
Giá trị trả về
BatchGetWaitEstimatesResponse
// Batch request for the wait estimates for the specified merchant, service and // party sizes. message BatchGetWaitEstimatesRequest { option features.(pb.java).nest_in_file_class = YES; // Required. Partner-provided ID for the merchant. string merchant_id = 1 [features.(pb.cpp).string_type = STRING]; // Required. Partner-provided ID for the service. string service_id = 2 [features.(pb.cpp).string_type = STRING]; // Required. The different party sizes WaitEstimates are requested for. // WaitEstimates may differ with the number of people in the party. A single // request will not include duplicate party sizes. repeated int32 party_size = 3; } // Response for the BatchGetWaitEstimates RPC with the wait estimates of the // specified merchant, service and party sizes. message BatchGetWaitEstimatesResponse { option features.(pb.java).nest_in_file_class = YES; // Required. A status for the waitlist that indicates whether new users can // join and what the reason is if they can’t join. If the waitlist is not // open, all other fields in the BatchGetWaitEstimatesResponse are expected to // be unset. WaitlistStatus waitlist_status = 1; // The wait estimates for each party size requested. The response should // contain exactly one wait estimate for each party size sent in the request. // If a party size is not available for some reason, prefer ommitting it // instead of returning an error so that the user will have some options to // choose from. repeated WaitEstimate wait_estimate = 2; } // A status for the waitlist that determines if new users can join and what // the reason is if they can’t join. enum WaitlistStatus { option features.(pb.cpp).enum_name_uses_string_view = false; option features.(pb.java).nest_in_file_class = YES; WAITLIST_STATUS_UNSPECIFIED = 0; // The waitlist is open and is accepting new users. OPEN = 1; // There is currently no wait and users should arrive at the merchant // without joining the waitlist. CLOSED_NO_WAIT = 2; // The waitlist is not currently accepting new users because it is full // or closed for other reasons. CLOSED_OTHER = 3; }
Mẫu BatchGetWaitEstimates
Ví dụ này minh hoạ trường hợp một nhà hàng thường cho phép giá trị party_size từ 2 đến 10 nhưng tại thời điểm yêu cầu, nhà hàng không thể tiếp nhận giá trị party_size lớn hơn 7 (ví dụ: gần đến giờ đóng cửa) và giá trị party_size là 2 thực sự không có thời gian chờ.
Nhận yêu cầu chờ
{
"merchant_id": "dining-1",
"party_size": [2, 3, 4, 5, 6, 7, 8, 9, 10],
"service_id": "reservation"
}Nhận phản hồi chờ
{
"waitlist_status": "OPEN",
"wait_estimate": [
{ "party_size": 2, "wait_length": {} },
{ "party_size": 3, "wait_length": { "parties_ahead_count": 3 } },
{ "party_size": 4, "wait_length": { "parties_ahead_count": 3 } },
{ "party_size": 5, "wait_length": { "parties_ahead_count": 3 } },
{ "party_size": 6, "wait_length": { "parties_ahead_count": 3 } },
{ "party_size": 7, "wait_length": { "parties_ahead_count": 3 } }
]
}