files.stone 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560
  1. namespace files
  2. "This namespace contains endpoints and data types for basic file operations."
  3. import async
  4. import auth
  5. import common
  6. import users_common
  7. import properties
  8. alias Id = String(min_length=1)
  9. alias Path = String(pattern="/(.|[\\r\\n])*")
  10. alias PathOrId = String(pattern="/(.|[\\r\\n])*|id:.*|(ns:[0-9]+(/.*)?)")
  11. alias PathR = String(pattern="(/(.|[\\r\\n])*)?|(ns:[0-9]+(/.*)?)") # A path that can be the root path ("").
  12. alias Rev = String(min_length=9, pattern="[0-9a-f]+") # TODO: Change pattern to "rev:[0-9a-f]{9,}"
  13. alias ListFolderCursor = String(min_length=1)
  14. alias ReadPath = String(pattern="(/(.|[\\r\\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?)")
  15. alias WritePath = String(pattern="(/(.|[\\r\\n])*)|(ns:[0-9]+(/.*)?)")
  16. alias Sha256HexHash = String(min_length=64, max_length=64)
  17. #
  18. # Metadata definitions and route
  19. #
  20. struct Metadata
  21. "Metadata for a file or folder."
  22. union_closed
  23. file FileMetadata
  24. folder FolderMetadata
  25. deleted DeletedMetadata # Used by list_folder* and search
  26. name String
  27. "The last component of the path (including extension).
  28. This never contains a slash."
  29. path_lower String?
  30. "The lowercased full path in the user's Dropbox. This always starts with a slash.
  31. This field will be null if the file or folder is not mounted."
  32. path_display String?
  33. "The cased path to be used for display purposes only. In rare instances the casing will not
  34. correctly match the user's filesystem, but this behavior will match the path provided in
  35. the Core API v1, and at least the last path component will have the correct casing. Changes
  36. to only the casing of paths won't be returned by :route:`list_folder/continue`. This field
  37. will be null if the file or folder is not mounted."
  38. parent_shared_folder_id common.SharedFolderId?
  39. "Deprecated. Please use :field:`FileSharingInfo.parent_shared_folder_id`
  40. or :field:`FolderSharingInfo.parent_shared_folder_id` instead."
  41. example default
  42. file = default
  43. example folder_metadata
  44. folder = default
  45. struct SharingInfo
  46. "Sharing info for a file or folder."
  47. read_only Boolean
  48. "True if the file or folder is inside a read-only shared folder."
  49. example default
  50. read_only = false
  51. struct FileSharingInfo extends SharingInfo
  52. "Sharing info for a file which is contained by a shared folder."
  53. parent_shared_folder_id common.SharedFolderId
  54. "ID of shared folder that holds this file."
  55. modified_by users_common.AccountId?
  56. "The last user who modified the file. This field will be null if
  57. the user's account has been deleted."
  58. example default
  59. read_only = true
  60. parent_shared_folder_id = "84528192421"
  61. modified_by = "dbid:AAH4f99T0taONIb-OurWxbNQ6ywGRopQngc"
  62. struct FolderSharingInfo extends SharingInfo
  63. "Sharing info for a folder which is contained in a shared folder or is a
  64. shared folder mount point."
  65. parent_shared_folder_id common.SharedFolderId?
  66. "Set if the folder is contained by a shared folder."
  67. shared_folder_id common.SharedFolderId?
  68. "If this folder is a shared folder mount point, the ID of the shared
  69. folder mounted at this location."
  70. traverse_only Boolean = false
  71. "Specifies that the folder can only be traversed and the user can only see
  72. a limited subset of the contents of this folder because they don't have
  73. read access to this folder. They do, however, have access to some sub folder."
  74. no_access Boolean = false
  75. "Specifies that the folder cannot be accessed by the user."
  76. example default
  77. "Folder inside a shared folder."
  78. read_only = false
  79. parent_shared_folder_id = "84528192421"
  80. example shared_folder
  81. "Read-only shared folder mount point."
  82. read_only = true
  83. shared_folder_id = "84528192421"
  84. struct Dimensions
  85. "Dimensions for a photo or video."
  86. height UInt64
  87. "Height of the photo/video."
  88. width UInt64
  89. "Width of the photo/video."
  90. example default
  91. height = 768
  92. width = 1024
  93. struct GpsCoordinates
  94. "GPS coordinates for a photo or video."
  95. latitude Float64
  96. "Latitude of the GPS coordinates."
  97. longitude Float64
  98. "Longitude of the GPS coordinates."
  99. example default
  100. latitude = 37.7833
  101. longitude = 122.4167
  102. struct MediaMetadata
  103. "Metadata for a photo or video."
  104. union_closed
  105. photo PhotoMetadata
  106. video VideoMetadata
  107. dimensions Dimensions?
  108. "Dimension of the photo/video."
  109. location GpsCoordinates?
  110. "The GPS coordinate of the photo/video."
  111. time_taken common.DropboxTimestamp?
  112. "The timestamp when the photo/video is taken."
  113. struct PhotoMetadata extends MediaMetadata
  114. "Metadata for a photo."
  115. example default
  116. dimensions = default
  117. location = default
  118. time_taken = "2015-05-12T15:50:38Z"
  119. struct VideoMetadata extends MediaMetadata
  120. "Metadata for a video."
  121. duration UInt64?
  122. "The duration of the video in milliseconds."
  123. example default
  124. dimensions = default
  125. location = default
  126. time_taken = "2015-05-12T15:50:38Z"
  127. duration = 1000
  128. union_closed MediaInfo
  129. pending
  130. "Indicate the photo/video is still under processing and metadata is
  131. not available yet."
  132. metadata MediaMetadata
  133. "The metadata for the photo/video."
  134. struct FileMetadata extends Metadata
  135. id Id
  136. "A unique identifier for the file."
  137. client_modified common.DropboxTimestamp
  138. "For files, this is the modification time set by the desktop client
  139. when the file was added to Dropbox. Since this time is not verified
  140. (the Dropbox server stores whatever the desktop client sends up), this
  141. should only be used for display purposes (such as sorting) and not,
  142. for example, to determine if a file has changed or not."
  143. server_modified common.DropboxTimestamp
  144. "The last time the file was modified on Dropbox."
  145. rev Rev
  146. "A unique identifier for the current revision of a file. This field is
  147. the same rev as elsewhere in the API and can be used to detect changes
  148. and avoid conflicts."
  149. size UInt64
  150. "The file size in bytes."
  151. media_info MediaInfo?
  152. "Additional information if the file is a photo or video."
  153. sharing_info FileSharingInfo?
  154. "Set if this file is contained in a shared folder."
  155. property_groups List(properties.PropertyGroup)?
  156. "Additional information if the file has custom properties with the
  157. property template specified."
  158. has_explicit_shared_members Boolean?
  159. "This flag will only be present if include_has_explicit_shared_members
  160. is true in :route:`list_folder` or :route:`get_metadata`. If this
  161. flag is present, it will be true if this file has any explicit shared
  162. members. This is different from sharing_info in that this could be true
  163. in the case where a file has explicit members but is not contained within
  164. a shared folder."
  165. content_hash Sha256HexHash?
  166. "A hash of the file content. This field can be used to verify data integrity. For more
  167. information see our :link:`Content hash /developers/reference/content-hash` page."
  168. example default
  169. id = "id:a4ayc_80_OEAAAAAAAAAXw"
  170. name = "Prime_Numbers.txt"
  171. path_lower = "/homework/math/prime_numbers.txt"
  172. path_display = "/Homework/math/Prime_Numbers.txt"
  173. sharing_info = default
  174. client_modified = "2015-05-12T15:50:38Z"
  175. server_modified = "2015-05-12T15:50:38Z"
  176. rev = "a1c10ce0dd78"
  177. size = 7212
  178. property_groups = [default]
  179. has_explicit_shared_members = false
  180. content_hash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
  181. struct FolderMetadata extends Metadata
  182. id Id
  183. "A unique identifier for the folder."
  184. shared_folder_id common.SharedFolderId?
  185. "Deprecated. Please use :field:`sharing_info` instead."
  186. sharing_info FolderSharingInfo?
  187. "Set if the folder is contained in a shared folder or is a shared folder mount point."
  188. property_groups List(properties.PropertyGroup)?
  189. "Additional information if the file has custom properties with the
  190. property template specified."
  191. example default
  192. id = "id:a4ayc_80_OEAAAAAAAAAXz"
  193. path_lower = "/homework/math"
  194. path_display = "/Homework/math"
  195. name = "math"
  196. sharing_info = default
  197. property_groups = [default]
  198. struct DeletedMetadata extends Metadata
  199. "Indicates that there used to be a file or folder at this path, but it no longer exists."
  200. # TODO: Do we care about whether it's a deleted file or folder?
  201. # TODO: Add the mtime when it's been deleted? And the rev???
  202. example default
  203. path_lower = "/homework/math/pi.txt"
  204. path_display = "/Homework/math/pi.txt"
  205. name = "pi.txt"
  206. union_closed GetMetadataError
  207. path LookupError
  208. struct GetMetadataArg
  209. path ReadPath
  210. "The path of a file or folder on Dropbox."
  211. include_media_info Boolean = false
  212. "If true, :field:`FileMetadata.media_info` is set for photo and video."
  213. include_deleted Boolean = false
  214. "If true, :type:`DeletedMetadata` will be returned for deleted file or
  215. folder, otherwise :field:`LookupError.not_found` will be returned."
  216. include_has_explicit_shared_members Boolean = false
  217. "If true, the results will include a flag for each file indicating whether or not
  218. that file has any explicit members."
  219. example default
  220. path = "/Homework/math"
  221. example id
  222. path = "id:a4ayc_80_OEAAAAAAAAAYa"
  223. example rev
  224. path = "rev:a1c10ce0dd78"
  225. route get_metadata (GetMetadataArg, Metadata, GetMetadataError)
  226. "Returns the metadata for a file or folder.
  227. Note: Metadata for the root folder is unsupported."
  228. attrs
  229. owner = "dev-plat"
  230. allow_app_folder_app = true
  231. takes_path_root = true
  232. #
  233. # List folder routes
  234. #
  235. struct ListFolderLongpollArg
  236. cursor ListFolderCursor
  237. "A cursor as returned by :route:`list_folder` or :route:`list_folder/continue`. Cursors
  238. retrieved by setting :field:`ListFolderArg.include_media_info` to :val:`true` are not
  239. supported."
  240. timeout UInt64(min_value=30, max_value=480) = 30
  241. "A timeout in seconds. The request will block for at most this length
  242. of time, plus up to 90 seconds of random jitter added to avoid the
  243. thundering herd problem. Care should be taken when using this
  244. parameter, as some network infrastructure does not support long
  245. timeouts."
  246. example default
  247. cursor = "ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu"
  248. struct ListFolderLongpollResult
  249. changes Boolean
  250. "Indicates whether new changes are available. If true, call
  251. :route:`list_folder/continue` to retrieve the changes."
  252. backoff UInt64?
  253. "If present, backoff for at least this many seconds before calling
  254. :route:`list_folder/longpoll` again."
  255. example default
  256. changes = true
  257. union ListFolderLongpollError
  258. reset
  259. "Indicates that the cursor has been invalidated. Call
  260. :route:`list_folder` to obtain a new cursor."
  261. route list_folder/longpoll (ListFolderLongpollArg, ListFolderLongpollResult, ListFolderLongpollError)
  262. "A longpoll endpoint to wait for changes on an account. In conjunction with
  263. :route:`list_folder/continue`, this call gives you a low-latency way to
  264. monitor an account for file changes. The connection will block until there
  265. are changes available or a timeout occurs. This endpoint is useful mostly
  266. for client-side apps. If you're looking for server-side notifications,
  267. check out our
  268. :link:`webhooks documentation https://www.dropbox.com/developers/reference/webhooks`."
  269. attrs
  270. host = "notify"
  271. auth = "noauth"
  272. owner = "dev-plat"
  273. allow_app_folder_app = true
  274. struct ListFolderArg
  275. path PathR
  276. "The path to the folder you want to see the contents of."
  277. recursive Boolean = false
  278. "If true, the list folder operation will be applied recursively to all subfolders
  279. and the response will contain contents of all subfolders."
  280. include_media_info Boolean = false
  281. "If true, :field:`FileMetadata.media_info` is set for photo and video."
  282. include_deleted Boolean = false
  283. "If true, the results will include entries for files and folders that used to exist but were deleted."
  284. include_has_explicit_shared_members Boolean = false
  285. "If true, the results will include a flag for each file indicating whether or not
  286. that file has any explicit members."
  287. example default
  288. path = "/Homework/math"
  289. recursive = false
  290. struct ListFolderResult
  291. entries List(Metadata)
  292. "The files and (direct) subfolders in the folder."
  293. cursor ListFolderCursor
  294. "Pass the cursor into :route:`list_folder/continue` to see what's
  295. changed in the folder since your previous query."
  296. has_more Boolean
  297. "If true, then there are more entries available. Pass the
  298. cursor to :route:`list_folder/continue` to retrieve the rest."
  299. example default
  300. entries = [default, folder_metadata]
  301. cursor = "ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu"
  302. has_more = false
  303. union ListFolderError
  304. path LookupError
  305. route list_folder (ListFolderArg, ListFolderResult, ListFolderError)
  306. "Starts returning the contents of a folder. If the result's :field:`ListFolderResult.has_more`
  307. field is :val:`true`, call :route:`list_folder/continue` with the returned
  308. :field:`ListFolderResult.cursor` to retrieve more entries.
  309. If you're using :field:`ListFolderArg.recursive` set to :val:`true` to keep a local cache of
  310. the contents of a Dropbox account, iterate through each entry in order and process them as
  311. follows to keep your local state in sync:
  312. For each :type:`FileMetadata`, store the new entry at the given path in your local state. If the
  313. required parent folders don't exist yet, create them. If there's already something else at the
  314. given path, replace it and remove all its children.
  315. For each :type:`FolderMetadata`, store the new entry at the given path in your local state. If
  316. the required parent folders don't exist yet, create them. If there's already something else at
  317. the given path, replace it but leave the children as they are. Check the new entry's
  318. :field:`FolderSharingInfo.read_only` and set all its children's read-only statuses to match.
  319. For each :type:`DeletedMetadata`, if your local state has something at the given path, remove it
  320. and all its children. If there's nothing at the given path, ignore this entry.
  321. Note: :type:`auth.RateLimitError` may be returned if multiple :route:`list_folder` or
  322. :route:`list_folder/continue` calls with same parameters are made simultaneously by same
  323. API app for same user. If your app implements retry logic, please hold off the retry until
  324. the previous request finishes."
  325. attrs
  326. owner = "dev-plat"
  327. allow_app_folder_app = true
  328. struct ListFolderContinueArg
  329. cursor ListFolderCursor
  330. "The cursor returned by your last call to :route:`list_folder` or
  331. :route:`list_folder/continue`."
  332. example default
  333. cursor = "ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu"
  334. union ListFolderContinueError
  335. path LookupError
  336. reset
  337. "Indicates that the cursor has been invalidated. Call
  338. :route:`list_folder` to obtain a new cursor."
  339. route list_folder/continue (ListFolderContinueArg, ListFolderResult, ListFolderContinueError)
  340. "Once a cursor has been retrieved from :route:`list_folder`, use this to paginate through all
  341. files and retrieve updates to the folder, following the same rules as documented for
  342. :route:`list_folder`."
  343. attrs
  344. owner = "dev-plat"
  345. allow_app_folder_app = true
  346. struct ListFolderGetLatestCursorResult
  347. cursor ListFolderCursor
  348. "Pass the cursor into :route:`list_folder/continue` to see what's
  349. changed in the folder since your previous query."
  350. example default
  351. cursor = "ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu"
  352. route list_folder/get_latest_cursor (ListFolderArg, ListFolderGetLatestCursorResult, ListFolderError)
  353. "A way to quickly get a cursor for the folder's state. Unlike :route:`list_folder`,
  354. :route:`list_folder/get_latest_cursor` doesn't return any entries. This endpoint is for app
  355. which only needs to know about new files and modifications and doesn't need to know about
  356. files that already exist in Dropbox."
  357. attrs
  358. owner = "dev-plat"
  359. allow_app_folder_app = true
  360. #
  361. # Download
  362. #
  363. union DownloadError
  364. path LookupError
  365. struct DownloadArg
  366. path ReadPath
  367. "The path of the file to download."
  368. rev Rev?
  369. "Deprecated. Please specify revision in :field:`path` instead."
  370. example default
  371. path = "/Homework/math/Prime_Numbers.txt"
  372. example id
  373. path = "id:a4ayc_80_OEAAAAAAAAAYa"
  374. example rev
  375. path = "rev:a1c10ce0dd78"
  376. route download (DownloadArg, FileMetadata, DownloadError)
  377. "Download a file from a user's Dropbox."
  378. attrs
  379. host = "content"
  380. style = "download"
  381. owner = "dev-plat"
  382. allow_app_folder_app = true
  383. #
  384. # Upload Routes
  385. #
  386. # Errors
  387. struct UploadWriteFailed
  388. reason WriteError
  389. "The reason why the file couldn't be saved."
  390. upload_session_id String
  391. "The upload session ID; this may be used to retry the commit."
  392. union UploadError
  393. path UploadWriteFailed
  394. "Unable to save the uploaded contents to a file."
  395. struct UploadSessionOffsetError
  396. correct_offset UInt64
  397. "The offset up to which data has been collected."
  398. union UploadSessionLookupError
  399. not_found
  400. "The upload session ID was not found or has expired. Upload sessions are
  401. valid for 48 hours."
  402. incorrect_offset UploadSessionOffsetError
  403. "The specified offset was incorrect. See the value for the
  404. correct offset. This error may occur when a previous request
  405. was received and processed successfully but the client did not
  406. receive the response, e.g. due to a network error."
  407. closed
  408. "You are attempting to append data to an upload session that
  409. has alread been closed (i.e. committed)."
  410. not_closed
  411. "The session must be closed before calling upload_session/finish_batch."
  412. union UploadSessionFinishError
  413. lookup_failed UploadSessionLookupError
  414. "The session arguments are incorrect; the value explains the reason."
  415. path WriteError
  416. "Unable to save the uploaded contents to a file."
  417. too_many_shared_folder_targets
  418. "The batch request commits files into too many different shared folders.
  419. Please limit your batch request to files contained in a single shared folder."
  420. too_many_write_operations
  421. "There are too many write operations happening in the user's Dropbox. You should
  422. retry uploading this file."
  423. # Req/Resp
  424. struct UploadSessionStartArg
  425. close Boolean = false
  426. "If true, the current session will be closed, at which point you won't
  427. be able to call :route:`upload_session/append_v2` anymore with the
  428. current session."
  429. example with_close
  430. close = false
  431. struct UploadSessionStartResult
  432. session_id String
  433. "A unique identifier for the upload session. Pass this to
  434. :route:`upload_session/append_v2` and
  435. :route:`upload_session/finish`."
  436. example default
  437. session_id = "1234faaf0678bcde"
  438. route upload_session/start (UploadSessionStartArg, UploadSessionStartResult, Void)
  439. "Upload sessions allow you to upload a single file in one or more
  440. requests, for example where the size of the file is greater than 150
  441. MB. This call starts a new upload session with the given data. You
  442. can then use :route:`upload_session/append_v2` to add more data and
  443. :route:`upload_session/finish` to save all the data to a file in
  444. Dropbox.
  445. A single request should not upload more than 150 MB.
  446. An upload session can be used for a maximum of 48 hours. Attempting
  447. to use an :field:`UploadSessionStartResult.session_id` with
  448. :route:`upload_session/append_v2` or :route:`upload_session/finish` more
  449. than 48 hours after its creation will return a
  450. :field:`UploadSessionLookupError.not_found`."
  451. attrs
  452. host = "content"
  453. style = "upload"
  454. owner = "dev-plat"
  455. feature = "upload_api_rate_limit"
  456. allow_app_folder_app = true
  457. struct UploadSessionAppendArg
  458. cursor UploadSessionCursor
  459. "Contains the upload session ID and the offset."
  460. close Boolean = false
  461. "If true, the current session will be closed, at which point
  462. you won't be able to call :route:`upload_session/append_v2`
  463. anymore with the current session."
  464. example default
  465. cursor = default
  466. route upload_session/append_v2 (UploadSessionAppendArg, Void, UploadSessionLookupError)
  467. "Append more data to an upload session.
  468. When the parameter close is set, this call will close the session.
  469. A single request should not upload more than 150 MB."
  470. attrs
  471. host = "content"
  472. style = "upload"
  473. owner = "dev-plat"
  474. feature = "upload_api_rate_limit"
  475. allow_app_folder_app = true
  476. struct UploadSessionCursor
  477. session_id String
  478. "The upload session ID (returned by :route:`upload_session/start`)."
  479. offset UInt64
  480. "The amount of data that has been uploaded so far. We use this to make
  481. sure upload data isn't lost or duplicated in the event of a network
  482. error."
  483. example default
  484. session_id = "1234faaf0678bcde"
  485. offset = 0
  486. route upload_session/append (UploadSessionCursor, Void, UploadSessionLookupError) deprecated by upload_session/append_v2
  487. "Append more data to an upload session.
  488. A single request should not upload more than 150 MB."
  489. attrs
  490. host = "content"
  491. style = "upload"
  492. owner = "dev-plat"
  493. feature = "upload_api_rate_limit"
  494. allow_app_folder_app = true
  495. union_closed WriteMode
  496. "Your intent when writing a file to some path. This is used to determine
  497. what constitutes a conflict and what the autorename strategy is.
  498. In some situations, the conflict behavior is identical:
  499. (a) If the target path doesn't contain anything, the file is always written;
  500. no conflict.
  501. (b) If the target path contains a folder, it's always a conflict.
  502. (c) If the target path contains a file with identical contents, nothing gets
  503. written; no conflict.
  504. The conflict checking differs in the case where there's a file at the target
  505. path with contents different from the contents you're trying to write."
  506. add
  507. "Do not overwrite an existing file if there is a conflict. The
  508. autorename strategy is to append a number to the file name. For example,
  509. \"document.txt\" might become \"document (2).txt\"."
  510. overwrite
  511. "Always overwrite the existing file. The autorename
  512. strategy is the same as it is for :field:`add`."
  513. update Rev
  514. "Overwrite if the given \"rev\" matches the existing file's \"rev\".
  515. The autorename strategy is to append the string \"conflicted copy\"
  516. to the file name. For example, \"document.txt\" might become
  517. \"document (conflicted copy).txt\" or \"document (Panda's conflicted copy).txt\"."
  518. example default
  519. add = null
  520. example overwriting
  521. overwrite = null
  522. example with_revision
  523. update = "a1c10ce0dd78"
  524. struct CommitInfo
  525. path WritePath
  526. "Path in the user's Dropbox to save the file."
  527. mode WriteMode = add
  528. "Selects what to do if the file already exists."
  529. autorename Boolean = false
  530. "If there's a conflict, as determined by :field:`mode`, have the Dropbox
  531. server try to autorename the file to avoid conflict."
  532. client_modified common.DropboxTimestamp?
  533. "The value to store as the :field:`client_modified` timestamp. Dropbox
  534. automatically records the time at which the file was written to the
  535. Dropbox servers. It can also record an additional timestamp, provided
  536. by Dropbox desktop clients, mobile clients, and API apps of when the
  537. file was actually created or modified."
  538. mute Boolean = false
  539. "Normally, users are made aware of any file modifications in their
  540. Dropbox account via notifications in the client software. If
  541. :val:`true`, this tells the clients that this modification shouldn't
  542. result in a user notification."
  543. example default
  544. path = "/Homework/math/Matrices.txt"
  545. autorename = true
  546. example update
  547. path = "/Homework/math/Matrices.txt"
  548. mode = with_revision
  549. autorename = false
  550. struct UploadSessionFinishArg
  551. cursor UploadSessionCursor
  552. "Contains the upload session ID and the offset."
  553. commit CommitInfo
  554. "Contains the path and other optional modifiers for the commit."
  555. example default
  556. cursor = default
  557. commit = default
  558. example update
  559. cursor = default
  560. commit = update
  561. route upload_session/finish (UploadSessionFinishArg, FileMetadata, UploadSessionFinishError)
  562. "Finish an upload session and save the uploaded data to the given file
  563. path.
  564. A single request should not upload more than 150 MB."
  565. attrs
  566. host = "content"
  567. style = "upload"
  568. owner = "dev-plat"
  569. feature = "upload_api_rate_limit"
  570. allow_app_folder_app = true
  571. route upload (CommitInfo, FileMetadata, UploadError)
  572. "Create a new file with the contents provided in the request.
  573. Do not use this to upload a file larger than 150 MB. Instead, create an
  574. upload session with :route:`upload_session/start`."
  575. attrs
  576. host = "content"
  577. style = "upload"
  578. owner = "dev-plat"
  579. feature = "upload_api_rate_limit"
  580. allow_app_folder_app = true
  581. takes_path_root = true
  582. #
  583. # Batch Upload
  584. #
  585. struct UploadSessionFinishBatchArg
  586. entries List(UploadSessionFinishArg, max_items=1000)
  587. "Commit information for each file in the batch."
  588. example default
  589. entries = [default]
  590. struct UploadSessionFinishBatchResult
  591. entries List(UploadSessionFinishBatchResultEntry)
  592. "Commit result for each file in the batch."
  593. example default
  594. entries = [default]
  595. union_closed UploadSessionFinishBatchResultEntry
  596. success FileMetadata
  597. failure UploadSessionFinishError
  598. example default
  599. success = default
  600. union_closed UploadSessionFinishBatchJobStatus extends async.PollResultBase
  601. complete UploadSessionFinishBatchResult
  602. "The :route:`upload_session/finish_batch` has finished."
  603. example default
  604. complete = default
  605. union UploadSessionFinishBatchLaunch extends async.LaunchResultBase
  606. "Result returned by :route:`upload_session/finish_batch` that may either launch an
  607. asynchronous job or complete synchronously."
  608. complete UploadSessionFinishBatchResult
  609. example complete
  610. complete = default
  611. example async_job_id
  612. async_job_id = "34g93hh34h04y384084"
  613. route upload_session/finish_batch (UploadSessionFinishBatchArg, UploadSessionFinishBatchLaunch, Void)
  614. "This route helps you commit many files at once into a user's Dropbox. Use
  615. :route:`upload_session/start` and :route:`upload_session/append_v2` to
  616. upload file contents. We recommend uploading many files in parallel to increase
  617. throughput. Once the file contents have been uploaded, rather than calling
  618. :route:`upload_session/finish`, use this route to finish all your upload sessions
  619. in a single request.
  620. :field:`UploadSessionStartArg.close` or :field:`UploadSessionAppendArg.close`
  621. needs to be true for the last
  622. :route:`upload_session/start` or :route:`upload_session/append_v2` call.
  623. This route will return a job_id immediately and do the async commit job in background.
  624. Use :route:`upload_session/finish_batch/check` to check the job status.
  625. For the same account, this route should be executed serially. That means you should not start
  626. the next job before current job finishes. We allow up to 1000 entries in a single request."
  627. attrs
  628. owner = "dev-plat"
  629. feature = "upload_api_rate_limit"
  630. allow_app_folder_app = true
  631. route upload_session/finish_batch/check(async.PollArg, UploadSessionFinishBatchJobStatus, async.PollError)
  632. "Returns the status of an asynchronous job for :route:`upload_session/finish_batch`. If
  633. success, it returns list of result for each entry."
  634. attrs
  635. owner = "dev-plat"
  636. allow_app_folder_app = true
  637. #
  638. # Search
  639. #
  640. union_closed SearchMode
  641. filename
  642. "Search file and folder names."
  643. filename_and_content
  644. "Search file and folder names as well as file contents."
  645. deleted_filename
  646. "Search for deleted file and folder names."
  647. example default
  648. filename_and_content = null
  649. example name_only
  650. filename = null
  651. example deleted_names
  652. deleted_filename = null
  653. struct SearchArg
  654. path PathR
  655. "The path in the user's Dropbox to search. Should probably be
  656. a folder."
  657. query String
  658. "The string to search for. The search string is split on spaces into
  659. multiple tokens. For file name searching, the last token is used for
  660. prefix matching (i.e. \"bat c\" matches \"bat cave\" but not \"batman
  661. car\")."
  662. start UInt64 = 0
  663. "The starting index within the search results (used for paging)."
  664. max_results UInt64(min_value=1, max_value=1000) = 100
  665. "The maximum number of search results to return."
  666. mode SearchMode = filename
  667. "The search mode (filename, filename_and_content, or deleted_filename).
  668. Note that searching file content is only available for Dropbox Business
  669. accounts."
  670. example default
  671. path = ""
  672. query = "prime numbers"
  673. union_closed SearchMatchType
  674. "Indicates what type of match was found for a given item."
  675. filename
  676. "This item was matched on its file or folder name."
  677. content
  678. "This item was matched based on its file contents."
  679. both
  680. "This item was matched based on both its contents and its file name."
  681. example default
  682. content = null
  683. struct SearchMatch
  684. match_type SearchMatchType
  685. "The type of the match."
  686. metadata Metadata
  687. "The metadata for the matched file or folder."
  688. example default
  689. match_type = default
  690. metadata = default
  691. struct SearchResult
  692. matches List(SearchMatch)
  693. "A list (possibly empty) of matches for the query."
  694. more Boolean
  695. "Used for paging. If true, indicates there is another page of results
  696. available that can be fetched by calling :route:`search` again."
  697. start UInt64
  698. "Used for paging. Value to set the start argument to when calling
  699. :route:`search` to fetch the next page of results."
  700. example default
  701. matches = [default]
  702. more = false
  703. start = 1
  704. union SearchError
  705. path LookupError
  706. route search (SearchArg, SearchResult, SearchError)
  707. "Searches for files and folders.
  708. Note: Recent changes may not immediately be reflected in search results due to a short delay in indexing."
  709. attrs
  710. owner = "dev-plat"
  711. allow_app_folder_app = true
  712. #
  713. # Errors shared by various operations
  714. #
  715. alias MalformedPathError = String? # TODO: Maybe a user_message-like thing?
  716. union LookupError
  717. malformed_path MalformedPathError
  718. not_found
  719. "There is nothing at the given path."
  720. not_file
  721. "We were expecting a file, but the given path refers to something that isn't a file."
  722. not_folder
  723. "We were expecting a folder, but the given path refers to something that isn't a folder."
  724. restricted_content
  725. "The file cannot be transferred because the content is restricted. For example,
  726. sometimes there are legal restrictions due to copyright claims."
  727. union WriteError
  728. malformed_path MalformedPathError
  729. conflict WriteConflictError
  730. "Couldn't write to the target path because there was something in the way."
  731. no_write_permission
  732. "The user doesn't have permissions to write to the target location."
  733. insufficient_space
  734. "The user doesn't have enough available space (bytes) to write more data."
  735. disallowed_name
  736. "Dropbox will not save the file or folder because of its name."
  737. team_folder
  738. "This endpoint cannot modify or delete team folders."
  739. union WriteConflictError
  740. file
  741. "There's a file in the way."
  742. folder
  743. "There's a folder in the way."
  744. file_ancestor
  745. "There's a file at an ancestor path, so we couldn't create the required parent folders."
  746. #
  747. # Create folder
  748. #
  749. struct CreateFolderArg
  750. path WritePath
  751. "Path in the user's Dropbox to create."
  752. autorename Boolean = false
  753. "If there's a conflict, have the Dropbox server try to autorename
  754. the folder to avoid the conflict."
  755. example default
  756. path = "/Homework/math"
  757. union_closed CreateFolderError
  758. path WriteError
  759. route create_folder (CreateFolderArg, FolderMetadata, CreateFolderError)
  760. "Create a folder at a given path."
  761. attrs
  762. owner = "dev-plat"
  763. allow_app_folder_app = true
  764. #
  765. # Delete
  766. #
  767. struct DeleteArg
  768. path WritePath
  769. "Path in the user's Dropbox to delete."
  770. example delete
  771. path = "/Homework/math/Prime_Numbers.txt"
  772. union DeleteError
  773. path_lookup LookupError
  774. path_write WriteError
  775. struct DeleteBatchArg
  776. entries List(DeleteArg)
  777. example default
  778. entries = [delete]
  779. union_closed DeleteBatchResultEntry
  780. success DeleteResult
  781. failure DeleteError
  782. example default
  783. success = default
  784. struct DeleteResult
  785. metadata Metadata
  786. example default
  787. metadata = default
  788. struct DeleteBatchResult
  789. entries List(DeleteBatchResultEntry)
  790. example default
  791. entries = [default]
  792. union DeleteBatchError
  793. too_many_write_operations
  794. "There are too many write operations in user's Dropbox. Please retry
  795. this request."
  796. union DeleteBatchJobStatus extends async.PollResultBase
  797. complete DeleteBatchResult
  798. "The batch delete has finished."
  799. failed DeleteBatchError
  800. "The batch delete has failed."
  801. example default
  802. complete = default
  803. union DeleteBatchLaunch extends async.LaunchResultBase
  804. "Result returned by :route:`delete_batch` that may either launch an asynchronous job or complete
  805. synchronously."
  806. complete DeleteBatchResult
  807. example complete
  808. complete = default
  809. example async_job_id
  810. async_job_id = "34g93hh34h04y384084"
  811. route delete (DeleteArg, Metadata, DeleteError)
  812. "Delete the file or folder at a given path.
  813. If the path is a folder, all its contents will be deleted too.
  814. A successful response indicates that the file or folder was deleted. The returned metadata will
  815. be the corresponding :type:`FileMetadata` or :type:`FolderMetadata` for the item at time of
  816. deletion, and not a :type:`DeletedMetadata` object."
  817. attrs
  818. owner = "dev-plat"
  819. allow_app_folder_app = true
  820. route delete_batch (DeleteBatchArg, DeleteBatchLaunch, Void)
  821. "Delete multiple files/folders at once.
  822. This route is asynchronous, which returns a job ID immediately and runs
  823. the delete batch asynchronously. Use :route:`delete_batch/check` to check
  824. the job status."
  825. attrs
  826. owner = "dev-plat"
  827. allow_app_folder_app = true
  828. route delete_batch/check (async.PollArg, DeleteBatchJobStatus, async.PollError)
  829. "Returns the status of an asynchronous job for :route:`delete_batch`. If
  830. success, it returns list of result for each entry."
  831. attrs
  832. owner = "dev-plat"
  833. allow_app_folder_app = true
  834. route permanently_delete (DeleteArg, Void, DeleteError)
  835. "Permanently delete the file or folder at a given path
  836. (see https://www.dropbox.com/en/help/40).
  837. Note: This endpoint is only available for Dropbox Business apps."
  838. #
  839. # Args and error shared by copy and move
  840. #
  841. struct RelocationPath
  842. from_path WritePath
  843. "Path in the user's Dropbox to be copied or moved."
  844. to_path WritePath
  845. "Path in the user's Dropbox that is the destination."
  846. example default
  847. from_path = "/Homework/math"
  848. to_path = "/Homework/algebra"
  849. struct RelocationArg extends RelocationPath
  850. allow_shared_folder Boolean = false
  851. "If true, :route:`copy` will copy contents in shared folder,
  852. otherwise :field:`RelocationError.cant_copy_shared_folder` will be
  853. returned if :field:`from_path` contains shared folder. This field is
  854. always true for :route:`move`."
  855. autorename Boolean = false
  856. "If there's a conflict, have the Dropbox server try to autorename
  857. the file to avoid the conflict."
  858. example default
  859. from_path = "/Homework/math"
  860. to_path = "/Homework/algebra"
  861. union RelocationError
  862. from_lookup LookupError
  863. from_write WriteError
  864. to WriteError
  865. cant_copy_shared_folder
  866. "Shared folders can't be copied."
  867. cant_nest_shared_folder
  868. "Your move operation would result in nested shared folders. This is not allowed."
  869. cant_move_folder_into_itself
  870. "You cannot move a folder into itself."
  871. too_many_files
  872. "The operation would involve more than 10,000 files and folders."
  873. duplicated_or_nested_paths
  874. "There are duplicated/nested paths among :field:`RelocationArg.from_path`
  875. and :field:`RelocationArg.to_path`."
  876. struct RelocationBatchArg
  877. entries List(RelocationPath)
  878. "List of entries to be moved or copied. Each entry is :type:`RelocationPath`."
  879. allow_shared_folder Boolean = false
  880. "If true, :route:`copy_batch` will copy contents in shared folder,
  881. otherwise :field:`RelocationError.cant_copy_shared_folder` will be
  882. returned if :field:`RelocationPath.from_path` contains shared folder.
  883. This field is always true for :route:`move_batch`."
  884. autorename Boolean = false
  885. "If there's a conflict with any file, have the Dropbox server try to
  886. autorename that file to avoid the conflict."
  887. example default
  888. entries = [default]
  889. struct RelocationBatchResult
  890. entries List(RelocationResult)
  891. example default
  892. entries = [default]
  893. union_closed RelocationBatchJobStatus extends async.PollResultBase
  894. complete RelocationBatchResult
  895. "The copy or move batch job has finished."
  896. failed RelocationBatchError
  897. "The copy or move batch job has failed with exception."
  898. example default
  899. complete = default
  900. union RelocationBatchLaunch extends async.LaunchResultBase
  901. "Result returned by :route:`copy_batch` or :route:`move_batch` that may either launch an
  902. asynchronous job or complete synchronously."
  903. complete RelocationBatchResult
  904. example complete
  905. complete = default
  906. example async_job_id
  907. async_job_id = "34g93hh34h04y384084"
  908. struct RelocationResult
  909. metadata Metadata
  910. example default
  911. metadata = default
  912. union RelocationBatchError extends RelocationError
  913. too_many_write_operations
  914. "There are too many write operations in user's Dropbox. Please retry
  915. this request."
  916. #
  917. # Copy
  918. #
  919. route copy (RelocationArg, Metadata, RelocationError)
  920. "Copy a file or folder to a different location in the user's Dropbox.
  921. If the source path is a folder all its contents will be copied."
  922. attrs
  923. owner = "dev-plat"
  924. allow_app_folder_app = true
  925. route copy_batch (RelocationBatchArg, RelocationBatchLaunch, Void)
  926. "Copy multiple files or folders to different locations at once in the
  927. user's Dropbox.
  928. If :field:`RelocationBatchArg.allow_shared_folder` is false, this
  929. route is atomic. If on entry failes, the whole transaction will abort. If
  930. :field:`RelocationBatchArg.allow_shared_folder` is true, not
  931. atomicity is guaranteed, but you will be able to copy the contents of
  932. shared folders to new locations.
  933. This route will return job ID immediately and do the async copy job in
  934. background. Please use :route:`copy_batch/check` to check the job status."
  935. attrs
  936. owner = "dev-plat"
  937. allow_app_folder_app = true
  938. route copy_batch/check(async.PollArg, RelocationBatchJobStatus, async.PollError)
  939. "Returns the status of an asynchronous job for :route:`copy_batch`. If
  940. success, it returns list of results for each entry."
  941. attrs
  942. owner = "dev-plat"
  943. allow_app_folder_app = true
  944. #
  945. # Move
  946. #
  947. route move (RelocationArg, Metadata, RelocationError)
  948. "Move a file or folder to a different location in the user's Dropbox.
  949. If the source path is a folder all its contents will be moved."
  950. attrs
  951. owner = "dev-plat"
  952. allow_app_folder_app = true
  953. route move_batch (RelocationBatchArg, RelocationBatchLaunch, Void)
  954. "Move multiple files or folders to different locations at once in the
  955. user's Dropbox.
  956. This route is 'all or nothing', which means if one entry fails, the
  957. whole transaction will abort.
  958. This route will return job ID immediately and do the async moving job in
  959. background. Please use :route:`move_batch/check` to check the job status."
  960. attrs
  961. owner = "dev-plat"
  962. allow_app_folder_app = true
  963. route move_batch/check(async.PollArg, RelocationBatchJobStatus, async.PollError)
  964. "Returns the status of an asynchronous job for :route:`move_batch`. If
  965. success, it returns list of results for each entry."
  966. attrs
  967. owner = "dev-plat"
  968. allow_app_folder_app = true
  969. #
  970. # Thumbnail
  971. #
  972. union_closed ThumbnailSize
  973. w32h32
  974. "32 by 32 px."
  975. w64h64
  976. "64 by 64 px."
  977. w128h128
  978. "128 by 128 px."
  979. w640h480
  980. "640 by 480 px."
  981. w1024h768
  982. "1024 by 768."
  983. union_closed ThumbnailFormat
  984. jpeg
  985. png
  986. struct ThumbnailArg
  987. path ReadPath
  988. "The path to the image file you want to thumbnail."
  989. format ThumbnailFormat = jpeg
  990. "The format for the thumbnail image, jpeg (default) or png. For
  991. images that are photos, jpeg should be preferred, while png is
  992. better for screenshots and digital arts."
  993. size ThumbnailSize = w64h64
  994. "The size for the thumbnail image."
  995. example default
  996. path = "/image.jpg"
  997. format = jpeg
  998. example id
  999. path = "id:a4ayc_80_OEAAAAAAAAAYa"
  1000. format = jpeg
  1001. example rev
  1002. path = "rev:a1c10ce0dd78"
  1003. format = jpeg
  1004. union_closed ThumbnailError
  1005. path LookupError
  1006. "An error occurs when downloading metadata for the image."
  1007. unsupported_extension
  1008. "The file extension doesn't allow conversion to a thumbnail."
  1009. unsupported_image
  1010. "The image cannot be converted to a thumbnail."
  1011. conversion_error
  1012. "An error occurs during thumbnail conversion."
  1013. route get_thumbnail(ThumbnailArg, FileMetadata, ThumbnailError)
  1014. "Get a thumbnail for an image.
  1015. This method currently supports files with the following file extensions:
  1016. jpg, jpeg, png, tiff, tif, gif and bmp. Photos that are larger than 20MB
  1017. in size won't be converted to a thumbnail."
  1018. attrs
  1019. host = "content"
  1020. style = "download"
  1021. owner = "dev-plat"
  1022. allow_app_folder_app = true
  1023. #
  1024. # Preview
  1025. #
  1026. struct PreviewArg
  1027. path ReadPath
  1028. "The path of the file to preview."
  1029. rev Rev?
  1030. "Deprecated. Please specify revision in :field:`path` instead."
  1031. example default
  1032. path = "/word.docx"
  1033. example id
  1034. path = "id:a4ayc_80_OEAAAAAAAAAYa"
  1035. example rev
  1036. path = "rev:a1c10ce0dd78"
  1037. union_closed PreviewError
  1038. path LookupError
  1039. "An error occurs when downloading metadata for the file."
  1040. in_progress
  1041. "This preview generation is still in progress and the file is not ready
  1042. for preview yet."
  1043. unsupported_extension
  1044. "The file extension is not supported preview generation."
  1045. unsupported_content
  1046. "The file content is not supported for preview generation."
  1047. route get_preview(PreviewArg, FileMetadata, PreviewError)
  1048. "Get a preview for a file.
  1049. Currently, PDF previews are generated for files with the following extensions:
  1050. .ai, .doc, .docm, .docx, .eps, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf.
  1051. HTML previews are generated for files with the following extensions: .csv, .ods, .xls, .xlsm, .xlsx.
  1052. Other formats will return an unsupported extension error."
  1053. attrs
  1054. host = "content"
  1055. style = "download"
  1056. owner = "dev-plat"
  1057. allow_app_folder_app = true
  1058. #
  1059. # List revisions
  1060. #
  1061. struct ListRevisionsArg
  1062. path PathOrId
  1063. "The path to the file you want to see the revisions of."
  1064. limit UInt64(min_value=1, max_value=100) = 10
  1065. "The maximum number of revision entries returned."
  1066. # TODO: Add last_rev when we get pagination support from FJ Service.
  1067. example default
  1068. path = "/root/word.docx"
  1069. limit = 10
  1070. union ListRevisionsError
  1071. path LookupError
  1072. struct ListRevisionsResult
  1073. is_deleted Boolean
  1074. "If the file is deleted."
  1075. entries List(FileMetadata)
  1076. "The revisions for the file. Only non-delete revisions will show up here."
  1077. example default
  1078. is_deleted = false
  1079. entries = [default]
  1080. route list_revisions(ListRevisionsArg, ListRevisionsResult, ListRevisionsError)
  1081. "Return revisions of a file."
  1082. attrs
  1083. owner = "dev-plat"
  1084. allow_app_folder_app = true
  1085. #
  1086. # Restore
  1087. #
  1088. struct RestoreArg
  1089. path WritePath
  1090. "The path to the file you want to restore."
  1091. rev Rev
  1092. "The revision to restore for the file."
  1093. example default
  1094. path = "/root/word.docx"
  1095. rev = "a1c10ce0dd78"
  1096. union RestoreError
  1097. path_lookup LookupError
  1098. "An error occurs when downloading metadata for the file."
  1099. path_write WriteError
  1100. "An error occurs when trying to restore the file to that path."
  1101. invalid_revision
  1102. "The revision is invalid. It may point to a different file."
  1103. route restore(RestoreArg, FileMetadata, RestoreError)
  1104. "Restore a file to a specific revision."
  1105. attrs
  1106. owner = "dev-plat"
  1107. allow_app_folder_app = true
  1108. #
  1109. # Temporary link
  1110. #
  1111. struct GetTemporaryLinkArg
  1112. path ReadPath
  1113. "The path to the file you want a temporary link to."
  1114. example default
  1115. path = "/video.mp4"
  1116. struct GetTemporaryLinkResult
  1117. metadata FileMetadata
  1118. "Metadata of the file."
  1119. link String
  1120. "The temporary link which can be used to stream content the file."
  1121. example default
  1122. metadata = default
  1123. link = "https://dl.dropboxusercontent.com/apitl/1/YXNkZmFzZGcyMzQyMzI0NjU2NDU2NDU2"
  1124. union GetTemporaryLinkError
  1125. path LookupError
  1126. route get_temporary_link(GetTemporaryLinkArg, GetTemporaryLinkResult, GetTemporaryLinkError)
  1127. "Get a temporary link to stream content of a file. This link will expire in four hours and
  1128. afterwards you will get 410 Gone. Content-Type of the link is determined automatically by
  1129. the file's mime type."
  1130. attrs
  1131. owner = "dev-plat"
  1132. allow_app_folder_app = true
  1133. #
  1134. # Copy reference
  1135. #
  1136. struct GetCopyReferenceArg
  1137. path ReadPath
  1138. "The path to the file or folder you want to get a copy reference to."
  1139. example default
  1140. path = "/video.mp4"
  1141. struct GetCopyReferenceResult
  1142. metadata Metadata
  1143. "Metadata of the file or folder."
  1144. copy_reference String
  1145. "A copy reference to the file or folder."
  1146. expires common.DropboxTimestamp
  1147. "The expiration date of the copy reference. This value is currently set to be
  1148. far enough in the future so that expiration is effectively not an issue."
  1149. example default
  1150. metadata = default
  1151. copy_reference = "z1X6ATl6aWtzOGq0c3g5Ng"
  1152. expires = "2045-05-12T15:50:38Z"
  1153. union GetCopyReferenceError
  1154. path LookupError
  1155. route copy_reference/get(GetCopyReferenceArg, GetCopyReferenceResult, GetCopyReferenceError)
  1156. "Get a copy reference to a file or folder. This reference string can be used to
  1157. save that file or folder to another user's Dropbox by passing it to
  1158. :route:`copy_reference/save`."
  1159. attrs
  1160. owner = "dev-plat"
  1161. allow_app_folder_app = true
  1162. struct SaveCopyReferenceArg
  1163. copy_reference String
  1164. "A copy reference returned by :route:`copy_reference/get`."
  1165. path Path
  1166. "Path in the user's Dropbox that is the destination."
  1167. example default
  1168. copy_reference = "z1X6ATl6aWtzOGq0c3g5Ng"
  1169. path = "/video.mp4"
  1170. struct SaveCopyReferenceResult
  1171. metadata Metadata
  1172. "The metadata of the saved file or folder in the user's Dropbox."
  1173. example default
  1174. metadata = default
  1175. union SaveCopyReferenceError
  1176. path WriteError
  1177. invalid_copy_reference
  1178. "The copy reference is invalid."
  1179. no_permission
  1180. "You don't have permission to save the given copy reference. Please make sure this app
  1181. is same app which created the copy reference and the source user is still linked to
  1182. the app."
  1183. not_found
  1184. "The file referenced by the copy reference cannot be found."
  1185. too_many_files
  1186. "The operation would involve more than 10,000 files and folders."
  1187. route copy_reference/save(SaveCopyReferenceArg, SaveCopyReferenceResult, SaveCopyReferenceError)
  1188. "Save a copy reference returned by :route:`copy_reference/get` to the user's Dropbox."
  1189. attrs
  1190. owner = "dev-plat"
  1191. allow_app_folder_app = true
  1192. #
  1193. # Save URL
  1194. #
  1195. struct SaveUrlArg
  1196. path Path
  1197. "The path in Dropbox where the URL will be saved to."
  1198. url String
  1199. "The URL to be saved."
  1200. example default
  1201. path = "/a.txt"
  1202. url = "http://example.com/a.txt"
  1203. union_closed SaveUrlResult extends async.LaunchResultBase
  1204. complete FileMetadata
  1205. "Metadata of the file where the URL is saved to."
  1206. union SaveUrlError
  1207. path WriteError
  1208. download_failed
  1209. "Failed downloading the given URL."
  1210. invalid_url
  1211. "The given URL is invalid."
  1212. not_found
  1213. "The file where the URL is saved to no longer exists."
  1214. route save_url(SaveUrlArg, SaveUrlResult, SaveUrlError)
  1215. "Save a specified URL into a file in user's Dropbox. If the given path already
  1216. exists, the file will be renamed to avoid the conflict (e.g. myfile (1).txt)."
  1217. attrs
  1218. owner = "dev-plat"
  1219. allow_app_folder_app = true
  1220. #
  1221. # Save URL Job
  1222. #
  1223. union_closed SaveUrlJobStatus extends async.PollResultBase
  1224. complete FileMetadata
  1225. "Metadata of the file where the URL is saved to."
  1226. failed SaveUrlError
  1227. route save_url/check_job_status(async.PollArg, SaveUrlJobStatus, async.PollError)
  1228. "Check the status of a :route:`save_url` job."
  1229. attrs
  1230. owner = "dev-plat"
  1231. allow_app_folder_app = true