BatchAvailabilityLookup نمونه ها و تعاریف,BatchAvailabilityLookup نمونه ها و تعاریف

ساختار درخواست

درخواست‌های BatchAvailabilityLookup می‌توانند در چندین سرویس برای یک تاجر یکسان باشند، و اسلات‌های درخواستی می‌توانند چندین منبع و چند روز را شامل شوند. توصیه می‌کنیم برای ساده‌سازی یکپارچه‌سازی شما، از یک شناسه خدمات واحد در بین تاجران استفاده شود.

زمان پاسخگویی

درخواست‌های BatchAvailabilityLookup دارای آستانه تأخیر 1.5 ثانیه هستند قبل از اینکه پاسخ به عنوان پاسخ ناموفق در نظر گرفته شود. اطمینان حاصل کنید که شبکه داخلی و مسیریابی DNS شما برای به حداقل رساندن تاخیر در درخواستی که به زیرساخت شما می رسد، همگام سازی شده است. اگر خطاهای مهلت زمانی قابل توجهی وجود داشته باشد، ادغام شما ممکن است آفلاین شود تا زمانی که بتوانید آنها را برطرف کنید.

هر پاسخ به یک درخواست باید وضعیت واقعی موجودی شما را در آن لحظه بازگرداند و نه زمانی که جریان رزرو وارد شده است. اگر یک اسلات رزرو شده است، آن را در پاسخ‌های فعلی منعکس کنید.

تعاریف

روش BatchAvailabilityLookup تأیید می کند که فقط اسلات های فعلی در طول جریان رزرو به کاربران ارائه می شود.

درخواست BatchAvailabilityLookup

message BatchAvailabilityLookupRequest {
  // ID of the merchant.
  string merchant_id = 1;

  // Multiple slot times to be checked for availability. All queried times apply
  // to the same merchant_id and service_id.
  repeated SlotTime slot_time = 3;

  reserved 2;
}

پاسخ BatchAvailabilityLookup

// Response for the [ext.maps.booking.partner.v3.BatchAvailabilityLookupRequest]
// RPC with the availabilities of the appointment slots.
message BatchAvailabilityLookupResponse {
  // The availabilities for the requested SlotTime entries. There must be
  // exactly one slot_time_availability for each SlotTime entry in the
  // [ext.maps.booking.partner.v3.BatchAvailabilityLookupRequest].
  repeated SlotTimeAvailability slot_time_availability = 1;
}

SlotTime

// Identifies a Slot service_id and start time and optionally, the Slot duration
// and resources, for a specific merchant. Note that this differs from the
// definition of Slot, as it does not include merchant_id identifier.
message SlotTime {
  // ID of the service. (required)
  string service_id = 5;

  // Start time of the appointment slot in seconds of UTC time since Unix epoch
  // (required)
  int64 start_sec = 1;

  // Duration of the appointment slot in seconds (optional)
  int64 duration_sec = 2;

  // Opaque tag that identifies the availability slot and matches the value
  // provided in the Availability Feed (optional)
  string availability_tag = 3;

  // The set of resources that specifies the appointment slot, e.g. by
  // indicating the staff member and room selected by the user, or party size
  // for dining slots (optional)
  ResourceIds resource_ids = 4;

  // Indicates whether bookings of this slot will be confirmed
  // synchronously or asynchronously. (optional)
  // An UNSPECIFIED value will be interpreted as synchronous.
  ConfirmationMode confirmation_mode = 6;
}

SlotTimeAvailability

اگر هیچ شکافی پیدا نشد، یک پاسخ خالی برگردانید. خطای 400 را برنگردانید، در عوض می توانید 204 یا کدهای 2xx دیگر را برگردانید. تأیید می کند که پاسخ به درستی دریافت شده است.

message SlotTimeAvailability {
  // The SlotTime for which availability was checked.
  SlotTime slot_time = 1;

  // Whether the requested SlotTime is available
  bool available = 2;
}

نمونه های BatchAvailabilityLookup

بارگذاری صفحه

هنگامی که کاربر روی Book Online کلیک می‌کند تا جریان رزرو را آغاز کند، یک درخواست BatchAvailabilityLookup با اسلات‌های در دسترس بودن شناخته شده برای تاجر ارسال می‌شود. برای هر شکاف ارسال شده در درخواست، سرور رزرو شما پاسخی با موجود بودن واقعی و فعلی اسلات را برمی‌گرداند. فقط اسلات های موجود در قسمت جلویی به کاربر ارائه می شود.

اگر کاربر اندازه مهمانی خود را تغییر دهد یا تاریخ دیگری را انتخاب کند، درخواست بارگذاری صفحه دیگری می تواند ارسال شود.

درخواست بارگذاری صفحه

 {
    "merchant_id" : "1234",
   "slot_time" : [
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606467600"
       },
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606469400"
       },
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606471200"
       }
    ]
 }

پاسخ بارگذاری صفحه

 { "slot_time_availability" :
    [
       {
          "available" : true,
          "slot_time" : {
                "duration_sec" : "1800",
                "resource_ids" : {
                     "party_size" : 2 },
                 "service_id" : "1000",
                 "start_sec" : "1606467600"  }
       },
       {
          "available" : true,
          "slot_time" : {
                "duration_sec" : "1800",
                "resource_ids" : {
                     "party_size" : 2 },
                 "service_id" : "1000",
                 "start_sec" : "1606469400" }
       },
       {
          "available" : false,
          "slot_time" : {
                 "duration_sec" : "1800",
                  "resource_ids" : {
                       "party_size" : 2 },
                 "service_id" : "1000",
                 "start_sec" : "1606471200" }
       }
    ]
 }

اسلات کلیک کنید

هنگامی که کاربر یک اسلات قابل رزرو را انتخاب می کند، یک درخواست BatchAvailabilityLookup برای آن اسلات خاص ارسال می شود. سرور رزرو شما پاسخی را با موجود بودن واقعی و فعلی اسلات برمی‌گرداند. اگر آن اسلات توسط کاربر دیگری از Google رزرو شده باشد، در داخل سیستم شما یا بین درخواست‌های بارگذاری صفحه و کلیک روی اسلات، پاسخ مورد انتظار برای در دسترس بودن نادرست است.

درخواست کلیک اسلات

 {
    "merchant_id" : "1234",
    "slot_time" : [
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606467600"
       }
    ]
 }

پاسخ کلیک اسلات

 {
    "slot_time_availability" : [
       {
          "available" : true,
          "slot_time" : {
           "duration_sec" : "1800",
             "resource_ids" : {
                "party_size" : 2
             },
             "service_id" : "1000",
             "start_sec" : "1606467600"
          }
       }
    ]
 }
،

ساختار درخواست

درخواست‌های BatchAvailabilityLookup می‌توانند در چندین سرویس برای یک تاجر یکسان باشند، و اسلات‌های درخواستی می‌توانند چندین منبع و چند روز را شامل شوند. توصیه می‌کنیم برای ساده‌سازی یکپارچه‌سازی شما، از یک شناسه خدمات واحد در بین تاجران استفاده شود.

زمان پاسخگویی

درخواست‌های BatchAvailabilityLookup دارای آستانه تأخیر 1.5 ثانیه هستند قبل از اینکه پاسخ به عنوان پاسخ ناموفق در نظر گرفته شود. اطمینان حاصل کنید که شبکه داخلی و مسیریابی DNS شما برای به حداقل رساندن تاخیر در درخواستی که به زیرساخت شما می رسد، همگام سازی شده است. اگر خطاهای مهلت زمانی قابل توجهی وجود داشته باشد، ادغام شما ممکن است آفلاین شود تا زمانی که بتوانید آنها را برطرف کنید.

هر پاسخ به یک درخواست باید وضعیت واقعی موجودی شما را در آن لحظه بازگرداند و نه زمانی که جریان رزرو وارد شده است. اگر یک اسلات رزرو شده است، آن را در پاسخ‌های فعلی منعکس کنید.

تعاریف

روش BatchAvailabilityLookup تأیید می کند که فقط اسلات های فعلی در طول جریان رزرو به کاربران ارائه می شود.

درخواست BatchAvailabilityLookup

message BatchAvailabilityLookupRequest {
  // ID of the merchant.
  string merchant_id = 1;

  // Multiple slot times to be checked for availability. All queried times apply
  // to the same merchant_id and service_id.
  repeated SlotTime slot_time = 3;

  reserved 2;
}

پاسخ BatchAvailabilityLookup

// Response for the [ext.maps.booking.partner.v3.BatchAvailabilityLookupRequest]
// RPC with the availabilities of the appointment slots.
message BatchAvailabilityLookupResponse {
  // The availabilities for the requested SlotTime entries. There must be
  // exactly one slot_time_availability for each SlotTime entry in the
  // [ext.maps.booking.partner.v3.BatchAvailabilityLookupRequest].
  repeated SlotTimeAvailability slot_time_availability = 1;
}

SlotTime

// Identifies a Slot service_id and start time and optionally, the Slot duration
// and resources, for a specific merchant. Note that this differs from the
// definition of Slot, as it does not include merchant_id identifier.
message SlotTime {
  // ID of the service. (required)
  string service_id = 5;

  // Start time of the appointment slot in seconds of UTC time since Unix epoch
  // (required)
  int64 start_sec = 1;

  // Duration of the appointment slot in seconds (optional)
  int64 duration_sec = 2;

  // Opaque tag that identifies the availability slot and matches the value
  // provided in the Availability Feed (optional)
  string availability_tag = 3;

  // The set of resources that specifies the appointment slot, e.g. by
  // indicating the staff member and room selected by the user, or party size
  // for dining slots (optional)
  ResourceIds resource_ids = 4;

  // Indicates whether bookings of this slot will be confirmed
  // synchronously or asynchronously. (optional)
  // An UNSPECIFIED value will be interpreted as synchronous.
  ConfirmationMode confirmation_mode = 6;
}

SlotTimeAvailability

اگر هیچ شکافی پیدا نشد، یک پاسخ خالی برگردانید. خطای 400 را برنگردانید، در عوض می توانید 204 یا کدهای 2xx دیگر را برگردانید. تأیید می کند که پاسخ به درستی دریافت شده است.

message SlotTimeAvailability {
  // The SlotTime for which availability was checked.
  SlotTime slot_time = 1;

  // Whether the requested SlotTime is available
  bool available = 2;
}

نمونه های BatchAvailabilityLookup

بارگذاری صفحه

هنگامی که کاربر روی Book Online کلیک می‌کند تا جریان رزرو را آغاز کند، یک درخواست BatchAvailabilityLookup با اسلات‌های در دسترس بودن شناخته شده برای تاجر ارسال می‌شود. برای هر شکاف ارسال شده در درخواست، سرور رزرو شما پاسخی با موجود بودن واقعی و فعلی اسلات را برمی‌گرداند. فقط اسلات های موجود در قسمت جلویی به کاربر ارائه می شود.

اگر کاربر اندازه مهمانی خود را تغییر دهد یا تاریخ دیگری را انتخاب کند، درخواست بارگذاری صفحه دیگری می تواند ارسال شود.

درخواست بارگذاری صفحه

 {
    "merchant_id" : "1234",
   "slot_time" : [
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606467600"
       },
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606469400"
       },
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606471200"
       }
    ]
 }

پاسخ بارگذاری صفحه

 { "slot_time_availability" :
    [
       {
          "available" : true,
          "slot_time" : {
                "duration_sec" : "1800",
                "resource_ids" : {
                     "party_size" : 2 },
                 "service_id" : "1000",
                 "start_sec" : "1606467600"  }
       },
       {
          "available" : true,
          "slot_time" : {
                "duration_sec" : "1800",
                "resource_ids" : {
                     "party_size" : 2 },
                 "service_id" : "1000",
                 "start_sec" : "1606469400" }
       },
       {
          "available" : false,
          "slot_time" : {
                 "duration_sec" : "1800",
                  "resource_ids" : {
                       "party_size" : 2 },
                 "service_id" : "1000",
                 "start_sec" : "1606471200" }
       }
    ]
 }

اسلات کلیک کنید

هنگامی که کاربر یک اسلات قابل رزرو را انتخاب می کند، یک درخواست BatchAvailabilityLookup برای آن اسلات خاص ارسال می شود. سرور رزرو شما پاسخی را با موجود بودن واقعی و فعلی اسلات برمی‌گرداند. اگر آن اسلات توسط کاربر دیگری از Google رزرو شده باشد، در داخل سیستم شما یا بین درخواست‌های بارگذاری صفحه و کلیک روی اسلات، پاسخ مورد انتظار برای در دسترس بودن نادرست است.

درخواست کلیک اسلات

 {
    "merchant_id" : "1234",
    "slot_time" : [
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606467600"
       }
    ]
 }

پاسخ کلیک اسلات

 {
    "slot_time_availability" : [
       {
          "available" : true,
          "slot_time" : {
           "duration_sec" : "1800",
             "resource_ids" : {
                "party_size" : 2
             },
             "service_id" : "1000",
             "start_sec" : "1606467600"
          }
       }
    ]
 }