Skip to content

Commit 13712ee

Browse files
committed
add new model in csharp
1 parent f521d6e commit 13712ee

File tree

3 files changed

+397
-0
lines changed
  • samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model

3 files changed

+397
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
using System;
2+
using System.Linq;
3+
using System.IO;
4+
using System.Text;
5+
using System.Collections;
6+
using System.Collections.Generic;
7+
using System.Collections.ObjectModel;
8+
using System.Runtime.Serialization;
9+
using Newtonsoft.Json;
10+
using Newtonsoft.Json.Converters;
11+
12+
namespace IO.Swagger.Model
13+
{
14+
/// <summary>
15+
///
16+
/// </summary>
17+
[DataContract]
18+
public partial class Animal : IEquatable<Animal>
19+
{
20+
21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="Animal" /> class.
23+
/// Initializes a new instance of the <see cref="Animal" />class.
24+
/// </summary>
25+
/// <param name="ClassName">ClassName (required).</param>
26+
27+
public Animal(string ClassName = null)
28+
{
29+
// to ensure "ClassName" is required (not null)
30+
if (ClassName == null)
31+
{
32+
throw new InvalidDataException("ClassName is a required property for Animal and cannot be null");
33+
}
34+
else
35+
{
36+
this.ClassName = ClassName;
37+
}
38+
39+
}
40+
41+
42+
/// <summary>
43+
/// Gets or Sets ClassName
44+
/// </summary>
45+
[DataMember(Name="className", EmitDefaultValue=false)]
46+
public string ClassName { get; set; }
47+
48+
/// <summary>
49+
/// Returns the string presentation of the object
50+
/// </summary>
51+
/// <returns>String presentation of the object</returns>
52+
public override string ToString()
53+
{
54+
var sb = new StringBuilder();
55+
sb.Append("class Animal {\n");
56+
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
57+
58+
sb.Append("}\n");
59+
return sb.ToString();
60+
}
61+
62+
/// <summary>
63+
/// Returns the JSON string presentation of the object
64+
/// </summary>
65+
/// <returns>JSON string presentation of the object</returns>
66+
public string ToJson()
67+
{
68+
return JsonConvert.SerializeObject(this, Formatting.Indented);
69+
}
70+
71+
/// <summary>
72+
/// Returns true if objects are equal
73+
/// </summary>
74+
/// <param name="obj">Object to be compared</param>
75+
/// <returns>Boolean</returns>
76+
public override bool Equals(object obj)
77+
{
78+
// credit: http://stackoverflow.com/a/10454552/677735
79+
return this.Equals(obj as Animal);
80+
}
81+
82+
/// <summary>
83+
/// Returns true if Animal instances are equal
84+
/// </summary>
85+
/// <param name="other">Instance of Animal to be compared</param>
86+
/// <returns>Boolean</returns>
87+
public bool Equals(Animal other)
88+
{
89+
// credit: http://stackoverflow.com/a/10454552/677735
90+
if (other == null)
91+
return false;
92+
93+
return
94+
(
95+
this.ClassName == other.ClassName ||
96+
this.ClassName != null &&
97+
this.ClassName.Equals(other.ClassName)
98+
);
99+
}
100+
101+
/// <summary>
102+
/// Gets the hash code
103+
/// </summary>
104+
/// <returns>Hash code</returns>
105+
public override int GetHashCode()
106+
{
107+
// credit: http://stackoverflow.com/a/263416/677735
108+
unchecked // Overflow is fine, just wrap
109+
{
110+
int hash = 41;
111+
// Suitable nullity checks etc, of course :)
112+
113+
if (this.ClassName != null)
114+
hash = hash * 59 + this.ClassName.GetHashCode();
115+
116+
return hash;
117+
}
118+
}
119+
120+
}
121+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
using System;
2+
using System.Linq;
3+
using System.IO;
4+
using System.Text;
5+
using System.Collections;
6+
using System.Collections.Generic;
7+
using System.Collections.ObjectModel;
8+
using System.Runtime.Serialization;
9+
using Newtonsoft.Json;
10+
using Newtonsoft.Json.Converters;
11+
12+
namespace IO.Swagger.Model
13+
{
14+
/// <summary>
15+
///
16+
/// </summary>
17+
[DataContract]
18+
public partial class Cat : Animal, IEquatable<Cat>
19+
{
20+
21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="Cat" /> class.
23+
/// Initializes a new instance of the <see cref="Cat" />class.
24+
/// </summary>
25+
/// <param name="ClassName">ClassName (required).</param>
26+
/// <param name="Declawed">Declawed.</param>
27+
28+
public Cat(string ClassName = null, bool? Declawed = null)
29+
{
30+
// to ensure "ClassName" is required (not null)
31+
if (ClassName == null)
32+
{
33+
throw new InvalidDataException("ClassName is a required property for Cat and cannot be null");
34+
}
35+
else
36+
{
37+
this.ClassName = ClassName;
38+
}
39+
this.Declawed = Declawed;
40+
41+
}
42+
43+
44+
/// <summary>
45+
/// Gets or Sets ClassName
46+
/// </summary>
47+
[DataMember(Name="className", EmitDefaultValue=false)]
48+
public string ClassName { get; set; }
49+
50+
/// <summary>
51+
/// Gets or Sets Declawed
52+
/// </summary>
53+
[DataMember(Name="declawed", EmitDefaultValue=false)]
54+
public bool? Declawed { get; set; }
55+
56+
/// <summary>
57+
/// Returns the string presentation of the object
58+
/// </summary>
59+
/// <returns>String presentation of the object</returns>
60+
public override string ToString()
61+
{
62+
var sb = new StringBuilder();
63+
sb.Append("class Cat {\n");
64+
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
65+
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
66+
67+
sb.Append("}\n");
68+
return sb.ToString();
69+
}
70+
71+
/// <summary>
72+
/// Returns the JSON string presentation of the object
73+
/// </summary>
74+
/// <returns>JSON string presentation of the object</returns>
75+
public new string ToJson()
76+
{
77+
return JsonConvert.SerializeObject(this, Formatting.Indented);
78+
}
79+
80+
/// <summary>
81+
/// Returns true if objects are equal
82+
/// </summary>
83+
/// <param name="obj">Object to be compared</param>
84+
/// <returns>Boolean</returns>
85+
public override bool Equals(object obj)
86+
{
87+
// credit: http://stackoverflow.com/a/10454552/677735
88+
return this.Equals(obj as Cat);
89+
}
90+
91+
/// <summary>
92+
/// Returns true if Cat instances are equal
93+
/// </summary>
94+
/// <param name="other">Instance of Cat to be compared</param>
95+
/// <returns>Boolean</returns>
96+
public bool Equals(Cat other)
97+
{
98+
// credit: http://stackoverflow.com/a/10454552/677735
99+
if (other == null)
100+
return false;
101+
102+
return
103+
(
104+
this.ClassName == other.ClassName ||
105+
this.ClassName != null &&
106+
this.ClassName.Equals(other.ClassName)
107+
) &&
108+
(
109+
this.Declawed == other.Declawed ||
110+
this.Declawed != null &&
111+
this.Declawed.Equals(other.Declawed)
112+
);
113+
}
114+
115+
/// <summary>
116+
/// Gets the hash code
117+
/// </summary>
118+
/// <returns>Hash code</returns>
119+
public override int GetHashCode()
120+
{
121+
// credit: http://stackoverflow.com/a/263416/677735
122+
unchecked // Overflow is fine, just wrap
123+
{
124+
int hash = 41;
125+
// Suitable nullity checks etc, of course :)
126+
127+
if (this.ClassName != null)
128+
hash = hash * 59 + this.ClassName.GetHashCode();
129+
130+
if (this.Declawed != null)
131+
hash = hash * 59 + this.Declawed.GetHashCode();
132+
133+
return hash;
134+
}
135+
}
136+
137+
}
138+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
using System;
2+
using System.Linq;
3+
using System.IO;
4+
using System.Text;
5+
using System.Collections;
6+
using System.Collections.Generic;
7+
using System.Collections.ObjectModel;
8+
using System.Runtime.Serialization;
9+
using Newtonsoft.Json;
10+
using Newtonsoft.Json.Converters;
11+
12+
namespace IO.Swagger.Model
13+
{
14+
/// <summary>
15+
///
16+
/// </summary>
17+
[DataContract]
18+
public partial class Dog : Animal, IEquatable<Dog>
19+
{
20+
21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="Dog" /> class.
23+
/// Initializes a new instance of the <see cref="Dog" />class.
24+
/// </summary>
25+
/// <param name="ClassName">ClassName (required).</param>
26+
/// <param name="Breed">Breed.</param>
27+
28+
public Dog(string ClassName = null, string Breed = null)
29+
{
30+
// to ensure "ClassName" is required (not null)
31+
if (ClassName == null)
32+
{
33+
throw new InvalidDataException("ClassName is a required property for Dog and cannot be null");
34+
}
35+
else
36+
{
37+
this.ClassName = ClassName;
38+
}
39+
this.Breed = Breed;
40+
41+
}
42+
43+
44+
/// <summary>
45+
/// Gets or Sets ClassName
46+
/// </summary>
47+
[DataMember(Name="className", EmitDefaultValue=false)]
48+
public string ClassName { get; set; }
49+
50+
/// <summary>
51+
/// Gets or Sets Breed
52+
/// </summary>
53+
[DataMember(Name="breed", EmitDefaultValue=false)]
54+
public string Breed { get; set; }
55+
56+
/// <summary>
57+
/// Returns the string presentation of the object
58+
/// </summary>
59+
/// <returns>String presentation of the object</returns>
60+
public override string ToString()
61+
{
62+
var sb = new StringBuilder();
63+
sb.Append("class Dog {\n");
64+
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
65+
sb.Append(" Breed: ").Append(Breed).Append("\n");
66+
67+
sb.Append("}\n");
68+
return sb.ToString();
69+
}
70+
71+
/// <summary>
72+
/// Returns the JSON string presentation of the object
73+
/// </summary>
74+
/// <returns>JSON string presentation of the object</returns>
75+
public new string ToJson()
76+
{
77+
return JsonConvert.SerializeObject(this, Formatting.Indented);
78+
}
79+
80+
/// <summary>
81+
/// Returns true if objects are equal
82+
/// </summary>
83+
/// <param name="obj">Object to be compared</param>
84+
/// <returns>Boolean</returns>
85+
public override bool Equals(object obj)
86+
{
87+
// credit: http://stackoverflow.com/a/10454552/677735
88+
return this.Equals(obj as Dog);
89+
}
90+
91+
/// <summary>
92+
/// Returns true if Dog instances are equal
93+
/// </summary>
94+
/// <param name="other">Instance of Dog to be compared</param>
95+
/// <returns>Boolean</returns>
96+
public bool Equals(Dog other)
97+
{
98+
// credit: http://stackoverflow.com/a/10454552/677735
99+
if (other == null)
100+
return false;
101+
102+
return
103+
(
104+
this.ClassName == other.ClassName ||
105+
this.ClassName != null &&
106+
this.ClassName.Equals(other.ClassName)
107+
) &&
108+
(
109+
this.Breed == other.Breed ||
110+
this.Breed != null &&
111+
this.Breed.Equals(other.Breed)
112+
);
113+
}
114+
115+
/// <summary>
116+
/// Gets the hash code
117+
/// </summary>
118+
/// <returns>Hash code</returns>
119+
public override int GetHashCode()
120+
{
121+
// credit: http://stackoverflow.com/a/263416/677735
122+
unchecked // Overflow is fine, just wrap
123+
{
124+
int hash = 41;
125+
// Suitable nullity checks etc, of course :)
126+
127+
if (this.ClassName != null)
128+
hash = hash * 59 + this.ClassName.GetHashCode();
129+
130+
if (this.Breed != null)
131+
hash = hash * 59 + this.Breed.GetHashCode();
132+
133+
return hash;
134+
}
135+
}
136+
137+
}
138+
}

0 commit comments

Comments
 (0)