-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ffa6e8
commit 926a197
Showing
19 changed files
with
450 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
using AniMoe.App.Services; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AniMoe.App.Models.UserModel | ||
{ | ||
public partial class UserModel | ||
{ | ||
[JsonProperty("data")] | ||
public Data Data { get; set; } | ||
} | ||
|
||
public partial class Data | ||
{ | ||
[JsonProperty("User")] | ||
public User User { get; set; } | ||
} | ||
|
||
public partial class User | ||
{ | ||
[JsonProperty("id")] | ||
public long Id { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("about")] | ||
public string About { get; set; } | ||
|
||
[JsonProperty("avatar")] | ||
public Avatar Avatar { get; set; } | ||
|
||
[JsonProperty("bannerImage")] | ||
public Uri BannerImage { get; set; } | ||
|
||
[JsonProperty("isFollowing")] | ||
public bool IsFollowing { get; set; } | ||
|
||
[JsonProperty("isFollower")] | ||
public bool IsFollower { get; set; } | ||
|
||
[JsonProperty("isBlocked")] | ||
public bool IsBlocked { get; set; } | ||
|
||
[JsonProperty("siteUrl")] | ||
public Uri SiteUrl { get; set; } | ||
|
||
[JsonProperty("donatorTier")] | ||
public long DonatorTier { get; set; } | ||
|
||
[JsonProperty("donatorBadge")] | ||
public string DonatorBadge { get; set; } | ||
|
||
[JsonProperty("moderatorRoles")] | ||
public object ModeratorRoles { get; set; } | ||
|
||
[JsonProperty("statistics")] | ||
public Statistics Statistics { get; set; } | ||
} | ||
|
||
public partial class Avatar | ||
{ | ||
[JsonProperty("large")] | ||
public Uri Large { get; set; } | ||
} | ||
|
||
public partial class Statistics | ||
{ | ||
[JsonProperty("anime")] | ||
public Anime Anime { get; set; } | ||
|
||
[JsonProperty("manga")] | ||
public Anime Manga { get; set; } | ||
} | ||
|
||
public partial class Anime | ||
{ | ||
[JsonProperty("count")] | ||
public long Count { get; set; } | ||
|
||
[JsonProperty("meanScore")] | ||
public double MeanScore { get; set; } | ||
|
||
[JsonProperty("standardDeviation")] | ||
public double StandardDeviation { get; set; } | ||
|
||
[JsonProperty("minutesWatched")] | ||
public long MinutesWatched { get; set; } | ||
|
||
[JsonProperty("episodesWatched")] | ||
public long EpisodesWatched { get; set; } | ||
|
||
[JsonProperty("chaptersRead")] | ||
public long ChaptersRead { get; set; } | ||
|
||
[JsonProperty("volumesRead")] | ||
public long VolumesRead { get; set; } | ||
|
||
[JsonProperty("scores")] | ||
public Country[] Scores { get; set; } | ||
|
||
[JsonProperty("lengths")] | ||
public Country[] Lengths { get; set; } | ||
|
||
[JsonProperty("genres")] | ||
public Genre[] Genres { get; set; } | ||
|
||
[JsonProperty("tags")] | ||
public Genre[] Tags { get; set; } | ||
|
||
[JsonProperty("formats")] | ||
public Country[] Formats { get; set; } | ||
|
||
[JsonProperty("countries")] | ||
public Country[] Countries { get; set; } | ||
|
||
[JsonProperty("releaseYears")] | ||
public Country[] ReleaseYears { get; set; } | ||
|
||
[JsonProperty("startYears")] | ||
public Country[] StartYears { get; set; } | ||
} | ||
|
||
public partial class Country | ||
{ | ||
[JsonProperty("count")] | ||
public long Count { get; set; } | ||
|
||
[JsonProperty("meanScore")] | ||
public double MeanScore { get; set; } | ||
|
||
[JsonProperty("minutesWatched")] | ||
public long MinutesWatched { get; set; } | ||
|
||
[JsonProperty("country")] | ||
public string CountryCountry { get; set; } | ||
|
||
[JsonProperty("format")] | ||
public string Format { get; set; } | ||
|
||
[JsonProperty("releaseYear")] | ||
public long? ReleaseYear { get; set; } | ||
|
||
[JsonProperty("startYear")] | ||
public long? StartYear { get; set; } | ||
} | ||
|
||
public partial class Genre | ||
{ | ||
[JsonProperty("genre")] | ||
public string GenreGenre { get; set; } | ||
|
||
[JsonProperty("count")] | ||
public long Count { get; set; } | ||
|
||
[JsonProperty("meanScore")] | ||
public double MeanScore { get; set; } | ||
|
||
[JsonProperty("minutesWatched")] | ||
public long MinutesWatched { get; set; } | ||
|
||
[JsonProperty("mediaIds")] | ||
public long[] MediaIds { get; set; } | ||
|
||
[JsonProperty("tag")] | ||
public Tag Tag { get; set; } | ||
} | ||
|
||
public partial class Tag | ||
{ | ||
[JsonProperty("id")] | ||
public long Id { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
} | ||
|
||
public static partial class Initialize | ||
{ | ||
public static async Task<UserModel> FetchData(int userId, bool isSelf) | ||
{ | ||
IRequestHandler Handler = App.Current.Services.GetService<IRequestHandler>(); | ||
UserModel Model = await Handler.RequestApi<UserModel>( | ||
Queries.Query.UserInfoQuery, | ||
new | ||
{ | ||
userId, | ||
isSelf | ||
} | ||
); | ||
return Model; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AniMoe.App.Queries | ||
{ | ||
public static partial class Query | ||
{ | ||
public static string UserInfoQuery = @" | ||
query ($userId: Int, $isSelf: Boolean = false) { | ||
User(id: $userId) { | ||
id | ||
name | ||
about | ||
avatar { | ||
large | ||
} | ||
bannerImage | ||
isFollowing @skip(if: $isSelf) | ||
isFollower @skip(if: $isSelf) | ||
isBlocked | ||
siteUrl | ||
donatorTier | ||
donatorBadge | ||
moderatorRoles | ||
statistics { | ||
anime { | ||
...UserStats | ||
} | ||
manga { | ||
...UserStats | ||
} | ||
} | ||
} | ||
} | ||
fragment UserStats on UserStatistics { | ||
count | ||
meanScore | ||
standardDeviation | ||
minutesWatched | ||
episodesWatched | ||
chaptersRead | ||
volumesRead | ||
scores { | ||
...ScoreStats | ||
} | ||
lengths { | ||
...LengthStats | ||
} | ||
genres { | ||
...GenreStats | ||
} | ||
tags { | ||
...TagStats | ||
} | ||
formats { | ||
...FormatStats | ||
} | ||
countries { | ||
...CountryStats | ||
} | ||
releaseYears { | ||
...ReleaseYearStats | ||
} | ||
startYears { | ||
...WatchYearStats | ||
} | ||
} | ||
fragment ScoreStats on UserScoreStatistic { | ||
count | ||
minutesWatched | ||
meanScore | ||
} | ||
fragment LengthStats on UserLengthStatistic { | ||
count | ||
minutesWatched | ||
meanScore | ||
} | ||
fragment GenreStats on UserGenreStatistic { | ||
genre | ||
count | ||
meanScore | ||
minutesWatched | ||
mediaIds | ||
} | ||
fragment TagStats on UserTagStatistic { | ||
count | ||
meanScore | ||
minutesWatched | ||
mediaIds | ||
tag { | ||
id | ||
name | ||
} | ||
} | ||
fragment FormatStats on UserFormatStatistic { | ||
count | ||
meanScore | ||
minutesWatched | ||
format | ||
} | ||
fragment CountryStats on UserCountryStatistic { | ||
count | ||
meanScore | ||
minutesWatched | ||
country | ||
} | ||
fragment ReleaseYearStats on UserReleaseYearStatistic { | ||
count | ||
meanScore | ||
minutesWatched | ||
releaseYear | ||
} | ||
fragment WatchYearStats on UserStartYearStatistic { | ||
count | ||
meanScore | ||
minutesWatched | ||
startYear | ||
}"; | ||
} | ||
} |
Oops, something went wrong.