Skip to content

Commit

Permalink
clan member townhall is not required
Browse files Browse the repository at this point in the history
  • Loading branch information
devhl-labs committed Dec 13, 2023
1 parent 0354cf4 commit ccd759a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 31 deletions.
2 changes: 1 addition & 1 deletion docs/models/ClanMember.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Name | Type | Description | Notes
**Name** | **string** | | [readonly]
**PreviousClanRank** | **int** | | [readonly]
**Tag** | **string** | | [readonly]
**TownHallLevel** | **int** | | [readonly]
**Trophies** | **int** | | [readonly]
**BuilderBaseLeague** | [**BuilderBaseLeague**](BuilderBaseLeague.md) | | [optional] [readonly]
**PlayerHouse** | [**PlayerHouse**](PlayerHouse.md) | | [optional] [readonly]
**Role** | **Role** | | [optional] [readonly]
**TownHallLevel** | **int** | | [optional] [readonly]

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)

64 changes: 35 additions & 29 deletions src/CocApi.Rest/Models/ClanMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public partial class ClanMember : IEquatable<ClanMember?>
/// <param name="name">name</param>
/// <param name="previousClanRank">previousClanRank</param>
/// <param name="tag">tag</param>
/// <param name="townHallLevel">townHallLevel</param>
/// <param name="trophies">trophies</param>
/// <param name="builderBaseLeague">builderBaseLeague</param>
/// <param name="playerHouse">playerHouse</param>
/// <param name="role">role</param>
/// <param name="townHallLevel">townHallLevel</param>
[JsonConstructor]
internal ClanMember(int builderBaseTrophies, int clanRank, int donations, int donationsReceived, int expLevel, League league, string name, int previousClanRank, string tag, int townHallLevel, int trophies, Option<BuilderBaseLeague?> builderBaseLeague = default, Option<PlayerHouse?> playerHouse = default, Option<Role?> role = default)
internal ClanMember(int builderBaseTrophies, int clanRank, int donations, int donationsReceived, int expLevel, League league, string name, int previousClanRank, string tag, int trophies, Option<BuilderBaseLeague?> builderBaseLeague = default, Option<PlayerHouse?> playerHouse = default, Option<Role?> role = default, Option<int?> townHallLevel = default)
{
BuilderBaseTrophies = builderBaseTrophies;
ClanRank = clanRank;
Expand All @@ -58,11 +58,11 @@ internal ClanMember(int builderBaseTrophies, int clanRank, int donations, int do
Name = name;
PreviousClanRank = previousClanRank;
Tag = tag;
TownHallLevel = townHallLevel;
Trophies = trophies;
BuilderBaseLeagueOption = builderBaseLeague;
PlayerHouseOption = playerHouse;
RoleOption = role;
TownHallLevelOption = townHallLevel;
OnCreated();
}

Expand Down Expand Up @@ -135,12 +135,6 @@ internal ClanMember(int builderBaseTrophies, int clanRank, int donations, int do
[JsonPropertyName("tag")]
public string Tag { get; }

/// <summary>
/// Gets or Sets TownHallLevel
/// </summary>
[JsonPropertyName("townHallLevel")]
public int TownHallLevel { get; }

/// <summary>
/// Gets or Sets Trophies
/// </summary>
Expand Down Expand Up @@ -173,6 +167,19 @@ internal ClanMember(int builderBaseTrophies, int clanRank, int donations, int do
[JsonPropertyName("playerHouse")]
public PlayerHouse? PlayerHouse { get { return this. PlayerHouseOption; } }

/// <summary>
/// Used to track the state of TownHallLevel
/// </summary>
[JsonIgnore]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Option<int?> TownHallLevelOption { get; }

/// <summary>
/// Gets or Sets TownHallLevel
/// </summary>
[JsonPropertyName("townHallLevel")]
public int? TownHallLevel { get { return this. TownHallLevelOption; } }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand All @@ -190,11 +197,11 @@ public override string ToString()
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" PreviousClanRank: ").Append(PreviousClanRank).Append("\n");
sb.Append(" Tag: ").Append(Tag).Append("\n");
sb.Append(" TownHallLevel: ").Append(TownHallLevel).Append("\n");
sb.Append(" Trophies: ").Append(Trophies).Append("\n");
sb.Append(" BuilderBaseLeague: ").Append(BuilderBaseLeague).Append("\n");
sb.Append(" PlayerHouse: ").Append(PlayerHouse).Append("\n");
sb.Append(" Role: ").Append(Role).Append("\n");
sb.Append(" TownHallLevel: ").Append(TownHallLevel).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand Down Expand Up @@ -259,10 +266,6 @@ public bool Equals(ClanMember? input)
(Tag != null &&
Tag.Equals(input.Tag))
) &&
(
TownHallLevel == input.TownHallLevel ||
TownHallLevel.Equals(input.TownHallLevel)
) &&
(
Trophies == input.Trophies ||
Trophies.Equals(input.Trophies)
Expand All @@ -280,6 +283,10 @@ public bool Equals(ClanMember? input)
(
Role == input.Role ||
Role.Equals(input.Role)
) &&
(
TownHallLevel == input.TownHallLevel ||
TownHallLevel.Equals(input.TownHallLevel)
);
}

Expand All @@ -301,7 +308,6 @@ public override int GetHashCode()
hashCode = (hashCode * 59) + Name.GetHashCode();
hashCode = (hashCode * 59) + PreviousClanRank.GetHashCode();
hashCode = (hashCode * 59) + Tag.GetHashCode();
hashCode = (hashCode * 59) + TownHallLevel.GetHashCode();
hashCode = (hashCode * 59) + Trophies.GetHashCode();
if (BuilderBaseLeague != null)
hashCode = (hashCode * 59) + BuilderBaseLeague.GetHashCode();
Expand All @@ -312,6 +318,9 @@ public override int GetHashCode()
if (Role != null)
hashCode = (hashCode * 59) + Role.GetHashCode();

if (TownHallLevel != null)
hashCode = (hashCode * 59) + TownHallLevel.GetHashCode();


return hashCode;
}
Expand Down Expand Up @@ -349,11 +358,11 @@ public override ClanMember Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
Option<string?> name = default;
Option<int?> previousClanRank = default;
Option<string?> tag = default;
Option<int?> townHallLevel = default;
Option<int?> trophies = default;
Option<BuilderBaseLeague?> builderBaseLeague = default;
Option<PlayerHouse?> playerHouse = default;
Option<Role?> role = default;
Option<int?> townHallLevel = default;

while (utf8JsonReader.Read())
{
Expand Down Expand Up @@ -405,10 +414,6 @@ public override ClanMember Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
case "tag":
tag = new Option<string?>(utf8JsonReader.GetString()!);
break;
case "townHallLevel":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
townHallLevel = new Option<int?>(utf8JsonReader.GetInt32());
break;
case "trophies":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
trophies = new Option<int?>(utf8JsonReader.GetInt32());
Expand All @@ -426,6 +431,10 @@ public override ClanMember Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (roleRawValue != null)
role = new Option<Role?>(RoleValueConverter.FromStringOrDefault(roleRawValue));
break;
case "townHallLevel":
if (utf8JsonReader.TokenType != JsonTokenType.Null)
townHallLevel = new Option<int?>(utf8JsonReader.GetInt32());
break;
default:
break;
}
Expand Down Expand Up @@ -459,9 +468,6 @@ public override ClanMember Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (!tag.IsSet)
throw new ArgumentException("Property is required for class ClanMember.", nameof(tag));

if (!townHallLevel.IsSet)
throw new ArgumentException("Property is required for class ClanMember.", nameof(townHallLevel));

if (!trophies.IsSet)
throw new ArgumentException("Property is required for class ClanMember.", nameof(trophies));

Expand Down Expand Up @@ -492,9 +498,6 @@ public override ClanMember Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (tag.IsSet && tag.Value == null)
throw new ArgumentNullException(nameof(tag), "Property is not nullable for class ClanMember.");

if (townHallLevel.IsSet && townHallLevel.Value == null)
throw new ArgumentNullException(nameof(townHallLevel), "Property is not nullable for class ClanMember.");

if (trophies.IsSet && trophies.Value == null)
throw new ArgumentNullException(nameof(trophies), "Property is not nullable for class ClanMember.");

Expand All @@ -507,7 +510,10 @@ public override ClanMember Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (role.IsSet && role.Value == null)
throw new ArgumentNullException(nameof(role), "Property is not nullable for class ClanMember.");

return new ClanMember(builderBaseTrophies.Value!.Value!, clanRank.Value!.Value!, donations.Value!.Value!, donationsReceived.Value!.Value!, expLevel.Value!.Value!, league.Value!, name.Value!, previousClanRank.Value!.Value!, tag.Value!, townHallLevel.Value!.Value!, trophies.Value!.Value!, builderBaseLeague, playerHouse, role);
if (townHallLevel.IsSet && townHallLevel.Value == null)
throw new ArgumentNullException(nameof(townHallLevel), "Property is not nullable for class ClanMember.");

return new ClanMember(builderBaseTrophies.Value!.Value!, clanRank.Value!.Value!, donations.Value!.Value!, donationsReceived.Value!.Value!, expLevel.Value!.Value!, league.Value!, name.Value!, previousClanRank.Value!.Value!, tag.Value!, trophies.Value!.Value!, builderBaseLeague, playerHouse, role, townHallLevel);
}

/// <summary>
Expand Down Expand Up @@ -567,8 +573,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, ClanMember clanMember, Js

writer.WriteString("tag", clanMember.Tag);

writer.WriteNumber("townHallLevel", clanMember.TownHallLevel);

writer.WriteNumber("trophies", clanMember.Trophies);

if (clanMember.BuilderBaseLeagueOption.IsSet)
Expand All @@ -586,6 +590,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ClanMember clanMember, Js
var roleRawValue = RoleValueConverter.ToJsonValue(clanMember.Role!.Value);
writer.WriteString("role", roleRawValue);
}
if (clanMember.TownHallLevelOption.IsSet)
writer.WriteNumber("townHallLevel", clanMember.TownHallLevelOption.Value!.Value);
}
}
}
2 changes: 1 addition & 1 deletion src/CocApi.Rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Authentication schemes defined for the API:

## Build
- SDK version: 2.11.1
- Build date: 2023-12-12T20:18:51.222829200-05:00[America/New_York]
- Build date: 2023-12-12T20:51:12.559726900-05:00[America/New_York]
- Build package: org.openapitools.codegen.languages.CSharpClientCodegen

## Api Information
Expand Down

0 comments on commit ccd759a

Please sign in to comment.