Skip to content

Commit a31203c

Browse files
DropboxBotBrent Bumann
andauthored
Automated Spec Update (#287)
895e08a3fa941888c2c57681c8117a294f8fa4b9 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: DropboxBot <[email protected]> Co-authored-by: Brent Bumann <[email protected]>
1 parent 8e56665 commit a31203c

File tree

12 files changed

+1740
-647
lines changed

12 files changed

+1740
-647
lines changed

dropbox-sdk-dotnet/Dropbox.Api/Generated/Files/CommitInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace Dropbox.Api.Files
1313
/// <summary>
1414
/// <para>The commit info object</para>
1515
/// </summary>
16-
/// <seealso cref="CommitInfoWithProperties" />
1716
/// <seealso cref="GetTemporaryUploadLinkArg" />
17+
/// <seealso cref="UploadArg" />
1818
/// <seealso cref="UploadSessionFinishArg" />
1919
public class CommitInfo
2020
{

dropbox-sdk-dotnet/Dropbox.Api/Generated/Files/FilesUserRoutes.cs

Lines changed: 143 additions & 78 deletions
Large diffs are not rendered by default.
Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

dropbox-sdk-dotnet/Dropbox.Api/Generated/Files/UploadError.cs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,28 @@ public PayloadTooLarge AsPayloadTooLarge
100100
}
101101
}
102102

103+
/// <summary>
104+
/// <para>Gets a value indicating whether this instance is ContentHashMismatch</para>
105+
/// </summary>
106+
public bool IsContentHashMismatch
107+
{
108+
get
109+
{
110+
return this is ContentHashMismatch;
111+
}
112+
}
113+
114+
/// <summary>
115+
/// <para>Gets this instance as a ContentHashMismatch, or <c>null</c>.</para>
116+
/// </summary>
117+
public ContentHashMismatch AsContentHashMismatch
118+
{
119+
get
120+
{
121+
return this as ContentHashMismatch;
122+
}
123+
}
124+
103125
/// <summary>
104126
/// <para>Gets a value indicating whether this instance is Other</para>
105127
/// </summary>
@@ -154,6 +176,12 @@ public override void EncodeFields(UploadError value, enc.IJsonWriter writer)
154176
PayloadTooLarge.Encoder.EncodeFields((PayloadTooLarge)value, writer);
155177
return;
156178
}
179+
if (value is ContentHashMismatch)
180+
{
181+
WriteProperty(".tag", "content_hash_mismatch", writer, enc.StringEncoder.Instance);
182+
ContentHashMismatch.Encoder.EncodeFields((ContentHashMismatch)value, writer);
183+
return;
184+
}
157185
if (value is Other)
158186
{
159187
WriteProperty(".tag", "other", writer, enc.StringEncoder.Instance);
@@ -198,6 +226,8 @@ protected override UploadError Decode(string tag, enc.IJsonReader reader)
198226
return PropertiesError.Decoder.DecodeFields(reader);
199227
case "payload_too_large":
200228
return PayloadTooLarge.Decoder.DecodeFields(reader);
229+
case "content_hash_mismatch":
230+
return ContentHashMismatch.Decoder.DecodeFields(reader);
201231
default:
202232
return Other.Decoder.DecodeFields(reader);
203233
}
@@ -462,6 +492,78 @@ protected override PayloadTooLarge Create()
462492
#endregion
463493
}
464494

495+
/// <summary>
496+
/// <para>The content received by the Dropbox server in this call does not match the
497+
/// provided content hash.</para>
498+
/// </summary>
499+
public sealed class ContentHashMismatch : UploadError
500+
{
501+
#pragma warning disable 108
502+
503+
/// <summary>
504+
/// <para>The encoder instance.</para>
505+
/// </summary>
506+
internal static enc.StructEncoder<ContentHashMismatch> Encoder = new ContentHashMismatchEncoder();
507+
508+
/// <summary>
509+
/// <para>The decoder instance.</para>
510+
/// </summary>
511+
internal static enc.StructDecoder<ContentHashMismatch> Decoder = new ContentHashMismatchDecoder();
512+
513+
/// <summary>
514+
/// <para>Initializes a new instance of the <see cref="ContentHashMismatch" />
515+
/// class.</para>
516+
/// </summary>
517+
private ContentHashMismatch()
518+
{
519+
}
520+
521+
/// <summary>
522+
/// <para>A singleton instance of ContentHashMismatch</para>
523+
/// </summary>
524+
public static readonly ContentHashMismatch Instance = new ContentHashMismatch();
525+
526+
#region Encoder class
527+
528+
/// <summary>
529+
/// <para>Encoder for <see cref="ContentHashMismatch" />.</para>
530+
/// </summary>
531+
private class ContentHashMismatchEncoder : enc.StructEncoder<ContentHashMismatch>
532+
{
533+
/// <summary>
534+
/// <para>Encode fields of given value.</para>
535+
/// </summary>
536+
/// <param name="value">The value.</param>
537+
/// <param name="writer">The writer.</param>
538+
public override void EncodeFields(ContentHashMismatch value, enc.IJsonWriter writer)
539+
{
540+
}
541+
}
542+
543+
#endregion
544+
545+
#region Decoder class
546+
547+
/// <summary>
548+
/// <para>Decoder for <see cref="ContentHashMismatch" />.</para>
549+
/// </summary>
550+
private class ContentHashMismatchDecoder : enc.StructDecoder<ContentHashMismatch>
551+
{
552+
/// <summary>
553+
/// <para>Create a new instance of type <see cref="ContentHashMismatch"
554+
/// />.</para>
555+
/// </summary>
556+
/// <returns>The struct instance.</returns>
557+
protected override ContentHashMismatch Create()
558+
{
559+
return ContentHashMismatch.Instance;
560+
}
561+
562+
}
563+
564+
#endregion
565+
}
566+
465567
/// <summary>
466568
/// <para>The other object</para>
467569
/// </summary>

0 commit comments

Comments
 (0)