-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAddFieldsData.cs
More file actions
163 lines (141 loc) · 6.02 KB
/
AddFieldsData.cs
File metadata and controls
163 lines (141 loc) · 6.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// <auto-generated>
/*
* DocSpring API
*
* Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
*
* The version of the OpenAPI document: v1
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using DocSpring.Client.Client;
namespace DocSpring.Client.Model
{
/// <summary>
/// AddFieldsData
/// </summary>
public partial class AddFieldsData : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="AddFieldsData" /> class.
/// </summary>
/// <param name="fields">fields</param>
[JsonConstructor]
public AddFieldsData(List<Object> fields)
{
this.fields = fields;
OnCreated();
}
partial void OnCreated();
/// <summary>
/// Gets or Sets fields
/// </summary>
[JsonPropertyName("fields")]
public List<Object> fields { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class AddFieldsData {\n");
sb.Append(" fields: ").Append(fields).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// A Json converter for type <see cref="AddFieldsData" />
/// </summary>
public class AddFieldsDataJsonConverter : JsonConverter<AddFieldsData>
{
/// <summary>
/// Deserializes json to <see cref="AddFieldsData" />
/// </summary>
/// <param name="utf8JsonReader"></param>
/// <param name="typeToConvert"></param>
/// <param name="jsonSerializerOptions"></param>
/// <returns></returns>
/// <exception cref="JsonException"></exception>
public override AddFieldsData Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
{
int currentDepth = utf8JsonReader.CurrentDepth;
if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
throw new JsonException();
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option<List<Object>> fields = default;
while (utf8JsonReader.Read())
{
if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
break;
if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
break;
if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
{
string localVarJsonPropertyName = utf8JsonReader.GetString();
utf8JsonReader.Read();
switch (localVarJsonPropertyName)
{
case "fields":
fields = new Option<List<Object>>(JsonSerializer.Deserialize<List<Object>>(ref utf8JsonReader, jsonSerializerOptions));
break;
default:
break;
}
}
}
if (!fields.IsSet)
throw new ArgumentException("Property is required for class AddFieldsData.", nameof(fields));
if (fields.IsSet && fields.Value == null)
throw new ArgumentNullException(nameof(fields), "Property is not nullable for class AddFieldsData.");
return new AddFieldsData(fields.Value);
}
/// <summary>
/// Serializes a <see cref="AddFieldsData" />
/// </summary>
/// <param name="writer"></param>
/// <param name="addFieldsData"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public override void Write(Utf8JsonWriter writer, AddFieldsData addFieldsData, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteStartObject();
WriteProperties(writer, addFieldsData, jsonSerializerOptions);
writer.WriteEndObject();
}
/// <summary>
/// Serializes the properties of <see cref="AddFieldsData" />
/// </summary>
/// <param name="writer"></param>
/// <param name="addFieldsData"></param>
/// <param name="jsonSerializerOptions"></param>
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(Utf8JsonWriter writer, AddFieldsData addFieldsData, JsonSerializerOptions jsonSerializerOptions)
{
if (addFieldsData.fields == null)
throw new ArgumentNullException(nameof(addFieldsData.fields), "Property is required for class AddFieldsData.");
writer.WritePropertyName("fields");
JsonSerializer.Serialize(writer, addFieldsData.fields, jsonSerializerOptions);
}
}
}