Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullable enabled #4

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions AniDb.Api/AniDb.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);CS8618</NoWarn>
<!--Package options-->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.3</Version>
<Version>0.0.4</Version>
<Authors>Vagab0nd</Authors>
<Company>Vagab0nd</Company>
<Description>.Net library that provides wrapper for AniDB API.</Description>
Expand All @@ -18,7 +17,7 @@
<RepositoryType>Git</RepositoryType>
<PackageTags>anidb api anime</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>Add anime titles dump support</PackageReleaseNotes>
<PackageReleaseNotes>Enforce nullable checking in project.</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Flurl.Http" Version="4.0.2" />
Expand Down
30 changes: 15 additions & 15 deletions AniDb.Api/Models/Anime/Anime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
public record Anime
{
[XmlAttribute(AttributeName = "id")]
public string AnimeId { get; set; }
public string AnimeId { get; set; } = null!;

[XmlAttribute(AttributeName = "restricted")]
public bool Restricted { get; set; }

[XmlElement(ElementName = "type")]
public string Type { get; set; }
public string Type { get; set; } = null!;

[XmlElement(ElementName = "episodecount")]
public int EpisodeCount { get; set; }
Expand All @@ -25,49 +25,49 @@ public record Anime

[XmlArray(ElementName = "titles")]
[XmlArrayItem(ElementName = "title")]
public Title[] Titles { get; set; }
public Title[] Titles { get; set; } = [];

[XmlArray(ElementName = "relatedanime")]
[XmlArrayItem(ElementName = "anime")]
public AnimeRelated[] RelatedAnime { get; set; }
public AnimeRelated[]? RelatedAnime { get; set; }

[XmlArray(ElementName = "similaranime")]
[XmlArrayItem(ElementName = "anime")]
public AnimeSimilar[] SimilarAnime { get; set; }
public AnimeSimilar[] SimilarAnime { get; set; } = [];

[XmlArray(ElementName = "recommendations")]
[XmlArrayItem(ElementName = "recommendation")]
public Recommendation[] Recommendations { get; set; }
public Recommendation[] Recommendations { get; set; } = [];

[XmlElement(ElementName = "url")]
public string Url { get; set; }
public string Url { get; set; } = string.Empty;

[XmlArray(ElementName = "creators")]
[XmlArrayItem(ElementName = "name")]
public Creator[] Creators { get; set; }
public Creator[] Creators { get; set; } = [];

[XmlElement(ElementName = "description")]
public string Description { get; set; }
public string Description { get; set; } = string.Empty;

[XmlElement(ElementName = "ratings")]
public Ratings Ratings { get; set; }
public Ratings Ratings { get; set; } = new Ratings();

[XmlElement(ElementName = "picture")]
public string Picture { get; set; }
public string Picture { get; set; } = string.Empty;

[XmlArray(ElementName = "resources")]
[XmlArrayItem(ElementName = "resource")]
public Resource[] Resources { get; set; }
public Resource[] Resources { get; set; } = [];

[XmlArray(ElementName = "tags")]
[XmlArrayItem(ElementName = "tag")]
public Tag[] Tags { get; set; }
public Tag[] Tags { get; set; } = [];

[XmlArray(ElementName = "characters")]
[XmlArrayItem(ElementName = "character")]
public Character[] Characters { get; set; }
public Character[] Characters { get; set; } = [];

[XmlArray(ElementName = "episodes")]
[XmlArrayItem(ElementName = "episode")]
public Episode[] Episodes { get; set; }
public Episode[] Episodes { get; set; } = [];
}
6 changes: 3 additions & 3 deletions AniDb.Api/Models/Anime/AnimeRelated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ namespace AniDb.Api.Models.Anime
public record AnimeRelated
{
[XmlAttribute(AttributeName = "id")]
public string AnimeId { get; set; }
public string AnimeId { get; set; } = null!;

[XmlAttribute(AttributeName = "type")]
public string Type { get; set; }
public string Type { get; set; } = null!;

[XmlText]
public string Text { get; set; }
public string Text { get; set; } = string.Empty;
}

}
4 changes: 2 additions & 2 deletions AniDb.Api/Models/Anime/AnimeSimilar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace AniDb.Api.Models.Anime
public record AnimeSimilar
{
[XmlAttribute(AttributeName = "id")]
public string AnimeId { get; set; }
public string AnimeId { get; set; } = null!;

[XmlAttribute(AttributeName = "approval")]
public int Approval { get; set; }
Expand All @@ -14,7 +14,7 @@ public record AnimeSimilar
public int Total { get; set; }

[XmlText]
public string Text { get; set; }
public string Text { get; set; } = string.Empty;
}

}
20 changes: 10 additions & 10 deletions AniDb.Api/Models/Anime/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ namespace AniDb.Api.Models.Anime
public record Character
{
[XmlAttribute(AttributeName = "id")]
public int CharacterId { get; set; }
public string CharacterId { get; set; } = null!;

[XmlAttribute(AttributeName = "type")]
public string Type { get; set; }
public string Type { get; set; } = null!;

[XmlAttribute(AttributeName = "update")]
public string Update { get; set; }
public string Update { get; set; } = string.Empty;

[XmlElement(ElementName = "rating")]
public CharacterRating Rating { get; set; }
public CharacterRating Rating { get; set; } = new CharacterRating();

[XmlElement(ElementName = "name")]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[XmlElement(ElementName = "gender")]
public string Gender { get; set; }
public string Gender { get; set; } = string.Empty;

[XmlElement(ElementName = "charactertype")]
public string CharacterType { get; set; }
public string CharacterType { get; set; } = string.Empty;

[XmlElement(ElementName = "description")]
public string Description { get; set; }
public string Description { get; set; } = string.Empty;

[XmlElement(ElementName = "picture")]
public string Picture { get; set; }
public string Picture { get; set; } = string.Empty;

[XmlElement(ElementName = "seiyuu")]
public Seiyuu Seiyuu { get; set; }
public Seiyuu? Seiyuu { get; set; }
}
}
6 changes: 3 additions & 3 deletions AniDb.Api/Models/Anime/Creator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace AniDb.Api.Models.Anime
public record Creator
{
[XmlAttribute(AttributeName = "id")]
public string CreatorId { get; set; }
public string CreatorId { get; set; } = null!;

[XmlAttribute(AttributeName = "type")]
public string Type { get; set; }
public string Type { get; set; } = null!;

[XmlText]
public string Text { get; set; }
public string Text { get; set; } = string.Empty;
}
}
12 changes: 6 additions & 6 deletions AniDb.Api/Models/Anime/Episode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ namespace AniDb.Api.Models.Anime
public record Episode
{
[XmlAttribute(AttributeName = "id")]
public int EpisodeId { get; set; }
public string EpisodeId { get; set; } = null!;

[XmlAttribute(AttributeName = "length")]
public string PlayLength { get; set; }
public string PlayLength { get; set; } = string.Empty;

[XmlAttribute(AttributeName = "update")]
public string Update { get; set; }
public string Update { get; set; } = string.Empty;

[XmlElement(ElementName = "title")]
public Title[] Titles { get; set; }
public Title[] Titles { get; set; } = [];

[XmlElement(ElementName = "description")]
public string Description { get; set; }
public string Description { get; set; } = string.Empty;

[XmlElement(ElementName = "airdate")]
public string AirDate { get; set; }
public string AirDate { get; set; } = string.Empty;
}
}
4 changes: 2 additions & 2 deletions AniDb.Api/Models/Anime/ExternalEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace AniDb.Api.Models.Anime
public record ExternalEntity
{
[XmlArrayItem(ElementName = "identifier")]
public string[] Identifiers { get; set; }
public string[] Identifiers { get; set; } = [];

[XmlElement(ElementName = "url")]
public string Url { get; set; }
public string Url { get; set; } = string.Empty;
}
}
6 changes: 3 additions & 3 deletions AniDb.Api/Models/Anime/Ratings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace AniDb.Api.Models.Anime
public record Ratings
{
[XmlElement(ElementName = "permanent")]
public AnimeRating Permanent { get; set; }
public AnimeRating Permanent { get; set; } = new AnimeRating();

[XmlElement(ElementName = "temporary")]
public AnimeRating Temporary { get; set; }
public AnimeRating Temporary { get; set; } = new AnimeRating();

[XmlElement(ElementName = "review")]
public AnimeRating Review { get; set; }
public AnimeRating Review { get; set; } = new AnimeRating();
}
}
6 changes: 3 additions & 3 deletions AniDb.Api/Models/Anime/Recommendation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace AniDb.Api.Models.Anime
public record Recommendation
{
[XmlAttribute(AttributeName = "type")]
public string Type { get; set; }
public string Type { get; set; } = null!;

[XmlAttribute(AttributeName = "uid")]
public string UserId { get; set; }
public string UserId { get; set; } = null!;

[XmlText]
public string Text { get; set; }
public string Text { get; set; } = string.Empty;
}
}
2 changes: 1 addition & 1 deletion AniDb.Api/Models/Anime/Resource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public record Resource
public int Type { get; set; }

[XmlElement(ElementName = "externalentity")]
public ExternalEntity ExternalEntity { get; set; }
public ExternalEntity ExternalEntity { get; set; } = new ExternalEntity();
}
}
4 changes: 2 additions & 2 deletions AniDb.Api/Models/Anime/Seiyuu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public record Seiyuu
public int CreatorId { get; set; }

[XmlAttribute(AttributeName = "picture")]
public string Picture { get; set; }
public string Picture { get; set; } = string.Empty;

[XmlText]
public string Text { get; set; }
public string Text { get; set; } = string.Empty;
}
}
10 changes: 5 additions & 5 deletions AniDb.Api/Models/Anime/Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace AniDb.Api.Models.Anime
public record Tag
{
[XmlAttribute(AttributeName = "id")]
public int TagId { get; set; }
public string TagId { get; set; } = null!;

[XmlAttribute(AttributeName = "parentid")]
public int ParentId { get; set; }
public string? ParentId { get; set; }

[XmlAttribute(AttributeName = "weight")]
public int Weight { get; set; }
Expand All @@ -26,12 +26,12 @@ public record Tag
public DateTime Update { get; set; }

[XmlElement(ElementName = "name")]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[XmlElement(ElementName = "description")]
public string Description { get; set; }
public string Description { get; set; } = string.Empty;

[XmlElement(ElementName = "picurl")]
public string PictureUrl { get; set; }
public string PictureUrl { get; set; } = string.Empty;
}
}
6 changes: 3 additions & 3 deletions AniDb.Api/Models/Common/Title.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace AniDb.Api.Models.Common
public record Title
{
[XmlAttribute(AttributeName = "lang")]
public string Language { get; set; }
public string Language { get; set; } = string.Empty;

[XmlAttribute(AttributeName = "type")]
public string Type { get; set; }
public string Type { get; set; } = null!;

[XmlText]
public string Text { get; set; }
public string Text { get; set; } = string.Empty;
}
}
2 changes: 1 addition & 1 deletion AniDb.Api/Models/Hints/Hint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public record Hint
public DateTime AddedDate { get; set; }

[XmlElement("relid")]
public string AnimeId { get; set; }
public string AnimeId { get; set; } = null!;

[XmlElement("calculated")]
public decimal Calculated { get; set; }
Expand Down
6 changes: 3 additions & 3 deletions AniDb.Api/Models/Hints/HintCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ namespace AniDb.Api.Models.Hints
public record HintCollection
{
[XmlAttribute("uid")]
public int UserId { get; set; }
public string UserId { get; set; } = null!;

[XmlAttribute("type")]
public int Type { get; set; }
public string Type { get; set; } = null!;

[XmlElement("hint")]
public Hint[] Hints { get; set; }
public Hint[] Hints { get; set; } = [];
}
}
4 changes: 2 additions & 2 deletions AniDb.Api/Models/MyListSummary/MyListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace AniDb.Api.Models.MyListSummary
public record MyListItem
{
[XmlAttribute(AttributeName = "aid")]
public int AnimeId { get; set; }
public string AnimeId { get; set; } = null!;

[XmlAttribute(AttributeName = "state")]
public int State { get; set; }
public string State { get; set; } = null!;

[XmlElement(ElementName = "episodecount")]
public int EpisodeCount { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions AniDb.Api/Models/MyListSummary/MyListSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace AniDb.Api.Models.MyListSummary
public record MyListSummary
{
[XmlAttribute(AttributeName = "uid")]
public int UserId { get; set; }
public string UserId { get; set; } = null!;

[XmlElement("mylistitem")]
public MyListItem[] MyListItems { get; set; }
public MyListItem[] MyListItems { get; set; } = [];
}
}
4 changes: 2 additions & 2 deletions AniDb.Api/Models/Titles/AnimeTitles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace AniDb.Api.Models.Titles
public record AnimeTitles
{
[XmlAttribute(AttributeName = "aid")]
public string AnimeId { get; set; }
public string AnimeId { get; set; } = null!;

[XmlElement(ElementName = "title")]
public Title[] Titles { get; set; }
public Title[] Titles { get; set; } = [];
}
}
Loading