frameio 0.0.28__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. frameio/__init__.py +1158 -0
  2. frameio/account_permissions/__init__.py +4 -0
  3. frameio/account_permissions/client.py +193 -0
  4. frameio/account_permissions/raw_client.py +333 -0
  5. frameio/accounts/__init__.py +4 -0
  6. frameio/accounts/client.py +162 -0
  7. frameio/accounts/raw_client.py +309 -0
  8. frameio/client.py +439 -0
  9. frameio/comments/__init__.py +38 -0
  10. frameio/comments/client.py +654 -0
  11. frameio/comments/raw_client.py +1316 -0
  12. frameio/comments/types/__init__.py +40 -0
  13. frameio/comments/types/comments_show_request_include.py +5 -0
  14. frameio/comments/types/create_comment_params_data.py +33 -0
  15. frameio/comments/types/update_comment_params_data.py +33 -0
  16. frameio/core/__init__.py +122 -0
  17. frameio/core/api_error.py +23 -0
  18. frameio/core/client_wrapper.py +95 -0
  19. frameio/core/custom_pagination.py +152 -0
  20. frameio/core/datetime_utils.py +28 -0
  21. frameio/core/file.py +67 -0
  22. frameio/core/force_multipart.py +18 -0
  23. frameio/core/http_client.py +663 -0
  24. frameio/core/http_response.py +55 -0
  25. frameio/core/http_sse/__init__.py +42 -0
  26. frameio/core/http_sse/_api.py +112 -0
  27. frameio/core/http_sse/_decoders.py +61 -0
  28. frameio/core/http_sse/_exceptions.py +7 -0
  29. frameio/core/http_sse/_models.py +17 -0
  30. frameio/core/jsonable_encoder.py +100 -0
  31. frameio/core/pagination.py +82 -0
  32. frameio/core/pydantic_utilities.py +361 -0
  33. frameio/core/query_encoder.py +58 -0
  34. frameio/core/remove_none_from_dict.py +11 -0
  35. frameio/core/request_options.py +35 -0
  36. frameio/core/serialization.py +276 -0
  37. frameio/core/unchecked_base_model.py +376 -0
  38. frameio/environment.py +7 -0
  39. frameio/errors/__init__.py +53 -0
  40. frameio/errors/bad_request_error.py +11 -0
  41. frameio/errors/forbidden_error.py +11 -0
  42. frameio/errors/not_found_error.py +11 -0
  43. frameio/errors/too_many_requests_error.py +11 -0
  44. frameio/errors/unauthorized_error.py +11 -0
  45. frameio/errors/unprocessable_entity_error.py +10 -0
  46. frameio/files/__init__.py +58 -0
  47. frameio/files/client.py +1171 -0
  48. frameio/files/raw_client.py +2517 -0
  49. frameio/files/types/__init__.py +56 -0
  50. frameio/files/types/file_copy_params_data.py +15 -0
  51. frameio/files/types/file_create_local_upload_params_data.py +20 -0
  52. frameio/files/types/file_create_params_data.py +31 -0
  53. frameio/files/types/file_create_remote_upload_params_data.py +20 -0
  54. frameio/files/types/file_move_params_data.py +15 -0
  55. frameio/files/types/file_update_params_data.py +15 -0
  56. frameio/files/types/files_copy_request_copy_comments.py +5 -0
  57. frameio/folders/__init__.py +39 -0
  58. frameio/folders/client.py +1004 -0
  59. frameio/folders/raw_client.py +2074 -0
  60. frameio/folders/types/__init__.py +42 -0
  61. frameio/folders/types/folder_copy_params_data.py +15 -0
  62. frameio/folders/types/folder_create_params_data.py +15 -0
  63. frameio/folders/types/folder_move_params_data.py +15 -0
  64. frameio/folders/types/folder_update_params_data.py +15 -0
  65. frameio/metadata/__init__.py +37 -0
  66. frameio/metadata/client.py +293 -0
  67. frameio/metadata/raw_client.py +509 -0
  68. frameio/metadata/types/__init__.py +38 -0
  69. frameio/metadata/types/bulk_update_metadata_params_data.py +23 -0
  70. frameio/metadata/types/bulk_update_metadata_params_data_values_item.py +13 -0
  71. frameio/metadata_fields/__init__.py +103 -0
  72. frameio/metadata_fields/client.py +536 -0
  73. frameio/metadata_fields/raw_client.py +996 -0
  74. frameio/metadata_fields/types/__init__.py +105 -0
  75. frameio/metadata_fields/types/create_field_definition_params_data.py +112 -0
  76. frameio/metadata_fields/types/update_field_definition_params_data.py +118 -0
  77. frameio/project_permissions/__init__.py +4 -0
  78. frameio/project_permissions/client.py +426 -0
  79. frameio/project_permissions/raw_client.py +824 -0
  80. frameio/projects/__init__.py +38 -0
  81. frameio/projects/client.py +604 -0
  82. frameio/projects/raw_client.py +1286 -0
  83. frameio/projects/types/__init__.py +40 -0
  84. frameio/projects/types/project_params_data.py +20 -0
  85. frameio/projects/types/project_update_params_data.py +26 -0
  86. frameio/projects/types/project_update_params_data_status.py +5 -0
  87. frameio/py.typed +0 -0
  88. frameio/shares/__init__.py +64 -0
  89. frameio/shares/client.py +1217 -0
  90. frameio/shares/raw_client.py +2511 -0
  91. frameio/shares/types/__init__.py +61 -0
  92. frameio/shares/types/add_asset_params_data.py +15 -0
  93. frameio/shares/types/add_reviewers_to_share_params_data.py +18 -0
  94. frameio/shares/types/add_reviewers_to_share_params_data_reviewers.py +27 -0
  95. frameio/shares/types/create_share_params_data.py +26 -0
  96. frameio/shares/types/remove_reviewer_params_data.py +13 -0
  97. frameio/shares/types/remove_reviewer_params_data_reviewers.py +27 -0
  98. frameio/shares/types/update_share_params_data.py +34 -0
  99. frameio/shares/types/update_share_params_data_access.py +5 -0
  100. frameio/types/__init__.py +983 -0
  101. frameio/types/account.py +70 -0
  102. frameio/types/account_roles_item.py +5 -0
  103. frameio/types/account_user_role.py +23 -0
  104. frameio/types/account_user_role_role.py +5 -0
  105. frameio/types/account_user_roles_response.py +27 -0
  106. frameio/types/accounts_response.py +23 -0
  107. frameio/types/add_asset_response.py +13 -0
  108. frameio/types/add_asset_response_data.py +15 -0
  109. frameio/types/asset_common.py +48 -0
  110. frameio/types/asset_common_type.py +5 -0
  111. frameio/types/asset_common_with_includes.py +58 -0
  112. frameio/types/asset_common_with_includes_type.py +5 -0
  113. frameio/types/asset_include.py +5 -0
  114. frameio/types/asset_share_params.py +39 -0
  115. frameio/types/asset_share_params_access.py +5 -0
  116. frameio/types/asset_with_includes.py +76 -0
  117. frameio/types/assets_with_includes_response.py +23 -0
  118. frameio/types/bad_request.py +13 -0
  119. frameio/types/bad_request_errors_item.py +15 -0
  120. frameio/types/bad_request_errors_item_source.py +12 -0
  121. frameio/types/boolean_value.py +12 -0
  122. frameio/types/children_type.py +3 -0
  123. frameio/types/comment.py +59 -0
  124. frameio/types/comment_include.py +5 -0
  125. frameio/types/comment_response.py +13 -0
  126. frameio/types/comment_with_includes.py +17 -0
  127. frameio/types/comment_with_includes_response.py +13 -0
  128. frameio/types/comments_with_includes_response.py +23 -0
  129. frameio/types/date_definition.py +49 -0
  130. frameio/types/date_definition_field_configuration.py +21 -0
  131. frameio/types/date_definition_field_configuration_display_format.py +7 -0
  132. frameio/types/date_definition_field_configuration_time_format.py +5 -0
  133. frameio/types/date_definition_field_type.py +10 -0
  134. frameio/types/date_definition_params.py +17 -0
  135. frameio/types/date_definition_params_field_configuration.py +23 -0
  136. frameio/types/date_definition_params_field_configuration_display_format.py +7 -0
  137. frameio/types/date_definition_params_field_configuration_time_format.py +7 -0
  138. frameio/types/date_definition_with_includes.py +13 -0
  139. frameio/types/date_value.py +12 -0
  140. frameio/types/email.py +3 -0
  141. frameio/types/empty_json.py +5 -0
  142. frameio/types/field_definition.py +167 -0
  143. frameio/types/field_definition_include.py +5 -0
  144. frameio/types/field_definition_response.py +13 -0
  145. frameio/types/field_definition_with_includes.py +178 -0
  146. frameio/types/field_definitions_with_includes_response.py +27 -0
  147. frameio/types/field_value_common.py +29 -0
  148. frameio/types/file.py +60 -0
  149. frameio/types/file_copy_response.py +13 -0
  150. frameio/types/file_remote_upload_response.py +17 -0
  151. frameio/types/file_response.py +13 -0
  152. frameio/types/file_status.py +5 -0
  153. frameio/types/file_upload_status.py +41 -0
  154. frameio/types/file_upload_status_response.py +13 -0
  155. frameio/types/file_with_includes.py +25 -0
  156. frameio/types/file_with_includes_response.py +13 -0
  157. frameio/types/file_with_includes_status.py +5 -0
  158. frameio/types/file_with_media_links_include.py +19 -0
  159. frameio/types/file_with_upload_urls.py +16 -0
  160. frameio/types/file_with_upload_urls_response.py +13 -0
  161. frameio/types/folder.py +15 -0
  162. frameio/types/folder_copy_response.py +13 -0
  163. frameio/types/folder_response.py +13 -0
  164. frameio/types/folder_with_includes.py +63 -0
  165. frameio/types/folder_with_includes_response.py +13 -0
  166. frameio/types/folders_with_includes_response.py +23 -0
  167. frameio/types/forbidden.py +13 -0
  168. frameio/types/forbidden_errors_item.py +15 -0
  169. frameio/types/forbidden_errors_item_source.py +12 -0
  170. frameio/types/include.py +5 -0
  171. frameio/types/include_total_count.py +3 -0
  172. frameio/types/integer_value.py +12 -0
  173. frameio/types/json_error_response.py +13 -0
  174. frameio/types/json_error_response_errors_item.py +15 -0
  175. frameio/types/json_error_response_errors_item_source.py +12 -0
  176. frameio/types/links.py +22 -0
  177. frameio/types/long_text_definition.py +49 -0
  178. frameio/types/long_text_definition_field_configuration.py +10 -0
  179. frameio/types/long_text_definition_field_type.py +10 -0
  180. frameio/types/long_text_definition_params.py +15 -0
  181. frameio/types/long_text_definition_with_includes.py +13 -0
  182. frameio/types/media_link_common.py +17 -0
  183. frameio/types/media_links_collection.py +24 -0
  184. frameio/types/metadata_field.py +149 -0
  185. frameio/types/metadata_response.py +13 -0
  186. frameio/types/metadata_with_definition.py +21 -0
  187. frameio/types/multi_select_value.py +14 -0
  188. frameio/types/multi_user_value.py +20 -0
  189. frameio/types/multi_user_value_member_options_type.py +5 -0
  190. frameio/types/no_content.py +3 -0
  191. frameio/types/not_found.py +13 -0
  192. frameio/types/not_found_errors_item.py +15 -0
  193. frameio/types/not_found_errors_item_source.py +12 -0
  194. frameio/types/number_definition.py +43 -0
  195. frameio/types/number_definition_field_configuration.py +21 -0
  196. frameio/types/number_definition_field_configuration_number_format.py +7 -0
  197. frameio/types/number_definition_params.py +17 -0
  198. frameio/types/number_definition_params_field_configuration.py +23 -0
  199. frameio/types/number_definition_params_field_configuration_number_format.py +7 -0
  200. frameio/types/number_definition_with_includes.py +13 -0
  201. frameio/types/number_value.py +12 -0
  202. frameio/types/original_media_link.py +16 -0
  203. frameio/types/profile.py +34 -0
  204. frameio/types/profile_response.py +17 -0
  205. frameio/types/project.py +66 -0
  206. frameio/types/project_include.py +5 -0
  207. frameio/types/project_response.py +17 -0
  208. frameio/types/project_status.py +5 -0
  209. frameio/types/project_with_includes.py +18 -0
  210. frameio/types/project_with_includes_response.py +17 -0
  211. frameio/types/projects_with_includes_response.py +27 -0
  212. frameio/types/rating_definition.py +43 -0
  213. frameio/types/rating_definition_field_configuration.py +22 -0
  214. frameio/types/rating_definition_field_configuration_style.py +5 -0
  215. frameio/types/rating_definition_params.py +17 -0
  216. frameio/types/rating_definition_params_field_configuration.py +22 -0
  217. frameio/types/rating_definition_params_field_configuration_style.py +5 -0
  218. frameio/types/rating_definition_with_includes.py +13 -0
  219. frameio/types/remove_asset_response.py +13 -0
  220. frameio/types/remove_asset_response_data.py +15 -0
  221. frameio/types/rendition_media_link.py +19 -0
  222. frameio/types/request_after_opaque_cursor.py +5 -0
  223. frameio/types/request_page_size.py +3 -0
  224. frameio/types/select_definition.py +43 -0
  225. frameio/types/select_definition_field_configuration.py +18 -0
  226. frameio/types/select_definition_field_configuration_options_item.py +22 -0
  227. frameio/types/select_definition_params.py +17 -0
  228. frameio/types/select_definition_params_field_configuration.py +20 -0
  229. frameio/types/select_definition_params_field_configuration_options_item.py +20 -0
  230. frameio/types/select_definition_with_includes.py +13 -0
  231. frameio/types/select_multi_definition.py +49 -0
  232. frameio/types/select_multi_definition_field_configuration.py +18 -0
  233. frameio/types/select_multi_definition_field_configuration_options_item.py +22 -0
  234. frameio/types/select_multi_definition_field_type.py +10 -0
  235. frameio/types/select_multi_definition_params.py +17 -0
  236. frameio/types/select_multi_definition_params_field_configuration.py +20 -0
  237. frameio/types/select_multi_definition_params_field_configuration_options_item.py +20 -0
  238. frameio/types/select_multi_definition_with_includes.py +13 -0
  239. frameio/types/select_option.py +20 -0
  240. frameio/types/select_value.py +14 -0
  241. frameio/types/share.py +66 -0
  242. frameio/types/share_access.py +5 -0
  243. frameio/types/share_response.py +13 -0
  244. frameio/types/share_reviewers_response.py +27 -0
  245. frameio/types/shares_response.py +27 -0
  246. frameio/types/single_user_value.py +20 -0
  247. frameio/types/single_user_value_member_options_type.py +5 -0
  248. frameio/types/text_definition.py +49 -0
  249. frameio/types/text_definition_field_configuration.py +10 -0
  250. frameio/types/text_definition_field_type.py +10 -0
  251. frameio/types/text_definition_params.py +15 -0
  252. frameio/types/text_definition_with_includes.py +13 -0
  253. frameio/types/text_value.py +12 -0
  254. frameio/types/time_stamp.py +5 -0
  255. frameio/types/toggle_definition.py +43 -0
  256. frameio/types/toggle_definition_field_configuration.py +15 -0
  257. frameio/types/toggle_definition_params.py +17 -0
  258. frameio/types/toggle_definition_params_field_configuration.py +15 -0
  259. frameio/types/toggle_definition_with_includes.py +13 -0
  260. frameio/types/too_many_requests.py +13 -0
  261. frameio/types/too_many_requests_errors_item.py +15 -0
  262. frameio/types/too_many_requests_errors_item_source.py +12 -0
  263. frameio/types/unauthorized.py +13 -0
  264. frameio/types/unauthorized_errors_item.py +15 -0
  265. frameio/types/unauthorized_errors_item_source.py +12 -0
  266. frameio/types/unprocessable_entity.py +13 -0
  267. frameio/types/unprocessable_entity_errors_item.py +15 -0
  268. frameio/types/unprocessable_entity_errors_item_source.py +12 -0
  269. frameio/types/update_date_definition_params.py +17 -0
  270. frameio/types/update_date_definition_params_field_configuration.py +25 -0
  271. frameio/types/update_date_definition_params_field_configuration_display_format.py +7 -0
  272. frameio/types/update_date_definition_params_field_configuration_time_format.py +7 -0
  273. frameio/types/update_long_text_definition_params.py +15 -0
  274. frameio/types/update_number_definition_params.py +17 -0
  275. frameio/types/update_number_definition_params_field_configuration.py +25 -0
  276. frameio/types/update_number_definition_params_field_configuration_number_format.py +7 -0
  277. frameio/types/update_rating_definition_params.py +17 -0
  278. frameio/types/update_rating_definition_params_field_configuration.py +24 -0
  279. frameio/types/update_rating_definition_params_field_configuration_style.py +7 -0
  280. frameio/types/update_select_definition_params.py +17 -0
  281. frameio/types/update_select_definition_params_field_configuration.py +20 -0
  282. frameio/types/update_select_definition_params_field_configuration_options_item.py +20 -0
  283. frameio/types/update_select_multi_definition_params.py +19 -0
  284. frameio/types/update_select_multi_definition_params_field_configuration.py +20 -0
  285. frameio/types/update_select_multi_definition_params_field_configuration_options_item.py +20 -0
  286. frameio/types/update_text_definition_params.py +15 -0
  287. frameio/types/update_toggle_definition_params.py +17 -0
  288. frameio/types/update_toggle_definition_params_field_configuration.py +15 -0
  289. frameio/types/update_user_multi_definition_params.py +17 -0
  290. frameio/types/update_user_multi_definition_params_field_configuration.py +25 -0
  291. frameio/types/update_user_multi_definition_params_field_configuration_custom_members_item.py +20 -0
  292. frameio/types/update_user_multi_definition_params_field_configuration_custom_members_item_type.py +7 -0
  293. frameio/types/update_user_multi_definition_params_field_configuration_member_options_type.py +7 -0
  294. frameio/types/update_user_roles_params.py +17 -0
  295. frameio/types/update_user_roles_params_data.py +13 -0
  296. frameio/types/update_user_roles_params_data_role.py +7 -0
  297. frameio/types/update_user_roles_response.py +13 -0
  298. frameio/types/update_user_roles_response_data.py +13 -0
  299. frameio/types/update_user_roles_response_data_role.py +7 -0
  300. frameio/types/update_user_single_definition_params.py +17 -0
  301. frameio/types/update_user_single_definition_params_field_configuration.py +25 -0
  302. frameio/types/update_user_single_definition_params_field_configuration_custom_members_item.py +20 -0
  303. frameio/types/update_user_single_definition_params_field_configuration_custom_members_item_type.py +7 -0
  304. frameio/types/update_user_single_definition_params_field_configuration_member_options_type.py +7 -0
  305. frameio/types/upload_url.py +20 -0
  306. frameio/types/user.py +44 -0
  307. frameio/types/user_multi_definition.py +49 -0
  308. frameio/types/user_multi_definition_field_configuration.py +23 -0
  309. frameio/types/user_multi_definition_field_configuration_custom_members_item.py +20 -0
  310. frameio/types/user_multi_definition_field_configuration_custom_members_item_type.py +7 -0
  311. frameio/types/user_multi_definition_field_configuration_member_options_type.py +7 -0
  312. frameio/types/user_multi_definition_field_type.py +10 -0
  313. frameio/types/user_multi_definition_params.py +17 -0
  314. frameio/types/user_multi_definition_params_field_configuration.py +23 -0
  315. frameio/types/user_multi_definition_params_field_configuration_custom_members_item.py +20 -0
  316. frameio/types/user_multi_definition_params_field_configuration_custom_members_item_type.py +7 -0
  317. frameio/types/user_multi_definition_params_field_configuration_member_options_type.py +7 -0
  318. frameio/types/user_multi_definition_with_includes.py +13 -0
  319. frameio/types/user_role.py +19 -0
  320. frameio/types/user_role_role.py +7 -0
  321. frameio/types/user_roles_response.py +27 -0
  322. frameio/types/user_single_definition.py +49 -0
  323. frameio/types/user_single_definition_field_configuration.py +23 -0
  324. frameio/types/user_single_definition_field_configuration_custom_members_item.py +20 -0
  325. frameio/types/user_single_definition_field_configuration_custom_members_item_type.py +7 -0
  326. frameio/types/user_single_definition_field_configuration_member_options_type.py +7 -0
  327. frameio/types/user_single_definition_field_type.py +10 -0
  328. frameio/types/user_single_definition_params.py +17 -0
  329. frameio/types/user_single_definition_params_field_configuration.py +23 -0
  330. frameio/types/user_single_definition_params_field_configuration_custom_members_item.py +20 -0
  331. frameio/types/user_single_definition_params_field_configuration_custom_members_item_type.py +7 -0
  332. frameio/types/user_single_definition_params_field_configuration_member_options_type.py +7 -0
  333. frameio/types/user_single_definition_with_includes.py +13 -0
  334. frameio/types/user_value.py +18 -0
  335. frameio/types/user_value_type.py +5 -0
  336. frameio/types/uuid_.py +3 -0
  337. frameio/types/version_stack.py +50 -0
  338. frameio/types/version_stack_copy_response.py +13 -0
  339. frameio/types/version_stack_response.py +13 -0
  340. frameio/types/version_stack_with_includes.py +60 -0
  341. frameio/types/version_stack_with_includes_response.py +13 -0
  342. frameio/types/version_stacks_with_includes_response.py +19 -0
  343. frameio/types/webhook.py +36 -0
  344. frameio/types/webhook_create_response.py +17 -0
  345. frameio/types/webhook_create_response_data.py +15 -0
  346. frameio/types/webhook_events.py +5 -0
  347. frameio/types/webhook_response.py +13 -0
  348. frameio/types/webhook_with_includes.py +13 -0
  349. frameio/types/webhook_with_includes_response.py +13 -0
  350. frameio/types/webhooks_with_includes_response.py +23 -0
  351. frameio/types/workspace.py +40 -0
  352. frameio/types/workspace_include.py +5 -0
  353. frameio/types/workspace_params.py +17 -0
  354. frameio/types/workspace_params_data.py +15 -0
  355. frameio/types/workspace_response.py +17 -0
  356. frameio/types/workspace_with_includes.py +13 -0
  357. frameio/types/workspace_with_includes_response.py +17 -0
  358. frameio/types/workspaces_with_includes_response.py +27 -0
  359. frameio/users/__init__.py +4 -0
  360. frameio/users/client.py +100 -0
  361. frameio/users/raw_client.py +234 -0
  362. frameio/version.py +3 -0
  363. frameio/version_stacks/__init__.py +49 -0
  364. frameio/version_stacks/client.py +818 -0
  365. frameio/version_stacks/raw_client.py +1614 -0
  366. frameio/version_stacks/types/__init__.py +47 -0
  367. frameio/version_stacks/types/version_stack_copy_params_data.py +15 -0
  368. frameio/version_stacks/types/version_stack_create_params_data.py +19 -0
  369. frameio/version_stacks/types/version_stack_move_params_data.py +15 -0
  370. frameio/version_stacks/types/version_stacks_show_request_include.py +19 -0
  371. frameio/webhooks/__init__.py +34 -0
  372. frameio/webhooks/client.py +793 -0
  373. frameio/webhooks/raw_client.py +1347 -0
  374. frameio/webhooks/types/__init__.py +38 -0
  375. frameio/webhooks/types/webhook_create_params_data.py +18 -0
  376. frameio/webhooks/types/webhook_update_params_data.py +23 -0
  377. frameio/workspace_permissions/__init__.py +4 -0
  378. frameio/workspace_permissions/client.py +430 -0
  379. frameio/workspace_permissions/raw_client.py +824 -0
  380. frameio/workspaces/__init__.py +4 -0
  381. frameio/workspaces/client.py +563 -0
  382. frameio/workspaces/raw_client.py +1259 -0
  383. frameio-0.0.28.dist-info/METADATA +259 -0
  384. frameio-0.0.28.dist-info/RECORD +385 -0
  385. frameio-0.0.28.dist-info/WHEEL +4 -0
@@ -0,0 +1,2517 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.request_options import RequestOptions
11
+ from ..core.serialization import convert_and_respect_annotation_metadata
12
+ from ..core.unchecked_base_model import construct_type
13
+ from ..errors.bad_request_error import BadRequestError
14
+ from ..errors.forbidden_error import ForbiddenError
15
+ from ..errors.not_found_error import NotFoundError
16
+ from ..errors.too_many_requests_error import TooManyRequestsError
17
+ from ..errors.unauthorized_error import UnauthorizedError
18
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
19
+ from ..types.assets_with_includes_response import AssetsWithIncludesResponse
20
+ from ..types.bad_request import BadRequest
21
+ from ..types.file_copy_response import FileCopyResponse
22
+ from ..types.file_remote_upload_response import FileRemoteUploadResponse
23
+ from ..types.file_response import FileResponse
24
+ from ..types.file_upload_status_response import FileUploadStatusResponse
25
+ from ..types.file_with_includes_response import FileWithIncludesResponse
26
+ from ..types.file_with_media_links_include import FileWithMediaLinksInclude
27
+ from ..types.file_with_upload_urls_response import FileWithUploadUrlsResponse
28
+ from ..types.forbidden import Forbidden
29
+ from ..types.include_total_count import IncludeTotalCount
30
+ from ..types.not_found import NotFound
31
+ from ..types.request_after_opaque_cursor import RequestAfterOpaqueCursor
32
+ from ..types.request_page_size import RequestPageSize
33
+ from ..types.too_many_requests import TooManyRequests
34
+ from ..types.unauthorized import Unauthorized
35
+ from ..types.uuid_ import Uuid
36
+ from .types.file_copy_params_data import FileCopyParamsData
37
+ from .types.file_create_local_upload_params_data import FileCreateLocalUploadParamsData
38
+ from .types.file_create_params_data import FileCreateParamsData
39
+ from .types.file_create_remote_upload_params_data import FileCreateRemoteUploadParamsData
40
+ from .types.file_move_params_data import FileMoveParamsData
41
+ from .types.file_update_params_data import FileUpdateParamsData
42
+ from .types.files_copy_request_copy_comments import FilesCopyRequestCopyComments
43
+
44
+ # this is used as the default value for optional parameters
45
+ OMIT = typing.cast(typing.Any, ...)
46
+
47
+
48
+ class RawFilesClient:
49
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
50
+ self._client_wrapper = client_wrapper
51
+
52
+ def list(
53
+ self,
54
+ account_id: Uuid,
55
+ folder_id: Uuid,
56
+ *,
57
+ include: typing.Optional[FileWithMediaLinksInclude] = None,
58
+ after: typing.Optional[RequestAfterOpaqueCursor] = None,
59
+ page_size: typing.Optional[RequestPageSize] = None,
60
+ include_total_count: typing.Optional[IncludeTotalCount] = None,
61
+ request_options: typing.Optional[RequestOptions] = None,
62
+ ) -> HttpResponse[AssetsWithIncludesResponse]:
63
+ """
64
+ List files in a given folder. <br>Rate Limits: 5 calls per 1 second(s) per account_user
65
+
66
+ Parameters
67
+ ----------
68
+ account_id : Uuid
69
+
70
+
71
+ folder_id : Uuid
72
+
73
+
74
+ include : typing.Optional[FileWithMediaLinksInclude]
75
+
76
+
77
+ after : typing.Optional[RequestAfterOpaqueCursor]
78
+ Opaque Cursor query param for requests returning paginated results.
79
+ <br/>
80
+ NOTE: this value is auto-generated and included as part of links from a previous response. It is not intended to be human readable.
81
+
82
+ page_size : typing.Optional[RequestPageSize]
83
+
84
+
85
+ include_total_count : typing.Optional[IncludeTotalCount]
86
+
87
+
88
+ request_options : typing.Optional[RequestOptions]
89
+ Request-specific configuration.
90
+
91
+ Returns
92
+ -------
93
+ HttpResponse[AssetsWithIncludesResponse]
94
+ OK
95
+ """
96
+ _response = self._client_wrapper.httpx_client.request(
97
+ f"v4/accounts/{jsonable_encoder(account_id)}/folders/{jsonable_encoder(folder_id)}/files",
98
+ method="GET",
99
+ params={
100
+ "include": include,
101
+ "after": after,
102
+ "page_size": page_size,
103
+ "include_total_count": include_total_count,
104
+ },
105
+ request_options=request_options,
106
+ )
107
+ try:
108
+ if 200 <= _response.status_code < 300:
109
+ _data = typing.cast(
110
+ AssetsWithIncludesResponse,
111
+ construct_type(
112
+ type_=AssetsWithIncludesResponse, # type: ignore
113
+ object_=_response.json(),
114
+ ),
115
+ )
116
+ return HttpResponse(response=_response, data=_data)
117
+ if _response.status_code == 400:
118
+ raise BadRequestError(
119
+ headers=dict(_response.headers),
120
+ body=typing.cast(
121
+ BadRequest,
122
+ construct_type(
123
+ type_=BadRequest, # type: ignore
124
+ object_=_response.json(),
125
+ ),
126
+ ),
127
+ )
128
+ if _response.status_code == 401:
129
+ raise UnauthorizedError(
130
+ headers=dict(_response.headers),
131
+ body=typing.cast(
132
+ Unauthorized,
133
+ construct_type(
134
+ type_=Unauthorized, # type: ignore
135
+ object_=_response.json(),
136
+ ),
137
+ ),
138
+ )
139
+ if _response.status_code == 403:
140
+ raise ForbiddenError(
141
+ headers=dict(_response.headers),
142
+ body=typing.cast(
143
+ Forbidden,
144
+ construct_type(
145
+ type_=Forbidden, # type: ignore
146
+ object_=_response.json(),
147
+ ),
148
+ ),
149
+ )
150
+ if _response.status_code == 404:
151
+ raise NotFoundError(
152
+ headers=dict(_response.headers),
153
+ body=typing.cast(
154
+ NotFound,
155
+ construct_type(
156
+ type_=NotFound, # type: ignore
157
+ object_=_response.json(),
158
+ ),
159
+ ),
160
+ )
161
+ if _response.status_code == 422:
162
+ raise UnprocessableEntityError(
163
+ headers=dict(_response.headers),
164
+ body=typing.cast(
165
+ typing.Any,
166
+ construct_type(
167
+ type_=typing.Any, # type: ignore
168
+ object_=_response.json(),
169
+ ),
170
+ ),
171
+ )
172
+ if _response.status_code == 429:
173
+ raise TooManyRequestsError(
174
+ headers=dict(_response.headers),
175
+ body=typing.cast(
176
+ TooManyRequests,
177
+ construct_type(
178
+ type_=TooManyRequests, # type: ignore
179
+ object_=_response.json(),
180
+ ),
181
+ ),
182
+ )
183
+ _response_json = _response.json()
184
+ except JSONDecodeError:
185
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
186
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
187
+
188
+ def create(
189
+ self,
190
+ account_id: Uuid,
191
+ folder_id: Uuid,
192
+ *,
193
+ data: FileCreateParamsData,
194
+ request_options: typing.Optional[RequestOptions] = None,
195
+ ) -> HttpResponse[FileWithUploadUrlsResponse]:
196
+ """
197
+ Create new file under parent folder. `Create file (local upload)` and `Create file (remote upload)` have replaced this endpoint. <br>Rate Limits: 5 calls per 1 second(s) per account_user
198
+
199
+ Parameters
200
+ ----------
201
+ account_id : Uuid
202
+
203
+
204
+ folder_id : Uuid
205
+
206
+
207
+ data : FileCreateParamsData
208
+
209
+ request_options : typing.Optional[RequestOptions]
210
+ Request-specific configuration.
211
+
212
+ Returns
213
+ -------
214
+ HttpResponse[FileWithUploadUrlsResponse]
215
+ Created
216
+ """
217
+ _response = self._client_wrapper.httpx_client.request(
218
+ f"v4/accounts/{jsonable_encoder(account_id)}/folders/{jsonable_encoder(folder_id)}/files",
219
+ method="POST",
220
+ json={
221
+ "data": convert_and_respect_annotation_metadata(
222
+ object_=data, annotation=FileCreateParamsData, direction="write"
223
+ ),
224
+ },
225
+ headers={
226
+ "content-type": "application/json",
227
+ },
228
+ request_options=request_options,
229
+ omit=OMIT,
230
+ )
231
+ try:
232
+ if 200 <= _response.status_code < 300:
233
+ _data = typing.cast(
234
+ FileWithUploadUrlsResponse,
235
+ construct_type(
236
+ type_=FileWithUploadUrlsResponse, # type: ignore
237
+ object_=_response.json(),
238
+ ),
239
+ )
240
+ return HttpResponse(response=_response, data=_data)
241
+ if _response.status_code == 400:
242
+ raise BadRequestError(
243
+ headers=dict(_response.headers),
244
+ body=typing.cast(
245
+ BadRequest,
246
+ construct_type(
247
+ type_=BadRequest, # type: ignore
248
+ object_=_response.json(),
249
+ ),
250
+ ),
251
+ )
252
+ if _response.status_code == 401:
253
+ raise UnauthorizedError(
254
+ headers=dict(_response.headers),
255
+ body=typing.cast(
256
+ Unauthorized,
257
+ construct_type(
258
+ type_=Unauthorized, # type: ignore
259
+ object_=_response.json(),
260
+ ),
261
+ ),
262
+ )
263
+ if _response.status_code == 403:
264
+ raise ForbiddenError(
265
+ headers=dict(_response.headers),
266
+ body=typing.cast(
267
+ Forbidden,
268
+ construct_type(
269
+ type_=Forbidden, # type: ignore
270
+ object_=_response.json(),
271
+ ),
272
+ ),
273
+ )
274
+ if _response.status_code == 404:
275
+ raise NotFoundError(
276
+ headers=dict(_response.headers),
277
+ body=typing.cast(
278
+ NotFound,
279
+ construct_type(
280
+ type_=NotFound, # type: ignore
281
+ object_=_response.json(),
282
+ ),
283
+ ),
284
+ )
285
+ if _response.status_code == 422:
286
+ raise UnprocessableEntityError(
287
+ headers=dict(_response.headers),
288
+ body=typing.cast(
289
+ typing.Any,
290
+ construct_type(
291
+ type_=typing.Any, # type: ignore
292
+ object_=_response.json(),
293
+ ),
294
+ ),
295
+ )
296
+ if _response.status_code == 429:
297
+ raise TooManyRequestsError(
298
+ headers=dict(_response.headers),
299
+ body=typing.cast(
300
+ TooManyRequests,
301
+ construct_type(
302
+ type_=TooManyRequests, # type: ignore
303
+ object_=_response.json(),
304
+ ),
305
+ ),
306
+ )
307
+ _response_json = _response.json()
308
+ except JSONDecodeError:
309
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
310
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
311
+
312
+ def show(
313
+ self,
314
+ account_id: Uuid,
315
+ file_id: Uuid,
316
+ *,
317
+ include: typing.Optional[FileWithMediaLinksInclude] = None,
318
+ request_options: typing.Optional[RequestOptions] = None,
319
+ ) -> HttpResponse[FileWithIncludesResponse]:
320
+ """
321
+ Show file details.
322
+ <br>
323
+ Use the `include` query parameter to selectively include additional properties in the response.
324
+ <br>
325
+ Note: if you include `media_links.original` and the user does not have permission to download the file
326
+ then this endpoint will respond with a `403 Forbidden` error. If the content is inaccessible because
327
+ watermarking is required for this user and isn't supported by the requested media_links, then the request will
328
+ succeed but the unsupported media links will be set to null.
329
+ Similarly, if a requested transcode link does not exist for a particular file (e.g. including
330
+ `media_links.video_h264_180` on a static image file) or transoding process hasn't completed
331
+ (i.e. the file's `status` is "uploaded" rather than "transcoded"), then the link will also be set to null in
332
+ the response payload. In short, the client must handle null media links gracefully.
333
+ <br>Rate Limits: 5 calls per 1 second(s) per account_user
334
+
335
+ Parameters
336
+ ----------
337
+ account_id : Uuid
338
+
339
+
340
+ file_id : Uuid
341
+
342
+
343
+ include : typing.Optional[FileWithMediaLinksInclude]
344
+
345
+
346
+ request_options : typing.Optional[RequestOptions]
347
+ Request-specific configuration.
348
+
349
+ Returns
350
+ -------
351
+ HttpResponse[FileWithIncludesResponse]
352
+ OK
353
+ """
354
+ _response = self._client_wrapper.httpx_client.request(
355
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}",
356
+ method="GET",
357
+ params={
358
+ "include": include,
359
+ },
360
+ request_options=request_options,
361
+ )
362
+ try:
363
+ if 200 <= _response.status_code < 300:
364
+ _data = typing.cast(
365
+ FileWithIncludesResponse,
366
+ construct_type(
367
+ type_=FileWithIncludesResponse, # type: ignore
368
+ object_=_response.json(),
369
+ ),
370
+ )
371
+ return HttpResponse(response=_response, data=_data)
372
+ if _response.status_code == 400:
373
+ raise BadRequestError(
374
+ headers=dict(_response.headers),
375
+ body=typing.cast(
376
+ BadRequest,
377
+ construct_type(
378
+ type_=BadRequest, # type: ignore
379
+ object_=_response.json(),
380
+ ),
381
+ ),
382
+ )
383
+ if _response.status_code == 401:
384
+ raise UnauthorizedError(
385
+ headers=dict(_response.headers),
386
+ body=typing.cast(
387
+ Unauthorized,
388
+ construct_type(
389
+ type_=Unauthorized, # type: ignore
390
+ object_=_response.json(),
391
+ ),
392
+ ),
393
+ )
394
+ if _response.status_code == 403:
395
+ raise ForbiddenError(
396
+ headers=dict(_response.headers),
397
+ body=typing.cast(
398
+ Forbidden,
399
+ construct_type(
400
+ type_=Forbidden, # type: ignore
401
+ object_=_response.json(),
402
+ ),
403
+ ),
404
+ )
405
+ if _response.status_code == 404:
406
+ raise NotFoundError(
407
+ headers=dict(_response.headers),
408
+ body=typing.cast(
409
+ NotFound,
410
+ construct_type(
411
+ type_=NotFound, # type: ignore
412
+ object_=_response.json(),
413
+ ),
414
+ ),
415
+ )
416
+ if _response.status_code == 422:
417
+ raise UnprocessableEntityError(
418
+ headers=dict(_response.headers),
419
+ body=typing.cast(
420
+ typing.Any,
421
+ construct_type(
422
+ type_=typing.Any, # type: ignore
423
+ object_=_response.json(),
424
+ ),
425
+ ),
426
+ )
427
+ if _response.status_code == 429:
428
+ raise TooManyRequestsError(
429
+ headers=dict(_response.headers),
430
+ body=typing.cast(
431
+ TooManyRequests,
432
+ construct_type(
433
+ type_=TooManyRequests, # type: ignore
434
+ object_=_response.json(),
435
+ ),
436
+ ),
437
+ )
438
+ _response_json = _response.json()
439
+ except JSONDecodeError:
440
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
441
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
442
+
443
+ def delete(
444
+ self, account_id: Uuid, file_id: Uuid, *, request_options: typing.Optional[RequestOptions] = None
445
+ ) -> HttpResponse[None]:
446
+ """
447
+ Delete file by ID. <br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
448
+
449
+ Parameters
450
+ ----------
451
+ account_id : Uuid
452
+
453
+
454
+ file_id : Uuid
455
+
456
+
457
+ request_options : typing.Optional[RequestOptions]
458
+ Request-specific configuration.
459
+
460
+ Returns
461
+ -------
462
+ HttpResponse[None]
463
+ """
464
+ _response = self._client_wrapper.httpx_client.request(
465
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}",
466
+ method="DELETE",
467
+ request_options=request_options,
468
+ )
469
+ try:
470
+ if 200 <= _response.status_code < 300:
471
+ return HttpResponse(response=_response, data=None)
472
+ if _response.status_code == 400:
473
+ raise BadRequestError(
474
+ headers=dict(_response.headers),
475
+ body=typing.cast(
476
+ BadRequest,
477
+ construct_type(
478
+ type_=BadRequest, # type: ignore
479
+ object_=_response.json(),
480
+ ),
481
+ ),
482
+ )
483
+ if _response.status_code == 401:
484
+ raise UnauthorizedError(
485
+ headers=dict(_response.headers),
486
+ body=typing.cast(
487
+ Unauthorized,
488
+ construct_type(
489
+ type_=Unauthorized, # type: ignore
490
+ object_=_response.json(),
491
+ ),
492
+ ),
493
+ )
494
+ if _response.status_code == 403:
495
+ raise ForbiddenError(
496
+ headers=dict(_response.headers),
497
+ body=typing.cast(
498
+ Forbidden,
499
+ construct_type(
500
+ type_=Forbidden, # type: ignore
501
+ object_=_response.json(),
502
+ ),
503
+ ),
504
+ )
505
+ if _response.status_code == 404:
506
+ raise NotFoundError(
507
+ headers=dict(_response.headers),
508
+ body=typing.cast(
509
+ NotFound,
510
+ construct_type(
511
+ type_=NotFound, # type: ignore
512
+ object_=_response.json(),
513
+ ),
514
+ ),
515
+ )
516
+ if _response.status_code == 422:
517
+ raise UnprocessableEntityError(
518
+ headers=dict(_response.headers),
519
+ body=typing.cast(
520
+ typing.Any,
521
+ construct_type(
522
+ type_=typing.Any, # type: ignore
523
+ object_=_response.json(),
524
+ ),
525
+ ),
526
+ )
527
+ if _response.status_code == 429:
528
+ raise TooManyRequestsError(
529
+ headers=dict(_response.headers),
530
+ body=typing.cast(
531
+ TooManyRequests,
532
+ construct_type(
533
+ type_=TooManyRequests, # type: ignore
534
+ object_=_response.json(),
535
+ ),
536
+ ),
537
+ )
538
+ _response_json = _response.json()
539
+ except JSONDecodeError:
540
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
541
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
542
+
543
+ def update(
544
+ self,
545
+ account_id: Uuid,
546
+ file_id: Uuid,
547
+ *,
548
+ data: FileUpdateParamsData,
549
+ request_options: typing.Optional[RequestOptions] = None,
550
+ ) -> HttpResponse[FileResponse]:
551
+ """
552
+ Update file details. <br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
553
+
554
+ Parameters
555
+ ----------
556
+ account_id : Uuid
557
+
558
+
559
+ file_id : Uuid
560
+
561
+
562
+ data : FileUpdateParamsData
563
+
564
+ request_options : typing.Optional[RequestOptions]
565
+ Request-specific configuration.
566
+
567
+ Returns
568
+ -------
569
+ HttpResponse[FileResponse]
570
+ OK
571
+ """
572
+ _response = self._client_wrapper.httpx_client.request(
573
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}",
574
+ method="PATCH",
575
+ json={
576
+ "data": convert_and_respect_annotation_metadata(
577
+ object_=data, annotation=FileUpdateParamsData, direction="write"
578
+ ),
579
+ },
580
+ headers={
581
+ "content-type": "application/json",
582
+ },
583
+ request_options=request_options,
584
+ omit=OMIT,
585
+ )
586
+ try:
587
+ if 200 <= _response.status_code < 300:
588
+ _data = typing.cast(
589
+ FileResponse,
590
+ construct_type(
591
+ type_=FileResponse, # type: ignore
592
+ object_=_response.json(),
593
+ ),
594
+ )
595
+ return HttpResponse(response=_response, data=_data)
596
+ if _response.status_code == 400:
597
+ raise BadRequestError(
598
+ headers=dict(_response.headers),
599
+ body=typing.cast(
600
+ BadRequest,
601
+ construct_type(
602
+ type_=BadRequest, # type: ignore
603
+ object_=_response.json(),
604
+ ),
605
+ ),
606
+ )
607
+ if _response.status_code == 401:
608
+ raise UnauthorizedError(
609
+ headers=dict(_response.headers),
610
+ body=typing.cast(
611
+ Unauthorized,
612
+ construct_type(
613
+ type_=Unauthorized, # type: ignore
614
+ object_=_response.json(),
615
+ ),
616
+ ),
617
+ )
618
+ if _response.status_code == 403:
619
+ raise ForbiddenError(
620
+ headers=dict(_response.headers),
621
+ body=typing.cast(
622
+ Forbidden,
623
+ construct_type(
624
+ type_=Forbidden, # type: ignore
625
+ object_=_response.json(),
626
+ ),
627
+ ),
628
+ )
629
+ if _response.status_code == 404:
630
+ raise NotFoundError(
631
+ headers=dict(_response.headers),
632
+ body=typing.cast(
633
+ NotFound,
634
+ construct_type(
635
+ type_=NotFound, # type: ignore
636
+ object_=_response.json(),
637
+ ),
638
+ ),
639
+ )
640
+ if _response.status_code == 422:
641
+ raise UnprocessableEntityError(
642
+ headers=dict(_response.headers),
643
+ body=typing.cast(
644
+ typing.Any,
645
+ construct_type(
646
+ type_=typing.Any, # type: ignore
647
+ object_=_response.json(),
648
+ ),
649
+ ),
650
+ )
651
+ if _response.status_code == 429:
652
+ raise TooManyRequestsError(
653
+ headers=dict(_response.headers),
654
+ body=typing.cast(
655
+ TooManyRequests,
656
+ construct_type(
657
+ type_=TooManyRequests, # type: ignore
658
+ object_=_response.json(),
659
+ ),
660
+ ),
661
+ )
662
+ _response_json = _response.json()
663
+ except JSONDecodeError:
664
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
665
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
666
+
667
+ def copy(
668
+ self,
669
+ account_id: Uuid,
670
+ file_id: Uuid,
671
+ *,
672
+ copy_metadata: typing.Optional[bool] = None,
673
+ copy_comments: typing.Optional[FilesCopyRequestCopyComments] = None,
674
+ data: typing.Optional[FileCopyParamsData] = OMIT,
675
+ request_options: typing.Optional[RequestOptions] = None,
676
+ ) -> HttpResponse[FileCopyResponse]:
677
+ """
678
+ Copy file. <br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
679
+
680
+ Parameters
681
+ ----------
682
+ account_id : Uuid
683
+
684
+
685
+ file_id : Uuid
686
+
687
+
688
+ copy_metadata : typing.Optional[bool]
689
+ Whether to copy metadata values along with the file
690
+
691
+ copy_comments : typing.Optional[FilesCopyRequestCopyComments]
692
+ Which comments to copy along with the file
693
+
694
+ data : typing.Optional[FileCopyParamsData]
695
+
696
+ request_options : typing.Optional[RequestOptions]
697
+ Request-specific configuration.
698
+
699
+ Returns
700
+ -------
701
+ HttpResponse[FileCopyResponse]
702
+ OK
703
+ """
704
+ _response = self._client_wrapper.httpx_client.request(
705
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}/copy",
706
+ method="POST",
707
+ params={
708
+ "copy_metadata": copy_metadata,
709
+ "copy_comments": copy_comments,
710
+ },
711
+ json={
712
+ "data": convert_and_respect_annotation_metadata(
713
+ object_=data, annotation=FileCopyParamsData, direction="write"
714
+ ),
715
+ },
716
+ headers={
717
+ "content-type": "application/json",
718
+ },
719
+ request_options=request_options,
720
+ omit=OMIT,
721
+ )
722
+ try:
723
+ if 200 <= _response.status_code < 300:
724
+ _data = typing.cast(
725
+ FileCopyResponse,
726
+ construct_type(
727
+ type_=FileCopyResponse, # type: ignore
728
+ object_=_response.json(),
729
+ ),
730
+ )
731
+ return HttpResponse(response=_response, data=_data)
732
+ if _response.status_code == 400:
733
+ raise BadRequestError(
734
+ headers=dict(_response.headers),
735
+ body=typing.cast(
736
+ BadRequest,
737
+ construct_type(
738
+ type_=BadRequest, # type: ignore
739
+ object_=_response.json(),
740
+ ),
741
+ ),
742
+ )
743
+ if _response.status_code == 401:
744
+ raise UnauthorizedError(
745
+ headers=dict(_response.headers),
746
+ body=typing.cast(
747
+ Unauthorized,
748
+ construct_type(
749
+ type_=Unauthorized, # type: ignore
750
+ object_=_response.json(),
751
+ ),
752
+ ),
753
+ )
754
+ if _response.status_code == 403:
755
+ raise ForbiddenError(
756
+ headers=dict(_response.headers),
757
+ body=typing.cast(
758
+ Forbidden,
759
+ construct_type(
760
+ type_=Forbidden, # type: ignore
761
+ object_=_response.json(),
762
+ ),
763
+ ),
764
+ )
765
+ if _response.status_code == 404:
766
+ raise NotFoundError(
767
+ headers=dict(_response.headers),
768
+ body=typing.cast(
769
+ NotFound,
770
+ construct_type(
771
+ type_=NotFound, # type: ignore
772
+ object_=_response.json(),
773
+ ),
774
+ ),
775
+ )
776
+ if _response.status_code == 422:
777
+ raise UnprocessableEntityError(
778
+ headers=dict(_response.headers),
779
+ body=typing.cast(
780
+ typing.Any,
781
+ construct_type(
782
+ type_=typing.Any, # type: ignore
783
+ object_=_response.json(),
784
+ ),
785
+ ),
786
+ )
787
+ if _response.status_code == 429:
788
+ raise TooManyRequestsError(
789
+ headers=dict(_response.headers),
790
+ body=typing.cast(
791
+ TooManyRequests,
792
+ construct_type(
793
+ type_=TooManyRequests, # type: ignore
794
+ object_=_response.json(),
795
+ ),
796
+ ),
797
+ )
798
+ _response_json = _response.json()
799
+ except JSONDecodeError:
800
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
801
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
802
+
803
+ def create_remote_upload(
804
+ self,
805
+ account_id: Uuid,
806
+ folder_id: Uuid,
807
+ *,
808
+ data: FileCreateRemoteUploadParamsData,
809
+ request_options: typing.Optional[RequestOptions] = None,
810
+ ) -> HttpResponse[FileRemoteUploadResponse]:
811
+ """
812
+ Create new file under parent folder through remote upload. <br>Rate Limits: 5 calls per 1 second(s) per account_user
813
+
814
+ Parameters
815
+ ----------
816
+ account_id : Uuid
817
+
818
+
819
+ folder_id : Uuid
820
+
821
+
822
+ data : FileCreateRemoteUploadParamsData
823
+
824
+ request_options : typing.Optional[RequestOptions]
825
+ Request-specific configuration.
826
+
827
+ Returns
828
+ -------
829
+ HttpResponse[FileRemoteUploadResponse]
830
+ Accepted
831
+ """
832
+ _response = self._client_wrapper.httpx_client.request(
833
+ f"v4/accounts/{jsonable_encoder(account_id)}/folders/{jsonable_encoder(folder_id)}/files/remote_upload",
834
+ method="POST",
835
+ json={
836
+ "data": convert_and_respect_annotation_metadata(
837
+ object_=data, annotation=FileCreateRemoteUploadParamsData, direction="write"
838
+ ),
839
+ },
840
+ headers={
841
+ "content-type": "application/json",
842
+ },
843
+ request_options=request_options,
844
+ omit=OMIT,
845
+ )
846
+ try:
847
+ if 200 <= _response.status_code < 300:
848
+ _data = typing.cast(
849
+ FileRemoteUploadResponse,
850
+ construct_type(
851
+ type_=FileRemoteUploadResponse, # type: ignore
852
+ object_=_response.json(),
853
+ ),
854
+ )
855
+ return HttpResponse(response=_response, data=_data)
856
+ if _response.status_code == 400:
857
+ raise BadRequestError(
858
+ headers=dict(_response.headers),
859
+ body=typing.cast(
860
+ BadRequest,
861
+ construct_type(
862
+ type_=BadRequest, # type: ignore
863
+ object_=_response.json(),
864
+ ),
865
+ ),
866
+ )
867
+ if _response.status_code == 401:
868
+ raise UnauthorizedError(
869
+ headers=dict(_response.headers),
870
+ body=typing.cast(
871
+ Unauthorized,
872
+ construct_type(
873
+ type_=Unauthorized, # type: ignore
874
+ object_=_response.json(),
875
+ ),
876
+ ),
877
+ )
878
+ if _response.status_code == 403:
879
+ raise ForbiddenError(
880
+ headers=dict(_response.headers),
881
+ body=typing.cast(
882
+ Forbidden,
883
+ construct_type(
884
+ type_=Forbidden, # type: ignore
885
+ object_=_response.json(),
886
+ ),
887
+ ),
888
+ )
889
+ if _response.status_code == 404:
890
+ raise NotFoundError(
891
+ headers=dict(_response.headers),
892
+ body=typing.cast(
893
+ NotFound,
894
+ construct_type(
895
+ type_=NotFound, # type: ignore
896
+ object_=_response.json(),
897
+ ),
898
+ ),
899
+ )
900
+ if _response.status_code == 422:
901
+ raise UnprocessableEntityError(
902
+ headers=dict(_response.headers),
903
+ body=typing.cast(
904
+ typing.Any,
905
+ construct_type(
906
+ type_=typing.Any, # type: ignore
907
+ object_=_response.json(),
908
+ ),
909
+ ),
910
+ )
911
+ if _response.status_code == 429:
912
+ raise TooManyRequestsError(
913
+ headers=dict(_response.headers),
914
+ body=typing.cast(
915
+ TooManyRequests,
916
+ construct_type(
917
+ type_=TooManyRequests, # type: ignore
918
+ object_=_response.json(),
919
+ ),
920
+ ),
921
+ )
922
+ _response_json = _response.json()
923
+ except JSONDecodeError:
924
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
925
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
926
+
927
+ def move(
928
+ self,
929
+ account_id: Uuid,
930
+ file_id: Uuid,
931
+ *,
932
+ data: FileMoveParamsData,
933
+ request_options: typing.Optional[RequestOptions] = None,
934
+ ) -> HttpResponse[FileResponse]:
935
+ """
936
+ Move file to a folder or version_stack. <br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
937
+
938
+ Parameters
939
+ ----------
940
+ account_id : Uuid
941
+
942
+
943
+ file_id : Uuid
944
+
945
+
946
+ data : FileMoveParamsData
947
+
948
+ request_options : typing.Optional[RequestOptions]
949
+ Request-specific configuration.
950
+
951
+ Returns
952
+ -------
953
+ HttpResponse[FileResponse]
954
+ OK
955
+ """
956
+ _response = self._client_wrapper.httpx_client.request(
957
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}/move",
958
+ method="PATCH",
959
+ json={
960
+ "data": convert_and_respect_annotation_metadata(
961
+ object_=data, annotation=FileMoveParamsData, direction="write"
962
+ ),
963
+ },
964
+ headers={
965
+ "content-type": "application/json",
966
+ },
967
+ request_options=request_options,
968
+ omit=OMIT,
969
+ )
970
+ try:
971
+ if 200 <= _response.status_code < 300:
972
+ _data = typing.cast(
973
+ FileResponse,
974
+ construct_type(
975
+ type_=FileResponse, # type: ignore
976
+ object_=_response.json(),
977
+ ),
978
+ )
979
+ return HttpResponse(response=_response, data=_data)
980
+ if _response.status_code == 400:
981
+ raise BadRequestError(
982
+ headers=dict(_response.headers),
983
+ body=typing.cast(
984
+ BadRequest,
985
+ construct_type(
986
+ type_=BadRequest, # type: ignore
987
+ object_=_response.json(),
988
+ ),
989
+ ),
990
+ )
991
+ if _response.status_code == 401:
992
+ raise UnauthorizedError(
993
+ headers=dict(_response.headers),
994
+ body=typing.cast(
995
+ Unauthorized,
996
+ construct_type(
997
+ type_=Unauthorized, # type: ignore
998
+ object_=_response.json(),
999
+ ),
1000
+ ),
1001
+ )
1002
+ if _response.status_code == 403:
1003
+ raise ForbiddenError(
1004
+ headers=dict(_response.headers),
1005
+ body=typing.cast(
1006
+ Forbidden,
1007
+ construct_type(
1008
+ type_=Forbidden, # type: ignore
1009
+ object_=_response.json(),
1010
+ ),
1011
+ ),
1012
+ )
1013
+ if _response.status_code == 404:
1014
+ raise NotFoundError(
1015
+ headers=dict(_response.headers),
1016
+ body=typing.cast(
1017
+ NotFound,
1018
+ construct_type(
1019
+ type_=NotFound, # type: ignore
1020
+ object_=_response.json(),
1021
+ ),
1022
+ ),
1023
+ )
1024
+ if _response.status_code == 422:
1025
+ raise UnprocessableEntityError(
1026
+ headers=dict(_response.headers),
1027
+ body=typing.cast(
1028
+ typing.Any,
1029
+ construct_type(
1030
+ type_=typing.Any, # type: ignore
1031
+ object_=_response.json(),
1032
+ ),
1033
+ ),
1034
+ )
1035
+ if _response.status_code == 429:
1036
+ raise TooManyRequestsError(
1037
+ headers=dict(_response.headers),
1038
+ body=typing.cast(
1039
+ TooManyRequests,
1040
+ construct_type(
1041
+ type_=TooManyRequests, # type: ignore
1042
+ object_=_response.json(),
1043
+ ),
1044
+ ),
1045
+ )
1046
+ _response_json = _response.json()
1047
+ except JSONDecodeError:
1048
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1049
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1050
+
1051
+ def create_local_upload(
1052
+ self,
1053
+ account_id: Uuid,
1054
+ folder_id: Uuid,
1055
+ *,
1056
+ data: FileCreateLocalUploadParamsData,
1057
+ request_options: typing.Optional[RequestOptions] = None,
1058
+ ) -> HttpResponse[FileWithUploadUrlsResponse]:
1059
+ """
1060
+ Create new file under parent folder through local upload. <br>Rate Limits: 5 calls per 1 second(s) per account_user
1061
+
1062
+ Parameters
1063
+ ----------
1064
+ account_id : Uuid
1065
+
1066
+
1067
+ folder_id : Uuid
1068
+
1069
+
1070
+ data : FileCreateLocalUploadParamsData
1071
+
1072
+ request_options : typing.Optional[RequestOptions]
1073
+ Request-specific configuration.
1074
+
1075
+ Returns
1076
+ -------
1077
+ HttpResponse[FileWithUploadUrlsResponse]
1078
+ Created
1079
+ """
1080
+ _response = self._client_wrapper.httpx_client.request(
1081
+ f"v4/accounts/{jsonable_encoder(account_id)}/folders/{jsonable_encoder(folder_id)}/files/local_upload",
1082
+ method="POST",
1083
+ json={
1084
+ "data": convert_and_respect_annotation_metadata(
1085
+ object_=data, annotation=FileCreateLocalUploadParamsData, direction="write"
1086
+ ),
1087
+ },
1088
+ headers={
1089
+ "content-type": "application/json",
1090
+ },
1091
+ request_options=request_options,
1092
+ omit=OMIT,
1093
+ )
1094
+ try:
1095
+ if 200 <= _response.status_code < 300:
1096
+ _data = typing.cast(
1097
+ FileWithUploadUrlsResponse,
1098
+ construct_type(
1099
+ type_=FileWithUploadUrlsResponse, # type: ignore
1100
+ object_=_response.json(),
1101
+ ),
1102
+ )
1103
+ return HttpResponse(response=_response, data=_data)
1104
+ if _response.status_code == 400:
1105
+ raise BadRequestError(
1106
+ headers=dict(_response.headers),
1107
+ body=typing.cast(
1108
+ BadRequest,
1109
+ construct_type(
1110
+ type_=BadRequest, # type: ignore
1111
+ object_=_response.json(),
1112
+ ),
1113
+ ),
1114
+ )
1115
+ if _response.status_code == 401:
1116
+ raise UnauthorizedError(
1117
+ headers=dict(_response.headers),
1118
+ body=typing.cast(
1119
+ Unauthorized,
1120
+ construct_type(
1121
+ type_=Unauthorized, # type: ignore
1122
+ object_=_response.json(),
1123
+ ),
1124
+ ),
1125
+ )
1126
+ if _response.status_code == 403:
1127
+ raise ForbiddenError(
1128
+ headers=dict(_response.headers),
1129
+ body=typing.cast(
1130
+ Forbidden,
1131
+ construct_type(
1132
+ type_=Forbidden, # type: ignore
1133
+ object_=_response.json(),
1134
+ ),
1135
+ ),
1136
+ )
1137
+ if _response.status_code == 404:
1138
+ raise NotFoundError(
1139
+ headers=dict(_response.headers),
1140
+ body=typing.cast(
1141
+ NotFound,
1142
+ construct_type(
1143
+ type_=NotFound, # type: ignore
1144
+ object_=_response.json(),
1145
+ ),
1146
+ ),
1147
+ )
1148
+ if _response.status_code == 422:
1149
+ raise UnprocessableEntityError(
1150
+ headers=dict(_response.headers),
1151
+ body=typing.cast(
1152
+ typing.Any,
1153
+ construct_type(
1154
+ type_=typing.Any, # type: ignore
1155
+ object_=_response.json(),
1156
+ ),
1157
+ ),
1158
+ )
1159
+ if _response.status_code == 429:
1160
+ raise TooManyRequestsError(
1161
+ headers=dict(_response.headers),
1162
+ body=typing.cast(
1163
+ TooManyRequests,
1164
+ construct_type(
1165
+ type_=TooManyRequests, # type: ignore
1166
+ object_=_response.json(),
1167
+ ),
1168
+ ),
1169
+ )
1170
+ _response_json = _response.json()
1171
+ except JSONDecodeError:
1172
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1173
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1174
+
1175
+ def show_file_upload_status(
1176
+ self, account_id: Uuid, file_id: Uuid, *, request_options: typing.Optional[RequestOptions] = None
1177
+ ) -> HttpResponse[FileUploadStatusResponse]:
1178
+ """
1179
+ Show file upload status details. <br>Rate Limits: 5 calls per 1 second(s) per account_user
1180
+
1181
+ Parameters
1182
+ ----------
1183
+ account_id : Uuid
1184
+
1185
+
1186
+ file_id : Uuid
1187
+
1188
+
1189
+ request_options : typing.Optional[RequestOptions]
1190
+ Request-specific configuration.
1191
+
1192
+ Returns
1193
+ -------
1194
+ HttpResponse[FileUploadStatusResponse]
1195
+ OK
1196
+ """
1197
+ _response = self._client_wrapper.httpx_client.request(
1198
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}/status",
1199
+ method="GET",
1200
+ request_options=request_options,
1201
+ )
1202
+ try:
1203
+ if 200 <= _response.status_code < 300:
1204
+ _data = typing.cast(
1205
+ FileUploadStatusResponse,
1206
+ construct_type(
1207
+ type_=FileUploadStatusResponse, # type: ignore
1208
+ object_=_response.json(),
1209
+ ),
1210
+ )
1211
+ return HttpResponse(response=_response, data=_data)
1212
+ if _response.status_code == 400:
1213
+ raise BadRequestError(
1214
+ headers=dict(_response.headers),
1215
+ body=typing.cast(
1216
+ BadRequest,
1217
+ construct_type(
1218
+ type_=BadRequest, # type: ignore
1219
+ object_=_response.json(),
1220
+ ),
1221
+ ),
1222
+ )
1223
+ if _response.status_code == 401:
1224
+ raise UnauthorizedError(
1225
+ headers=dict(_response.headers),
1226
+ body=typing.cast(
1227
+ Unauthorized,
1228
+ construct_type(
1229
+ type_=Unauthorized, # type: ignore
1230
+ object_=_response.json(),
1231
+ ),
1232
+ ),
1233
+ )
1234
+ if _response.status_code == 403:
1235
+ raise ForbiddenError(
1236
+ headers=dict(_response.headers),
1237
+ body=typing.cast(
1238
+ Forbidden,
1239
+ construct_type(
1240
+ type_=Forbidden, # type: ignore
1241
+ object_=_response.json(),
1242
+ ),
1243
+ ),
1244
+ )
1245
+ if _response.status_code == 404:
1246
+ raise NotFoundError(
1247
+ headers=dict(_response.headers),
1248
+ body=typing.cast(
1249
+ NotFound,
1250
+ construct_type(
1251
+ type_=NotFound, # type: ignore
1252
+ object_=_response.json(),
1253
+ ),
1254
+ ),
1255
+ )
1256
+ if _response.status_code == 422:
1257
+ raise UnprocessableEntityError(
1258
+ headers=dict(_response.headers),
1259
+ body=typing.cast(
1260
+ typing.Any,
1261
+ construct_type(
1262
+ type_=typing.Any, # type: ignore
1263
+ object_=_response.json(),
1264
+ ),
1265
+ ),
1266
+ )
1267
+ if _response.status_code == 429:
1268
+ raise TooManyRequestsError(
1269
+ headers=dict(_response.headers),
1270
+ body=typing.cast(
1271
+ TooManyRequests,
1272
+ construct_type(
1273
+ type_=TooManyRequests, # type: ignore
1274
+ object_=_response.json(),
1275
+ ),
1276
+ ),
1277
+ )
1278
+ _response_json = _response.json()
1279
+ except JSONDecodeError:
1280
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1281
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1282
+
1283
+
1284
+ class AsyncRawFilesClient:
1285
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
1286
+ self._client_wrapper = client_wrapper
1287
+
1288
+ async def list(
1289
+ self,
1290
+ account_id: Uuid,
1291
+ folder_id: Uuid,
1292
+ *,
1293
+ include: typing.Optional[FileWithMediaLinksInclude] = None,
1294
+ after: typing.Optional[RequestAfterOpaqueCursor] = None,
1295
+ page_size: typing.Optional[RequestPageSize] = None,
1296
+ include_total_count: typing.Optional[IncludeTotalCount] = None,
1297
+ request_options: typing.Optional[RequestOptions] = None,
1298
+ ) -> AsyncHttpResponse[AssetsWithIncludesResponse]:
1299
+ """
1300
+ List files in a given folder. <br>Rate Limits: 5 calls per 1 second(s) per account_user
1301
+
1302
+ Parameters
1303
+ ----------
1304
+ account_id : Uuid
1305
+
1306
+
1307
+ folder_id : Uuid
1308
+
1309
+
1310
+ include : typing.Optional[FileWithMediaLinksInclude]
1311
+
1312
+
1313
+ after : typing.Optional[RequestAfterOpaqueCursor]
1314
+ Opaque Cursor query param for requests returning paginated results.
1315
+ <br/>
1316
+ NOTE: this value is auto-generated and included as part of links from a previous response. It is not intended to be human readable.
1317
+
1318
+ page_size : typing.Optional[RequestPageSize]
1319
+
1320
+
1321
+ include_total_count : typing.Optional[IncludeTotalCount]
1322
+
1323
+
1324
+ request_options : typing.Optional[RequestOptions]
1325
+ Request-specific configuration.
1326
+
1327
+ Returns
1328
+ -------
1329
+ AsyncHttpResponse[AssetsWithIncludesResponse]
1330
+ OK
1331
+ """
1332
+ _response = await self._client_wrapper.httpx_client.request(
1333
+ f"v4/accounts/{jsonable_encoder(account_id)}/folders/{jsonable_encoder(folder_id)}/files",
1334
+ method="GET",
1335
+ params={
1336
+ "include": include,
1337
+ "after": after,
1338
+ "page_size": page_size,
1339
+ "include_total_count": include_total_count,
1340
+ },
1341
+ request_options=request_options,
1342
+ )
1343
+ try:
1344
+ if 200 <= _response.status_code < 300:
1345
+ _data = typing.cast(
1346
+ AssetsWithIncludesResponse,
1347
+ construct_type(
1348
+ type_=AssetsWithIncludesResponse, # type: ignore
1349
+ object_=_response.json(),
1350
+ ),
1351
+ )
1352
+ return AsyncHttpResponse(response=_response, data=_data)
1353
+ if _response.status_code == 400:
1354
+ raise BadRequestError(
1355
+ headers=dict(_response.headers),
1356
+ body=typing.cast(
1357
+ BadRequest,
1358
+ construct_type(
1359
+ type_=BadRequest, # type: ignore
1360
+ object_=_response.json(),
1361
+ ),
1362
+ ),
1363
+ )
1364
+ if _response.status_code == 401:
1365
+ raise UnauthorizedError(
1366
+ headers=dict(_response.headers),
1367
+ body=typing.cast(
1368
+ Unauthorized,
1369
+ construct_type(
1370
+ type_=Unauthorized, # type: ignore
1371
+ object_=_response.json(),
1372
+ ),
1373
+ ),
1374
+ )
1375
+ if _response.status_code == 403:
1376
+ raise ForbiddenError(
1377
+ headers=dict(_response.headers),
1378
+ body=typing.cast(
1379
+ Forbidden,
1380
+ construct_type(
1381
+ type_=Forbidden, # type: ignore
1382
+ object_=_response.json(),
1383
+ ),
1384
+ ),
1385
+ )
1386
+ if _response.status_code == 404:
1387
+ raise NotFoundError(
1388
+ headers=dict(_response.headers),
1389
+ body=typing.cast(
1390
+ NotFound,
1391
+ construct_type(
1392
+ type_=NotFound, # type: ignore
1393
+ object_=_response.json(),
1394
+ ),
1395
+ ),
1396
+ )
1397
+ if _response.status_code == 422:
1398
+ raise UnprocessableEntityError(
1399
+ headers=dict(_response.headers),
1400
+ body=typing.cast(
1401
+ typing.Any,
1402
+ construct_type(
1403
+ type_=typing.Any, # type: ignore
1404
+ object_=_response.json(),
1405
+ ),
1406
+ ),
1407
+ )
1408
+ if _response.status_code == 429:
1409
+ raise TooManyRequestsError(
1410
+ headers=dict(_response.headers),
1411
+ body=typing.cast(
1412
+ TooManyRequests,
1413
+ construct_type(
1414
+ type_=TooManyRequests, # type: ignore
1415
+ object_=_response.json(),
1416
+ ),
1417
+ ),
1418
+ )
1419
+ _response_json = _response.json()
1420
+ except JSONDecodeError:
1421
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1422
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1423
+
1424
+ async def create(
1425
+ self,
1426
+ account_id: Uuid,
1427
+ folder_id: Uuid,
1428
+ *,
1429
+ data: FileCreateParamsData,
1430
+ request_options: typing.Optional[RequestOptions] = None,
1431
+ ) -> AsyncHttpResponse[FileWithUploadUrlsResponse]:
1432
+ """
1433
+ Create new file under parent folder. `Create file (local upload)` and `Create file (remote upload)` have replaced this endpoint. <br>Rate Limits: 5 calls per 1 second(s) per account_user
1434
+
1435
+ Parameters
1436
+ ----------
1437
+ account_id : Uuid
1438
+
1439
+
1440
+ folder_id : Uuid
1441
+
1442
+
1443
+ data : FileCreateParamsData
1444
+
1445
+ request_options : typing.Optional[RequestOptions]
1446
+ Request-specific configuration.
1447
+
1448
+ Returns
1449
+ -------
1450
+ AsyncHttpResponse[FileWithUploadUrlsResponse]
1451
+ Created
1452
+ """
1453
+ _response = await self._client_wrapper.httpx_client.request(
1454
+ f"v4/accounts/{jsonable_encoder(account_id)}/folders/{jsonable_encoder(folder_id)}/files",
1455
+ method="POST",
1456
+ json={
1457
+ "data": convert_and_respect_annotation_metadata(
1458
+ object_=data, annotation=FileCreateParamsData, direction="write"
1459
+ ),
1460
+ },
1461
+ headers={
1462
+ "content-type": "application/json",
1463
+ },
1464
+ request_options=request_options,
1465
+ omit=OMIT,
1466
+ )
1467
+ try:
1468
+ if 200 <= _response.status_code < 300:
1469
+ _data = typing.cast(
1470
+ FileWithUploadUrlsResponse,
1471
+ construct_type(
1472
+ type_=FileWithUploadUrlsResponse, # type: ignore
1473
+ object_=_response.json(),
1474
+ ),
1475
+ )
1476
+ return AsyncHttpResponse(response=_response, data=_data)
1477
+ if _response.status_code == 400:
1478
+ raise BadRequestError(
1479
+ headers=dict(_response.headers),
1480
+ body=typing.cast(
1481
+ BadRequest,
1482
+ construct_type(
1483
+ type_=BadRequest, # type: ignore
1484
+ object_=_response.json(),
1485
+ ),
1486
+ ),
1487
+ )
1488
+ if _response.status_code == 401:
1489
+ raise UnauthorizedError(
1490
+ headers=dict(_response.headers),
1491
+ body=typing.cast(
1492
+ Unauthorized,
1493
+ construct_type(
1494
+ type_=Unauthorized, # type: ignore
1495
+ object_=_response.json(),
1496
+ ),
1497
+ ),
1498
+ )
1499
+ if _response.status_code == 403:
1500
+ raise ForbiddenError(
1501
+ headers=dict(_response.headers),
1502
+ body=typing.cast(
1503
+ Forbidden,
1504
+ construct_type(
1505
+ type_=Forbidden, # type: ignore
1506
+ object_=_response.json(),
1507
+ ),
1508
+ ),
1509
+ )
1510
+ if _response.status_code == 404:
1511
+ raise NotFoundError(
1512
+ headers=dict(_response.headers),
1513
+ body=typing.cast(
1514
+ NotFound,
1515
+ construct_type(
1516
+ type_=NotFound, # type: ignore
1517
+ object_=_response.json(),
1518
+ ),
1519
+ ),
1520
+ )
1521
+ if _response.status_code == 422:
1522
+ raise UnprocessableEntityError(
1523
+ headers=dict(_response.headers),
1524
+ body=typing.cast(
1525
+ typing.Any,
1526
+ construct_type(
1527
+ type_=typing.Any, # type: ignore
1528
+ object_=_response.json(),
1529
+ ),
1530
+ ),
1531
+ )
1532
+ if _response.status_code == 429:
1533
+ raise TooManyRequestsError(
1534
+ headers=dict(_response.headers),
1535
+ body=typing.cast(
1536
+ TooManyRequests,
1537
+ construct_type(
1538
+ type_=TooManyRequests, # type: ignore
1539
+ object_=_response.json(),
1540
+ ),
1541
+ ),
1542
+ )
1543
+ _response_json = _response.json()
1544
+ except JSONDecodeError:
1545
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1546
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1547
+
1548
+ async def show(
1549
+ self,
1550
+ account_id: Uuid,
1551
+ file_id: Uuid,
1552
+ *,
1553
+ include: typing.Optional[FileWithMediaLinksInclude] = None,
1554
+ request_options: typing.Optional[RequestOptions] = None,
1555
+ ) -> AsyncHttpResponse[FileWithIncludesResponse]:
1556
+ """
1557
+ Show file details.
1558
+ <br>
1559
+ Use the `include` query parameter to selectively include additional properties in the response.
1560
+ <br>
1561
+ Note: if you include `media_links.original` and the user does not have permission to download the file
1562
+ then this endpoint will respond with a `403 Forbidden` error. If the content is inaccessible because
1563
+ watermarking is required for this user and isn't supported by the requested media_links, then the request will
1564
+ succeed but the unsupported media links will be set to null.
1565
+ Similarly, if a requested transcode link does not exist for a particular file (e.g. including
1566
+ `media_links.video_h264_180` on a static image file) or transoding process hasn't completed
1567
+ (i.e. the file's `status` is "uploaded" rather than "transcoded"), then the link will also be set to null in
1568
+ the response payload. In short, the client must handle null media links gracefully.
1569
+ <br>Rate Limits: 5 calls per 1 second(s) per account_user
1570
+
1571
+ Parameters
1572
+ ----------
1573
+ account_id : Uuid
1574
+
1575
+
1576
+ file_id : Uuid
1577
+
1578
+
1579
+ include : typing.Optional[FileWithMediaLinksInclude]
1580
+
1581
+
1582
+ request_options : typing.Optional[RequestOptions]
1583
+ Request-specific configuration.
1584
+
1585
+ Returns
1586
+ -------
1587
+ AsyncHttpResponse[FileWithIncludesResponse]
1588
+ OK
1589
+ """
1590
+ _response = await self._client_wrapper.httpx_client.request(
1591
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}",
1592
+ method="GET",
1593
+ params={
1594
+ "include": include,
1595
+ },
1596
+ request_options=request_options,
1597
+ )
1598
+ try:
1599
+ if 200 <= _response.status_code < 300:
1600
+ _data = typing.cast(
1601
+ FileWithIncludesResponse,
1602
+ construct_type(
1603
+ type_=FileWithIncludesResponse, # type: ignore
1604
+ object_=_response.json(),
1605
+ ),
1606
+ )
1607
+ return AsyncHttpResponse(response=_response, data=_data)
1608
+ if _response.status_code == 400:
1609
+ raise BadRequestError(
1610
+ headers=dict(_response.headers),
1611
+ body=typing.cast(
1612
+ BadRequest,
1613
+ construct_type(
1614
+ type_=BadRequest, # type: ignore
1615
+ object_=_response.json(),
1616
+ ),
1617
+ ),
1618
+ )
1619
+ if _response.status_code == 401:
1620
+ raise UnauthorizedError(
1621
+ headers=dict(_response.headers),
1622
+ body=typing.cast(
1623
+ Unauthorized,
1624
+ construct_type(
1625
+ type_=Unauthorized, # type: ignore
1626
+ object_=_response.json(),
1627
+ ),
1628
+ ),
1629
+ )
1630
+ if _response.status_code == 403:
1631
+ raise ForbiddenError(
1632
+ headers=dict(_response.headers),
1633
+ body=typing.cast(
1634
+ Forbidden,
1635
+ construct_type(
1636
+ type_=Forbidden, # type: ignore
1637
+ object_=_response.json(),
1638
+ ),
1639
+ ),
1640
+ )
1641
+ if _response.status_code == 404:
1642
+ raise NotFoundError(
1643
+ headers=dict(_response.headers),
1644
+ body=typing.cast(
1645
+ NotFound,
1646
+ construct_type(
1647
+ type_=NotFound, # type: ignore
1648
+ object_=_response.json(),
1649
+ ),
1650
+ ),
1651
+ )
1652
+ if _response.status_code == 422:
1653
+ raise UnprocessableEntityError(
1654
+ headers=dict(_response.headers),
1655
+ body=typing.cast(
1656
+ typing.Any,
1657
+ construct_type(
1658
+ type_=typing.Any, # type: ignore
1659
+ object_=_response.json(),
1660
+ ),
1661
+ ),
1662
+ )
1663
+ if _response.status_code == 429:
1664
+ raise TooManyRequestsError(
1665
+ headers=dict(_response.headers),
1666
+ body=typing.cast(
1667
+ TooManyRequests,
1668
+ construct_type(
1669
+ type_=TooManyRequests, # type: ignore
1670
+ object_=_response.json(),
1671
+ ),
1672
+ ),
1673
+ )
1674
+ _response_json = _response.json()
1675
+ except JSONDecodeError:
1676
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1677
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1678
+
1679
+ async def delete(
1680
+ self, account_id: Uuid, file_id: Uuid, *, request_options: typing.Optional[RequestOptions] = None
1681
+ ) -> AsyncHttpResponse[None]:
1682
+ """
1683
+ Delete file by ID. <br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
1684
+
1685
+ Parameters
1686
+ ----------
1687
+ account_id : Uuid
1688
+
1689
+
1690
+ file_id : Uuid
1691
+
1692
+
1693
+ request_options : typing.Optional[RequestOptions]
1694
+ Request-specific configuration.
1695
+
1696
+ Returns
1697
+ -------
1698
+ AsyncHttpResponse[None]
1699
+ """
1700
+ _response = await self._client_wrapper.httpx_client.request(
1701
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}",
1702
+ method="DELETE",
1703
+ request_options=request_options,
1704
+ )
1705
+ try:
1706
+ if 200 <= _response.status_code < 300:
1707
+ return AsyncHttpResponse(response=_response, data=None)
1708
+ if _response.status_code == 400:
1709
+ raise BadRequestError(
1710
+ headers=dict(_response.headers),
1711
+ body=typing.cast(
1712
+ BadRequest,
1713
+ construct_type(
1714
+ type_=BadRequest, # type: ignore
1715
+ object_=_response.json(),
1716
+ ),
1717
+ ),
1718
+ )
1719
+ if _response.status_code == 401:
1720
+ raise UnauthorizedError(
1721
+ headers=dict(_response.headers),
1722
+ body=typing.cast(
1723
+ Unauthorized,
1724
+ construct_type(
1725
+ type_=Unauthorized, # type: ignore
1726
+ object_=_response.json(),
1727
+ ),
1728
+ ),
1729
+ )
1730
+ if _response.status_code == 403:
1731
+ raise ForbiddenError(
1732
+ headers=dict(_response.headers),
1733
+ body=typing.cast(
1734
+ Forbidden,
1735
+ construct_type(
1736
+ type_=Forbidden, # type: ignore
1737
+ object_=_response.json(),
1738
+ ),
1739
+ ),
1740
+ )
1741
+ if _response.status_code == 404:
1742
+ raise NotFoundError(
1743
+ headers=dict(_response.headers),
1744
+ body=typing.cast(
1745
+ NotFound,
1746
+ construct_type(
1747
+ type_=NotFound, # type: ignore
1748
+ object_=_response.json(),
1749
+ ),
1750
+ ),
1751
+ )
1752
+ if _response.status_code == 422:
1753
+ raise UnprocessableEntityError(
1754
+ headers=dict(_response.headers),
1755
+ body=typing.cast(
1756
+ typing.Any,
1757
+ construct_type(
1758
+ type_=typing.Any, # type: ignore
1759
+ object_=_response.json(),
1760
+ ),
1761
+ ),
1762
+ )
1763
+ if _response.status_code == 429:
1764
+ raise TooManyRequestsError(
1765
+ headers=dict(_response.headers),
1766
+ body=typing.cast(
1767
+ TooManyRequests,
1768
+ construct_type(
1769
+ type_=TooManyRequests, # type: ignore
1770
+ object_=_response.json(),
1771
+ ),
1772
+ ),
1773
+ )
1774
+ _response_json = _response.json()
1775
+ except JSONDecodeError:
1776
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1777
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1778
+
1779
+ async def update(
1780
+ self,
1781
+ account_id: Uuid,
1782
+ file_id: Uuid,
1783
+ *,
1784
+ data: FileUpdateParamsData,
1785
+ request_options: typing.Optional[RequestOptions] = None,
1786
+ ) -> AsyncHttpResponse[FileResponse]:
1787
+ """
1788
+ Update file details. <br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
1789
+
1790
+ Parameters
1791
+ ----------
1792
+ account_id : Uuid
1793
+
1794
+
1795
+ file_id : Uuid
1796
+
1797
+
1798
+ data : FileUpdateParamsData
1799
+
1800
+ request_options : typing.Optional[RequestOptions]
1801
+ Request-specific configuration.
1802
+
1803
+ Returns
1804
+ -------
1805
+ AsyncHttpResponse[FileResponse]
1806
+ OK
1807
+ """
1808
+ _response = await self._client_wrapper.httpx_client.request(
1809
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}",
1810
+ method="PATCH",
1811
+ json={
1812
+ "data": convert_and_respect_annotation_metadata(
1813
+ object_=data, annotation=FileUpdateParamsData, direction="write"
1814
+ ),
1815
+ },
1816
+ headers={
1817
+ "content-type": "application/json",
1818
+ },
1819
+ request_options=request_options,
1820
+ omit=OMIT,
1821
+ )
1822
+ try:
1823
+ if 200 <= _response.status_code < 300:
1824
+ _data = typing.cast(
1825
+ FileResponse,
1826
+ construct_type(
1827
+ type_=FileResponse, # type: ignore
1828
+ object_=_response.json(),
1829
+ ),
1830
+ )
1831
+ return AsyncHttpResponse(response=_response, data=_data)
1832
+ if _response.status_code == 400:
1833
+ raise BadRequestError(
1834
+ headers=dict(_response.headers),
1835
+ body=typing.cast(
1836
+ BadRequest,
1837
+ construct_type(
1838
+ type_=BadRequest, # type: ignore
1839
+ object_=_response.json(),
1840
+ ),
1841
+ ),
1842
+ )
1843
+ if _response.status_code == 401:
1844
+ raise UnauthorizedError(
1845
+ headers=dict(_response.headers),
1846
+ body=typing.cast(
1847
+ Unauthorized,
1848
+ construct_type(
1849
+ type_=Unauthorized, # type: ignore
1850
+ object_=_response.json(),
1851
+ ),
1852
+ ),
1853
+ )
1854
+ if _response.status_code == 403:
1855
+ raise ForbiddenError(
1856
+ headers=dict(_response.headers),
1857
+ body=typing.cast(
1858
+ Forbidden,
1859
+ construct_type(
1860
+ type_=Forbidden, # type: ignore
1861
+ object_=_response.json(),
1862
+ ),
1863
+ ),
1864
+ )
1865
+ if _response.status_code == 404:
1866
+ raise NotFoundError(
1867
+ headers=dict(_response.headers),
1868
+ body=typing.cast(
1869
+ NotFound,
1870
+ construct_type(
1871
+ type_=NotFound, # type: ignore
1872
+ object_=_response.json(),
1873
+ ),
1874
+ ),
1875
+ )
1876
+ if _response.status_code == 422:
1877
+ raise UnprocessableEntityError(
1878
+ headers=dict(_response.headers),
1879
+ body=typing.cast(
1880
+ typing.Any,
1881
+ construct_type(
1882
+ type_=typing.Any, # type: ignore
1883
+ object_=_response.json(),
1884
+ ),
1885
+ ),
1886
+ )
1887
+ if _response.status_code == 429:
1888
+ raise TooManyRequestsError(
1889
+ headers=dict(_response.headers),
1890
+ body=typing.cast(
1891
+ TooManyRequests,
1892
+ construct_type(
1893
+ type_=TooManyRequests, # type: ignore
1894
+ object_=_response.json(),
1895
+ ),
1896
+ ),
1897
+ )
1898
+ _response_json = _response.json()
1899
+ except JSONDecodeError:
1900
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1901
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1902
+
1903
+ async def copy(
1904
+ self,
1905
+ account_id: Uuid,
1906
+ file_id: Uuid,
1907
+ *,
1908
+ copy_metadata: typing.Optional[bool] = None,
1909
+ copy_comments: typing.Optional[FilesCopyRequestCopyComments] = None,
1910
+ data: typing.Optional[FileCopyParamsData] = OMIT,
1911
+ request_options: typing.Optional[RequestOptions] = None,
1912
+ ) -> AsyncHttpResponse[FileCopyResponse]:
1913
+ """
1914
+ Copy file. <br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
1915
+
1916
+ Parameters
1917
+ ----------
1918
+ account_id : Uuid
1919
+
1920
+
1921
+ file_id : Uuid
1922
+
1923
+
1924
+ copy_metadata : typing.Optional[bool]
1925
+ Whether to copy metadata values along with the file
1926
+
1927
+ copy_comments : typing.Optional[FilesCopyRequestCopyComments]
1928
+ Which comments to copy along with the file
1929
+
1930
+ data : typing.Optional[FileCopyParamsData]
1931
+
1932
+ request_options : typing.Optional[RequestOptions]
1933
+ Request-specific configuration.
1934
+
1935
+ Returns
1936
+ -------
1937
+ AsyncHttpResponse[FileCopyResponse]
1938
+ OK
1939
+ """
1940
+ _response = await self._client_wrapper.httpx_client.request(
1941
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}/copy",
1942
+ method="POST",
1943
+ params={
1944
+ "copy_metadata": copy_metadata,
1945
+ "copy_comments": copy_comments,
1946
+ },
1947
+ json={
1948
+ "data": convert_and_respect_annotation_metadata(
1949
+ object_=data, annotation=FileCopyParamsData, direction="write"
1950
+ ),
1951
+ },
1952
+ headers={
1953
+ "content-type": "application/json",
1954
+ },
1955
+ request_options=request_options,
1956
+ omit=OMIT,
1957
+ )
1958
+ try:
1959
+ if 200 <= _response.status_code < 300:
1960
+ _data = typing.cast(
1961
+ FileCopyResponse,
1962
+ construct_type(
1963
+ type_=FileCopyResponse, # type: ignore
1964
+ object_=_response.json(),
1965
+ ),
1966
+ )
1967
+ return AsyncHttpResponse(response=_response, data=_data)
1968
+ if _response.status_code == 400:
1969
+ raise BadRequestError(
1970
+ headers=dict(_response.headers),
1971
+ body=typing.cast(
1972
+ BadRequest,
1973
+ construct_type(
1974
+ type_=BadRequest, # type: ignore
1975
+ object_=_response.json(),
1976
+ ),
1977
+ ),
1978
+ )
1979
+ if _response.status_code == 401:
1980
+ raise UnauthorizedError(
1981
+ headers=dict(_response.headers),
1982
+ body=typing.cast(
1983
+ Unauthorized,
1984
+ construct_type(
1985
+ type_=Unauthorized, # type: ignore
1986
+ object_=_response.json(),
1987
+ ),
1988
+ ),
1989
+ )
1990
+ if _response.status_code == 403:
1991
+ raise ForbiddenError(
1992
+ headers=dict(_response.headers),
1993
+ body=typing.cast(
1994
+ Forbidden,
1995
+ construct_type(
1996
+ type_=Forbidden, # type: ignore
1997
+ object_=_response.json(),
1998
+ ),
1999
+ ),
2000
+ )
2001
+ if _response.status_code == 404:
2002
+ raise NotFoundError(
2003
+ headers=dict(_response.headers),
2004
+ body=typing.cast(
2005
+ NotFound,
2006
+ construct_type(
2007
+ type_=NotFound, # type: ignore
2008
+ object_=_response.json(),
2009
+ ),
2010
+ ),
2011
+ )
2012
+ if _response.status_code == 422:
2013
+ raise UnprocessableEntityError(
2014
+ headers=dict(_response.headers),
2015
+ body=typing.cast(
2016
+ typing.Any,
2017
+ construct_type(
2018
+ type_=typing.Any, # type: ignore
2019
+ object_=_response.json(),
2020
+ ),
2021
+ ),
2022
+ )
2023
+ if _response.status_code == 429:
2024
+ raise TooManyRequestsError(
2025
+ headers=dict(_response.headers),
2026
+ body=typing.cast(
2027
+ TooManyRequests,
2028
+ construct_type(
2029
+ type_=TooManyRequests, # type: ignore
2030
+ object_=_response.json(),
2031
+ ),
2032
+ ),
2033
+ )
2034
+ _response_json = _response.json()
2035
+ except JSONDecodeError:
2036
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2037
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2038
+
2039
+ async def create_remote_upload(
2040
+ self,
2041
+ account_id: Uuid,
2042
+ folder_id: Uuid,
2043
+ *,
2044
+ data: FileCreateRemoteUploadParamsData,
2045
+ request_options: typing.Optional[RequestOptions] = None,
2046
+ ) -> AsyncHttpResponse[FileRemoteUploadResponse]:
2047
+ """
2048
+ Create new file under parent folder through remote upload. <br>Rate Limits: 5 calls per 1 second(s) per account_user
2049
+
2050
+ Parameters
2051
+ ----------
2052
+ account_id : Uuid
2053
+
2054
+
2055
+ folder_id : Uuid
2056
+
2057
+
2058
+ data : FileCreateRemoteUploadParamsData
2059
+
2060
+ request_options : typing.Optional[RequestOptions]
2061
+ Request-specific configuration.
2062
+
2063
+ Returns
2064
+ -------
2065
+ AsyncHttpResponse[FileRemoteUploadResponse]
2066
+ Accepted
2067
+ """
2068
+ _response = await self._client_wrapper.httpx_client.request(
2069
+ f"v4/accounts/{jsonable_encoder(account_id)}/folders/{jsonable_encoder(folder_id)}/files/remote_upload",
2070
+ method="POST",
2071
+ json={
2072
+ "data": convert_and_respect_annotation_metadata(
2073
+ object_=data, annotation=FileCreateRemoteUploadParamsData, direction="write"
2074
+ ),
2075
+ },
2076
+ headers={
2077
+ "content-type": "application/json",
2078
+ },
2079
+ request_options=request_options,
2080
+ omit=OMIT,
2081
+ )
2082
+ try:
2083
+ if 200 <= _response.status_code < 300:
2084
+ _data = typing.cast(
2085
+ FileRemoteUploadResponse,
2086
+ construct_type(
2087
+ type_=FileRemoteUploadResponse, # type: ignore
2088
+ object_=_response.json(),
2089
+ ),
2090
+ )
2091
+ return AsyncHttpResponse(response=_response, data=_data)
2092
+ if _response.status_code == 400:
2093
+ raise BadRequestError(
2094
+ headers=dict(_response.headers),
2095
+ body=typing.cast(
2096
+ BadRequest,
2097
+ construct_type(
2098
+ type_=BadRequest, # type: ignore
2099
+ object_=_response.json(),
2100
+ ),
2101
+ ),
2102
+ )
2103
+ if _response.status_code == 401:
2104
+ raise UnauthorizedError(
2105
+ headers=dict(_response.headers),
2106
+ body=typing.cast(
2107
+ Unauthorized,
2108
+ construct_type(
2109
+ type_=Unauthorized, # type: ignore
2110
+ object_=_response.json(),
2111
+ ),
2112
+ ),
2113
+ )
2114
+ if _response.status_code == 403:
2115
+ raise ForbiddenError(
2116
+ headers=dict(_response.headers),
2117
+ body=typing.cast(
2118
+ Forbidden,
2119
+ construct_type(
2120
+ type_=Forbidden, # type: ignore
2121
+ object_=_response.json(),
2122
+ ),
2123
+ ),
2124
+ )
2125
+ if _response.status_code == 404:
2126
+ raise NotFoundError(
2127
+ headers=dict(_response.headers),
2128
+ body=typing.cast(
2129
+ NotFound,
2130
+ construct_type(
2131
+ type_=NotFound, # type: ignore
2132
+ object_=_response.json(),
2133
+ ),
2134
+ ),
2135
+ )
2136
+ if _response.status_code == 422:
2137
+ raise UnprocessableEntityError(
2138
+ headers=dict(_response.headers),
2139
+ body=typing.cast(
2140
+ typing.Any,
2141
+ construct_type(
2142
+ type_=typing.Any, # type: ignore
2143
+ object_=_response.json(),
2144
+ ),
2145
+ ),
2146
+ )
2147
+ if _response.status_code == 429:
2148
+ raise TooManyRequestsError(
2149
+ headers=dict(_response.headers),
2150
+ body=typing.cast(
2151
+ TooManyRequests,
2152
+ construct_type(
2153
+ type_=TooManyRequests, # type: ignore
2154
+ object_=_response.json(),
2155
+ ),
2156
+ ),
2157
+ )
2158
+ _response_json = _response.json()
2159
+ except JSONDecodeError:
2160
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2161
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2162
+
2163
+ async def move(
2164
+ self,
2165
+ account_id: Uuid,
2166
+ file_id: Uuid,
2167
+ *,
2168
+ data: FileMoveParamsData,
2169
+ request_options: typing.Optional[RequestOptions] = None,
2170
+ ) -> AsyncHttpResponse[FileResponse]:
2171
+ """
2172
+ Move file to a folder or version_stack. <br>Rate Limits: 100 calls per 1.00 minute(s) per account_user
2173
+
2174
+ Parameters
2175
+ ----------
2176
+ account_id : Uuid
2177
+
2178
+
2179
+ file_id : Uuid
2180
+
2181
+
2182
+ data : FileMoveParamsData
2183
+
2184
+ request_options : typing.Optional[RequestOptions]
2185
+ Request-specific configuration.
2186
+
2187
+ Returns
2188
+ -------
2189
+ AsyncHttpResponse[FileResponse]
2190
+ OK
2191
+ """
2192
+ _response = await self._client_wrapper.httpx_client.request(
2193
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}/move",
2194
+ method="PATCH",
2195
+ json={
2196
+ "data": convert_and_respect_annotation_metadata(
2197
+ object_=data, annotation=FileMoveParamsData, direction="write"
2198
+ ),
2199
+ },
2200
+ headers={
2201
+ "content-type": "application/json",
2202
+ },
2203
+ request_options=request_options,
2204
+ omit=OMIT,
2205
+ )
2206
+ try:
2207
+ if 200 <= _response.status_code < 300:
2208
+ _data = typing.cast(
2209
+ FileResponse,
2210
+ construct_type(
2211
+ type_=FileResponse, # type: ignore
2212
+ object_=_response.json(),
2213
+ ),
2214
+ )
2215
+ return AsyncHttpResponse(response=_response, data=_data)
2216
+ if _response.status_code == 400:
2217
+ raise BadRequestError(
2218
+ headers=dict(_response.headers),
2219
+ body=typing.cast(
2220
+ BadRequest,
2221
+ construct_type(
2222
+ type_=BadRequest, # type: ignore
2223
+ object_=_response.json(),
2224
+ ),
2225
+ ),
2226
+ )
2227
+ if _response.status_code == 401:
2228
+ raise UnauthorizedError(
2229
+ headers=dict(_response.headers),
2230
+ body=typing.cast(
2231
+ Unauthorized,
2232
+ construct_type(
2233
+ type_=Unauthorized, # type: ignore
2234
+ object_=_response.json(),
2235
+ ),
2236
+ ),
2237
+ )
2238
+ if _response.status_code == 403:
2239
+ raise ForbiddenError(
2240
+ headers=dict(_response.headers),
2241
+ body=typing.cast(
2242
+ Forbidden,
2243
+ construct_type(
2244
+ type_=Forbidden, # type: ignore
2245
+ object_=_response.json(),
2246
+ ),
2247
+ ),
2248
+ )
2249
+ if _response.status_code == 404:
2250
+ raise NotFoundError(
2251
+ headers=dict(_response.headers),
2252
+ body=typing.cast(
2253
+ NotFound,
2254
+ construct_type(
2255
+ type_=NotFound, # type: ignore
2256
+ object_=_response.json(),
2257
+ ),
2258
+ ),
2259
+ )
2260
+ if _response.status_code == 422:
2261
+ raise UnprocessableEntityError(
2262
+ headers=dict(_response.headers),
2263
+ body=typing.cast(
2264
+ typing.Any,
2265
+ construct_type(
2266
+ type_=typing.Any, # type: ignore
2267
+ object_=_response.json(),
2268
+ ),
2269
+ ),
2270
+ )
2271
+ if _response.status_code == 429:
2272
+ raise TooManyRequestsError(
2273
+ headers=dict(_response.headers),
2274
+ body=typing.cast(
2275
+ TooManyRequests,
2276
+ construct_type(
2277
+ type_=TooManyRequests, # type: ignore
2278
+ object_=_response.json(),
2279
+ ),
2280
+ ),
2281
+ )
2282
+ _response_json = _response.json()
2283
+ except JSONDecodeError:
2284
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2285
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2286
+
2287
+ async def create_local_upload(
2288
+ self,
2289
+ account_id: Uuid,
2290
+ folder_id: Uuid,
2291
+ *,
2292
+ data: FileCreateLocalUploadParamsData,
2293
+ request_options: typing.Optional[RequestOptions] = None,
2294
+ ) -> AsyncHttpResponse[FileWithUploadUrlsResponse]:
2295
+ """
2296
+ Create new file under parent folder through local upload. <br>Rate Limits: 5 calls per 1 second(s) per account_user
2297
+
2298
+ Parameters
2299
+ ----------
2300
+ account_id : Uuid
2301
+
2302
+
2303
+ folder_id : Uuid
2304
+
2305
+
2306
+ data : FileCreateLocalUploadParamsData
2307
+
2308
+ request_options : typing.Optional[RequestOptions]
2309
+ Request-specific configuration.
2310
+
2311
+ Returns
2312
+ -------
2313
+ AsyncHttpResponse[FileWithUploadUrlsResponse]
2314
+ Created
2315
+ """
2316
+ _response = await self._client_wrapper.httpx_client.request(
2317
+ f"v4/accounts/{jsonable_encoder(account_id)}/folders/{jsonable_encoder(folder_id)}/files/local_upload",
2318
+ method="POST",
2319
+ json={
2320
+ "data": convert_and_respect_annotation_metadata(
2321
+ object_=data, annotation=FileCreateLocalUploadParamsData, direction="write"
2322
+ ),
2323
+ },
2324
+ headers={
2325
+ "content-type": "application/json",
2326
+ },
2327
+ request_options=request_options,
2328
+ omit=OMIT,
2329
+ )
2330
+ try:
2331
+ if 200 <= _response.status_code < 300:
2332
+ _data = typing.cast(
2333
+ FileWithUploadUrlsResponse,
2334
+ construct_type(
2335
+ type_=FileWithUploadUrlsResponse, # type: ignore
2336
+ object_=_response.json(),
2337
+ ),
2338
+ )
2339
+ return AsyncHttpResponse(response=_response, data=_data)
2340
+ if _response.status_code == 400:
2341
+ raise BadRequestError(
2342
+ headers=dict(_response.headers),
2343
+ body=typing.cast(
2344
+ BadRequest,
2345
+ construct_type(
2346
+ type_=BadRequest, # type: ignore
2347
+ object_=_response.json(),
2348
+ ),
2349
+ ),
2350
+ )
2351
+ if _response.status_code == 401:
2352
+ raise UnauthorizedError(
2353
+ headers=dict(_response.headers),
2354
+ body=typing.cast(
2355
+ Unauthorized,
2356
+ construct_type(
2357
+ type_=Unauthorized, # type: ignore
2358
+ object_=_response.json(),
2359
+ ),
2360
+ ),
2361
+ )
2362
+ if _response.status_code == 403:
2363
+ raise ForbiddenError(
2364
+ headers=dict(_response.headers),
2365
+ body=typing.cast(
2366
+ Forbidden,
2367
+ construct_type(
2368
+ type_=Forbidden, # type: ignore
2369
+ object_=_response.json(),
2370
+ ),
2371
+ ),
2372
+ )
2373
+ if _response.status_code == 404:
2374
+ raise NotFoundError(
2375
+ headers=dict(_response.headers),
2376
+ body=typing.cast(
2377
+ NotFound,
2378
+ construct_type(
2379
+ type_=NotFound, # type: ignore
2380
+ object_=_response.json(),
2381
+ ),
2382
+ ),
2383
+ )
2384
+ if _response.status_code == 422:
2385
+ raise UnprocessableEntityError(
2386
+ headers=dict(_response.headers),
2387
+ body=typing.cast(
2388
+ typing.Any,
2389
+ construct_type(
2390
+ type_=typing.Any, # type: ignore
2391
+ object_=_response.json(),
2392
+ ),
2393
+ ),
2394
+ )
2395
+ if _response.status_code == 429:
2396
+ raise TooManyRequestsError(
2397
+ headers=dict(_response.headers),
2398
+ body=typing.cast(
2399
+ TooManyRequests,
2400
+ construct_type(
2401
+ type_=TooManyRequests, # type: ignore
2402
+ object_=_response.json(),
2403
+ ),
2404
+ ),
2405
+ )
2406
+ _response_json = _response.json()
2407
+ except JSONDecodeError:
2408
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2409
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2410
+
2411
+ async def show_file_upload_status(
2412
+ self, account_id: Uuid, file_id: Uuid, *, request_options: typing.Optional[RequestOptions] = None
2413
+ ) -> AsyncHttpResponse[FileUploadStatusResponse]:
2414
+ """
2415
+ Show file upload status details. <br>Rate Limits: 5 calls per 1 second(s) per account_user
2416
+
2417
+ Parameters
2418
+ ----------
2419
+ account_id : Uuid
2420
+
2421
+
2422
+ file_id : Uuid
2423
+
2424
+
2425
+ request_options : typing.Optional[RequestOptions]
2426
+ Request-specific configuration.
2427
+
2428
+ Returns
2429
+ -------
2430
+ AsyncHttpResponse[FileUploadStatusResponse]
2431
+ OK
2432
+ """
2433
+ _response = await self._client_wrapper.httpx_client.request(
2434
+ f"v4/accounts/{jsonable_encoder(account_id)}/files/{jsonable_encoder(file_id)}/status",
2435
+ method="GET",
2436
+ request_options=request_options,
2437
+ )
2438
+ try:
2439
+ if 200 <= _response.status_code < 300:
2440
+ _data = typing.cast(
2441
+ FileUploadStatusResponse,
2442
+ construct_type(
2443
+ type_=FileUploadStatusResponse, # type: ignore
2444
+ object_=_response.json(),
2445
+ ),
2446
+ )
2447
+ return AsyncHttpResponse(response=_response, data=_data)
2448
+ if _response.status_code == 400:
2449
+ raise BadRequestError(
2450
+ headers=dict(_response.headers),
2451
+ body=typing.cast(
2452
+ BadRequest,
2453
+ construct_type(
2454
+ type_=BadRequest, # type: ignore
2455
+ object_=_response.json(),
2456
+ ),
2457
+ ),
2458
+ )
2459
+ if _response.status_code == 401:
2460
+ raise UnauthorizedError(
2461
+ headers=dict(_response.headers),
2462
+ body=typing.cast(
2463
+ Unauthorized,
2464
+ construct_type(
2465
+ type_=Unauthorized, # type: ignore
2466
+ object_=_response.json(),
2467
+ ),
2468
+ ),
2469
+ )
2470
+ if _response.status_code == 403:
2471
+ raise ForbiddenError(
2472
+ headers=dict(_response.headers),
2473
+ body=typing.cast(
2474
+ Forbidden,
2475
+ construct_type(
2476
+ type_=Forbidden, # type: ignore
2477
+ object_=_response.json(),
2478
+ ),
2479
+ ),
2480
+ )
2481
+ if _response.status_code == 404:
2482
+ raise NotFoundError(
2483
+ headers=dict(_response.headers),
2484
+ body=typing.cast(
2485
+ NotFound,
2486
+ construct_type(
2487
+ type_=NotFound, # type: ignore
2488
+ object_=_response.json(),
2489
+ ),
2490
+ ),
2491
+ )
2492
+ if _response.status_code == 422:
2493
+ raise UnprocessableEntityError(
2494
+ headers=dict(_response.headers),
2495
+ body=typing.cast(
2496
+ typing.Any,
2497
+ construct_type(
2498
+ type_=typing.Any, # type: ignore
2499
+ object_=_response.json(),
2500
+ ),
2501
+ ),
2502
+ )
2503
+ if _response.status_code == 429:
2504
+ raise TooManyRequestsError(
2505
+ headers=dict(_response.headers),
2506
+ body=typing.cast(
2507
+ TooManyRequests,
2508
+ construct_type(
2509
+ type_=TooManyRequests, # type: ignore
2510
+ object_=_response.json(),
2511
+ ),
2512
+ ),
2513
+ )
2514
+ _response_json = _response.json()
2515
+ except JSONDecodeError:
2516
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2517
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)