|
| 1 | +// <auto-generated> |
| 2 | +// Auto-generated by StoneAPI, do not modify. |
| 3 | +// </auto-generated> |
| 4 | + |
| 5 | +namespace Dropbox.Api.Files |
| 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 add tag arg object</para> |
| 15 | + /// </summary> |
| 16 | + public class AddTagArg |
| 17 | + { |
| 18 | + #pragma warning disable 108 |
| 19 | + |
| 20 | + /// <summary> |
| 21 | + /// <para>The encoder instance.</para> |
| 22 | + /// </summary> |
| 23 | + internal static enc.StructEncoder<AddTagArg> Encoder = new AddTagArgEncoder(); |
| 24 | + |
| 25 | + /// <summary> |
| 26 | + /// <para>The decoder instance.</para> |
| 27 | + /// </summary> |
| 28 | + internal static enc.StructDecoder<AddTagArg> Decoder = new AddTagArgDecoder(); |
| 29 | + |
| 30 | + /// <summary> |
| 31 | + /// <para>Initializes a new instance of the <see cref="AddTagArg" /> class.</para> |
| 32 | + /// </summary> |
| 33 | + /// <param name="path">Path to the item to be tagged.</param> |
| 34 | + /// <param name="tagText">The value of the tag to add.</param> |
| 35 | + public AddTagArg(string path, |
| 36 | + string tagText) |
| 37 | + { |
| 38 | + if (path == null) |
| 39 | + { |
| 40 | + throw new sys.ArgumentNullException("path"); |
| 41 | + } |
| 42 | + if (!re.Regex.IsMatch(path, @"\A(?:/(.|[\r\n])*)\z")) |
| 43 | + { |
| 44 | + throw new sys.ArgumentOutOfRangeException("path", @"Value should match pattern '\A(?:/(.|[\r\n])*)\z'"); |
| 45 | + } |
| 46 | + |
| 47 | + if (tagText == null) |
| 48 | + { |
| 49 | + throw new sys.ArgumentNullException("tagText"); |
| 50 | + } |
| 51 | + if (tagText.Length < 1) |
| 52 | + { |
| 53 | + throw new sys.ArgumentOutOfRangeException("tagText", "Length should be at least 1"); |
| 54 | + } |
| 55 | + if (tagText.Length > 32) |
| 56 | + { |
| 57 | + throw new sys.ArgumentOutOfRangeException("tagText", "Length should be at most 32"); |
| 58 | + } |
| 59 | + if (!re.Regex.IsMatch(tagText, @"\A(?:[A-Za-z0-9_]+)\z")) |
| 60 | + { |
| 61 | + throw new sys.ArgumentOutOfRangeException("tagText", @"Value should match pattern '\A(?:[A-Za-z0-9_]+)\z'"); |
| 62 | + } |
| 63 | + |
| 64 | + this.Path = path; |
| 65 | + this.TagText = tagText; |
| 66 | + } |
| 67 | + |
| 68 | + /// <summary> |
| 69 | + /// <para>Initializes a new instance of the <see cref="AddTagArg" /> class.</para> |
| 70 | + /// </summary> |
| 71 | + /// <remarks>This is to construct an instance of the object when |
| 72 | + /// deserializing.</remarks> |
| 73 | + [sys.ComponentModel.EditorBrowsable(sys.ComponentModel.EditorBrowsableState.Never)] |
| 74 | + public AddTagArg() |
| 75 | + { |
| 76 | + } |
| 77 | + |
| 78 | + /// <summary> |
| 79 | + /// <para>Path to the item to be tagged.</para> |
| 80 | + /// </summary> |
| 81 | + public string Path { get; protected set; } |
| 82 | + |
| 83 | + /// <summary> |
| 84 | + /// <para>The value of the tag to add.</para> |
| 85 | + /// </summary> |
| 86 | + public string TagText { get; protected set; } |
| 87 | + |
| 88 | + #region Encoder class |
| 89 | + |
| 90 | + /// <summary> |
| 91 | + /// <para>Encoder for <see cref="AddTagArg" />.</para> |
| 92 | + /// </summary> |
| 93 | + private class AddTagArgEncoder : enc.StructEncoder<AddTagArg> |
| 94 | + { |
| 95 | + /// <summary> |
| 96 | + /// <para>Encode fields of given value.</para> |
| 97 | + /// </summary> |
| 98 | + /// <param name="value">The value.</param> |
| 99 | + /// <param name="writer">The writer.</param> |
| 100 | + public override void EncodeFields(AddTagArg value, enc.IJsonWriter writer) |
| 101 | + { |
| 102 | + WriteProperty("path", value.Path, writer, enc.StringEncoder.Instance); |
| 103 | + WriteProperty("tag_text", value.TagText, writer, enc.StringEncoder.Instance); |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + #endregion |
| 108 | + |
| 109 | + |
| 110 | + #region Decoder class |
| 111 | + |
| 112 | + /// <summary> |
| 113 | + /// <para>Decoder for <see cref="AddTagArg" />.</para> |
| 114 | + /// </summary> |
| 115 | + private class AddTagArgDecoder : enc.StructDecoder<AddTagArg> |
| 116 | + { |
| 117 | + /// <summary> |
| 118 | + /// <para>Create a new instance of type <see cref="AddTagArg" />.</para> |
| 119 | + /// </summary> |
| 120 | + /// <returns>The struct instance.</returns> |
| 121 | + protected override AddTagArg Create() |
| 122 | + { |
| 123 | + return new AddTagArg(); |
| 124 | + } |
| 125 | + |
| 126 | + /// <summary> |
| 127 | + /// <para>Set given field.</para> |
| 128 | + /// </summary> |
| 129 | + /// <param name="value">The field value.</param> |
| 130 | + /// <param name="fieldName">The field name.</param> |
| 131 | + /// <param name="reader">The json reader.</param> |
| 132 | + protected override void SetField(AddTagArg value, string fieldName, enc.IJsonReader reader) |
| 133 | + { |
| 134 | + switch (fieldName) |
| 135 | + { |
| 136 | + case "path": |
| 137 | + value.Path = enc.StringDecoder.Instance.Decode(reader); |
| 138 | + break; |
| 139 | + case "tag_text": |
| 140 | + value.TagText = enc.StringDecoder.Instance.Decode(reader); |
| 141 | + break; |
| 142 | + default: |
| 143 | + reader.Skip(); |
| 144 | + break; |
| 145 | + } |
| 146 | + } |
| 147 | + } |
| 148 | + |
| 149 | + #endregion |
| 150 | + } |
| 151 | +} |
0 commit comments