Skip to content

Commit b6c505f

Browse files
authored
Update generator to recursively handle unions (#258)
* Update generator to recursively handle unions
1 parent afbc332 commit b6c505f

28 files changed

+6174
-2
lines changed

dropbox-sdk-dotnet/Dropbox.Api/Generated/FileProperties/AddPropertiesError.cs

Lines changed: 556 additions & 0 deletions
Large diffs are not rendered by default.

dropbox-sdk-dotnet/Dropbox.Api/Generated/FileProperties/InvalidPropertyGroupError.cs

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,72 @@ public UnsupportedFolder AsUnsupportedFolder
146146
}
147147
}
148148

149+
/// <summary>
150+
/// <para>Gets a value indicating whether this instance is TemplateNotFound</para>
151+
/// </summary>
152+
public bool IsTemplateNotFound
153+
{
154+
get
155+
{
156+
return this is TemplateNotFound;
157+
}
158+
}
159+
160+
/// <summary>
161+
/// <para>Gets this instance as a TemplateNotFound, or <c>null</c>.</para>
162+
/// </summary>
163+
public TemplateNotFound AsTemplateNotFound
164+
{
165+
get
166+
{
167+
return this as TemplateNotFound;
168+
}
169+
}
170+
171+
/// <summary>
172+
/// <para>Gets a value indicating whether this instance is RestrictedContent</para>
173+
/// </summary>
174+
public bool IsRestrictedContent
175+
{
176+
get
177+
{
178+
return this is RestrictedContent;
179+
}
180+
}
181+
182+
/// <summary>
183+
/// <para>Gets this instance as a RestrictedContent, or <c>null</c>.</para>
184+
/// </summary>
185+
public RestrictedContent AsRestrictedContent
186+
{
187+
get
188+
{
189+
return this as RestrictedContent;
190+
}
191+
}
192+
193+
/// <summary>
194+
/// <para>Gets a value indicating whether this instance is Other</para>
195+
/// </summary>
196+
public bool IsOther
197+
{
198+
get
199+
{
200+
return this is Other;
201+
}
202+
}
203+
204+
/// <summary>
205+
/// <para>Gets this instance as a Other, or <c>null</c>.</para>
206+
/// </summary>
207+
public Other AsOther
208+
{
209+
get
210+
{
211+
return this as Other;
212+
}
213+
}
214+
149215
#region Encoder class
150216

151217
/// <summary>
@@ -190,6 +256,24 @@ public override void EncodeFields(InvalidPropertyGroupError value, enc.IJsonWrit
190256
UnsupportedFolder.Encoder.EncodeFields((UnsupportedFolder)value, writer);
191257
return;
192258
}
259+
if (value is TemplateNotFound)
260+
{
261+
WriteProperty(".tag", "template_not_found", writer, enc.StringEncoder.Instance);
262+
TemplateNotFound.Encoder.EncodeFields((TemplateNotFound)value, writer);
263+
return;
264+
}
265+
if (value is RestrictedContent)
266+
{
267+
WriteProperty(".tag", "restricted_content", writer, enc.StringEncoder.Instance);
268+
RestrictedContent.Encoder.EncodeFields((RestrictedContent)value, writer);
269+
return;
270+
}
271+
if (value is Other)
272+
{
273+
WriteProperty(".tag", "other", writer, enc.StringEncoder.Instance);
274+
Other.Encoder.EncodeFields((Other)value, writer);
275+
return;
276+
}
193277
throw new sys.InvalidOperationException();
194278
}
195279
}
@@ -233,6 +317,12 @@ protected override InvalidPropertyGroupError Decode(string tag, enc.IJsonReader
233317
return Path.Decoder.DecodeFields(reader);
234318
case "unsupported_folder":
235319
return UnsupportedFolder.Decoder.DecodeFields(reader);
320+
case "template_not_found":
321+
return TemplateNotFound.Decoder.DecodeFields(reader);
322+
case "restricted_content":
323+
return RestrictedContent.Decoder.DecodeFields(reader);
324+
case "other":
325+
return Other.Decoder.DecodeFields(reader);
236326
default:
237327
throw new sys.InvalidOperationException();
238328
}
@@ -623,5 +713,243 @@ protected override UnsupportedFolder Create()
623713

624714
#endregion
625715
}
716+
717+
/// <summary>
718+
/// <para>Template does not exist for the given identifier.</para>
719+
/// </summary>
720+
public sealed class TemplateNotFound : InvalidPropertyGroupError
721+
{
722+
#pragma warning disable 108
723+
724+
/// <summary>
725+
/// <para>The encoder instance.</para>
726+
/// </summary>
727+
internal static enc.StructEncoder<TemplateNotFound> Encoder = new TemplateNotFoundEncoder();
728+
729+
/// <summary>
730+
/// <para>The decoder instance.</para>
731+
/// </summary>
732+
internal static enc.StructDecoder<TemplateNotFound> Decoder = new TemplateNotFoundDecoder();
733+
734+
/// <summary>
735+
/// <para>Initializes a new instance of the <see cref="TemplateNotFound" />
736+
/// class.</para>
737+
/// </summary>
738+
/// <param name="value">The value</param>
739+
public TemplateNotFound(string value)
740+
{
741+
this.Value = value;
742+
}
743+
/// <summary>
744+
/// <para>Initializes a new instance of the <see cref="TemplateNotFound" />
745+
/// class.</para>
746+
/// </summary>
747+
private TemplateNotFound()
748+
{
749+
}
750+
751+
/// <summary>
752+
/// <para>Gets the value of this instance.</para>
753+
/// </summary>
754+
public string Value { get; private set; }
755+
756+
#region Encoder class
757+
758+
/// <summary>
759+
/// <para>Encoder for <see cref="TemplateNotFound" />.</para>
760+
/// </summary>
761+
private class TemplateNotFoundEncoder : enc.StructEncoder<TemplateNotFound>
762+
{
763+
/// <summary>
764+
/// <para>Encode fields of given value.</para>
765+
/// </summary>
766+
/// <param name="value">The value.</param>
767+
/// <param name="writer">The writer.</param>
768+
public override void EncodeFields(TemplateNotFound value, enc.IJsonWriter writer)
769+
{
770+
WriteProperty("template_not_found", value.Value, writer, enc.StringEncoder.Instance);
771+
}
772+
}
773+
774+
#endregion
775+
776+
#region Decoder class
777+
778+
/// <summary>
779+
/// <para>Decoder for <see cref="TemplateNotFound" />.</para>
780+
/// </summary>
781+
private class TemplateNotFoundDecoder : enc.StructDecoder<TemplateNotFound>
782+
{
783+
/// <summary>
784+
/// <para>Create a new instance of type <see cref="TemplateNotFound" />.</para>
785+
/// </summary>
786+
/// <returns>The struct instance.</returns>
787+
protected override TemplateNotFound Create()
788+
{
789+
return new TemplateNotFound();
790+
}
791+
792+
/// <summary>
793+
/// <para>Set given field.</para>
794+
/// </summary>
795+
/// <param name="value">The field value.</param>
796+
/// <param name="fieldName">The field name.</param>
797+
/// <param name="reader">The json reader.</param>
798+
protected override void SetField(TemplateNotFound value, string fieldName, enc.IJsonReader reader)
799+
{
800+
switch (fieldName)
801+
{
802+
case "template_not_found":
803+
value.Value = enc.StringDecoder.Instance.Decode(reader);
804+
break;
805+
default:
806+
reader.Skip();
807+
break;
808+
}
809+
}
810+
}
811+
812+
#endregion
813+
}
814+
815+
/// <summary>
816+
/// <para>You do not have permission to modify this template.</para>
817+
/// </summary>
818+
public sealed class RestrictedContent : InvalidPropertyGroupError
819+
{
820+
#pragma warning disable 108
821+
822+
/// <summary>
823+
/// <para>The encoder instance.</para>
824+
/// </summary>
825+
internal static enc.StructEncoder<RestrictedContent> Encoder = new RestrictedContentEncoder();
826+
827+
/// <summary>
828+
/// <para>The decoder instance.</para>
829+
/// </summary>
830+
internal static enc.StructDecoder<RestrictedContent> Decoder = new RestrictedContentDecoder();
831+
832+
/// <summary>
833+
/// <para>Initializes a new instance of the <see cref="RestrictedContent" />
834+
/// class.</para>
835+
/// </summary>
836+
private RestrictedContent()
837+
{
838+
}
839+
840+
/// <summary>
841+
/// <para>A singleton instance of RestrictedContent</para>
842+
/// </summary>
843+
public static readonly RestrictedContent Instance = new RestrictedContent();
844+
845+
#region Encoder class
846+
847+
/// <summary>
848+
/// <para>Encoder for <see cref="RestrictedContent" />.</para>
849+
/// </summary>
850+
private class RestrictedContentEncoder : enc.StructEncoder<RestrictedContent>
851+
{
852+
/// <summary>
853+
/// <para>Encode fields of given value.</para>
854+
/// </summary>
855+
/// <param name="value">The value.</param>
856+
/// <param name="writer">The writer.</param>
857+
public override void EncodeFields(RestrictedContent value, enc.IJsonWriter writer)
858+
{
859+
}
860+
}
861+
862+
#endregion
863+
864+
#region Decoder class
865+
866+
/// <summary>
867+
/// <para>Decoder for <see cref="RestrictedContent" />.</para>
868+
/// </summary>
869+
private class RestrictedContentDecoder : enc.StructDecoder<RestrictedContent>
870+
{
871+
/// <summary>
872+
/// <para>Create a new instance of type <see cref="RestrictedContent"
873+
/// />.</para>
874+
/// </summary>
875+
/// <returns>The struct instance.</returns>
876+
protected override RestrictedContent Create()
877+
{
878+
return RestrictedContent.Instance;
879+
}
880+
881+
}
882+
883+
#endregion
884+
}
885+
886+
/// <summary>
887+
/// <para>The other object</para>
888+
/// </summary>
889+
public sealed class Other : InvalidPropertyGroupError
890+
{
891+
#pragma warning disable 108
892+
893+
/// <summary>
894+
/// <para>The encoder instance.</para>
895+
/// </summary>
896+
internal static enc.StructEncoder<Other> Encoder = new OtherEncoder();
897+
898+
/// <summary>
899+
/// <para>The decoder instance.</para>
900+
/// </summary>
901+
internal static enc.StructDecoder<Other> Decoder = new OtherDecoder();
902+
903+
/// <summary>
904+
/// <para>Initializes a new instance of the <see cref="Other" /> class.</para>
905+
/// </summary>
906+
private Other()
907+
{
908+
}
909+
910+
/// <summary>
911+
/// <para>A singleton instance of Other</para>
912+
/// </summary>
913+
public static readonly Other Instance = new Other();
914+
915+
#region Encoder class
916+
917+
/// <summary>
918+
/// <para>Encoder for <see cref="Other" />.</para>
919+
/// </summary>
920+
private class OtherEncoder : enc.StructEncoder<Other>
921+
{
922+
/// <summary>
923+
/// <para>Encode fields of given value.</para>
924+
/// </summary>
925+
/// <param name="value">The value.</param>
926+
/// <param name="writer">The writer.</param>
927+
public override void EncodeFields(Other value, enc.IJsonWriter writer)
928+
{
929+
}
930+
}
931+
932+
#endregion
933+
934+
#region Decoder class
935+
936+
/// <summary>
937+
/// <para>Decoder for <see cref="Other" />.</para>
938+
/// </summary>
939+
private class OtherDecoder : enc.StructDecoder<Other>
940+
{
941+
/// <summary>
942+
/// <para>Create a new instance of type <see cref="Other" />.</para>
943+
/// </summary>
944+
/// <returns>The struct instance.</returns>
945+
protected override Other Create()
946+
{
947+
return Other.Instance;
948+
}
949+
950+
}
951+
952+
#endregion
953+
}
626954
}
627955
}

0 commit comments

Comments
 (0)