问题描述
我们通过 C# client which was build by parahlman 连接到 Akeneo。我可以使用此客户端创建产品,但是我不想手动添加所有“语言环境”(例如 nl_NL)作为产品值之一,而是希望收到活动语言环境列表,以便我可以以某种方式循环并添加Akeneo 中的产品,适用于所有这些活跃的语言环境。
在 C# 客户端的文档中有一些加载已知属性的示例代码:https://akeneonet.readthedocs.io/en/latest/products.html
查看 C# 客户端,我认为我需要使用 AkeneoClient 类的 GetManyAsync 方法:
public async Task<PaginationResult<TModel>> GetManyAsync<TModel>(string parentCode,int page = 1,int limit = 10,bool withCount = false,CancellationToken ct = default(CancellationToken)) where TModel : ModelBase
{
var endpoint = _endpointResolver.ForPagination<TModel>(parentCode,page,limit,withCount);
_logger.Debug($"Getting multiple resource '{typeof(TModel).Name}' from URL '{endpoint}'.");
var response = await GetAsync(endpoint,ct);
return response.IsSuccessstatusCode
? await response.Content.ReadAsJsonAsync<PaginationResult<TModel>>()
: PaginationResult<TModel>.Empty;
}
我试过了:
PaginationResult<Locale> paginationResult = await client.GetManyAsync<Locale>("list_locales"); //locales //Locales etc.
paginationResult 保持为“空”: paginationResult 我不确定使用什么作为 parentCode,并且在文档中没有找到任何指导我朝着正确方向前进的内容。我还检查了 Akeneo 文档,但也不确定如何使用它:https://api.akeneo.com/api-reference-30.html#get_locales
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)