了解新的 Picker API 和重要的 Library API 变更。如需了解详情,请点击
此处。
REST Resource: sessions
资源:PickingSession
表示用户会话,在此会话期间,用户可以使用 Google 相册选择照片和视频。
JSON 表示法 |
{
"id": string,
"pickerUri": string,
"pollingConfig": {
object (PollingConfig )
},
"expireTime": string,
"mediaItemsSet": boolean
} |
字段 |
id |
string
仅限输出。Google 为此会话生成的标识符。
|
pickerUri |
string
仅限输出。用于将用户重定向到 Google 相册(网页版)的 URI,以便用户选择当前会话的照片和视频。 如需成功查看此页面,用户必须在其网络浏览器中登录拥有此会话的 Google 账号。 出于安全原因,pickerUri 无法在 iframe 中打开。
|
pollingConfig |
object (PollingConfig )
仅限输出。应用在轮询 sessions.get 时应使用的建议配置。 只有在尚未为此会话选择媒体内容(即mediaItemsSet 为 false)。
|
expireTime |
string (Timestamp format)
仅限输出。对此会话(及其所选媒体内容)的访问权限到期的时间。 时间戳采用 RFC3339 世界协调时间(UTC,即“祖鲁时”)格式,精确到纳秒,最多九个小数位。示例:"2014-10-02T15:01:23Z" 和 "2014-10-02T15:01:23.045123456Z" 。
|
mediaItemsSet |
boolean
仅限输出。如果设置为 true ,则表示已为此会话选择了媒体内容,您的应用可以通过 mediaItems.list 请求所选媒体内容的列表。
|
PollingConfig
JSON 表示法 |
{
"pollInterval": string,
"timeoutIn": string
} |
字段 |
pollInterval |
string (Duration format)
仅限输出。建议的轮询请求间隔时间。 该时长以秒为单位,最多包含九个小数位,以“s ”结尾。示例:"3.5s" 。
|
timeoutIn |
string (Duration format)
仅限输出。客户端应在多长时间后停止轮询。 值为 0 表示客户端应停止轮询(如果尚未停止)。 该时长以秒为单位,最多包含九个小数位,以“s ”结尾。示例:"3.5s" 。
|
方法 |
|
生成一个新会话,用户可以在该会话中选择要授予第三方访问权限的照片和视频。 |
|
删除指定的会话。 |
|
检索指定会话的相关信息。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-11-21。
[null,null,["最后更新时间 (UTC):2024-11-21。"],[[["Google Photos Picker API provides sessions for users to select photos and videos."],["`PickingSession` resource represents the user's selection session, including a URI to redirect users to Google Photos for picking media."],["Applications can poll the API using the recommended `PollingConfig` to check for session updates and retrieve selected media items."],["Sessions have an expiration time and can be programmatically created, retrieved, and deleted using the API methods."]]],["A `PickingSession` represents a user's photo/video selection process in Google Photos, identified by a unique ID. It provides a `pickerUri` to direct users to Google Photos for media selection. `PollingConfig` defines API polling parameters with `pollInterval` and `timeoutIn`. A session expires at a specified `expireTime`, after which access ends. Once `mediaItemsSet` is true, selected media can be requested. Methods allow to `create`, `get` and `delete` sessions.\n"]]