什么是Dropbox中的Union and Struct

时间:2018-12-21 22:46:06

标签: dropbox-api

我正在研究一个使用Dropbox API的项目。我一直在阅读Dropbox API文档,并且其中有些术语过于复杂。

有人可以帮助我了解Dropbox中的联合和结构吗?

2 个答案:

答案 0 :(得分:0)

The Dropbox API spec使用the Stone interface description language编写。

它确实使用了许多不同类型的对象,例如联合和结构。这些不是特定于Dropbox的,因此您可以在线找到有关它们的信息,例如以下链接:

使用the Dropbox API不一定需要对这些计算机科学概念有深入的了解。有a Getting Started guide here

如果可能,我们建议使用the official SDKs中的一种,因为它们会为您完成大部分工作。

答案 1 :(得分:0)

虽然我同意我可以利用SDK,而不必担心那些Computer Science概念,但是事实是Dropbox API并不易于使用。我已经尝试过Python SDK(糟糕的文档)。

要获得与团队信息一样简单的步骤太多。

dbx = dbx.DropboxTeam('TOKEN')
team_info = dbx.team_get_info()
policies = team_info.policies
emm_state = policies.emm_state
office_addin = policies.office_addin
sharing = policies.sharing
folder_join_policy = sharing.shared_folder_join_policy
folder_member_policy = sharing.shared_folder_join_policy
link_create_policy = sharing.shared_link_create_policy

#Now call each is_* method on each class (office_addin, emm_state, folder_join_policy, folder_member_policy, link_create_policy) to check which options are enabled.
#This is really an overkill for something as simple as getting team info unless I am wrong.
#I would rather use the HTTP APIs, but then the info is buried deep within those nested `.tag` doors.

team_get_info只是一个例子。