get inventory with language (#3409)

* get inventory with language

* get inventory with language

* edit

* edit
This commit is contained in:
Outzzz
2025-04-14 15:15:11 +08:00
committed by GitHub
parent f1a49cdff0
commit d20fa79897
4 changed files with 13 additions and 7 deletions

View File

@@ -283,7 +283,7 @@ public sealed class BotController : ArchiController {
[HttpGet("{botNames:required}/Inventory/{appID}/{contextID}")]
[ProducesResponseType<GenericResponse<IReadOnlyDictionary<string, BotInventoryResponse>>>((int) HttpStatusCode.OK)]
[ProducesResponseType<GenericResponse>((int) HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> InventoryGet(string botNames, uint appID, ulong contextID) {
public async Task<ActionResult<GenericResponse>> InventoryGet(string botNames, uint appID, ulong contextID, [FromQuery] string? language = null) {
ArgumentException.ThrowIfNullOrEmpty(botNames);
if (appID == 0) {
@@ -300,7 +300,7 @@ public sealed class BotController : ArchiController {
return BadRequest(new GenericResponse(false, Strings.FormatBotNotFound(botNames)));
}
IList<(HashSet<Asset>? Result, string Message)> results = await Utilities.InParallel(bots.Select(bot => bot.Actions.GetInventory(appID, contextID))).ConfigureAwait(false);
IList<(HashSet<Asset>? Result, string Message)> results = await Utilities.InParallel(bots.Select(bot => bot.Actions.GetInventory(appID, contextID, language: language))).ConfigureAwait(false);
Dictionary<string, BotInventoryResponse> result = new(bots.Count, Bot.BotsComparer);