什么是 "gapi.client.people.people.get"?
What is "gapi.client.people.people.get"?
我正在阅读这份入门文档:
https://github.com/google/google-api-javascript-client/blob/master/docs/start.md
在Option1中,写入如下代码:
gapi.client.people.people.get({
'resourceName': 'people/me',
'requestMask.includeField': 'person.names'
})
为什么.people.people
?我想知道这个语法的细节。如果我使用google驱动器API,我写gapi.client.drive.drive.get
吗?
For each method defined in the API Discovery Document, a corresponding method is constructed on the gapi.client
object.
For example, The People API's methods are under gapi.client.people
.
The People API has the methods people.get
and people.connections.list
.
[T]he generated methods can be called as follows:
gapi.client.people.people.get(...)
gapi.client.people.people.connections.list(...)
You can view API Methods on APIs Explorer.
所以.people.people
表示:
Using the People API
-equivalent method people
, call the people.get(...)
method.
要使用 Drive API v3,您需要使用您的方法名称查询 gapi.client.drive
。例如,gapi.client.drive.channels.stop(...)
.
来自 this answer 的重要说明:您必须在使用前加载驱动器 API。
gapi.client.load('drive', 'v3', callback);
要回答这个问题,让我们从 Discovery services api
开始
The Discovery API provides a list of Google APIs for retrieving a machine-readable "Discovery document" metadata for each API.
我们关注这个的原因是因为 Google apis js client library which you are using gapi was generated using the discovery services api. apis-client-generator
然后让我们看看 people api
的发现码头
如果您在资源下查看,您会得到
- 联系人组
- contactGroups.Members
- 其他联系人
- 人
- people.conversations
然后每个资源都有一组方法,人员资源有一个名为 get 的方法。
所以people.people.get
实际上是{API}.{resource}.{method}
这就是 google 选择建立 API 的方式。
现在google盘api也有一组资源
- 关于
- 变化
- 频道
- 评论
- 文件
- 权限
- 回复
- 修正
- 驱动器
有一个名为 gapi.client.drive.drives.get 的方法,它是驱动器 api,驱动器资源,get 方法将 return 驱动器资源。
如果您实际上在寻找文件,那么它可能更像是 gapi.client.drive.files.get 驱动器 api、文件资源、文件获取方法 return 文件资源。
我正在阅读这份入门文档:
https://github.com/google/google-api-javascript-client/blob/master/docs/start.md
在Option1中,写入如下代码:
gapi.client.people.people.get({
'resourceName': 'people/me',
'requestMask.includeField': 'person.names'
})
为什么.people.people
?我想知道这个语法的细节。如果我使用google驱动器API,我写gapi.client.drive.drive.get
吗?
For each method defined in the API Discovery Document, a corresponding method is constructed on the
gapi.client
object.For example, The People API's methods are under
gapi.client.people
.The People API has the methods
people.get
andpeople.connections.list
.[T]he generated methods can be called as follows:
gapi.client.people.people.get(...)
gapi.client.people.people.connections.list(...)
You can view API Methods on APIs Explorer.
所以.people.people
表示:
Using the
People API
-equivalent methodpeople
, call thepeople.get(...)
method.
要使用 Drive API v3,您需要使用您的方法名称查询 gapi.client.drive
。例如,gapi.client.drive.channels.stop(...)
.
来自 this answer 的重要说明:您必须在使用前加载驱动器 API。
gapi.client.load('drive', 'v3', callback);
要回答这个问题,让我们从 Discovery services api
开始The Discovery API provides a list of Google APIs for retrieving a machine-readable "Discovery document" metadata for each API.
我们关注这个的原因是因为 Google apis js client library which you are using gapi was generated using the discovery services api. apis-client-generator
然后让我们看看 people api
的发现码头如果您在资源下查看,您会得到
- 联系人组
- contactGroups.Members
- 其他联系人
- 人
- people.conversations
然后每个资源都有一组方法,人员资源有一个名为 get 的方法。
所以people.people.get
实际上是{API}.{resource}.{method}
这就是 google 选择建立 API 的方式。
现在google盘api也有一组资源
- 关于
- 变化
- 频道
- 评论
- 文件
- 权限
- 回复
- 修正
- 驱动器
有一个名为 gapi.client.drive.drives.get 的方法,它是驱动器 api,驱动器资源,get 方法将 return 驱动器资源。
如果您实际上在寻找文件,那么它可能更像是 gapi.client.drive.files.get 驱动器 api、文件资源、文件获取方法 return 文件资源。