CreateLease 方法
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
请求
CreateLeaseRequest
返回值
CreateLeaseResponse
要求:
- lease_id 必须由合作伙伴后端创建,并在 CreateLeaseResponse 中设置。
- 必须在 CreateLeaseResponse 中设置 lease_expiration_time。
- 如果在 CreateLeaseRequest 中指定了资源字段,则必须在 CreateLeaseResponse 中对其进行设置并使之与 CreateLeaseRequest 相匹配。
- 必须对 CreateLeaseResponse 中的所有其他字段进行设置并使之与 CreateLeaseRequest 相匹配。
规范的 gRPC 错误代码
INVALID_ARGUMENT
(商家 ID、服务 ID、客户端引用或空档时间规范无效)
ALREADY_EXISTS
(如果客户端已为相应空档创建租借)
RESOURCE_EXHAUSTED
(如果相应空档不可用)
// Request to create a [ext.maps.booking.partner.v0.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
Lease lease = 1;
}
// Response for the [ext.maps.booking.partner.v0.CreateLease] RPC with the
// created [ext.maps.booking.partner.v0.Lease]
message CreateLeaseResponse {
// The created [ext.maps.booking.partner.v0.Lease]
Lease lease = 1;
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003ePartners must create and set \u003ccode\u003elease_id\u003c/code\u003e and \u003ccode\u003elease_expiration_time\u003c/code\u003e in the \u003ccode\u003eCreateLeaseResponse\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCreateLeaseResponse\u003c/code\u003e must mirror the \u003ccode\u003eCreateLeaseRequest\u003c/code\u003e, including the \u003ccode\u003eresources\u003c/code\u003e field if provided, and all other fields.\u003c/p\u003e\n"],["\u003cp\u003ePotential errors include \u003ccode\u003eINVALID_ARGUMENT\u003c/code\u003e, \u003ccode\u003eALREADY_EXISTS\u003c/code\u003e, and \u003ccode\u003eRESOURCE_EXHAUSTED\u003c/code\u003e for various invalid input or booking conflicts.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCreateLeaseRequest\u003c/code\u003e initiates a lease creation for a specific appointment slot, while the \u003ccode\u003eCreateLeaseResponse\u003c/code\u003e returns the created lease details.\u003c/p\u003e\n"],["\u003cp\u003eThe backend may adjust the lease expiration time in the response.\u003c/p\u003e\n"]]],["The `CreateLeaseRequest` initiates a lease creation, and `CreateLeaseResponse` returns the created lease. The partner backend must generate the `lease_id` and `lease_expiration_time` in the response. If `resources` is in the request, it must be mirrored in the response. All other response fields should mirror the request. Potential gRPC errors include `INVALID_ARGUMENT`, `ALREADY_EXISTS` if a lease exists, or `RESOURCE_EXHAUSTED` if the slot is unavailable. The response might adjust the expiration time.\n"],null,["# CreateLease method\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, client reference or slot time specification)\n- `ALREADY_EXISTS` (if the client already has a lease on the slot)\n- `RESOURCE_EXHAUSTED` (if the slot is not available)\n\n```scilab\n// Request to create a [ext.maps.booking.partner.v0.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 Lease lease = 1;\n}\n\n// Response for the [ext.maps.booking.partner.v0.CreateLease] RPC with the\n// created [ext.maps.booking.partner.v0.Lease]\nmessage CreateLeaseResponse {\n // The created [ext.maps.booking.partner.v0.Lease]\n Lease lease = 1;\n}\n```"]]