CreateLease 方法
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
对创建租借的支持是可选的。它适用于有兴趣实现此功能的合作伙伴。在开始之前,请与 Google 助理中心联系,以确定您是否符合资格要求。
创建租借是创建租借支持的预订的第一步。
合作伙伴后端会验证请求的预约空档是否有效且可用。在内部,合作伙伴会为请求的空档创建一个临时保全,并将其设置为于 lease_expiration_time 自动过期。如果请求的租借时间过长,则允许后端修改 lease_expiration_time。创建的租借会被返回给客户端。然后,由客户端请求为租借创建一个预定。
如果由于任何业务逻辑错误而导致创建租借失败,则应在响应中填充该错误。如需了解详情,请参阅预订失败。
请求
CreateLeaseRequest
返回值
CreateLeaseResponse
要求:
- lease_id 必须由合作伙伴后端创建,并在 CreateLeaseResponse 中设置。
- 必须在 CreateLeaseResponse 中设置 lease_expiration_time。
- 如果在 CreateLeaseRequest 中指定了资源字段,则必须在 CreateLeaseResponse 中对其进行设置并使之与 CreateLeaseRequest 相匹配。
- 必须对 CreateLeaseResponse 中的所有其他字段进行设置并使之与 CreateLeaseRequest 相匹配。
规范的 gRPC 错误代码
INVALID_ARGUMENT
(商家 ID、服务 ID 或空档时间规范无效)
// Request to create a [ext.maps.booking.partner.v2.Lease] for a slot in the
// inventory. The expiration time in the returned Lease may be modified by the
// backend, e.g. if the requested lease period is too long.
message CreateLeaseRequest {
// The lease to be created with information about the appointment slot
// (required)
Lease lease = 1;
}
// Response for the [ext.maps.booking.partner.v2.CreateLease] RPC with the
// created [ext.maps.booking.partner.v2.Lease]
message CreateLeaseResponse {
// The created [ext.maps.booking.partner.v2.Lease] (required)
Lease lease = 1;
// If creating a lease fails, this field should reflect the business logic
// error (e.g., slot has become unavailable) and lease field is expected to be
// unset. (required if failure occurs)
BookingFailure booking_failure = 2;
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eLease creation is an optional feature for partners to implement booking functionality.\u003c/p\u003e\n"],["\u003cp\u003ePartners must contact Actions Center for eligibility before implementing lease creation.\u003c/p\u003e\n"],["\u003cp\u003eCreating a lease involves a temporary hold on an appointment slot, which is later used for booking creation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCreateLeaseRequest\u003c/code\u003e initiates the process, and \u003ccode\u003eCreateLeaseResponse\u003c/code\u003e returns the lease details or error information.\u003c/p\u003e\n"],["\u003cp\u003ePartners must adhere to specific requirements when setting values in the \u003ccode\u003eCreateLeaseResponse\u003c/code\u003e.\u003c/p\u003e\n"]]],["Lease creation is an optional feature for partners. Partners must contact the Actions Center to determine eligibility. The process involves creating a temporary hold on a valid appointment slot, with an automatic expiration time that can be modified by the backend. Partners create a `lease_id` and `lease_expiration_time`, which are returned in the `CreateLeaseResponse`. If a lease fails due to business logic errors, an error response is populated. The response fields must match the request fields, and `INVALID_ARGUMENT` error can occur.\n"],null,["# CreateLease method\n\nSupport for lease creation is **optional**. It applies to partners that are\ninterested in implementing this functionality. Please contact the Actions Center to determine eligibility before you start.\n\nCreating the lease is the first step when creating a booking with Lease support.\nThe partner backend verifies that the requested appointment slot is valid and\navailable. Internally, the partner creates a temporary hold for the requested\nslot, which is set up to expire automatically at lease_expiration_time. The\nbackend is allowed to modify lease_expiration_time, e.g. if the requested lease\ntime is excessively long. The created lease is returned to the client. Then the\nclient requests to create a booking for the lease.\n\nIf creating a lease fails due to any business logic error, the error should be\npopulated in the response. See [Booking\nFailure](/actions-center/reference/grpc-api-v2/booking-failure-specification) for\ndetailed information.\n\n**Request**\n\nCreateLeaseRequest\n\n**Return value**\n\nCreateLeaseResponse\n\nRequirements:\n\n- lease_id must be created by the partner backend and set in the CreateLeaseResponse.\n- lease_expiration_time must be set in the CreateLeaseResponse.\n- If the resources field is specified in the CreateLeaseRequest, then it must be set in the CreateLeaseResponse, and match the CreateLeaseRequest.\n- All other fields in the CreateLeaseResponse must be set and match the CreateLeaseRequest.\n\n**Canonical gRPC error codes**\n\n- `INVALID_ARGUMENT` (invalid merchant ID, service ID, or slot time specification)\n\n```scilab\n// Request to create a [ext.maps.booking.partner.v2.Lease] for a slot in the\n// inventory. The expiration time in the returned Lease may be modified by the\n// backend, e.g. if the requested lease period is too long.\nmessage CreateLeaseRequest {\n // The lease to be created with information about the appointment slot\n // (required)\n Lease lease = 1;\n}\n\n// Response for the [ext.maps.booking.partner.v2.CreateLease] RPC with the\n// created [ext.maps.booking.partner.v2.Lease]\nmessage CreateLeaseResponse {\n // The created [ext.maps.booking.partner.v2.Lease] (required)\n Lease lease = 1;\n\n // If creating a lease fails, this field should reflect the business logic\n // error (e.g., slot has become unavailable) and lease field is expected to be\n // unset. (required if failure occurs)\n BookingFailure booking_failure = 2;\n}\n```"]]