展会信息港展会大全

谷歌眼镜Mirror API Reference之Timeline
来源:互联网   发布日期:2016-01-19 12:37:58   浏览:2450次  

导读:本帖最后由 zoulu 于 2014-1-9 23:59 编辑Timeline这个资源的方法列表,在文章的末尾资源表示形式用户Timeline中的每一项都被表示为一个TimelineItem JSON结构,描述如下:[HTML]纯文本查看复制代码?01020304 ...

本帖最后由 zoulu 于 2014-1-9 23:59 编辑

Timeline

这个资源的方法列表,在文章的末尾

资源表示形式

用户Timeline中的每一项都被表示为一个TimelineItem JSON结构,描述如下:

[HTML] 纯文本查看 复制代码

?

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

{

"kind": "mirror#timelineItem",

"id": string,

"sourceItemId": string,

"canonicalUrl": string,

"bundleId": string,

"isBundleCover": boolean,

"selfLink": string,

"created": datetime,

"updated": datetime,

"displayTime": datetime,

"isPinned": boolean,

"pinScore": integer,

"isDeleted": boolean,

"etag": etag,

"creator": contacts Resource,

"recipients": [

contacts Resource

],

"inReplyTo": string,

"title": string,

"text": string,

"html": string,

"speakableType": string,

"speakableText": string,

"attachments": [

timeline.attachments Resource

],

"location": locations Resource,

"menuItems": [

{

"id": string,

"action": string,

"values": [

{

"state": string,

"displayName": string,

"iconUrl": string

}

],

"removeWhenSelected": boolean,

"payload": string

}

],

"notification": {

"level": string,

"deliveryTime": datetime

}

}

属性名

描述

注释

attachments[]

list

与这个项目相关的媒体附件列表. 方便的话, 你可以参考html plyload的附件和cid方案. 例子:

attachment: <img src="attachment:attachment_index">其中attachment_index是0-based这个数组的索引

cid: <img src="cid:attachment_id"> attachment_id 就是附件ID

bundleId

string

对于一个item的bundle ID,服务可以为多个items一起指定一个bundleId。他们在设备上位于一个顶级层次item。

writable

canonicalUrl

string

规范URL指向规范/高质量版本的Timeline所代表的数据项

可写

created

datetime

这个项目创建的时间,格式为RFC 3339。

creator

nested object

创建项目的用户或组

可写

displayTime

datetime

这个时间会按RFC3339的格式显示到用户的时间轴上。用户的的时间轴是按展出时间排序的,因此这也将决定项目显示在时间轴中。如果没有设定的服务,显示时间默认为更新的时间。

可写

etag

etag

为这个item ETag

html

string

HTML内容项。如果text和html提供了一个项目,html将呈现在时间轴中

允许的 HTML 元素- 你可以在时间轴卡片中使用这些元素

Headers: h1, h2, h3, h4, h5, h6

Images: img

Lists: li, ol, ul

HTML5 semantics: article, aside, details, figure, figcaption, footer, header, nav, section, summary, time

Structural: blockquote, br, div, hr, p, span

Style: b, big, center, em, i, u, s, small, strike, strong, style, sub, sup

Tables: table, tbody, td, tfoot, th, thead, tr

封锁的 HTML 元素: 这些元素和他们的内容会从html中移除。

Document headers: head, title

Embeds: audio, embed, object, source, video

Frames: frame, frameset

Scripting: oranget, script

其他的元素: 其他没有被列出的元素会被移除,但他们的内容保存下来。

可写

id

string

时间轴的ID. 这是用户时间轴所特有的。

inReplyTo

string

如果这个item有另一个item回复生成,这个区域将被设置为回复item的id,这可以用于附加回复合适的对话或文章

isBundleCover

boolean

这个项目是否包含。

如果一个项目被标记为包含,这将是项目的入口点包bundleId一样的项目。它只会显示在主时间轴内没有打开包

在主时间轴中,项目显示为:

项目的isBundleCover设置为true

项目没有bundleId

In a bundle sub-timeline, items that are shown are:

在一个bundle sub-timeline,显示为:

项目有bundleId问题,isBundleCover设置为false

可写

isDeleted

boolean

当为真时,表明这个条目被删除,只有ID属性被设置。

isPinned

boolean

当为真时,表明这个项目,这意味着它的分组与 活跃 等导航和场所,和另一侧的主屏幕从历史(non-pinned)时间表的项目。你可以允许用户切换这个属性的值与TOGGLE_PINNED内置菜单项。

kind

string

资源的类型。这是mirror#timelineItem

location

nested object

与这个项目相关的地理位置。

可写

menuItems[]

list

一个菜单项列表,将提交给用户时,在时间轴中选择这个项目的。

可写

menuItems[].action

string

当用户选择菜单选项的控制行为。允许的值有:

自定义菜单 - Custom action set by the service. When the user selects thismenuItem, the API triggers a notification to yourcallbackUrlwith the userActions.type set toCUSTOM and theuserActions.payloadset to the ID of this menu item. This is the default value.

内置操作:

REPLY - Initiate a reply to the timeline item using the voice recording UI. The creatorattribute must be set in the timeline item for this menu to be available.

REPLY_ALL - Same behavior asREPLY. The original timeline item's recipients will be added to the reply item.

DELETE - Delete the timeline item.

SHARE - Share the timeline item with the available contacts.

READ_ALOUD - Read the timeline item's speakableText aloud; if this field is not set, read thetext field; if none of those fields are set, this menu item is ignored.

VOICE_CALL - Initiate a phone call using the timeline item'screator.phone_number attribute as recipient.

NAVIGATE - Navigate to the timeline item's location.

TOGGLE_PINNED - Toggle theisPinned state of the timeline item.

OPEN_URI - Open the payload of the menu item in the browser.

PLAY_VIDEO - Open the payloadof the menu item in theGlass video player.

可写

menuItems[].id

string

这个菜单项的ID。这是由应用程序生成的,并被视为一个不透明的令牌。

可写

menuItems[].payload

string

一个通用的有效载荷变化取决于这个菜单项的意义。

当动作是OPEN_URI,这个payload就是打开一个网站查看

当动作是PLAY_VIDEO,这个个payload就是打开一个流媒体

可写

menuItems[].removeWhenSelected

boolean

如果一个自定义菜单项设置为true,该项目将在菜单中选中之后被删除。

可写

menuItems[].values[]

list

对自定义项来说,列表值控制着每个菜单项的外观。必须提供一个默认值。如果状态不存在,他们将不会显示。

可写

menuItems[].values[].displayName

string

菜单项的显示名称。如果指定这个属性为内置菜单项,该菜单项的默认上下文语音命令不显示。

可写

menuItems[].values[].iconUrl

string

图标与菜单项显示的URL。

可写

menuItems[].values[].state

string

这个值适用于的状态。允许的值是:

DEFAULT - 默认值时显示在menuItems列表。

PENDING - 值显示在菜单项,用户选择的但是仍然可以被取消。

CONFIRMED - 值由用户显示菜单项,被选中时,不能再被取消。

可写

notification

nested object

控制这个项目的通知推送到设备上。如果这个不存在,就不会有通知。

可写

notification.deliveryTime

datetime

应推送通知的时间

可写

notification.level

string

描述了通知是多么的重要。允许的值是:

DEFAULT - 通知违约的重要性。将提醒用户一致。

可写

pinScore

integer

对于固定项,这决定项目在时间表的顺序显示,接近时钟出现拥有更高的分数。注意:设置这个字段目前不支持。

recipients[]

list

一个用户或组列表,前提是这个项目已经被共享。

可写

selfLink

string

一个URL,可以用来检索这一项。

sourceItemId

string

不透明的字符串可以使用时间表项映射到数据在您自己的服务。

可写

speakableText

string

这个项目的内容有可以交谈的版本的。随着使用READ_ALOUD这个菜单项时,这一领域提供的文本将会清晰大声朗读,或提供扩展信息直观地显示在谷歌眼镜上。

Glassware should also specify the speakableType field, which will be spoken before this text in cases where the additional context is useful, for example when the user requests that the item be read aloud following a notification.

Glassware还应该指定speakableType字段,将对在此之前额外的上下文是非常有用的,例如当用户请求项被念出来后的通知。

可写

speakableType

string

可以交谈的描述这个条目的类型。这对于向用户宣布之前阅读的内容项的情况下,额外的上下文是非常有用的,例如当用户请求项被念出来后通知。

这应该是一个简短、简单的名词短语,如 电子邮件 、 短信 ,或 星球日报新闻更新 。

Glassware鼓励来对于每个项目时间表填充,即使项目不包含speakableText或文本,以便用户可以在没有看屏幕情况下学习项目的类型。

可写

text

string

这个项目的文本内容

可写

title

string

这个项目的标题

可写

updated

datetime

这个项目最后修改的时间,格式为RFC 3339。

方法:

删除(delete)

删除一个Timeline item

获取(get)

通过id获取一个Timeline item

插入(insert)

插入一个新的item到Timeline

列表(list)

检索经过身份验证的用户的Timeline列表

补丁(patch)

更新项目时间表。这种方法支持补丁语义(patch semantics)

更新 (update)

更新项目时间表。

赞助本站

人工智能实验室

相关热词: Timeline 谷歌眼镜 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港