@@ -11,26 +11,25 @@ namespace Dropbox.Api.Files
1111 using enc = Dropbox . Api . Stone ;
1212
1313 /// <summary>
14- /// <para>The commit info with properties object</para>
14+ /// <para>The upload arg object</para>
1515 /// </summary>
1616 /// <seealso cref="Global::Dropbox.Api.Files.CommitInfo" />
17- public class CommitInfoWithProperties : CommitInfo
17+ public class UploadArg : CommitInfo
1818 {
1919 #pragma warning disable 108
2020
2121 /// <summary>
2222 /// <para>The encoder instance.</para>
2323 /// </summary>
24- internal static enc . StructEncoder < CommitInfoWithProperties > Encoder = new CommitInfoWithPropertiesEncoder ( ) ;
24+ internal static enc . StructEncoder < UploadArg > Encoder = new UploadArgEncoder ( ) ;
2525
2626 /// <summary>
2727 /// <para>The decoder instance.</para>
2828 /// </summary>
29- internal static enc . StructDecoder < CommitInfoWithProperties > Decoder = new CommitInfoWithPropertiesDecoder ( ) ;
29+ internal static enc . StructDecoder < UploadArg > Decoder = new UploadArgDecoder ( ) ;
3030
3131 /// <summary>
32- /// <para>Initializes a new instance of the <see cref="CommitInfoWithProperties" />
33- /// class.</para>
32+ /// <para>Initializes a new instance of the <see cref="UploadArg" /> class.</para>
3433 /// </summary>
3534 /// <param name="path">Path in the user's Dropbox to save the file.</param>
3635 /// <param name="mode">Selects what to do if the file already exists.</param>
@@ -53,41 +52,68 @@ public class CommitInfoWithProperties : CommitInfo
5352 /// "rev" doesn't match the existing file's "rev", even if the existing file has been
5453 /// deleted. This also forces a conflict even when the target path refers to a file
5554 /// with identical contents.</param>
56- public CommitInfoWithProperties ( string path ,
57- WriteMode mode = null ,
58- bool autorename = false ,
59- sys . DateTime ? clientModified = null ,
60- bool mute = false ,
61- col . IEnumerable < global ::Dropbox . Api . FileProperties . PropertyGroup > propertyGroups = null ,
62- bool strictConflict = false )
55+ /// <param name="contentHash">NOT YET SUPPORTED. A hash of the file content uploaded in
56+ /// this call. If provided and the uploaded content does not match this hash, an error
57+ /// will be returned. For more information see our <a
58+ /// href="https://www.dropbox.com/developers/reference/content-hash">Content hash</a>
59+ /// page.</param>
60+ public UploadArg ( string path ,
61+ WriteMode mode = null ,
62+ bool autorename = false ,
63+ sys . DateTime ? clientModified = null ,
64+ bool mute = false ,
65+ col . IEnumerable < global ::Dropbox . Api . FileProperties . PropertyGroup > propertyGroups = null ,
66+ bool strictConflict = false ,
67+ string contentHash = null )
6368 : base ( path , mode , autorename , clientModified , mute , propertyGroups , strictConflict )
6469 {
70+ if ( contentHash != null )
71+ {
72+ if ( contentHash . Length < 64 )
73+ {
74+ throw new sys . ArgumentOutOfRangeException ( "contentHash" , "Length should be at least 64" ) ;
75+ }
76+ if ( contentHash . Length > 64 )
77+ {
78+ throw new sys . ArgumentOutOfRangeException ( "contentHash" , "Length should be at most 64" ) ;
79+ }
80+ }
81+
82+ this . ContentHash = contentHash ;
6583 }
6684
6785 /// <summary>
68- /// <para>Initializes a new instance of the <see cref="CommitInfoWithProperties" />
69- /// class.</para>
86+ /// <para>Initializes a new instance of the <see cref="UploadArg" /> class.</para>
7087 /// </summary>
7188 /// <remarks>This is to construct an instance of the object when
7289 /// deserializing.</remarks>
7390 [ sys . ComponentModel . EditorBrowsable ( sys . ComponentModel . EditorBrowsableState . Never ) ]
74- public CommitInfoWithProperties ( )
91+ public UploadArg ( )
7592 {
7693 }
7794
95+ /// <summary>
96+ /// <para>NOT YET SUPPORTED. A hash of the file content uploaded in this call. If
97+ /// provided and the uploaded content does not match this hash, an error will be
98+ /// returned. For more information see our <a
99+ /// href="https://www.dropbox.com/developers/reference/content-hash">Content hash</a>
100+ /// page.</para>
101+ /// </summary>
102+ public string ContentHash { get ; protected set ; }
103+
78104 #region Encoder class
79105
80106 /// <summary>
81- /// <para>Encoder for <see cref="CommitInfoWithProperties " />.</para>
107+ /// <para>Encoder for <see cref="UploadArg " />.</para>
82108 /// </summary>
83- private class CommitInfoWithPropertiesEncoder : enc . StructEncoder < CommitInfoWithProperties >
109+ private class UploadArgEncoder : enc . StructEncoder < UploadArg >
84110 {
85111 /// <summary>
86112 /// <para>Encode fields of given value.</para>
87113 /// </summary>
88114 /// <param name="value">The value.</param>
89115 /// <param name="writer">The writer.</param>
90- public override void EncodeFields ( CommitInfoWithProperties value , enc . IJsonWriter writer )
116+ public override void EncodeFields ( UploadArg value , enc . IJsonWriter writer )
91117 {
92118 WriteProperty ( "path" , value . Path , writer , enc . StringEncoder . Instance ) ;
93119 WriteProperty ( "mode" , value . Mode , writer , global ::Dropbox . Api . Files . WriteMode . Encoder ) ;
@@ -102,6 +128,10 @@ public override void EncodeFields(CommitInfoWithProperties value, enc.IJsonWrite
102128 WriteListProperty ( "property_groups" , value . PropertyGroups , writer , global ::Dropbox . Api . FileProperties . PropertyGroup . Encoder ) ;
103129 }
104130 WriteProperty ( "strict_conflict" , value . StrictConflict , writer , enc . BooleanEncoder . Instance ) ;
131+ if ( value . ContentHash != null )
132+ {
133+ WriteProperty ( "content_hash" , value . ContentHash , writer , enc . StringEncoder . Instance ) ;
134+ }
105135 }
106136 }
107137
@@ -111,18 +141,17 @@ public override void EncodeFields(CommitInfoWithProperties value, enc.IJsonWrite
111141 #region Decoder class
112142
113143 /// <summary>
114- /// <para>Decoder for <see cref="CommitInfoWithProperties " />.</para>
144+ /// <para>Decoder for <see cref="UploadArg " />.</para>
115145 /// </summary>
116- private class CommitInfoWithPropertiesDecoder : enc . StructDecoder < CommitInfoWithProperties >
146+ private class UploadArgDecoder : enc . StructDecoder < UploadArg >
117147 {
118148 /// <summary>
119- /// <para>Create a new instance of type <see cref="CommitInfoWithProperties"
120- /// />.</para>
149+ /// <para>Create a new instance of type <see cref="UploadArg" />.</para>
121150 /// </summary>
122151 /// <returns>The struct instance.</returns>
123- protected override CommitInfoWithProperties Create ( )
152+ protected override UploadArg Create ( )
124153 {
125- return new CommitInfoWithProperties ( ) ;
154+ return new UploadArg ( ) ;
126155 }
127156
128157 /// <summary>
@@ -131,7 +160,7 @@ protected override CommitInfoWithProperties Create()
131160 /// <param name="value">The field value.</param>
132161 /// <param name="fieldName">The field name.</param>
133162 /// <param name="reader">The json reader.</param>
134- protected override void SetField ( CommitInfoWithProperties value , string fieldName , enc . IJsonReader reader )
163+ protected override void SetField ( UploadArg value , string fieldName , enc . IJsonReader reader )
135164 {
136165 switch ( fieldName )
137166 {
@@ -156,6 +185,9 @@ protected override void SetField(CommitInfoWithProperties value, string fieldNam
156185 case "strict_conflict" :
157186 value . StrictConflict = enc . BooleanDecoder . Instance . Decode ( reader ) ;
158187 break ;
188+ case "content_hash" :
189+ value . ContentHash = enc . StringDecoder . Instance . Decode ( reader ) ;
190+ break ;
159191 default :
160192 reader . Skip ( ) ;
161193 break ;
0 commit comments