CreateLease 方法
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
要求
CreateLeaseRequest
傳回值
CreateLeaseResponse
相關規定如下:
- lease_id 必須由合作夥伴後端建立,並在 CreateLeaseResponse 中設定。
- lease_expiration_time 必須在 CreateLeaseResponse 中設定。
- 若在 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;
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間: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```"]]