feat: new graphql query

This commit is contained in:
Mikhail Shabanov committed 2022-07-21 14:19:35 +02:00
1 parent 8c490edcc6
commit 703e16fc39
4 files changed
+111

No files matched your search

@@ -0,0 +1,16 @@
query dictionary($nationId: String!, $requestLanguage: RequestLanguage!) {
vehicles(nationId: $nationId, language: $requestLanguage) {
tankId
name
description
isPremium
typeId
nationId
tier
previewImage
normalImage
priceCredit
priceGold
nexTanksInTree
}
}
@@ -0,0 +1,70 @@
using System.Collections.Generic;
namespace WotBlitzStatisticsPro.Common.Model
{
/// <summary>
/// Response for vehicle dictionary query
/// </summary>
public class VehicleResponse
{
///<summary>
/// VehicleId
///</summary>
public long TankId { get; set; }
///<summary>
/// Vehicle name
///</summary>
public string Name { get; set; } = string.Empty;
///<summary>
/// Vehicle description
///</summary>
public string Description { get; set; } = string.Empty;
///<summary>
/// Is vehicle premium
///</summary>
public bool IsPremium { get; set; }
///<summary>
/// Vehicle type id
///</summary>
public string TypeId { get; set; } = string.Empty;
///<summary>
/// Vehicle nationId
///</summary>
public string NationId { get; set; } = string.Empty;
///<summary>
/// Vehicle tier
///</summary>
public int Tier { get; set; }
/// <summary>
/// Vehicle preview image
/// </summary>
public string PreviewImage { get; set; } = string.Empty;
/// <summary>
/// Vehicle normal image
/// </summary>
public string NormalImage { get; set; } = string.Empty;
/// <summary>
/// Vehicle price in credits
/// </summary>
public decimal PriceCredit { get; set; }
/// <summary>
/// Vehicle price in gold
/// </summary>
public decimal PriceGold { get; set; }
/// <summary>
/// Ids of nex tanks and their cost in XP
/// </summary>
public List<long>? NexTanksInTree { get; set; }
}
}
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using HotChocolate.Types;
using WotBlitzStatisticsPro.Common.Model;
using WotBlitzStatisticsPro.Logic;
namespace WotBlitzStatisticsPro.GraphQl.Query
{
[ExtendObjectType(Name = "Query")]
public class VehiclesQuery
{
/// <summary>
/// Returns a list of all vehicles of one nation
/// </summary>
/// <param name="nationId">Nation</param>
/// <param name="language">Request language</param>
/// <returns>A list of vehicles</returns>
public async Task<List<VehicleResponse>> GetVehicles(string nationId, RequestLanguage? language)
{
return new List<VehicleResponse>();
}
}
}
+1
View File
@@ -91,6 +91,7 @@ namespace WotBlitzStatisticsPro.GraphQl
.AddType<WotBlitzAchievementsQuery>()
.AddType<TankInfoResponseType>()
.AddType<WargamingAuthQuery>()
.AddType<VehiclesQuery>()
.AddMutationType(d => d.Name("Mutation"))
.AddType<WotBlitzStatisticsMutation>()
.AddType<AuthenticationMutation>()