|
| 1 | +// <auto-generated> |
| 2 | +// Auto-generated by StoneAPI, do not modify. |
| 3 | +// </auto-generated> |
| 4 | + |
| 5 | +namespace Dropbox.Api.Async |
| 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>Result returned by methods that may either launch an asynchronous job or complete |
| 15 | + /// synchronously. Upon synchronous completion of the job, no additional information is |
| 16 | + /// returned.</para> |
| 17 | + /// </summary> |
| 18 | + public class LaunchEmptyResult |
| 19 | + { |
| 20 | + #pragma warning disable 108 |
| 21 | + |
| 22 | + /// <summary> |
| 23 | + /// <para>The encoder instance.</para> |
| 24 | + /// </summary> |
| 25 | + internal static enc.StructEncoder<LaunchEmptyResult> Encoder = new LaunchEmptyResultEncoder(); |
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// <para>The decoder instance.</para> |
| 29 | + /// </summary> |
| 30 | + internal static enc.StructDecoder<LaunchEmptyResult> Decoder = new LaunchEmptyResultDecoder(); |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// <para>Initializes a new instance of the <see cref="LaunchEmptyResult" /> |
| 34 | + /// class.</para> |
| 35 | + /// </summary> |
| 36 | + public LaunchEmptyResult() |
| 37 | + { |
| 38 | + } |
| 39 | + |
| 40 | + /// <summary> |
| 41 | + /// <para>Gets a value indicating whether this instance is Complete</para> |
| 42 | + /// </summary> |
| 43 | + public bool IsComplete |
| 44 | + { |
| 45 | + get |
| 46 | + { |
| 47 | + return this is Complete; |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + /// <summary> |
| 52 | + /// <para>Gets this instance as a Complete, or <c>null</c>.</para> |
| 53 | + /// </summary> |
| 54 | + public Complete AsComplete |
| 55 | + { |
| 56 | + get |
| 57 | + { |
| 58 | + return this as Complete; |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// <para>Gets a value indicating whether this instance is AsyncJobId</para> |
| 64 | + /// </summary> |
| 65 | + public bool IsAsyncJobId |
| 66 | + { |
| 67 | + get |
| 68 | + { |
| 69 | + return this is AsyncJobId; |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + /// <summary> |
| 74 | + /// <para>Gets this instance as a AsyncJobId, or <c>null</c>.</para> |
| 75 | + /// </summary> |
| 76 | + public AsyncJobId AsAsyncJobId |
| 77 | + { |
| 78 | + get |
| 79 | + { |
| 80 | + return this as AsyncJobId; |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + #region Encoder class |
| 85 | + |
| 86 | + /// <summary> |
| 87 | + /// <para>Encoder for <see cref="LaunchEmptyResult" />.</para> |
| 88 | + /// </summary> |
| 89 | + private class LaunchEmptyResultEncoder : enc.StructEncoder<LaunchEmptyResult> |
| 90 | + { |
| 91 | + /// <summary> |
| 92 | + /// <para>Encode fields of given value.</para> |
| 93 | + /// </summary> |
| 94 | + /// <param name="value">The value.</param> |
| 95 | + /// <param name="writer">The writer.</param> |
| 96 | + public override void EncodeFields(LaunchEmptyResult value, enc.IJsonWriter writer) |
| 97 | + { |
| 98 | + if (value is Complete) |
| 99 | + { |
| 100 | + WriteProperty(".tag", "complete", writer, enc.StringEncoder.Instance); |
| 101 | + Complete.Encoder.EncodeFields((Complete)value, writer); |
| 102 | + return; |
| 103 | + } |
| 104 | + if (value is AsyncJobId) |
| 105 | + { |
| 106 | + WriteProperty(".tag", "async_job_id", writer, enc.StringEncoder.Instance); |
| 107 | + AsyncJobId.Encoder.EncodeFields((AsyncJobId)value, writer); |
| 108 | + return; |
| 109 | + } |
| 110 | + throw new sys.InvalidOperationException(); |
| 111 | + } |
| 112 | + } |
| 113 | + |
| 114 | + #endregion |
| 115 | + |
| 116 | + #region Decoder class |
| 117 | + |
| 118 | + /// <summary> |
| 119 | + /// <para>Decoder for <see cref="LaunchEmptyResult" />.</para> |
| 120 | + /// </summary> |
| 121 | + private class LaunchEmptyResultDecoder : enc.UnionDecoder<LaunchEmptyResult> |
| 122 | + { |
| 123 | + /// <summary> |
| 124 | + /// <para>Create a new instance of type <see cref="LaunchEmptyResult" />.</para> |
| 125 | + /// </summary> |
| 126 | + /// <returns>The struct instance.</returns> |
| 127 | + protected override LaunchEmptyResult Create() |
| 128 | + { |
| 129 | + return new LaunchEmptyResult(); |
| 130 | + } |
| 131 | + |
| 132 | + /// <summary> |
| 133 | + /// <para>Decode based on given tag.</para> |
| 134 | + /// </summary> |
| 135 | + /// <param name="tag">The tag.</param> |
| 136 | + /// <param name="reader">The json reader.</param> |
| 137 | + /// <returns>The decoded object.</returns> |
| 138 | + protected override LaunchEmptyResult Decode(string tag, enc.IJsonReader reader) |
| 139 | + { |
| 140 | + switch (tag) |
| 141 | + { |
| 142 | + case "complete": |
| 143 | + return Complete.Decoder.DecodeFields(reader); |
| 144 | + case "async_job_id": |
| 145 | + return AsyncJobId.Decoder.DecodeFields(reader); |
| 146 | + default: |
| 147 | + throw new sys.InvalidOperationException(); |
| 148 | + } |
| 149 | + } |
| 150 | + } |
| 151 | + |
| 152 | + #endregion |
| 153 | + |
| 154 | + /// <summary> |
| 155 | + /// <para>The job finished synchronously and successfully.</para> |
| 156 | + /// </summary> |
| 157 | + public sealed class Complete : LaunchEmptyResult |
| 158 | + { |
| 159 | + #pragma warning disable 108 |
| 160 | + |
| 161 | + /// <summary> |
| 162 | + /// <para>The encoder instance.</para> |
| 163 | + /// </summary> |
| 164 | + internal static enc.StructEncoder<Complete> Encoder = new CompleteEncoder(); |
| 165 | + |
| 166 | + /// <summary> |
| 167 | + /// <para>The decoder instance.</para> |
| 168 | + /// </summary> |
| 169 | + internal static enc.StructDecoder<Complete> Decoder = new CompleteDecoder(); |
| 170 | + |
| 171 | + /// <summary> |
| 172 | + /// <para>Initializes a new instance of the <see cref="Complete" /> class.</para> |
| 173 | + /// </summary> |
| 174 | + private Complete() |
| 175 | + { |
| 176 | + } |
| 177 | + |
| 178 | + /// <summary> |
| 179 | + /// <para>A singleton instance of Complete</para> |
| 180 | + /// </summary> |
| 181 | + public static readonly Complete Instance = new Complete(); |
| 182 | + |
| 183 | + #region Encoder class |
| 184 | + |
| 185 | + /// <summary> |
| 186 | + /// <para>Encoder for <see cref="Complete" />.</para> |
| 187 | + /// </summary> |
| 188 | + private class CompleteEncoder : enc.StructEncoder<Complete> |
| 189 | + { |
| 190 | + /// <summary> |
| 191 | + /// <para>Encode fields of given value.</para> |
| 192 | + /// </summary> |
| 193 | + /// <param name="value">The value.</param> |
| 194 | + /// <param name="writer">The writer.</param> |
| 195 | + public override void EncodeFields(Complete value, enc.IJsonWriter writer) |
| 196 | + { |
| 197 | + } |
| 198 | + } |
| 199 | + |
| 200 | + #endregion |
| 201 | + |
| 202 | + #region Decoder class |
| 203 | + |
| 204 | + /// <summary> |
| 205 | + /// <para>Decoder for <see cref="Complete" />.</para> |
| 206 | + /// </summary> |
| 207 | + private class CompleteDecoder : enc.StructDecoder<Complete> |
| 208 | + { |
| 209 | + /// <summary> |
| 210 | + /// <para>Create a new instance of type <see cref="Complete" />.</para> |
| 211 | + /// </summary> |
| 212 | + /// <returns>The struct instance.</returns> |
| 213 | + protected override Complete Create() |
| 214 | + { |
| 215 | + return Complete.Instance; |
| 216 | + } |
| 217 | + |
| 218 | + } |
| 219 | + |
| 220 | + #endregion |
| 221 | + } |
| 222 | + |
| 223 | + /// <summary> |
| 224 | + /// <para>This response indicates that the processing is asynchronous. The string is an |
| 225 | + /// id that can be used to obtain the status of the asynchronous job.</para> |
| 226 | + /// </summary> |
| 227 | + public sealed class AsyncJobId : LaunchEmptyResult |
| 228 | + { |
| 229 | + #pragma warning disable 108 |
| 230 | + |
| 231 | + /// <summary> |
| 232 | + /// <para>The encoder instance.</para> |
| 233 | + /// </summary> |
| 234 | + internal static enc.StructEncoder<AsyncJobId> Encoder = new AsyncJobIdEncoder(); |
| 235 | + |
| 236 | + /// <summary> |
| 237 | + /// <para>The decoder instance.</para> |
| 238 | + /// </summary> |
| 239 | + internal static enc.StructDecoder<AsyncJobId> Decoder = new AsyncJobIdDecoder(); |
| 240 | + |
| 241 | + /// <summary> |
| 242 | + /// <para>Initializes a new instance of the <see cref="AsyncJobId" /> class.</para> |
| 243 | + /// </summary> |
| 244 | + /// <param name="value">The value</param> |
| 245 | + public AsyncJobId(string value) |
| 246 | + { |
| 247 | + this.Value = value; |
| 248 | + } |
| 249 | + /// <summary> |
| 250 | + /// <para>Initializes a new instance of the <see cref="AsyncJobId" /> class.</para> |
| 251 | + /// </summary> |
| 252 | + private AsyncJobId() |
| 253 | + { |
| 254 | + } |
| 255 | + |
| 256 | + /// <summary> |
| 257 | + /// <para>Gets the value of this instance.</para> |
| 258 | + /// </summary> |
| 259 | + public string Value { get; private set; } |
| 260 | + |
| 261 | + #region Encoder class |
| 262 | + |
| 263 | + /// <summary> |
| 264 | + /// <para>Encoder for <see cref="AsyncJobId" />.</para> |
| 265 | + /// </summary> |
| 266 | + private class AsyncJobIdEncoder : enc.StructEncoder<AsyncJobId> |
| 267 | + { |
| 268 | + /// <summary> |
| 269 | + /// <para>Encode fields of given value.</para> |
| 270 | + /// </summary> |
| 271 | + /// <param name="value">The value.</param> |
| 272 | + /// <param name="writer">The writer.</param> |
| 273 | + public override void EncodeFields(AsyncJobId value, enc.IJsonWriter writer) |
| 274 | + { |
| 275 | + WriteProperty("async_job_id", value.Value, writer, enc.StringEncoder.Instance); |
| 276 | + } |
| 277 | + } |
| 278 | + |
| 279 | + #endregion |
| 280 | + |
| 281 | + #region Decoder class |
| 282 | + |
| 283 | + /// <summary> |
| 284 | + /// <para>Decoder for <see cref="AsyncJobId" />.</para> |
| 285 | + /// </summary> |
| 286 | + private class AsyncJobIdDecoder : enc.StructDecoder<AsyncJobId> |
| 287 | + { |
| 288 | + /// <summary> |
| 289 | + /// <para>Create a new instance of type <see cref="AsyncJobId" />.</para> |
| 290 | + /// </summary> |
| 291 | + /// <returns>The struct instance.</returns> |
| 292 | + protected override AsyncJobId Create() |
| 293 | + { |
| 294 | + return new AsyncJobId(); |
| 295 | + } |
| 296 | + |
| 297 | + /// <summary> |
| 298 | + /// <para>Set given field.</para> |
| 299 | + /// </summary> |
| 300 | + /// <param name="value">The field value.</param> |
| 301 | + /// <param name="fieldName">The field name.</param> |
| 302 | + /// <param name="reader">The json reader.</param> |
| 303 | + protected override void SetField(AsyncJobId value, string fieldName, enc.IJsonReader reader) |
| 304 | + { |
| 305 | + switch (fieldName) |
| 306 | + { |
| 307 | + case "async_job_id": |
| 308 | + value.Value = enc.StringDecoder.Instance.Decode(reader); |
| 309 | + break; |
| 310 | + default: |
| 311 | + reader.Skip(); |
| 312 | + break; |
| 313 | + } |
| 314 | + } |
| 315 | + } |
| 316 | + |
| 317 | + #endregion |
| 318 | + } |
| 319 | + } |
| 320 | +} |
0 commit comments