using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.AnilistSync.API
{
///
/// Media list status enum,
///
public enum MediaListStatus
{
/// Currently watching.
CURRENT,
/// Planning to watch.
PLANNING,
/// Completed.
COMPLETED,
/// Dropped.
DROPPED,
/// n hold.
PAUSED,
/// Rewatching.
REPEATING
}
///
/// Root JSON object.
///
public class RootObject
{
///
/// Gets or sets data.
///
[JsonPropertyName("data")]
public Data? Data { get; set; }
///
/// Gets or sets errors.
///
[JsonPropertyName("errors")]
public AnilistError[]? Errors { get; set; }
}
///
/// Data JSON Object.
///
public class Data
{
///
/// Gets or sets user.
///
[JsonPropertyName("Viewer")]
public User? User { get; set; }
///
/// Gets or sets list entry.
///
[JsonPropertyName("SaveMediaListEntry")]
public ListEntry? ListEntry { get; set; }
///
/// Gets or sets media.
///
[JsonPropertyName("Media")]
public Media? Media { get; set; }
}
///
/// Error object.
///
public class AnilistError
{
///
/// Gets or sets error message.
///
[JsonPropertyName("message")]
public string? ErrorMessage { get; set; }
///
/// Gets or sets error status.
///
[JsonPropertyName("status")]
public int? ErrorStatus { get; set; }
///
/// Gets or sets error locations.
///
[JsonPropertyName("locations")]
public Location[]? Locations { get; set; }
}
///
/// Locations of error(s) object.
///
public class Location
{
///
/// Gets or sets line.
///
[JsonPropertyName("line")]
public int? Line { get; set; }
///
/// Gets or sets column.
///
[JsonPropertyName("column")]
public int? Column { get; set; }
}
///
/// List Entry object.
///
public class ListEntry
{
///
/// Gets or sets mediaId.
///
[JsonPropertyName("mediaId")]
public int? MediaId { get; set; }
///
/// Gets or sets ID.
///
[JsonPropertyName("id")]
public int? Id { get; set; }
///
/// Gets or sets progress.
///
[JsonPropertyName("progress")]
public int? Progress { get; set; }
///
/// Gets or sets status.
///
[JsonPropertyName("status")]
public MediaListStatus? Status { get; set; }
}
///
/// Media object.
///
public class Media
{
///
/// Gets or sets episodes.
///
[JsonPropertyName("episodes")]
public int? Episodes { get; set; }
}
///
/// User object.
///
public class User
{
///
/// Gets or sets user ID.
///
[JsonPropertyName("id")]
public int? Id { get; set; }
///
/// Gets or sets user name.
///
[JsonPropertyName("name")]
public string? Name { get; set; }
}
///
/// GraphQLBody object.
///
public class GraphQLBody
{
///
/// Gets or sets GraphQL query string.
///
[JsonPropertyName("query")]
public string? Query { get; set; }
///
/// Gets or sets GraphQL variables.
///
[JsonPropertyName("variables")]
public ListEntry? Variables { get; set; }
}
///
/// OAuth response object.
///
public class OAuth
{
///
/// Gets or sets grant type.
///
[JsonPropertyName("grant_type")]
public string? GrantType { get; set; }
///
/// Gets or sets client ID.
///
[JsonPropertyName("client_id")]
public int? ClientId { get; set; }
///
/// Gets or sets client secret.
///
[JsonPropertyName("client_secret")]
public string? ClientSecret { get; set; }
///
/// Gets or sets redirect URI.
///
[JsonPropertyName("redirect_uri")]
public string? RedirectUri { get; set; }
///
/// Gets or sets code.
///
[JsonPropertyName("code")]
public string? Code { get; set; }
}
///
/// Code response object.
///
public class CodeResponse
{
///
/// Gets or sets token type.
///
[JsonPropertyName("token_type")]
public string? TokenType { get; set; }
///
/// Gets or sets expires in.
///
[JsonPropertyName("expires_in")]
public int? ExpiresIn { get; set; }
///
/// Gets or sets access token.
///
[JsonPropertyName("access_token")]
public string? AccessToken { get; set; }
///
/// Gets or sets refresh token.
///
[JsonPropertyName("refresh_token")]
public string? RefreshToken { get; set; }
}
}