mirror of
https://github.com/Pixeval/Pixeval.git
synced 2025-01-07 03:06:53 +08:00
替换WebApiClientCore (#501)
* 替换WebApiClientCore * 添加sg优化 * 公开类型 * 修复图标错位
This commit is contained in:
parent
4a0b8cb33d
commit
e182a5f636
141
src/Pixeval.CoreApi/AppJsonSerializerContext.cs
Normal file
141
src/Pixeval.CoreApi/AppJsonSerializerContext.cs
Normal file
@ -0,0 +1,141 @@
|
||||
#region Copyright
|
||||
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval.CoreApi
|
||||
// Copyright (c) 2024 Pixeval.CoreApi/AppJsonSerializerContext.cs
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using Pixeval.CoreApi.Global.Enum;
|
||||
using Pixeval.CoreApi.Model;
|
||||
using Pixeval.CoreApi.Net.Request;
|
||||
using Pixeval.CoreApi.Net.Response;
|
||||
|
||||
namespace Pixeval.CoreApi;
|
||||
|
||||
[JsonSerializable(typeof(AutoCompletionResponse))]
|
||||
[JsonSerializable(typeof(PixivBookmarkTagResponse))]
|
||||
[JsonSerializable(typeof(PixivCommentResponse))]
|
||||
[JsonSerializable(typeof(PixivIllustrationResponse))]
|
||||
[JsonSerializable(typeof(PixivNextUrlResponse<>))]
|
||||
[JsonSerializable(typeof(PixivNovelResponse))]
|
||||
[JsonSerializable(typeof(PixivRelatedUsersResponse))]
|
||||
[JsonSerializable(typeof(PixivSingleIllustResponse))]
|
||||
[JsonSerializable(typeof(PixivSingleNovelResponse))]
|
||||
[JsonSerializable(typeof(PixivSingleUserResponse))]
|
||||
[JsonSerializable(typeof(UserEntity))]
|
||||
[JsonSerializable(typeof(Profile))]
|
||||
[JsonSerializable(typeof(ProfilePublicity))]
|
||||
[JsonSerializable(typeof(Workspace))]
|
||||
[JsonSerializable(typeof(PixivSpotlightDetailResponse))]
|
||||
[JsonSerializable(typeof(SpotlightBody))]
|
||||
[JsonSerializable(typeof(Entry))]
|
||||
[JsonSerializable(typeof(PixivisionCategory))]
|
||||
[JsonSerializable(typeof(PixivisionSubcategory))]
|
||||
[JsonSerializable(typeof(PixivisionTag))]
|
||||
[JsonSerializable(typeof(Illust))]
|
||||
[JsonSerializable(typeof(Url))]
|
||||
[JsonSerializable(typeof(RelatedArticle))]
|
||||
[JsonSerializable(typeof(PixivSpotlightResponse))]
|
||||
[JsonSerializable(typeof(PixivUserResponse))]
|
||||
[JsonSerializable(typeof(PostCommentResponse))]
|
||||
[JsonSerializable(typeof(ReverseSearchResponse))]
|
||||
[JsonSerializable(typeof(ReverseSearchResponseHeader))]
|
||||
[JsonSerializable(typeof(Result))]
|
||||
[JsonSerializable(typeof(Data))]
|
||||
[JsonSerializable(typeof(ResultHeader))]
|
||||
[JsonSerializable(typeof(TrendingTagResponse))]
|
||||
[JsonSerializable(typeof(UgoiraMetadataResponse))]
|
||||
[JsonSerializable(typeof(UgoiraMetadata))]
|
||||
[JsonSerializable(typeof(Frame))]
|
||||
[JsonSerializable(typeof(ZipUrls))]
|
||||
[JsonSerializable(typeof(UserSpecifiedBookmarkTagResponse))]
|
||||
[JsonSerializable(typeof(UserSpecifiedBookmarkTagBody))]
|
||||
[JsonSerializable(typeof(UserSpecifiedBookmarkTag))]
|
||||
[JsonSerializable(typeof(WebApiBookmarksWithTagResponse))]
|
||||
[JsonSerializable(typeof(WebApiBookmarksWithTagBody))]
|
||||
[JsonSerializable(typeof(Work))]
|
||||
|
||||
[JsonSerializable(typeof(BookmarkTag))]
|
||||
[JsonSerializable(typeof(Feed))]
|
||||
[JsonSerializable(typeof(FeedType))]
|
||||
[JsonSerializable(typeof(IEntry))]
|
||||
[JsonSerializable(typeof(IIdEntry))]
|
||||
[JsonSerializable(typeof(IWorkEntry))]
|
||||
[JsonSerializable(typeof(Illustration))]
|
||||
[JsonSerializable(typeof(MetaSinglePage))]
|
||||
[JsonSerializable(typeof(ImageUrls))]
|
||||
[JsonSerializable(typeof(MangaImageUrls))]
|
||||
[JsonSerializable(typeof(MetaPage))]
|
||||
[JsonSerializable(typeof(XRestrict))]
|
||||
[JsonSerializable(typeof(IllustrationType))]
|
||||
[JsonSerializable(typeof(Novel))]
|
||||
[JsonSerializable(typeof(Series))]
|
||||
[JsonSerializable(typeof(NovelContent))]
|
||||
[JsonSerializable(typeof(Rating))]
|
||||
[JsonSerializable(typeof(SeriesNavigation))]
|
||||
[JsonSerializable(typeof(NovelNavigation))]
|
||||
[JsonSerializable(typeof(NovelImage))]
|
||||
[JsonSerializable(typeof(NovelImageUrls))]
|
||||
[JsonSerializable(typeof(NovelIllustInfo))]
|
||||
[JsonSerializable(typeof(NovelIllust))]
|
||||
[JsonSerializable(typeof(NovelTag))]
|
||||
[JsonSerializable(typeof(NovelIllustUrls))]
|
||||
[JsonSerializable(typeof(NovelUser))]
|
||||
[JsonSerializable(typeof(NovelReplaceableGlossary))]
|
||||
[JsonSerializable(typeof(ProfileImageUrls))]
|
||||
[JsonSerializable(typeof(Spotlight))]
|
||||
[JsonSerializable(typeof(SpotlightCategory))]
|
||||
[JsonSerializable(typeof(SpotlightDetail))]
|
||||
[JsonSerializable(typeof(Tag))]
|
||||
[JsonSerializable(typeof(TrendingTag))]
|
||||
[JsonSerializable(typeof(User))]
|
||||
[JsonSerializable(typeof(UserInfo))]
|
||||
[JsonSerializable(typeof(Comment))]
|
||||
[JsonSerializable(typeof(Stamp))]
|
||||
[JsonSerializable(typeof(CommentUser))]
|
||||
[JsonSerializable(typeof(TokenResponse))]
|
||||
[JsonSerializable(typeof(TokenUser))]
|
||||
[JsonSerializable(typeof(TokenProfileImageUrls))]
|
||||
|
||||
[JsonSerializable(typeof(AddIllustBookmarkRequest))]
|
||||
[JsonSerializable(typeof(AddNormalIllustCommentRequest))]
|
||||
[JsonSerializable(typeof(AddNormalNovelCommentRequest))]
|
||||
[JsonSerializable(typeof(AddNovelBookmarkRequest))]
|
||||
[JsonSerializable(typeof(AddStampIllustCommentRequest))]
|
||||
[JsonSerializable(typeof(AddStampNovelCommentRequest))]
|
||||
[JsonSerializable(typeof(AutoCompletionRequest))]
|
||||
[JsonSerializable(typeof(DeleteCommentRequest))]
|
||||
[JsonSerializable(typeof(FollowUserRequest))]
|
||||
[JsonSerializable(typeof(RefreshSessionRequest))]
|
||||
[JsonSerializable(typeof(RemoveIllustBookmarkRequest))]
|
||||
[JsonSerializable(typeof(RemoveFollowUserRequest))]
|
||||
[JsonSerializable(typeof(RemoveNovelBookmarkRequest))]
|
||||
[JsonSerializable(typeof(ReverseSearchRequest))]
|
||||
[JsonSerializable(typeof(SingleUserRequest))]
|
||||
|
||||
[JsonSerializable(typeof(PrivacyPolicy))]
|
||||
[JsonSerializable(typeof(RankOption))]
|
||||
[JsonSerializable(typeof(SearchDuration))]
|
||||
[JsonSerializable(typeof(SearchIllustrationTagMatchOption))]
|
||||
[JsonSerializable(typeof(SearchNovelTagMatchOption))]
|
||||
[JsonSerializable(typeof(TargetFilter))]
|
||||
[JsonSerializable(typeof(WorkSortOption))]
|
||||
[JsonSerializable(typeof(WorkType))]
|
||||
[JsonSerializable(typeof(SimpleWorkType))]
|
||||
internal partial class AppJsonSerializerContext : JsonSerializerContext;
|
@ -30,7 +30,7 @@ using Pixeval.CoreApi.Net.EndPoints;
|
||||
using Pixeval.CoreApi.Net.Request;
|
||||
using Pixeval.CoreApi.Net.Response;
|
||||
using Pixeval.Utilities;
|
||||
using Refit;
|
||||
using WebApiClientCore.Parameters;
|
||||
|
||||
namespace Pixeval.CoreApi;
|
||||
|
||||
@ -213,5 +213,5 @@ public partial class MakoClient
|
||||
|
||||
public Task<ReverseSearchResponse> ReverseSearchAsync(Stream imgStream, string apiKey)
|
||||
=> RunWithLoggerAsync(async () => await Provider.GetRequiredService<IReverseSearchApiEndPoint>()
|
||||
.GetSauceAsync(new ReverseSearchRequest(apiKey), new StreamPart(imgStream, "img")));
|
||||
.GetSauceAsync(new FormDataFile(imgStream, "img"), new ReverseSearchRequest(apiKey)));
|
||||
}
|
||||
|
@ -101,6 +101,22 @@ public partial class MakoClient
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<HttpResponseMessage> RunWithLoggerAsync(Func<Task<HttpResponseMessage>> task)
|
||||
{
|
||||
try
|
||||
{
|
||||
EnsureNotCancelled();
|
||||
|
||||
return await task();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.RequestTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<T> RunWithLoggerAsync<T>(Func<Task<Result<T>>> task, Func<T> createDefault)
|
||||
{
|
||||
try
|
||||
|
@ -33,7 +33,6 @@ using Pixeval.CoreApi.Net.Request;
|
||||
using Pixeval.CoreApi.Preference;
|
||||
using Pixeval.Logging;
|
||||
using Pixeval.Utilities;
|
||||
using Refit;
|
||||
|
||||
namespace Pixeval.CoreApi;
|
||||
|
||||
@ -76,8 +75,9 @@ public partial class MakoClient : ICancellable, IDisposable, IAsyncDisposable
|
||||
/// Injects necessary dependencies
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="ServiceProvider" /> contains all the required dependencies</returns>
|
||||
private ServiceProvider BuildServiceProvider(IServiceCollection serviceCollection) =>
|
||||
serviceCollection
|
||||
private ServiceProvider BuildServiceProvider(IServiceCollection serviceCollection)
|
||||
{
|
||||
_ = serviceCollection
|
||||
.AddSingleton(this)
|
||||
.AddSingleton<PixivApiHttpMessageHandler>()
|
||||
.AddSingleton<PixivImageHttpMessageHandler>()
|
||||
@ -109,39 +109,18 @@ public partial class MakoClient : ICancellable, IDisposable, IAsyncDisposable
|
||||
UserAgent = { new("PixivIOSApp", "5.8.7") }
|
||||
}
|
||||
})
|
||||
.AddSingleton(s => RestService.For<IAppApiEndPoint>(
|
||||
s.GetRequiredKeyedService<HttpClient>(MakoApiKind.AppApi),
|
||||
new RefitSettings
|
||||
{
|
||||
ExceptionFactory = async message =>
|
||||
!message.IsSuccessStatusCode
|
||||
? await MakoNetworkException
|
||||
.FromHttpResponseMessageAsync(message,
|
||||
s.GetRequiredService<MakoClient>().Configuration.DomainFronting).ConfigureAwait(false)
|
||||
: null
|
||||
}))
|
||||
.AddSingleton(s => RestService.For<IAuthEndPoint>(
|
||||
s.GetRequiredKeyedService<HttpClient>(MakoApiKind.AuthApi),
|
||||
new RefitSettings
|
||||
{
|
||||
ExceptionFactory = async message =>
|
||||
!message.IsSuccessStatusCode
|
||||
? await MakoNetworkException
|
||||
.FromHttpResponseMessageAsync(message,
|
||||
s.GetRequiredService<MakoClient>().Configuration.DomainFronting).ConfigureAwait(false)
|
||||
: null
|
||||
}))
|
||||
.AddSingleton(s => RestService.For<IReverseSearchApiEndPoint>("https://saucenao.com/",
|
||||
new RefitSettings
|
||||
{
|
||||
ExceptionFactory = async message =>
|
||||
!message.IsSuccessStatusCode
|
||||
? await MakoNetworkException
|
||||
.FromHttpResponseMessageAsync(message,
|
||||
s.GetRequiredService<MakoClient>().Configuration.DomainFronting).ConfigureAwait(false)
|
||||
: null
|
||||
}))
|
||||
.BuildServiceProvider();
|
||||
.AddWebApiClient()
|
||||
.UseSourceGeneratorHttpApiActivator()
|
||||
.ConfigureHttpApi(t => t.PrependJsonSerializerContext(AppJsonSerializerContext.Default));
|
||||
|
||||
_ = serviceCollection.AddHttpApi<IAppApiEndPoint>()
|
||||
.ConfigurePrimaryHttpMessageHandler<PixivApiHttpMessageHandler>();
|
||||
_ = serviceCollection.AddHttpApi<IAuthEndPoint>()
|
||||
.ConfigurePrimaryHttpMessageHandler<PixivApiHttpMessageHandler>();
|
||||
_ = serviceCollection.AddHttpApi<IReverseSearchApiEndPoint>();
|
||||
|
||||
return serviceCollection.BuildServiceProvider();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancels this <see cref="MakoClient" />, including all the running instances, the
|
||||
|
@ -23,7 +23,8 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Model;
|
||||
|
||||
public class Comment : IIdEntry
|
||||
[Factory]
|
||||
public partial record Comment : IIdEntry
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public required long Id { get; set; }
|
||||
@ -35,35 +36,37 @@ public class Comment : IIdEntry
|
||||
public required DateTimeOffset Date { get; set; }
|
||||
|
||||
[JsonPropertyName("user")]
|
||||
public required User CommentPoster { get; set; }
|
||||
public required CommentUser CommentPoster { get; set; }
|
||||
|
||||
[JsonPropertyName("has_replies")]
|
||||
public required bool HasReplies { get; set; }
|
||||
|
||||
[JsonPropertyName("stamp")]
|
||||
public required Stamp? CommentStamp { get; set; }
|
||||
|
||||
public class Stamp
|
||||
{
|
||||
[JsonPropertyName("stamp_id")]
|
||||
public required long StampId { get; set; }
|
||||
|
||||
[JsonPropertyName("stamp_url")]
|
||||
public required string StampUrl { get; set; }
|
||||
}
|
||||
|
||||
public class User
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public required long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("account")]
|
||||
public required string Account { get; set; }
|
||||
|
||||
[JsonPropertyName("profile_image_urls")]
|
||||
public required ProfileImageUrls ProfileImageUrls { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
[Factory]
|
||||
public partial record Stamp
|
||||
{
|
||||
[JsonPropertyName("stamp_id")]
|
||||
public required long StampId { get; set; }
|
||||
|
||||
[JsonPropertyName("stamp_url")]
|
||||
public required string StampUrl { get; set; }
|
||||
}
|
||||
|
||||
[Factory]
|
||||
public partial record CommentUser
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public required long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("account")]
|
||||
public required string Account { get; set; }
|
||||
|
||||
[JsonPropertyName("profile_image_urls")]
|
||||
public required ProfileImageUrls ProfileImageUrls { get; set; }
|
||||
}
|
||||
|
@ -24,8 +24,11 @@ using Pixeval.CoreApi.Preference;
|
||||
|
||||
namespace Pixeval.CoreApi.Model;
|
||||
|
||||
// 这个类型比较特殊,并非网络请求的响应类型,因此放到Model而非Response目录中
|
||||
public record TokenResponse
|
||||
/// <summary>
|
||||
/// 这个类型比较特殊,并非网络请求的响应类型,因此放到Model而非Response目录中
|
||||
/// </summary>
|
||||
[Factory]
|
||||
public partial record TokenResponse
|
||||
{
|
||||
[JsonPropertyName("access_token")]
|
||||
public required string AccessToken { get; set; }
|
||||
@ -63,47 +66,49 @@ public record TokenResponse
|
||||
User.IsPremium
|
||||
);
|
||||
}
|
||||
|
||||
public class TokenUser
|
||||
{
|
||||
[JsonPropertyName("profile_image_urls")]
|
||||
public required ProfileImageUrls ProfileImageUrls { get; set; }
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||
public required long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("account")]
|
||||
public required string Account { get; set; }
|
||||
|
||||
[JsonPropertyName("mail_address")]
|
||||
public required string MailAddress { get; set; }
|
||||
|
||||
[JsonPropertyName("is_premium")]
|
||||
public required bool IsPremium { get; set; }
|
||||
|
||||
[JsonPropertyName("x_restrict")]
|
||||
public required long XRestrict { get; set; }
|
||||
|
||||
[JsonPropertyName("is_mail_authorized")]
|
||||
public required bool IsMailAuthorized { get; set; }
|
||||
|
||||
[JsonPropertyName("require_policy_agreement")]
|
||||
public required bool RequirePolicyAgreement { get; set; }
|
||||
}
|
||||
|
||||
public class ProfileImageUrls
|
||||
{
|
||||
[JsonPropertyName("px_16x16")]
|
||||
public required string Px16X16 { get; set; }
|
||||
|
||||
[JsonPropertyName("px_50x50")]
|
||||
public required string Px50X50 { get; set; }
|
||||
|
||||
[JsonPropertyName("px_170x170")]
|
||||
public required string Px170X170 { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
[Factory]
|
||||
public partial record TokenUser
|
||||
{
|
||||
[JsonPropertyName("profile_image_urls")]
|
||||
public required TokenProfileImageUrls ProfileImageUrls { get; set; }
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||
public required long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("account")]
|
||||
public required string Account { get; set; }
|
||||
|
||||
[JsonPropertyName("mail_address")]
|
||||
public required string MailAddress { get; set; }
|
||||
|
||||
[JsonPropertyName("is_premium")]
|
||||
public required bool IsPremium { get; set; }
|
||||
|
||||
[JsonPropertyName("x_restrict")]
|
||||
public required long XRestrict { get; set; }
|
||||
|
||||
[JsonPropertyName("is_mail_authorized")]
|
||||
public required bool IsMailAuthorized { get; set; }
|
||||
|
||||
[JsonPropertyName("require_policy_agreement")]
|
||||
public required bool RequirePolicyAgreement { get; set; }
|
||||
}
|
||||
|
||||
[Factory]
|
||||
public partial record TokenProfileImageUrls
|
||||
{
|
||||
[JsonPropertyName("px_16x16")]
|
||||
public required string Px16X16 { get; set; }
|
||||
|
||||
[JsonPropertyName("px_50x50")]
|
||||
public required string Px50X50 { get; set; }
|
||||
|
||||
[JsonPropertyName("px_170x170")]
|
||||
public required string Px170X170 { get; set; }
|
||||
}
|
||||
|
@ -23,34 +23,36 @@ using System.Threading.Tasks;
|
||||
using Pixeval.CoreApi.Global.Enum;
|
||||
using Pixeval.CoreApi.Net.Request;
|
||||
using Pixeval.CoreApi.Net.Response;
|
||||
using Refit;
|
||||
using WebApiClientCore;
|
||||
using WebApiClientCore.Attributes;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.EndPoints;
|
||||
|
||||
internal interface IAppApiEndPoint
|
||||
[HttpHost(MakoHttpOptions.AppApiBaseUrl)]
|
||||
public interface IAppApiEndPoint
|
||||
{
|
||||
[Post("/v2/illust/bookmark/add")]
|
||||
Task<HttpResponseMessage> AddIllustBookmarkAsync([Body(BodySerializationMethod.UrlEncoded)] AddIllustBookmarkRequest request);
|
||||
[HttpPost("/v2/illust/bookmark/add")]
|
||||
Task<HttpResponseMessage> AddIllustBookmarkAsync([FormContent] AddIllustBookmarkRequest request);
|
||||
|
||||
[Post("/v1/illust/bookmark/delete")]
|
||||
Task<HttpResponseMessage> RemoveIllustBookmarkAsync([Body(BodySerializationMethod.UrlEncoded)] RemoveIllustBookmarkRequest request);
|
||||
[HttpPost("/v1/illust/bookmark/delete")]
|
||||
Task<HttpResponseMessage> RemoveIllustBookmarkAsync([FormContent] RemoveIllustBookmarkRequest request);
|
||||
|
||||
[Post("/v2/novel/bookmark/add")]
|
||||
Task<HttpResponseMessage> AddNovelBookmarkAsync([Body(BodySerializationMethod.UrlEncoded)] AddNovelBookmarkRequest request);
|
||||
[HttpPost("/v2/novel/bookmark/add")]
|
||||
Task<HttpResponseMessage> AddNovelBookmarkAsync([FormContent] AddNovelBookmarkRequest request);
|
||||
|
||||
[Post("/v1/novel/bookmark/delete")]
|
||||
Task<HttpResponseMessage> RemoveNovelBookmarkAsync([Body(BodySerializationMethod.UrlEncoded)] RemoveNovelBookmarkRequest request);
|
||||
[HttpPost("/v1/novel/bookmark/delete")]
|
||||
Task<HttpResponseMessage> RemoveNovelBookmarkAsync([FormContent] RemoveNovelBookmarkRequest request);
|
||||
|
||||
[Get("/v1/illust/detail")]
|
||||
[HttpGet("/v1/illust/detail")]
|
||||
Task<PixivSingleIllustResponse> GetSingleIllustAsync([AliasAs("illust_id")] long id);
|
||||
|
||||
[Get("/v1/user/detail")]
|
||||
[HttpGet("/v1/user/detail")]
|
||||
Task<PixivSingleUserResponse> GetSingleUserAsync(SingleUserRequest request);
|
||||
|
||||
[Get("/v2/novel/detail")]
|
||||
[HttpGet("/v2/novel/detail")]
|
||||
Task<PixivSingleNovelResponse> GetSingleNovelAsync([AliasAs("novel_id")] long id);
|
||||
|
||||
[Get("/webview/v2/novel")]
|
||||
[HttpGet("/webview/v2/novel")]
|
||||
Task<string> GetNovelContentAsync([AliasAs("id")] long id, [AliasAs("raw")] bool raw = false);
|
||||
/*
|
||||
[AliasAs("viewer_version")] string viewerVersion = "20221031_ai",
|
||||
@ -65,42 +67,42 @@ internal interface IAppApiEndPoint
|
||||
[AliasAs("margin_bottom")] string x9 = "50px"
|
||||
*/
|
||||
|
||||
[Get("/v1/user/related")]
|
||||
[HttpGet("/v1/user/related")]
|
||||
Task<PixivRelatedUsersResponse> RelatedUserAsync([AliasAs("filter")] TargetFilter filter, [AliasAs("seed_user_id")] long userId);
|
||||
|
||||
[Post("/v1/user/follow/add")]
|
||||
Task<HttpResponseMessage> FollowUserAsync([Body(BodySerializationMethod.UrlEncoded)] FollowUserRequest request);
|
||||
[HttpPost("/v1/user/follow/add")]
|
||||
Task<HttpResponseMessage> FollowUserAsync([FormContent] FollowUserRequest request);
|
||||
|
||||
[Post("/v1/user/follow/delete")]
|
||||
Task<HttpResponseMessage> RemoveFollowUserAsync([Body(BodySerializationMethod.UrlEncoded)] RemoveFollowUserRequest request);
|
||||
[HttpPost("/v1/user/follow/delete")]
|
||||
Task<HttpResponseMessage> RemoveFollowUserAsync([FormContent] RemoveFollowUserRequest request);
|
||||
|
||||
[Get("/v1/trending-tags/illust")]
|
||||
[HttpGet("/v1/trending-tags/illust")]
|
||||
Task<TrendingTagResponse> GetTrendingTagsAsync([AliasAs("filter")] TargetFilter filter);
|
||||
|
||||
[Get("/v1/trending-tags/novel")]
|
||||
[HttpGet("/v1/trending-tags/novel")]
|
||||
Task<TrendingTagResponse> GetTrendingTagsForNovelAsync([AliasAs("filter")] TargetFilter filter);
|
||||
|
||||
[Get("/v1/ugoira/metadata")]
|
||||
[HttpGet("/v1/ugoira/metadata")]
|
||||
Task<UgoiraMetadataResponse> GetUgoiraMetadataAsync([AliasAs("illust_id")] long id);
|
||||
|
||||
[Get("/v2/search/autocomplete")]
|
||||
[HttpGet("/v2/search/autocomplete")]
|
||||
Task<AutoCompletionResponse> GetAutoCompletionAsync(AutoCompletionRequest autoCompletionRequest);
|
||||
|
||||
[Post("/v1/illust/comment/add")]
|
||||
Task<HttpResponseMessage> AddIllustCommentAsync([Body(BodySerializationMethod.UrlEncoded)] AddNormalIllustCommentRequest request);
|
||||
[HttpPost("/v1/illust/comment/add")]
|
||||
Task<HttpResponseMessage> AddIllustCommentAsync([FormContent] AddNormalIllustCommentRequest request);
|
||||
|
||||
[Post("/v1/illust/comment/add")]
|
||||
Task<HttpResponseMessage> AddIllustCommentAsync([Body(BodySerializationMethod.UrlEncoded)] AddStampIllustCommentRequest request);
|
||||
[HttpPost("/v1/illust/comment/add")]
|
||||
Task<HttpResponseMessage> AddIllustCommentAsync([FormContent] AddStampIllustCommentRequest request);
|
||||
|
||||
[Post("/v1/illust/comment/delete")]
|
||||
Task<HttpResponseMessage> DeleteIllustCommentAsync([Body(BodySerializationMethod.UrlEncoded)] DeleteCommentRequest request);
|
||||
[HttpPost("/v1/illust/comment/delete")]
|
||||
Task<HttpResponseMessage> DeleteIllustCommentAsync([FormContent] DeleteCommentRequest request);
|
||||
|
||||
[Post("/v1/novel/comment/add")]
|
||||
Task<HttpResponseMessage> AddNovelCommentAsync([Body(BodySerializationMethod.UrlEncoded)] AddNormalNovelCommentRequest request);
|
||||
[HttpPost("/v1/novel/comment/add")]
|
||||
Task<HttpResponseMessage> AddNovelCommentAsync([FormContent] AddNormalNovelCommentRequest request);
|
||||
|
||||
[Post("/v1/novel/comment/add")]
|
||||
Task<HttpResponseMessage> AddNovelCommentAsync([Body(BodySerializationMethod.UrlEncoded)] AddStampNovelCommentRequest request);
|
||||
[HttpPost("/v1/novel/comment/add")]
|
||||
Task<HttpResponseMessage> AddNovelCommentAsync([FormContent] AddStampNovelCommentRequest request);
|
||||
|
||||
[Post("/v1/novel/comment/delete")]
|
||||
Task<HttpResponseMessage> DeleteNovelCommentAsync([Body(BodySerializationMethod.UrlEncoded)] DeleteCommentRequest request);
|
||||
[HttpPost("/v1/novel/comment/delete")]
|
||||
Task<HttpResponseMessage> DeleteNovelCommentAsync([FormContent] DeleteCommentRequest request);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval.CoreApi
|
||||
@ -21,13 +21,16 @@
|
||||
using System.Threading.Tasks;
|
||||
using Pixeval.CoreApi.Model;
|
||||
using Pixeval.CoreApi.Net.Request;
|
||||
using Refit;
|
||||
using WebApiClientCore;
|
||||
using WebApiClientCore.Attributes;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.EndPoints;
|
||||
|
||||
[Headers("User-Agent: PixivAndroidApp/5.0.64 (Android 6.0)", "Content-Type: application/x-www-form-urlencoded")]
|
||||
internal interface IAuthEndPoint
|
||||
[Header(HttpRequestHeader.UserAgent, "PixivAndroidApp/5.0.64 (Android 6.0)")]
|
||||
[Header(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded")]
|
||||
[HttpHost(MakoHttpOptions.OAuthBaseUrl)]
|
||||
public interface IAuthEndPoint
|
||||
{
|
||||
[Post("/auth/token")]
|
||||
Task<TokenResponse> RefreshAsync([Body(BodySerializationMethod.UrlEncoded)] RefreshSessionRequest request);
|
||||
}
|
||||
[HttpPost("/auth/token")]
|
||||
Task<TokenResponse> RefreshAsync([FormContent] RefreshSessionRequest request);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval.CoreApi
|
||||
@ -21,13 +21,14 @@
|
||||
using System.Threading.Tasks;
|
||||
using Pixeval.CoreApi.Net.Request;
|
||||
using Pixeval.CoreApi.Net.Response;
|
||||
using Refit;
|
||||
using WebApiClientCore.Attributes;
|
||||
using WebApiClientCore.Parameters;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.EndPoints;
|
||||
|
||||
internal interface IReverseSearchApiEndPoint
|
||||
[HttpHost("https://saucenao.com/")]
|
||||
public interface IReverseSearchApiEndPoint
|
||||
{
|
||||
[Multipart]
|
||||
[Post("/search.php")]
|
||||
Task<ReverseSearchResponse> GetSauceAsync([Query] ReverseSearchRequest request, [AliasAs("file")] StreamPart file);
|
||||
}
|
||||
[HttpPost("/search.php")]
|
||||
Task<ReverseSearchResponse> GetSauceAsync([FormDataContent] FormDataFile file, [PathQuery] ReverseSearchRequest request);
|
||||
}
|
||||
|
@ -18,12 +18,12 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using Pixeval.CoreApi.Global.Enum;
|
||||
using Refit;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
internal record AddIllustBookmarkRequest(
|
||||
[property: AliasAs("restrict")] PrivacyPolicy Restrict,
|
||||
[property: AliasAs("illust_id")] long Id,
|
||||
[property: AliasAs("tags[]")] string? Tags);
|
||||
public record AddIllustBookmarkRequest(
|
||||
[property: JsonPropertyName("restrict")] PrivacyPolicy Restrict,
|
||||
[property: JsonPropertyName("illust_id")] long Id,
|
||||
[property: JsonPropertyName("tags[]")] string? Tags);
|
||||
|
@ -20,18 +20,18 @@
|
||||
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
public record AddNormalIllustCommentRequest(
|
||||
[property: AliasAs("illust_id")] long Id,
|
||||
[property: AliasAs("parent_comment_id")] long? ParentCommentId,
|
||||
[property: AliasAs("comment")] string Content
|
||||
[property: JsonPropertyName("illust_id")] long Id,
|
||||
[property: JsonPropertyName("parent_comment_id")] long? ParentCommentId,
|
||||
[property: JsonPropertyName("comment")] string Content
|
||||
);
|
||||
|
||||
public record AddNormalNovelCommentRequest(
|
||||
[property: AliasAs("novel_id")] long Id,
|
||||
[property: AliasAs("parent_comment_id")] long? ParentCommentId,
|
||||
[property: AliasAs("comment")] string Content
|
||||
[property: JsonPropertyName("novel_id")] long Id,
|
||||
[property: JsonPropertyName("parent_comment_id")] long? ParentCommentId,
|
||||
[property: JsonPropertyName("comment")] string Content
|
||||
);
|
||||
|
@ -20,12 +20,12 @@
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using Pixeval.CoreApi.Global.Enum;
|
||||
using Refit;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
internal record AddNovelBookmarkRequest(
|
||||
[property: AliasAs("restrict")] PrivacyPolicy Restrict,
|
||||
[property: AliasAs("novel_id")] long Id,
|
||||
[property: AliasAs("tags[]")] string? Tags);
|
||||
public record AddNovelBookmarkRequest(
|
||||
[property: JsonPropertyName("restrict")] PrivacyPolicy Restrict,
|
||||
[property: JsonPropertyName("novel_id")] long Id,
|
||||
[property: JsonPropertyName("tags[]")] string? Tags);
|
||||
|
@ -20,18 +20,18 @@
|
||||
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
public record AddStampIllustCommentRequest(
|
||||
[property: AliasAs("illust_id")] long Id,
|
||||
[property: AliasAs("parent_comment_id")] long? ParentCommentId,
|
||||
[property: AliasAs("stamp_id")] int StampId
|
||||
[property: JsonPropertyName("illust_id")] long Id,
|
||||
[property: JsonPropertyName("parent_comment_id")] long? ParentCommentId,
|
||||
[property: JsonPropertyName("stamp_id")] int StampId
|
||||
);
|
||||
|
||||
public record AddStampNovelCommentRequest(
|
||||
[property: AliasAs("novel_id")] long Id,
|
||||
[property: AliasAs("parent_comment_id")] long? ParentCommentId,
|
||||
[property: AliasAs("stamp_id")] int StampId
|
||||
[property: JsonPropertyName("novel_id")] long Id,
|
||||
[property: JsonPropertyName("parent_comment_id")] long? ParentCommentId,
|
||||
[property: JsonPropertyName("stamp_id")] int StampId
|
||||
);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval.CoreApi
|
||||
@ -18,15 +18,15 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
public class AutoCompletionRequest(string word)
|
||||
{
|
||||
[AliasAs("merge_plain_keyword_results=true")]
|
||||
[JsonPropertyName("merge_plain_keyword_results")]
|
||||
public bool MergePlainKeywordResult { get; } = true;
|
||||
|
||||
[AliasAs("word")]
|
||||
[JsonPropertyName("word")]
|
||||
public string Word { get; } = word;
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
public record DeleteCommentRequest([property: AliasAs("comment_id")] long CommentId);
|
||||
public record DeleteCommentRequest([property: JsonPropertyName("comment_id")] long CommentId);
|
||||
|
@ -18,9 +18,9 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using Pixeval.CoreApi.Global.Enum;
|
||||
using Refit;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
internal record FollowUserRequest([property: AliasAs("user_id")] long Id, [property: AliasAs("restrict")] PrivacyPolicy Restrict);
|
||||
public record FollowUserRequest([property: JsonPropertyName("user_id")] long Id, [property: JsonPropertyName("restrict")] PrivacyPolicy Restrict);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval.CoreApi
|
||||
@ -18,28 +18,28 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
#pragma warning disable CA1822
|
||||
internal class RefreshSessionRequest(string? refreshToken)
|
||||
public class RefreshSessionRequest(string? refreshToken)
|
||||
{
|
||||
[AliasAs("refresh_token")]
|
||||
[JsonPropertyName("refresh_token")]
|
||||
public string? RefreshToken { get; } = refreshToken;
|
||||
|
||||
[AliasAs("grant_type")]
|
||||
[JsonPropertyName("grant_type")]
|
||||
public string GrantType => "refresh_token";
|
||||
|
||||
[AliasAs("client_id")]
|
||||
[JsonPropertyName("client_id")]
|
||||
public string ClientId => "MOBrBDS8blbauoSck0ZfDbtuzpyT";
|
||||
|
||||
[AliasAs("client_secret")]
|
||||
[JsonPropertyName("client_secret")]
|
||||
public string ClientSecret => "lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj";
|
||||
|
||||
[AliasAs("include_policy")]
|
||||
[JsonPropertyName("include_policy")]
|
||||
public string IncludePolicy => "true";
|
||||
}
|
||||
#pragma warning restore CA1822
|
||||
#pragma warning restore CA1822
|
||||
|
@ -18,8 +18,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
internal record RemoveIllustBookmarkRequest([property: AliasAs("illust_id")] long IllustId);
|
||||
public record RemoveIllustBookmarkRequest([property: JsonPropertyName("illust_id")] long IllustId);
|
||||
|
@ -18,10 +18,10 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
internal record RemoveFollowUserRequest([property: AliasAs("user_id")] long UserId);
|
||||
public record RemoveFollowUserRequest([property: JsonPropertyName("user_id")] long UserId);
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
internal record RemoveNovelBookmarkRequest([property: AliasAs("novel_id")] long NovelId);
|
||||
public record RemoveNovelBookmarkRequest([property: JsonPropertyName("novel_id")] long NovelId);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
#region Copyright (c) Pixeval/Pixeval.CoreApi
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval.CoreApi
|
||||
@ -18,21 +18,21 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
internal class ReverseSearchRequest(string apiKey)
|
||||
public class ReverseSearchRequest(string apiKey)
|
||||
{
|
||||
[AliasAs("api_key")]
|
||||
[JsonPropertyName("api_key")]
|
||||
public string ApiKey { get; } = apiKey;
|
||||
|
||||
[AliasAs("dbmask")]
|
||||
[JsonPropertyName("dbmask")]
|
||||
public string DbMask { get; } = "96";
|
||||
|
||||
[AliasAs("output_type")]
|
||||
[JsonPropertyName("output_type")]
|
||||
public string OutputType { get; } = "2";
|
||||
|
||||
[AliasAs("numres")]
|
||||
[JsonPropertyName("numres")]
|
||||
public string NumberResult { get; } = "1";
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using Refit;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Request;
|
||||
|
||||
internal record SingleUserRequest([property: AliasAs("user_id")] long Id, [property: AliasAs("filter")] string Filter);
|
||||
public record SingleUserRequest([property: JsonPropertyName("user_id")] long Id, [property: JsonPropertyName("filter")] string Filter);
|
||||
|
@ -26,7 +26,7 @@ using Pixeval.CoreApi.Model;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivBookmarkTagResponse : PixivNextUrlResponse<BookmarkTag>
|
||||
public partial record PixivBookmarkTagResponse : PixivNextUrlResponse<BookmarkTag>
|
||||
{
|
||||
[JsonPropertyName("bookmark_tags")]
|
||||
public override required BookmarkTag[] Entities { get; set; } = [];
|
||||
|
@ -24,7 +24,7 @@ using Pixeval.CoreApi.Model;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivIllustrationResponse : PixivNextUrlResponse<Illustration>
|
||||
public partial record PixivIllustrationResponse : PixivNextUrlResponse<Illustration>
|
||||
{
|
||||
[JsonPropertyName("illusts")]
|
||||
public override required Illustration[] Entities { get; set; } = [];
|
||||
|
@ -24,7 +24,7 @@ using Pixeval.CoreApi.Model;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivNovelResponse : PixivNextUrlResponse<Novel>
|
||||
public partial record PixivNovelResponse : PixivNextUrlResponse<Novel>
|
||||
{
|
||||
[JsonPropertyName("novels")]
|
||||
public override required Novel[] Entities { get; set; } = [];
|
||||
|
@ -24,7 +24,7 @@ using Pixeval.CoreApi.Model;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivSingleIllustResponse
|
||||
public partial record PixivSingleIllustResponse
|
||||
{
|
||||
[JsonPropertyName("illust")]
|
||||
public required Illustration Illust { get; set; }
|
||||
|
@ -23,7 +23,7 @@ using System.Text.Json.Serialization;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivSpotlightDetailResponse
|
||||
public partial record PixivSpotlightDetailResponse
|
||||
{
|
||||
[JsonPropertyName("error")]
|
||||
public required bool Error { get; set; }
|
||||
@ -36,7 +36,7 @@ internal partial record PixivSpotlightDetailResponse
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record SpotlightBody
|
||||
public partial record SpotlightBody
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public required string Id { get; set; } = "";
|
||||
@ -88,7 +88,7 @@ internal partial record SpotlightBody
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record Entry
|
||||
public partial record Entry
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||
@ -147,7 +147,7 @@ internal partial record Entry
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivisionCategory
|
||||
public partial record PixivisionCategory
|
||||
{
|
||||
[JsonPropertyName("label")]
|
||||
public required string Label { get; set; } = "";
|
||||
@ -157,7 +157,7 @@ internal partial record PixivisionCategory
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivisionSubcategory
|
||||
public partial record PixivisionSubcategory
|
||||
{
|
||||
[JsonPropertyName("label")]
|
||||
public required string Label { get; set; } = "";
|
||||
@ -179,7 +179,7 @@ internal partial record PixivisionSubcategory
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivisionTag
|
||||
public partial record PixivisionTag
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public required string Id { get; set; } = "";
|
||||
@ -189,7 +189,7 @@ internal partial record PixivisionTag
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record Illust
|
||||
public partial record Illust
|
||||
{
|
||||
[JsonPropertyName("spotlight_article_id")]
|
||||
public required long SpotlightArticleId { get; set; }
|
||||
@ -268,7 +268,7 @@ internal partial record Illust
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record Url
|
||||
public partial record Url
|
||||
{
|
||||
[JsonPropertyName("1200x1200")]
|
||||
public required string The1200X1200 { get; set; } = "";
|
||||
@ -284,7 +284,7 @@ internal partial record Url
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record RelatedArticle
|
||||
public partial record RelatedArticle
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public required string Id { get; set; } = "";
|
||||
|
@ -24,7 +24,7 @@ using Pixeval.CoreApi.Model;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivSpotlightResponse : PixivNextUrlResponse<Spotlight>
|
||||
public partial record PixivSpotlightResponse : PixivNextUrlResponse<Spotlight>
|
||||
{
|
||||
[JsonPropertyName("spotlight_articles")]
|
||||
public override required Spotlight[] Entities { get; set; } = [];
|
||||
|
@ -24,7 +24,7 @@ using Pixeval.CoreApi.Model;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record PixivUserResponse : PixivNextUrlResponse<User>
|
||||
public partial record PixivUserResponse : PixivNextUrlResponse<User>
|
||||
{
|
||||
[JsonPropertyName("user_previews")]
|
||||
public override required User[] Entities { get; set; } = [];
|
||||
|
@ -18,13 +18,13 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using Pixeval.CoreApi.Model;
|
||||
using Refit;
|
||||
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
public class PostCommentResponse
|
||||
{
|
||||
[AliasAs("comment")]
|
||||
[JsonPropertyName("comment")]
|
||||
public required Comment Comment { get; set; }
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ using Pixeval.CoreApi.Model;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record TrendingTagResponse
|
||||
public partial record TrendingTagResponse
|
||||
{
|
||||
[JsonPropertyName("trend_tags")]
|
||||
public required TrendingTag[] TrendTags { get; set; } = [];
|
||||
|
@ -23,7 +23,7 @@ using System.Text.Json.Serialization;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record UserSpecifiedBookmarkTagResponse
|
||||
public partial record UserSpecifiedBookmarkTagResponse
|
||||
{
|
||||
[JsonPropertyName("error")]
|
||||
public required bool Error { get; set; }
|
||||
@ -36,7 +36,7 @@ internal partial record UserSpecifiedBookmarkTagResponse
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record UserSpecifiedBookmarkTagBody
|
||||
public partial record UserSpecifiedBookmarkTagBody
|
||||
{
|
||||
[JsonPropertyName("public")]
|
||||
public required UserSpecifiedBookmarkTag[] Public { get; set; } = [];
|
||||
@ -52,7 +52,7 @@ internal partial record UserSpecifiedBookmarkTagBody
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record UserSpecifiedBookmarkTag
|
||||
public partial record UserSpecifiedBookmarkTag
|
||||
{
|
||||
[JsonPropertyName("tag")]
|
||||
public required string Name { get; set; } = "";
|
||||
|
@ -23,21 +23,21 @@ using System.Text.Json.Serialization;
|
||||
namespace Pixeval.CoreApi.Net.Response;
|
||||
|
||||
[Factory]
|
||||
internal partial record WebApiBookmarksWithTagResponse
|
||||
public partial record WebApiBookmarksWithTagResponse
|
||||
{
|
||||
[JsonPropertyName("body")]
|
||||
public required WebApiBookmarksWithTagBody ResponseBody { get; set; }
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record WebApiBookmarksWithTagBody
|
||||
public partial record WebApiBookmarksWithTagBody
|
||||
{
|
||||
[JsonPropertyName("works")]
|
||||
public required Work[] Works { get; set; } = [];
|
||||
}
|
||||
|
||||
[Factory]
|
||||
internal partial record Work
|
||||
public partial record Work
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||
|
@ -10,8 +10,9 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Refit" Version="7.0.0" PrivateAssets="True" />
|
||||
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
|
||||
<PackageReference Include="WebApiClientCore" Version="2.1.1" PrivateAssets="True" />
|
||||
<PackageReference Include="WebApiClientCore.Extensions.SourceGenerator" Version="2.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -30,13 +30,13 @@
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton Click="OpenRoamingFolder_OnClicked">
|
||||
<controls:DockPanel HorizontalSpacing="10">
|
||||
<fluent:SymbolIcon controls:DockPanel.Dock="Left" Symbol="FolderList" />
|
||||
<fluent:SymbolIcon controls:DockPanel.Dock="Left" Symbol="FolderGlobe" />
|
||||
<TextBlock x:Uid="/CheckExitedContentDialog/OpenRoamingFolder" />
|
||||
</controls:DockPanel>
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton Click="OpenLogFolder_OnClicked">
|
||||
<controls:DockPanel HorizontalSpacing="10">
|
||||
<fluent:SymbolIcon controls:DockPanel.Dock="Left" Symbol="FolderGlobe" />
|
||||
<fluent:SymbolIcon controls:DockPanel.Dock="Left" Symbol="FolderList" />
|
||||
<TextBlock x:Uid="/CheckExitedContentDialog/OpenLogFolder" />
|
||||
</controls:DockPanel>
|
||||
</HyperlinkButton>
|
||||
|
@ -104,7 +104,7 @@ public partial class MainPageViewModel : ObservableObject
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await App.AppViewModel.MakoClient.ReverseSearchAsync(stream, App.AppViewModel.AppSettings.ReverseSearchApiKey!);
|
||||
var result = await App.AppViewModel.MakoClient.ReverseSearchAsync(stream, App.AppViewModel.AppSettings.ReverseSearchApiKey);
|
||||
if (result.Header.Status is 0)
|
||||
{
|
||||
var viewModels = await Task.WhenAll(result.Results
|
||||
|
Loading…
Reference in New Issue
Block a user