Skip to content

Commit

Permalink
misc 适配新的IPC Attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Jan 11, 2025
1 parent 27b6f8e commit 4783a3e
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 26 deletions.
3 changes: 1 addition & 2 deletions ASFEnhance/ASFEnhance.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
</PropertyGroup>
Expand All @@ -10,7 +10,6 @@
<ItemGroup>
<PackageReference Include="AngleSharp.XPath" />
<PackageReference Include="SteamKit2" IncludeAssets="compile" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" />
<PackageReference Include="System.Composition.AttributedModel" />
<PackageReference Include="System.Linq.Async" IncludeAssets="compile" />
<PackageReference Include="ConfigureAwaitChecker.Analyzer">
Expand Down
3 changes: 1 addition & 2 deletions ASFEnhance/IPC/Controllers/ASFEController.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using ArchiSteamFarm.IPC.Controllers.Api;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Microsoft.AspNetCore.Routing;

namespace ASFEnhance.IPC.Controllers;

/// <summary>
/// 基础控制器
/// </summary>
[Route("/Api/[controller]/[action]")]
[SwaggerTag(nameof(ASFEnhance))]
public abstract class ASFEController : ArchiController { }
12 changes: 7 additions & 5 deletions ASFEnhance/IPC/Controllers/CuratorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using ASFEnhance.Data;
using ASFEnhance.IPC.Requests;
using ASFEnhance.IPC.Responses;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System.Globalization;
using System.Net;

Expand All @@ -25,8 +25,8 @@ public sealed class CuratorController : ASFEController
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 27 in ASFEnhance/IPC/Controllers/CuratorController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "关注鉴赏家", Description = "需要指定ClanId")]
[SwaggerResponse((int)HttpStatusCode.BadRequest, $"The request has failed, check {nameof(GenericResponse.Message)} from response body for actual reason. Most of the time this is ASF, understanding the request, but refusing to execute it due to provided reason.", typeof(GenericResponse))]
[EndpointDescription("需要指定ClanId")]
[EndpointSummary("关注鉴赏家")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BoolDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> FollowCurator(string botNames, [FromBody] ClanIdListRequest request)
Expand Down Expand Up @@ -84,7 +84,8 @@ public async Task<ActionResult<GenericResponse>> FollowCurator(string botNames,
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 86 in ASFEnhance/IPC/Controllers/CuratorController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "取消关注鉴赏家", Description = "需要指定ClanId")]
[EndpointDescription("需要指定ClanId")]
[EndpointSummary("取消关注鉴赏家")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BoolDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> UnFollowCurator(string botNames, [FromBody] ClanIdListRequest request)
Expand Down Expand Up @@ -143,7 +144,8 @@ public async Task<ActionResult<GenericResponse>> UnFollowCurator(string botNames
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 146 in ASFEnhance/IPC/Controllers/CuratorController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "获取已关注的鉴赏家列表", Description = "Start:起始位置,Count:获取数量")]
[EndpointDescription("Start:起始位置,Count:获取数量")]
[EndpointSummary("获取已关注的鉴赏家列表")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, HashSet<CuratorItem>>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> FollowingCurators(string botNames, [FromBody] CuratorsRequest request)
Expand Down
18 changes: 11 additions & 7 deletions ASFEnhance/IPC/Controllers/PurchaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
using ArchiSteamFarm.IPC.Responses;
using ArchiSteamFarm.Localization;
using ArchiSteamFarm.Steam;
using ASFEnhance.Cart;
using ASFEnhance.Data.Common;
using ASFEnhance.Data.IAccountCartService;
using ASFEnhance.Data.Plugin;
using ASFEnhance.IPC.Requests;
using ASFEnhance.IPC.Responses;
using ASFEnhance.Store;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System.Data;
using System.Globalization;
using System.Net;
Expand All @@ -31,7 +30,8 @@ public sealed class PurchaseController : ASFEController
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 32 in ASFEnhance/IPC/Controllers/PurchaseController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "获取游戏详情", Description = "需要指定AppIds列表")]
[EndpointDescription("需要指定AppIds列表")]
[EndpointSummary("获取游戏详情")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, AppDetailDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> GetAppDetail(string botNames, [FromBody] AppIdListRequest request)
Expand Down Expand Up @@ -154,7 +154,8 @@ public async Task<ActionResult<GenericResponse>> GetAppDetail(string botNames, [
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 156 in ASFEnhance/IPC/Controllers/PurchaseController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "清空购物车", Description = "清除购物车所有内容")]
[EndpointDescription("清除购物车所有内容")]
[EndpointSummary("清空购物车")]
[ProducesResponseType(typeof(GenericResponse<BoolDictResponse>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> ClearCart(string botNames)
Expand Down Expand Up @@ -200,7 +201,8 @@ public async Task<ActionResult<GenericResponse>> ClearCart(string botNames)
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 203 in ASFEnhance/IPC/Controllers/PurchaseController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "读取机器人购物车", Description = "读取机器人购物车内容")]
[EndpointDescription("读取机器人购物车内容")]
[EndpointSummary("读取机器人购物车")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BotCartResponse?>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> GetCart(string botNames)
Expand Down Expand Up @@ -316,7 +318,8 @@ public async Task<ActionResult<GenericResponse>> GetCart(string botNames)
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 320 in ASFEnhance/IPC/Controllers/PurchaseController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "购物车添加项目", Description = "IsGift为True时需要定义GiftInfo")]
[EndpointDescription("IsGift为True时需要定义GiftInfo")]
[EndpointSummary("购物车添加项目")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BotCartResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> AddCart(string botNames, [FromBody] AddCartRequest request)
Expand Down Expand Up @@ -482,7 +485,8 @@ public async Task<ActionResult<GenericResponse>> AddCart(string botNames, [FromB
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 487 in ASFEnhance/IPC/Controllers/PurchaseController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "购物车下单", Description = "结算当前购物车")]
[EndpointDescription("结算当前购物车")]
[EndpointSummary("购物车下单")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, OnlyPurchaseResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> Purchase(string botNames, [FromBody] OnlyPurchaseRequest request)
Expand Down
8 changes: 5 additions & 3 deletions ASFEnhance/IPC/Controllers/RecommendController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using ArchiSteamFarm.Steam;
using ASFEnhance.IPC.Requests;
using ASFEnhance.IPC.Responses;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System.Globalization;
using System.Net;

Expand All @@ -24,7 +24,8 @@ public sealed class RecommendController : ASFEController
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 26 in ASFEnhance/IPC/Controllers/RecommendController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "发布游戏评测", Description = "RateUp:true好评,AllowReply:true允许回复,ForFree:false非免费取得,Public:true评测公开可见,Comment:评测内容")]
[EndpointDescription("RateUp:true好评,AllowReply:true允许回复,ForFree:false非免费取得,Public:true评测公开可见,Comment:评测内容")]
[EndpointSummary("发布游戏评测")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BoolDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> PublishReview(string botNames, [FromBody] RecommendRequest request)
Expand Down Expand Up @@ -92,7 +93,8 @@ public async Task<ActionResult<GenericResponse>> PublishReview(string botNames,
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]

Check warning on line 95 in ASFEnhance/IPC/Controllers/RecommendController.cs

View workflow job for this annotation

GitHub Actions / build

Route '{botNames:required}' conflicts with another action route. An HTTP request that matches multiple routes results in an ambiguous match error. Fix the conflict by changing the route's pattern, HTTP method, or route constraints. (https://aka.ms/aspnet/analyzers)
[SwaggerOperation(Summary = "删除游戏评测", Description = "需要指定AppIds列表")]
[EndpointDescription("需要指定AppIds列表")]
[EndpointSummary("删除游戏评测")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BoolDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> DeleteReview(string botNames, [FromBody] AppIdListRequest request)
Expand Down
17 changes: 11 additions & 6 deletions ASFEnhance/IPC/Controllers/WishlistController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using ArchiSteamFarm.Steam;
using ASFEnhance.IPC.Requests;
using ASFEnhance.IPC.Responses;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System.Globalization;
using System.Net;

Expand All @@ -24,7 +24,8 @@ public sealed class WishlistController : ASFEController
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]
[SwaggerOperation(Summary = "添加愿望单", Description = "需要指定AppIds列表")]
[EndpointDescription("需要指定AppIds列表")]
[EndpointSummary("添加愿望单")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BoolDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> AddWishlist(string botNames, [FromBody] AppIdListRequest request)
Expand Down Expand Up @@ -84,7 +85,8 @@ public async Task<ActionResult<GenericResponse>> AddWishlist(string botNames, [F
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]
[SwaggerOperation(Summary = "移除愿望单", Description = "需要指定AppIds列表")]
[EndpointDescription("需要指定AppIds列表")]
[EndpointSummary("移除愿望单")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BoolDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> RemoveWishlist(string botNames, [FromBody] AppIdListRequest request)
Expand Down Expand Up @@ -144,7 +146,8 @@ public async Task<ActionResult<GenericResponse>> RemoveWishlist(string botNames,
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]
[SwaggerOperation(Summary = "关注游戏", Description = "需要指定AppIds列表")]
[EndpointDescription("需要指定AppIds列表")]
[EndpointSummary("关注游戏")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BoolDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> FollowGame(string botNames, [FromBody] AppIdListRequest request)
Expand Down Expand Up @@ -204,7 +207,8 @@ public async Task<ActionResult<GenericResponse>> FollowGame(string botNames, [Fr
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]
[SwaggerOperation(Summary = "取消关注游戏", Description = "需要指定AppIds列表")]
[EndpointDescription("需要指定AppIds列表")]
[EndpointSummary("取消关注游戏")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, BoolDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> UnFollowGame(string botNames, [FromBody] AppIdListRequest request)
Expand Down Expand Up @@ -264,7 +268,8 @@ public async Task<ActionResult<GenericResponse>> UnFollowGame(string botNames, [
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost("{botNames:required}")]
[SwaggerOperation(Summary = "检查游戏关注/愿望单情况", Description = "需要指定AppIds列表")]
[EndpointDescription("需要指定AppIds列表")]
[EndpointSummary("检查游戏关注/愿望单情况")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, CheckGameDictResponse>>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int)HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> CheckGame(string botNames, [FromBody] AppIdListRequest request)
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.3.3.0</Version>
<Version>2.3.4.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit 4783a3e

Please sign in to comment.