paper.stone 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. namespace paper
  2. "This namespace contains endpoints and data types for managing docs and folders in Dropbox Paper."
  3. import common
  4. import sharing
  5. alias PaperDocId = String
  6. "Paper doc ID."
  7. struct RefPaperDoc
  8. doc_id PaperDocId
  9. "The Paper doc ID."
  10. example default
  11. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  12. union ListPaperDocsFilterBy
  13. docs_accessed
  14. "Fetches all Paper doc IDs that the user has ever accessed."
  15. docs_created
  16. "Fetches only the Paper doc IDs that the user has created."
  17. union ListPaperDocsSortBy
  18. accessed
  19. "Sorts the Paper docs by the time they were last accessed."
  20. modified
  21. "Sorts the Paper docs by the time they were last modified."
  22. created
  23. "Sorts the Paper docs by the creation time."
  24. union ListPaperDocsSortOrder
  25. ascending
  26. "Sorts the search result in ascending order."
  27. descending
  28. "Sorts the search result in descending order."
  29. struct ListPaperDocsArgs
  30. filter_by ListPaperDocsFilterBy = docs_accessed
  31. "Allows user to specify how the Paper docs should be filtered."
  32. sort_by ListPaperDocsSortBy = accessed
  33. "Allows user to specify how the Paper docs should be sorted."
  34. sort_order ListPaperDocsSortOrder = ascending
  35. "Allows user to specify the sort order of the result."
  36. limit Int32(min_value=1, max_value=1000) = 1000
  37. "Size limit per batch. The maximum number of docs that
  38. can be retrieved per batch is 1000. Higher value results in invalid arguments error."
  39. example default
  40. filter_by = docs_created
  41. sort_by = modified
  42. sort_order = descending
  43. limit = 100
  44. struct ListPaperDocsContinueArgs
  45. cursor String
  46. "The cursor obtained from :route:`docs/list` or :route:`docs/list/continue`.
  47. Allows for pagination."
  48. example default
  49. cursor = "U60b6BxT43ySd5sAVQbbIvoteSnWLjUdLU7aR25hbt3ySd5sAVQbbIvoteSnWLjUd"
  50. struct Cursor
  51. value String
  52. "The actual cursor value."
  53. expiration common.DropboxTimestamp?
  54. "Expiration time of :field:`value`.
  55. Some cursors might have expiration time assigned. This is a UTC value after which
  56. the cursor is no longer valid and the API starts returning an error.
  57. If cursor expires a new one needs to be obtained and pagination needs to be restarted.
  58. Some cursors might be short-lived some cursors might be long-lived.
  59. This really depends on the sorting type and order, e.g.:
  60. 1. on one hand, listing docs created by the user, sorted by the created time
  61. ascending will have undefinite expiration because the results cannot change while
  62. the iteration is happening. This cursor would be suitable for long term polling.
  63. 2. on the other hand, listing docs sorted by the last modified time will have
  64. a very short expiration as docs do get modified very often and the modified time
  65. can be changed while the iteration is happening thus altering the results.
  66. "
  67. example default
  68. value = "zHZvTPBnXilGgm1AmDgVyZ10zf7qb0qznd5sAVQbbIvoteSnWLjUdLU7aR25hb"
  69. expiration = "2016-08-07T14:56:15Z"
  70. struct ListPaperDocsResponse
  71. doc_ids List(String)
  72. "The list of Paper doc IDs that can be used to access the given Paper docs or
  73. supplied to other API methods.
  74. The list is sorted in the order specified by the initial call to :route:`docs/list`."
  75. cursor Cursor
  76. "Pass the cursor into :route:`docs/list/continue` to paginate through all files.
  77. The cursor preserves all properties as specified in the original call
  78. to :route:`docs/list`.
  79. "
  80. has_more Boolean
  81. "Will be set to True if a subsequent call with the provided cursor
  82. to :route:`docs/list/continue` returns immediately with some results. If set to False
  83. please allow some delay before making another call to :route:`docs/list/continue`."
  84. example default
  85. doc_ids = ["zO1E7coc54sE8IuMdUoxz", "mm1AmDgVyZ10zf7qb0qzn", "dByYHZvTPBnXilGgyc5mm"]
  86. cursor = default
  87. has_more = true
  88. union ExportFormat
  89. "The desired export format of the Paper doc."
  90. html
  91. "The HTML export format."
  92. markdown
  93. "The markdown export format."
  94. struct PaperDocExport extends RefPaperDoc
  95. export_format ExportFormat
  96. example default
  97. export_format = markdown
  98. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  99. struct PaperDocExportResult
  100. owner String
  101. "The Paper doc owner's email address."
  102. title String
  103. "The Paper doc title."
  104. revision Int64
  105. "The Paper doc revision. Simply an ever increasing number."
  106. mime_type String
  107. "MIME type of the export. This corresponds to :type:`ExportFormat` specified
  108. in the request."
  109. example default
  110. owner = "james@example.com"
  111. title = "Week one retention"
  112. revision = 456736745
  113. mime_type = "text/x-markdown"
  114. union_closed DocSubscriptionLevel
  115. "The subscription level of a Paper doc."
  116. default
  117. "No change email messages unless you're the creator."
  118. ignore
  119. "Ignored: Not shown in pad lists or activity and no email message is sent."
  120. every
  121. "Subscribed: Shown in pad lists and activity and change email messages are sent."
  122. no_email
  123. "Unsubscribed: Shown in pad lists, but not in activity and no change email messages are sent."
  124. union_closed FolderSubscriptionLevel
  125. "The subscription level of a Paper folder."
  126. none
  127. "Not shown in activity, no email messages."
  128. activity_only
  129. "Shown in activity, no email messages."
  130. daily_emails
  131. "Shown in activity, daily email messages."
  132. weekly_emails
  133. "Shown in activity, weekly email messages."
  134. union_closed FolderSharingPolicyType
  135. "The sharing policy of a Paper folder.
  136. Note: The sharing policy of subfolders is inherited from the root folder."
  137. team
  138. "Everyone in your team and anyone directly invited can access this folder."
  139. invite_only
  140. "Only people directly invited can access this folder."
  141. union_closed SharingTeamPolicyType
  142. "The sharing policy type of the Paper doc."
  143. people_with_link_can_edit
  144. "Users who have a link to this doc can edit it."
  145. people_with_link_can_view_and_comment
  146. "Users who have a link to this doc can view and comment on it."
  147. invite_only
  148. "Users must be explicitly invited to this doc."
  149. union_closed SharingPublicPolicyType extends SharingTeamPolicyType
  150. disabled
  151. "Value used to indicate that doc sharing is enabled only within team."
  152. struct SharingPolicy
  153. "Sharing policy of Paper doc."
  154. public_sharing_policy SharingPublicPolicyType?
  155. "This value applies to the non-team members."
  156. team_sharing_policy SharingTeamPolicyType?
  157. "This value applies to the team members only. The value is null for all personal accounts."
  158. example default
  159. public_sharing_policy = people_with_link_can_edit
  160. team_sharing_policy = people_with_link_can_edit
  161. struct Folder
  162. "Data structure representing a Paper folder."
  163. id String
  164. "Paper folder ID. This ID uniquely identifies the folder."
  165. name String
  166. "Paper folder name."
  167. example default
  168. name = "Design docs"
  169. id = "e.gGYT6HSafpMej9bUv306oGm60vrHiCHgEFnzziioPGCvHf"
  170. struct FoldersContainingPaperDoc
  171. "Metadata about Paper folders containing the specififed Paper doc."
  172. folder_sharing_policy_type FolderSharingPolicyType?
  173. "The sharing policy of the folder containing the Paper doc."
  174. folders List(Folder)?
  175. "The folder path. If present the first folder is the root folder."
  176. example default
  177. folder_sharing_policy_type = team
  178. folders = [default]
  179. struct PaperDocSharingPolicy extends RefPaperDoc
  180. sharing_policy SharingPolicy
  181. "The default sharing policy to be set for the Paper doc."
  182. example default
  183. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  184. sharing_policy = default
  185. struct RemovePaperDocUser extends RefPaperDoc
  186. member sharing.MemberSelector
  187. "User which should be removed from the Paper doc. Specify only email address or
  188. Dropbox account ID."
  189. example default
  190. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  191. member = default
  192. union PaperDocPermissionLevel
  193. edit
  194. "User will be granted edit permissions."
  195. view_and_comment
  196. "User will be granted view and comment permissions."
  197. struct AddMember
  198. permission_level PaperDocPermissionLevel = edit
  199. "Permission for the user."
  200. member sharing.MemberSelector
  201. "User which should be added to the Paper doc. Specify only email address or
  202. Dropbox account ID."
  203. example default
  204. member = default
  205. permission_level = view_and_comment
  206. union UserOnPaperDocFilter
  207. visited
  208. "all users who have visited the Paper doc."
  209. shared
  210. "All uses who are shared on the Paper doc. This includes all users who have visited
  211. the Paper doc as well as those who have not."
  212. struct ListUsersOnPaperDocArgs extends RefPaperDoc
  213. limit Int32(min_value=1, max_value=1000) = 1000
  214. "Size limit per batch. The maximum number of users that can be retrieved per batch
  215. is 1000. Higher value results in invalid arguments error."
  216. filter_by UserOnPaperDocFilter = shared
  217. "Specify this attribute if you want to obtain users that have already accessed
  218. the Paper doc."
  219. example default
  220. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  221. limit = 100
  222. filter_by = shared
  223. struct ListUsersOnPaperDocContinueArgs extends RefPaperDoc
  224. cursor String
  225. "The cursor obtained from :route:`docs/users/list` or
  226. :route:`docs/users/list/continue`. Allows for pagination."
  227. example default
  228. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  229. cursor = "U60b6BxT43ySd5sAVQbbIvoteSnWLjUdLU7aR25hbt3ySd5sAVQbbIvoteSnWLjUd"
  230. struct InviteeInfoWithPermissionLevel
  231. invitee sharing.InviteeInfo
  232. "Email address invited to the Paper doc."
  233. permission_level PaperDocPermissionLevel
  234. "Permission level for the invitee."
  235. example default
  236. invitee = default
  237. permission_level = edit
  238. struct UserInfoWithPermissionLevel
  239. user sharing.UserInfo
  240. "User shared on the Paper doc."
  241. permission_level PaperDocPermissionLevel
  242. "Permission level for the user."
  243. example default
  244. user = default
  245. permission_level = view_and_comment
  246. struct ListUsersOnPaperDocResponse
  247. invitees List(InviteeInfoWithPermissionLevel)
  248. "List of email addresses with their respective permission levels
  249. that are invited on the Paper doc."
  250. users List(UserInfoWithPermissionLevel)
  251. "List of users with their respective permission levels
  252. that are invited on the Paper folder."
  253. doc_owner sharing.UserInfo
  254. "The Paper doc owner. This field is populated on every single response."
  255. cursor Cursor
  256. "Pass the cursor into :route:`docs/users/list/continue` to paginate
  257. through all users.
  258. The cursor preserves all properties as specified in the original call
  259. to :route:`docs/users/list`.
  260. "
  261. has_more Boolean
  262. "Will be set to True if a subsequent call with the provided cursor
  263. to :route:`docs/users/list/continue` returns immediately with some results.
  264. If set to False please allow some delay before making another call to
  265. :route:`docs/users/list/continue`."
  266. example default
  267. users = [default]
  268. invitees = [default]
  269. doc_owner = default
  270. cursor = default
  271. has_more = false
  272. struct AddPaperDocUser extends RefPaperDoc
  273. members List(AddMember, max_items = 20)
  274. "User which should be added to the Paper doc. Specify only email address or
  275. Dropbox account ID."
  276. custom_message String?
  277. "A personal message that will be emailed to each successfully added member."
  278. quiet Boolean = false
  279. "Clients should set this to true if no email message shall be sent to added users."
  280. example default
  281. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  282. members = [default]
  283. custom_message = "Welcome to Paper."
  284. union AddPaperDocUserResult
  285. success
  286. "User was successfully added to the Paper doc."
  287. unknown_error
  288. "Something unexpected happened when trying to add the user to the Paper doc."
  289. sharing_outside_team_disabled
  290. "The Paper doc can be shared only with team members."
  291. daily_limit_reached
  292. "The daily limit of how many users can be added to the Paper doc was reached."
  293. user_is_owner
  294. "Owner's permissions cannot be changed."
  295. failed_user_data_retrieval
  296. "User data could not be retrieved. Clients should retry."
  297. permission_already_granted
  298. "This user already has the correct permission to the Paper doc."
  299. struct AddPaperDocUserMemberResult
  300. "Per-member result for :route:`docs/users/add`."
  301. member sharing.MemberSelector
  302. "One of specified input members."
  303. result AddPaperDocUserResult
  304. "The outcome of the action on this member."
  305. union PaperApiBaseError
  306. insufficient_permissions
  307. "Your account does not have permissions to perform this action."
  308. union PaperApiCursorError
  309. expired_cursor
  310. "The provided cursor is expired."
  311. invalid_cursor
  312. "The provided cursor is invalid."
  313. wrong_user_in_cursor
  314. "The provided cursor contains invalid user."
  315. reset
  316. "Indicates that the cursor has been invalidated. Call
  317. the corresponding non-continue endpoint to obtain a new cursor."
  318. union DocLookupError extends PaperApiBaseError
  319. doc_not_found
  320. "The required doc was not found."
  321. union ListDocsCursorError
  322. cursor_error PaperApiCursorError
  323. union ListUsersCursorError extends PaperApiBaseError
  324. doc_not_found
  325. "The required doc was not found."
  326. cursor_error PaperApiCursorError
  327. struct ListUsersOnFolderResponse
  328. invitees List(sharing.InviteeInfo)
  329. "List of email addresses that are invited on the Paper folder."
  330. users List(sharing.UserInfo)
  331. "List of users that are invited on the Paper folder."
  332. cursor Cursor
  333. "Pass the cursor into :route:`docs/folder_users/list/continue` to paginate
  334. through all users.
  335. The cursor preserves all properties as specified in the original call
  336. to :route:`docs/folder_users/list`.
  337. "
  338. has_more Boolean
  339. "Will be set to True if a subsequent call with the provided cursor
  340. to :route:`docs/folder_users/list/continue` returns immediately with some results.
  341. If set to False please allow some delay before making another call to
  342. :route:`docs/folder_users/list/continue`."
  343. example default
  344. users = [default]
  345. invitees = [default]
  346. cursor = default
  347. has_more = false
  348. struct ListUsersOnFolderArgs extends RefPaperDoc
  349. limit Int32(min_value=1, max_value=1000) = 1000
  350. "Size limit per batch. The maximum number of users that can be retrieved per batch
  351. is 1000. Higher value results in invalid arguments error."
  352. example default
  353. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  354. limit = 100
  355. struct ListUsersOnFolderContinueArgs extends RefPaperDoc
  356. cursor String
  357. "The cursor obtained from :route:`docs/folder_users/list` or
  358. :route:`docs/folder_users/list/continue`. Allows for pagination."
  359. example default
  360. doc_id = "uaSvRuxvnkFa12PTkBv5q"
  361. cursor = "U60b6BxT43ySd5sAVQbbIvoteSnWLjUdLU7aR25hbt3ySd5sAVQbbIvoteSnWLjUd"
  362. route docs/folder_users/list (ListUsersOnFolderArgs, ListUsersOnFolderResponse, DocLookupError)
  363. "Lists the users who are explicitly invited to the Paper folder in which the Paper doc
  364. is contained. For private folders all users (including owner) shared on the folder
  365. are listed and for team folders all non-team users shared on the folder are returned."
  366. attrs
  367. owner="paper-eng"
  368. route docs/folder_users/list/continue (ListUsersOnFolderContinueArgs, ListUsersOnFolderResponse, ListUsersCursorError)
  369. "Once a cursor has been retrieved from :route:`docs/folder_users/list`, use this to
  370. paginate through all users on the Paper folder."
  371. attrs
  372. owner="paper-eng"
  373. route docs/sharing_policy/get (RefPaperDoc, SharingPolicy, DocLookupError)
  374. "Gets the default sharing policy for the given Paper doc."
  375. attrs
  376. owner="paper-eng"
  377. route docs/sharing_policy/set (PaperDocSharingPolicy, Void, DocLookupError)
  378. "Sets the default sharing policy for the given Paper doc. The default 'team_sharing_policy'
  379. can be changed only by teams, omit this field for personal accounts.
  380. Note: 'public_sharing_policy' cannot be set to the value 'disabled' because this setting
  381. can be changed only via the team admin console."
  382. attrs
  383. owner="paper-eng"
  384. route docs/archive (RefPaperDoc, Void, DocLookupError)
  385. "Marks the given Paper doc as archived.
  386. Note: This action can be performed or undone by anyone with edit permissions to the doc."
  387. attrs
  388. owner="paper-eng"
  389. route docs/permanently_delete (RefPaperDoc, Void, DocLookupError)
  390. "Permanently deletes the given Paper doc. This operation is final as the doc
  391. cannot be recovered.
  392. Note: This action can be performed only by the doc owner."
  393. attrs
  394. owner="paper-eng"
  395. route docs/download (PaperDocExport, PaperDocExportResult, DocLookupError)
  396. "Exports and downloads Paper doc either as HTML or markdown."
  397. attrs
  398. style="download"
  399. owner="paper-eng"
  400. route docs/get_folder_info (RefPaperDoc, FoldersContainingPaperDoc, DocLookupError)
  401. "Retrieves folder information for the given Paper doc. This includes:
  402. - folder sharing policy; permissions for subfolders are set by the top-level folder.
  403. - full 'filepath', i.e. the list of folders (both folderId and folderName) from
  404. the root folder to the folder directly containing the Paper doc.
  405. Note: If the Paper doc is not in any folder (aka unfiled) the response will be empty."
  406. attrs
  407. owner="paper-eng"
  408. route docs/users/add (AddPaperDocUser, List(AddPaperDocUserMemberResult), DocLookupError)
  409. "Allows an owner or editor to add users to a Paper doc or change their permissions
  410. using their email address or Dropbox account ID.
  411. Note: The Doc owner's permissions cannot be changed."
  412. attrs
  413. owner="paper-eng"
  414. route docs/users/remove (RemovePaperDocUser, Void, DocLookupError)
  415. "Allows an owner or editor to remove users from a Paper doc using their email address or
  416. Dropbox account ID.
  417. Note: Doc owner cannot be removed."
  418. attrs
  419. owner="paper-eng"
  420. route docs/users/list (ListUsersOnPaperDocArgs, ListUsersOnPaperDocResponse, DocLookupError)
  421. "Lists all users who visited the Paper doc or users with explicit access. This call
  422. excludes users who have been removed. The list is sorted by the date of the visit or
  423. the share date.
  424. The list will include both users, the explicitly shared ones as well as those
  425. who came in using the Paper url link."
  426. attrs
  427. owner="paper-eng"
  428. route docs/users/list/continue (ListUsersOnPaperDocContinueArgs, ListUsersOnPaperDocResponse, ListUsersCursorError)
  429. "Once a cursor has been retrieved from :route:`docs/users/list`, use this to
  430. paginate through all users on the Paper doc."
  431. attrs
  432. owner="paper-eng"
  433. route docs/list (ListPaperDocsArgs, ListPaperDocsResponse, Void)
  434. "Return the list of all Paper docs according to the argument specifications. To iterate
  435. over through the full pagination, pass the cursor to :route:`docs/list/continue`."
  436. attrs
  437. owner="paper-eng"
  438. route docs/list/continue (ListPaperDocsContinueArgs, ListPaperDocsResponse, ListDocsCursorError)
  439. "Once a cursor has been retrieved from :route:`docs/list`, use this to
  440. paginate through all Paper doc."
  441. attrs
  442. owner="paper-eng"