租借规范

租借可暂时保留对所请求的空档的所有权。

合作伙伴后端会验证请求的预约空档是否有效且仍然可用。在内部,合作伙伴会为请求的空档创建一个临时保全,并将其设置为于 lease_expiration_time自动过期。如果请求的租借时间过长,允许后端修改 lease_expiration_time。创建的租借会被返回给客户端。

我们的预订 API 为租借提供可选支持。如果启用了租借支持,则在创建预订时,首先需要为请求的空档创建租借。

// Temporary lease for an inventory slot
message Lease {
  // ID of the lease.
  // Not populated in CreateLeaseRequest. The value is chosen by the partner and
  // has to be returned in the response of CreateLease. (required)
  string lease_id = 1;

  // The appointment slot that the lease is created for. (required)
  Slot slot = 2;

  // Unique identifier for this lease, chosen by Reserve with Google. Serves as
  // an idempotency token for [ext.maps.booking.partner.v2.CreateLease]
  // requests. (required)
  string user_reference = 3;

  // Expiration time of the lease in UTC Timestamp (required)
  google.protobuf.Timestamp lease_expiration_time = 4;
}

// Reference to a [ext.maps.booking.partner.v2.Lease] that has been created via
// [ext.maps.booking.partner.v2.CreateLease]
message LeaseReference {
  // Lease ID (required)
  string lease_id = 1;
}

与租借相关的其他信息

您可以选择是否支持租借。它适用于有兴趣实现支持的合作伙伴。在开始之前,请与操作中心联系以确定是否符合条件。

如需支持租赁,必须实现建议的 API v2 集,此外

  • 还需要实现 CreateLease
  • 需要实现 CreateBooking,且应使用租借引用。合作伙伴后端使用提供的租借引用进行预订。

API v2 的要求也适用于对租借的支持,此外,

  • CreateBooking 应使用租借引用。在使用提供的租借引用进行预订时,合作伙伴会使用该此外并将其渲染为针对之后的任何预订均无效。合作伙伴还负责使用请求消息中的空档验证创建的预订。
  • 应在系统提供了租借引用且合作伙伴不知道租借 ID 时将 NOT_FOUND 作为额外的 gRPC 错误代码。
图:创建租赁预订