@@ -848,31 +848,41 @@ def files_alpha_upload(self,
848848 client_modified = None ,
849849 mute = False ,
850850 property_groups = None ,
851- strict_conflict = False ):
851+ strict_conflict = False ,
852+ content_hash = None ):
852853 """
853854 Create a new file with the contents provided in the request. Note that
854- this endpoint is part of the properties API alpha and is slightly
855- different from :meth:`files_upload`. Do not use this to upload a file
856- larger than 150 MB. Instead, create an upload session with
857- :meth:`files_upload_session_start`.
855+ the behavior of this alpha endpoint is unstable and subject to change.
856+ Do not use this to upload a file larger than 150 MB. Instead, create an
857+ upload session with :meth:`files_upload_session_start`.
858858
859859 Route attributes:
860860 scope: files.content.write
861861
862862 :param bytes f: Contents to upload.
863+ :param Nullable[str] content_hash: A hash of the file content uploaded
864+ in this call. If provided and the uploaded content does not match
865+ this hash, an error will be returned. For more information see our
866+ `Content hash
867+ <https://www.dropbox.com/developers/reference/content-hash>`_ page.
863868 :rtype: :class:`dropbox.files.FileMetadata`
869+ :raises: :class:`.exceptions.ApiError`
870+
871+ If this raises, ApiError will contain:
872+ :class:`dropbox.files.UploadError`
864873 """
865874 warnings .warn (
866- 'alpha/upload is deprecated. Use alpha/ upload.' ,
875+ 'alpha/upload is deprecated. Use upload.' ,
867876 DeprecationWarning ,
868877 )
869- arg = files .CommitInfoWithProperties (path ,
870- mode ,
871- autorename ,
872- client_modified ,
873- mute ,
874- property_groups ,
875- strict_conflict )
878+ arg = files .UploadArg (path ,
879+ mode ,
880+ autorename ,
881+ client_modified ,
882+ mute ,
883+ property_groups ,
884+ strict_conflict ,
885+ content_hash )
876886 r = self .request (
877887 files .alpha_upload ,
878888 'files' ,
@@ -3157,7 +3167,8 @@ def files_upload(self,
31573167 client_modified = None ,
31583168 mute = False ,
31593169 property_groups = None ,
3160- strict_conflict = False ):
3170+ strict_conflict = False ,
3171+ content_hash = None ):
31613172 """
31623173 Create a new file with the contents provided in the request. Do not use
31633174 this to upload a file larger than 150 MB. Instead, create an upload
@@ -3171,43 +3182,25 @@ def files_upload(self,
31713182 scope: files.content.write
31723183
31733184 :param bytes f: Contents to upload.
3174- :param str path: Path in the user's Dropbox to save the file.
3175- :param mode: Selects what to do if the file already exists.
3176- :type mode: :class:`dropbox.files.WriteMode`
3177- :param bool autorename: If there's a conflict, as determined by
3178- ``mode``, have the Dropbox server try to autorename the file to
3179- avoid conflict.
3180- :param Nullable[datetime] client_modified: The value to store as the
3181- ``client_modified`` timestamp. Dropbox automatically records the
3182- time at which the file was written to the Dropbox servers. It can
3183- also record an additional timestamp, provided by Dropbox desktop
3184- clients, mobile clients, and API apps of when the file was actually
3185- created or modified.
3186- :param bool mute: Normally, users are made aware of any file
3187- modifications in their Dropbox account via notifications in the
3188- client software. If ``True``, this tells the clients that this
3189- modification shouldn't result in a user notification.
3190- :param Nullable[List[:class:`dropbox.files.PropertyGroup`]]
3191- property_groups: List of custom properties to add to file.
3192- :param bool strict_conflict: Be more strict about how each
3193- :class:`dropbox.files.WriteMode` detects conflict. For example,
3194- always return a conflict error when ``mode`` = ``WriteMode.update``
3195- and the given "rev" doesn't match the existing file's "rev", even if
3196- the existing file has been deleted. This also forces a conflict even
3197- when the target path refers to a file with identical contents.
3185+ :param Nullable[str] content_hash: A hash of the file content uploaded
3186+ in this call. If provided and the uploaded content does not match
3187+ this hash, an error will be returned. For more information see our
3188+ `Content hash
3189+ <https://www.dropbox.com/developers/reference/content-hash>`_ page.
31983190 :rtype: :class:`dropbox.files.FileMetadata`
31993191 :raises: :class:`.exceptions.ApiError`
32003192
32013193 If this raises, ApiError will contain:
32023194 :class:`dropbox.files.UploadError`
32033195 """
3204- arg = files .CommitInfo (path ,
3205- mode ,
3206- autorename ,
3207- client_modified ,
3208- mute ,
3209- property_groups ,
3210- strict_conflict )
3196+ arg = files .UploadArg (path ,
3197+ mode ,
3198+ autorename ,
3199+ client_modified ,
3200+ mute ,
3201+ property_groups ,
3202+ strict_conflict ,
3203+ content_hash )
32113204 r = self .request (
32123205 files .upload ,
32133206 'files' ,
@@ -3219,7 +3212,8 @@ def files_upload(self,
32193212 def files_upload_session_append_v2 (self ,
32203213 f ,
32213214 cursor ,
3222- close = False ):
3215+ close = False ,
3216+ content_hash = None ):
32233217 """
32243218 Append more data to an upload session. When the parameter close is set,
32253219 this call will close the session. A single request should not upload
@@ -3240,14 +3234,20 @@ def files_upload_session_append_v2(self,
32403234 point you won't be able to call
32413235 :meth:`files_upload_session_append_v2` anymore with the current
32423236 session.
3237+ :param Nullable[str] content_hash: A hash of the file content uploaded
3238+ in this call. If provided and the uploaded content does not match
3239+ this hash, an error will be returned. For more information see our
3240+ `Content hash
3241+ <https://www.dropbox.com/developers/reference/content-hash>`_ page.
32433242 :rtype: None
32443243 :raises: :class:`.exceptions.ApiError`
32453244
32463245 If this raises, ApiError will contain:
3247- :class:`dropbox.files.UploadSessionLookupError `
3246+ :class:`dropbox.files.UploadSessionAppendError `
32483247 """
32493248 arg = files .UploadSessionAppendArg (cursor ,
3250- close )
3249+ close ,
3250+ content_hash )
32513251 r = self .request (
32523252 files .upload_session_append_v2 ,
32533253 'files' ,
@@ -3282,7 +3282,7 @@ def files_upload_session_append(self,
32823282 :raises: :class:`.exceptions.ApiError`
32833283
32843284 If this raises, ApiError will contain:
3285- :class:`dropbox.files.UploadSessionLookupError `
3285+ :class:`dropbox.files.UploadSessionAppendError `
32863286 """
32873287 warnings .warn (
32883288 'upload_session/append is deprecated. Use upload_session/append.' ,
@@ -3301,7 +3301,8 @@ def files_upload_session_append(self,
33013301 def files_upload_session_finish (self ,
33023302 f ,
33033303 cursor ,
3304- commit ):
3304+ commit ,
3305+ content_hash = None ):
33053306 """
33063307 Finish an upload session and save the uploaded data to the given file
33073308 path. A single request should not upload more than 150 MB. The maximum
@@ -3321,14 +3322,20 @@ def files_upload_session_finish(self,
33213322 :param commit: Contains the path and other optional modifiers for the
33223323 commit.
33233324 :type commit: :class:`dropbox.files.CommitInfo`
3325+ :param Nullable[str] content_hash: A hash of the file content uploaded
3326+ in this call. If provided and the uploaded content does not match
3327+ this hash, an error will be returned. For more information see our
3328+ `Content hash
3329+ <https://www.dropbox.com/developers/reference/content-hash>`_ page.
33243330 :rtype: :class:`dropbox.files.FileMetadata`
33253331 :raises: :class:`.exceptions.ApiError`
33263332
33273333 If this raises, ApiError will contain:
33283334 :class:`dropbox.files.UploadSessionFinishError`
33293335 """
33303336 arg = files .UploadSessionFinishArg (cursor ,
3331- commit )
3337+ commit ,
3338+ content_hash )
33323339 r = self .request (
33333340 files .upload_session_finish ,
33343341 'files' ,
@@ -3447,7 +3454,8 @@ def files_upload_session_finish_batch_check(self,
34473454 def files_upload_session_start (self ,
34483455 f ,
34493456 close = False ,
3450- session_type = None ):
3457+ session_type = None ,
3458+ content_hash = None ):
34513459 """
34523460 Upload sessions allow you to upload a single file in one or more
34533461 requests, for example where the size of the file is greater than 150 MB.
@@ -3495,14 +3503,20 @@ def files_upload_session_start(self,
34953503 :param Nullable[:class:`dropbox.files.UploadSessionType`] session_type:
34963504 Type of upload session you want to start. If not specified, default
34973505 is ``UploadSessionType.sequential``.
3506+ :param Nullable[str] content_hash: A hash of the file content uploaded
3507+ in this call. If provided and the uploaded content does not match
3508+ this hash, an error will be returned. For more information see our
3509+ `Content hash
3510+ <https://www.dropbox.com/developers/reference/content-hash>`_ page.
34983511 :rtype: :class:`dropbox.files.UploadSessionStartResult`
34993512 :raises: :class:`.exceptions.ApiError`
35003513
35013514 If this raises, ApiError will contain:
35023515 :class:`dropbox.files.UploadSessionStartError`
35033516 """
35043517 arg = files .UploadSessionStartArg (close ,
3505- session_type )
3518+ session_type ,
3519+ content_hash )
35063520 r = self .request (
35073521 files .upload_session_start ,
35083522 'files' ,
0 commit comments