我有带有以下响应的REST API ( api/tax/v1/countries )。在下面的 pngimagePath 和 svgimagePath 属性指向图像类型端点(api/tax/v1/country/Country1/{FlagPNG 或 FlagSVG})
在这种情况下,路径是动态生成的。
{
"countries": [
{
"pngimagePath": "https://test.com/api/tax/v1/country/Country1/4/image/FlagPNG",
"svgimagePath": "https://test.com/api/tax/v1/country/Country1/405/image/FlagSVG",
"displayName": "Country1",
"displayNameShort": "Country1",
"providerName": "Testing",
"providerTerms": null,
"uuid": "1",
"name": "Country1",
"path": "Country1",
"completeResponse": true
},
{
"pngimagePath": "https://test.com/api/tax/v1/country/Country2/5/image/FlagPNG",
"svgimagePath": "https://test.com/api/tax/v1/country/Country2/406/image/FlagSVG",
"displayName": "Country2",
"displayNameShort": "Country2",
"providerName": "Testing one",
"providerTerms": null,
"uuid": "2",
"name": "Country2",
"path": "Country2",
"completeResponse": true
}
],
"authorised": false,
"userMessage": ""
}
// Code to generate the image path
var apiPath = _appSettings.Value.ApiPath + "country/";
result.Countries.AddRange(rawCountries.Select(country => new DTO.CountryDTO {
PNGImagePath = $"{apiPath}{Helper.ReplaceChars(country.DefaultDisplayName)}/{country.PngImageId}/image/{country.PngImageType}" , SVGImagePath = $"{apiPath}{Helper.ReplaceChars(country.DefaultDisplayName)}/{country.SvgImageId}/image/{country.SvgImageType}" , } ) ) ;
我想使用 GraphQL.NET 生成图像路径。
谁能帮我知道如何实现这个功能