|
| 1 | +// <auto-generated> |
| 2 | +// Auto-generated by StoneAPI, do not modify. |
| 3 | +// </auto-generated> |
| 4 | + |
| 5 | +namespace Dropbox.Api.Sharing |
| 6 | +{ |
| 7 | + using sys = System; |
| 8 | + using col = System.Collections.Generic; |
| 9 | + using re = System.Text.RegularExpressions; |
| 10 | + |
| 11 | + using enc = Dropbox.Api.Stone; |
| 12 | + |
| 13 | + /// <summary> |
| 14 | + /// <para>The link audience option object</para> |
| 15 | + /// </summary> |
| 16 | + public class LinkAudienceOption |
| 17 | + { |
| 18 | + #pragma warning disable 108 |
| 19 | + |
| 20 | + /// <summary> |
| 21 | + /// <para>The encoder instance.</para> |
| 22 | + /// </summary> |
| 23 | + internal static enc.StructEncoder<LinkAudienceOption> Encoder = new LinkAudienceOptionEncoder(); |
| 24 | + |
| 25 | + /// <summary> |
| 26 | + /// <para>The decoder instance.</para> |
| 27 | + /// </summary> |
| 28 | + internal static enc.StructDecoder<LinkAudienceOption> Decoder = new LinkAudienceOptionDecoder(); |
| 29 | + |
| 30 | + /// <summary> |
| 31 | + /// <para>Initializes a new instance of the <see cref="LinkAudienceOption" /> |
| 32 | + /// class.</para> |
| 33 | + /// </summary> |
| 34 | + /// <param name="audience">Specifies who can access the link.</param> |
| 35 | + /// <param name="allowed">Whether the user calling this API can select this audience |
| 36 | + /// option.</param> |
| 37 | + /// <param name="disallowedReason">If <paramref name="allowed" /> is <c>false</c>, this |
| 38 | + /// will provide the reason that the user is not permitted to set the visibility to |
| 39 | + /// this policy.</param> |
| 40 | + public LinkAudienceOption(LinkAudience audience, |
| 41 | + bool allowed, |
| 42 | + LinkAudienceDisallowedReason disallowedReason = null) |
| 43 | + { |
| 44 | + if (audience == null) |
| 45 | + { |
| 46 | + throw new sys.ArgumentNullException("audience"); |
| 47 | + } |
| 48 | + |
| 49 | + this.Audience = audience; |
| 50 | + this.Allowed = allowed; |
| 51 | + this.DisallowedReason = disallowedReason; |
| 52 | + } |
| 53 | + |
| 54 | + /// <summary> |
| 55 | + /// <para>Initializes a new instance of the <see cref="LinkAudienceOption" /> |
| 56 | + /// class.</para> |
| 57 | + /// </summary> |
| 58 | + /// <remarks>This is to construct an instance of the object when |
| 59 | + /// deserializing.</remarks> |
| 60 | + [sys.ComponentModel.EditorBrowsable(sys.ComponentModel.EditorBrowsableState.Never)] |
| 61 | + public LinkAudienceOption() |
| 62 | + { |
| 63 | + } |
| 64 | + |
| 65 | + /// <summary> |
| 66 | + /// <para>Specifies who can access the link.</para> |
| 67 | + /// </summary> |
| 68 | + public LinkAudience Audience { get; protected set; } |
| 69 | + |
| 70 | + /// <summary> |
| 71 | + /// <para>Whether the user calling this API can select this audience option.</para> |
| 72 | + /// </summary> |
| 73 | + public bool Allowed { get; protected set; } |
| 74 | + |
| 75 | + /// <summary> |
| 76 | + /// <para>If <see cref="Allowed" /> is <c>false</c>, this will provide the reason that |
| 77 | + /// the user is not permitted to set the visibility to this policy.</para> |
| 78 | + /// </summary> |
| 79 | + public LinkAudienceDisallowedReason DisallowedReason { get; protected set; } |
| 80 | + |
| 81 | + #region Encoder class |
| 82 | + |
| 83 | + /// <summary> |
| 84 | + /// <para>Encoder for <see cref="LinkAudienceOption" />.</para> |
| 85 | + /// </summary> |
| 86 | + private class LinkAudienceOptionEncoder : enc.StructEncoder<LinkAudienceOption> |
| 87 | + { |
| 88 | + /// <summary> |
| 89 | + /// <para>Encode fields of given value.</para> |
| 90 | + /// </summary> |
| 91 | + /// <param name="value">The value.</param> |
| 92 | + /// <param name="writer">The writer.</param> |
| 93 | + public override void EncodeFields(LinkAudienceOption value, enc.IJsonWriter writer) |
| 94 | + { |
| 95 | + WriteProperty("audience", value.Audience, writer, global::Dropbox.Api.Sharing.LinkAudience.Encoder); |
| 96 | + WriteProperty("allowed", value.Allowed, writer, enc.BooleanEncoder.Instance); |
| 97 | + if (value.DisallowedReason != null) |
| 98 | + { |
| 99 | + WriteProperty("disallowed_reason", value.DisallowedReason, writer, global::Dropbox.Api.Sharing.LinkAudienceDisallowedReason.Encoder); |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | + |
| 104 | + #endregion |
| 105 | + |
| 106 | + |
| 107 | + #region Decoder class |
| 108 | + |
| 109 | + /// <summary> |
| 110 | + /// <para>Decoder for <see cref="LinkAudienceOption" />.</para> |
| 111 | + /// </summary> |
| 112 | + private class LinkAudienceOptionDecoder : enc.StructDecoder<LinkAudienceOption> |
| 113 | + { |
| 114 | + /// <summary> |
| 115 | + /// <para>Create a new instance of type <see cref="LinkAudienceOption" />.</para> |
| 116 | + /// </summary> |
| 117 | + /// <returns>The struct instance.</returns> |
| 118 | + protected override LinkAudienceOption Create() |
| 119 | + { |
| 120 | + return new LinkAudienceOption(); |
| 121 | + } |
| 122 | + |
| 123 | + /// <summary> |
| 124 | + /// <para>Set given field.</para> |
| 125 | + /// </summary> |
| 126 | + /// <param name="value">The field value.</param> |
| 127 | + /// <param name="fieldName">The field name.</param> |
| 128 | + /// <param name="reader">The json reader.</param> |
| 129 | + protected override void SetField(LinkAudienceOption value, string fieldName, enc.IJsonReader reader) |
| 130 | + { |
| 131 | + switch (fieldName) |
| 132 | + { |
| 133 | + case "audience": |
| 134 | + value.Audience = global::Dropbox.Api.Sharing.LinkAudience.Decoder.Decode(reader); |
| 135 | + break; |
| 136 | + case "allowed": |
| 137 | + value.Allowed = enc.BooleanDecoder.Instance.Decode(reader); |
| 138 | + break; |
| 139 | + case "disallowed_reason": |
| 140 | + value.DisallowedReason = global::Dropbox.Api.Sharing.LinkAudienceDisallowedReason.Decoder.Decode(reader); |
| 141 | + break; |
| 142 | + default: |
| 143 | + reader.Skip(); |
| 144 | + break; |
| 145 | + } |
| 146 | + } |
| 147 | + } |
| 148 | + |
| 149 | + #endregion |
| 150 | + } |
| 151 | +} |
0 commit comments