Skip to content

Commit 895e08a

Browse files
Brent1LTBrent Bumann
and
Brent Bumann
authored
Spec Update 02/09/2022 (#66)
Change Notes: common Namespace - Update comments files Namespace - Add UploadArg extends CommitInfo structs - Add UploadSessionAppendError extends UploadSessionLookupError unions - Remove CommitInfoWithProperties extends CommitInfo structs - Remove UploadErrorWithProperties extends UploadError unions Co-authored-by: Brent Bumann <[email protected]>
1 parent 13bbef7 commit 895e08a

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

common.stone

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ alias Date = Timestamp("%Y-%m-%d")
1212

1313
# Note - "\\." is needed in order to translate to "\."
1414

15+
# Note: If this pattern is changed, we also need to update _parse_json_arg_to_stone_data_type in dropbox/api/v2/substrate/wrapper.py
1516
alias EmailAddress = String(pattern="^['#&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*\\.[A-Za-z]{2,15}$", max_length=255)
1617

1718
# First name or Last name. NOTE: max_length should be synced with USER_NAME_MAX_LEN

files.stone

+38-17
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,8 @@ union UploadError
780780
"The supplied property group is invalid. The file has uploaded without property groups."
781781
payload_too_large
782782
"The request payload must be at most 150 MB."
783+
content_hash_mismatch
784+
"The content received by the Dropbox server in this call does not match the provided content hash."
783785

784786
struct UploadSessionOffsetError
785787
correct_offset UInt64
@@ -792,6 +794,8 @@ union UploadSessionStartError
792794
"Can not start a closed concurrent upload session."
793795
payload_too_large
794796
"The request payload must be at most 150 MB."
797+
content_hash_mismatch
798+
"The content received by the Dropbox server in this call does not match the provided content hash."
795799

796800
union UploadSessionLookupError
797801
not_found
@@ -817,6 +821,10 @@ union UploadSessionLookupError
817821
payload_too_large
818822
"The request payload must be at most 150 MB."
819823

824+
union UploadSessionAppendError extends UploadSessionLookupError
825+
content_hash_mismatch
826+
"The content received by the Dropbox server in this call does not match the provided content hash."
827+
820828
union UploadSessionFinishError
821829
lookup_failed UploadSessionLookupError
822830
"The session arguments are incorrect; the value explains the reason."
@@ -840,6 +848,8 @@ union UploadSessionFinishError
840848
"Not all pieces of data were uploaded before trying to finish the session."
841849
payload_too_large
842850
"The request payload must be at most 150 MB."
851+
content_hash_mismatch
852+
"The content received by the Dropbox server in this call does not match the provided content hash."
843853

844854
# Req/Resp
845855

@@ -860,6 +870,11 @@ struct UploadSessionStartArg
860870
"Type of upload session you want to start. If not specified, default is
861871
:field:`UploadSessionType.sequential`."
862872

873+
content_hash Sha256HexHash?
874+
"NOT YET SUPPORTED. A hash of the file content uploaded in this call. If provided and the
875+
uploaded content does not match this hash, an error will be returned. For more information see our
876+
:link:`Content hash https://www.dropbox.com/developers/reference/content-hash` page."
877+
863878
example with_close
864879
close = false
865880

@@ -922,11 +937,15 @@ struct UploadSessionAppendArg
922937
"If true, the current session will be closed, at which point
923938
you won't be able to call :route:`upload_session/append:2`
924939
anymore with the current session."
940+
content_hash Sha256HexHash?
941+
"NOT YET SUPPORTED. A hash of the file content uploaded in this call. If provided and the
942+
uploaded content does not match this hash, an error will be returned. For more information see our
943+
:link:`Content hash https://www.dropbox.com/developers/reference/content-hash` page."
925944

926945
example default
927946
cursor = default
928947

929-
route upload_session/append:2 (UploadSessionAppendArg, Void, UploadSessionLookupError)
948+
route upload_session/append:2 (UploadSessionAppendArg, Void, UploadSessionAppendError)
930949
"Append more data to an upload session.
931950

932951
When the parameter close is set, this call will close the session.
@@ -960,7 +979,7 @@ struct UploadSessionCursor
960979
session_id = "8dd9d57374911153"
961980
offset = 1073741824
962981

963-
route upload_session/append (UploadSessionCursor, Void, UploadSessionLookupError) deprecated by upload_session/append:2
982+
route upload_session/append (UploadSessionCursor, Void, UploadSessionAppendError) deprecated by upload_session/append:2
964983
"Append more data to an upload session.
965984

966985
A single request should not upload more than 150 MB. The maximum size of
@@ -1017,6 +1036,8 @@ union_closed WriteMode
10171036
example with_revision
10181037
update = "a1c10ce0dd78"
10191038

1039+
# NOTE: If you update this, also update dropbox.api.upload_session_utils.COMMIT_INFO_FIELDS
1040+
# or else tests will fail
10201041
struct CommitInfo
10211042
path WritePathOrId
10221043
"Path in the user's Dropbox to save the file."
@@ -1065,6 +1086,10 @@ struct UploadSessionFinishArg
10651086
"Contains the upload session ID and the offset."
10661087
commit CommitInfo
10671088
"Contains the path and other optional modifiers for the commit."
1089+
content_hash Sha256HexHash?
1090+
"NOT YET SUPPORTED. A hash of the file content uploaded in this call. If provided and the
1091+
uploaded content does not match this hash, an error will be returned. For more information see our
1092+
:link:`Content hash https://www.dropbox.com/developers/reference/content-hash` page."
10681093

10691094
example default
10701095
cursor = default
@@ -1096,7 +1121,13 @@ route upload_session/finish (UploadSessionFinishArg, FileMetadata, UploadSession
10961121
select_admin_mode = "team_admin"
10971122
scope= "files.content.write"
10981123

1099-
route upload (CommitInfo, FileMetadata, UploadError)
1124+
struct UploadArg extends CommitInfo
1125+
content_hash Sha256HexHash?
1126+
"NOT YET SUPPORTED. A hash of the file content uploaded in this call. If provided and the
1127+
uploaded content does not match this hash, an error will be returned. For more information see our
1128+
:link:`Content hash https://www.dropbox.com/developers/reference/content-hash` page."
1129+
1130+
route upload (UploadArg, FileMetadata, UploadError)
11001131
"Create a new file with the contents provided in the request.
11011132

11021133
Do not use this to upload a file larger than 150 MB. Instead, create an
@@ -2854,13 +2885,12 @@ union_closed AlphaGetMetadataError extends GetMetadataError
28542885
properties_error file_properties.LookUpPropertiesError
28552886

28562887
#
2857-
# Patched /upload that accepts properties
2888+
# Alpha /upload, originally for properties API. Can be used to pilot new functionality.
28582889
#
28592890

2860-
route alpha/upload (CommitInfoWithProperties, FileMetadata, UploadErrorWithProperties) deprecated by alpha/upload
2861-
"Create a new file with the contents provided in the request. Note that this
2862-
endpoint is part of the properties API alpha and is slightly different from
2863-
:route:`upload`.
2891+
route alpha/upload (UploadArg, FileMetadata, UploadError) deprecated by upload
2892+
"Create a new file with the contents provided in the request. Note that the
2893+
behavior of this alpha endpoint is unstable and subject to change.
28642894

28652895
Do not use this to upload a file larger than 150 MB. Instead, create an
28662896
upload session with :route:`upload_session/start`."
@@ -2872,15 +2902,6 @@ route alpha/upload (CommitInfoWithProperties, FileMetadata, UploadErrorWithPrope
28722902
allow_app_folder_app = true
28732903
scope = "files.content.write"
28742904

2875-
struct CommitInfoWithProperties extends CommitInfo
2876-
example default
2877-
path = "/Homework/math/Matrices.txt"
2878-
autorename = true
2879-
2880-
union UploadErrorWithProperties extends UploadError
2881-
example default
2882-
properties_error = does_not_fit_template
2883-
28842905
#
28852906
# Deprecated File Properties routes
28862907
#

0 commit comments

Comments
 (0)