Skip to content

Commit

Permalink
misc: expose anidb creator type in role.person model in APIv3
Browse files Browse the repository at this point in the history
because I need it in shokofin.
  • Loading branch information
revam committed Feb 6, 2025
1 parent 977424d commit 12e1356
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Shoko.Server/API/v3/Models/Common/Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public Role(AniDB_Anime_Character xref, AniDB_Character character, AniDB_Creator
AlternateName = staff.OriginalName ?? string.Empty,
Description = string.Empty,
Image = staff.GetImageMetadata() is { } staffImage ? new Image(staffImage) : null,
Type = staff.Type.ToString(),
}
: new()
{
Expand All @@ -67,6 +68,7 @@ public Role(AniDB_Anime_Character xref, AniDB_Character character, AniDB_Creator
AlternateName = string.Empty,
Description = string.Empty,
Image = null,
Type = "Unknown",
};
RoleName = CreatorRoleType.Actor;
RoleDetails = staff is not null
Expand All @@ -83,6 +85,7 @@ public Role(AniDB_Anime_Staff xref, AniDB_Creator staff)
AlternateName = staff.OriginalName ?? string.Empty,
Description = string.Empty,
Image = staff.GetImageMetadata() is { } staffImage ? new Image(staffImage) : null,
Type = staff.Type.ToString(),
};
RoleName = xref.RoleType;
RoleDetails = xref.Role;
Expand Down Expand Up @@ -242,6 +245,12 @@ public class Person
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public int? ID { get; set; }

/// <summary>
/// AniDB creator type, if the person object is an AniDB creator.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string? Type { get; set; }

/// <summary>
/// Main Name, romanized if needed
/// ex. Sawano Hiroyuki
Expand Down

0 comments on commit 12e1356

Please sign in to comment.