public async Task GetBrowseNodesAsyncTest1() { var request = new BrowseNodesRequest { BrowseNodeIds = new[] { "1981019031" }, Resources = new[] { "BrowseNodes.Ancestor", "BrowseNodes.Children" }, LanguagesOfPreference = new[] { "de_DE" } }; var response = await this._client.GetBrowseNodesAsync(request); Assert.IsTrue(response.Successful); }
/// <summary> /// Get browseNodes via browseNodeIds /// </summary> /// <param name="browseNodeIds"></param> /// <returns>GetBrowseNodesResponse</returns> public async Task <GetBrowseNodesResponse> GetBrowseNodesAsync(string[] browseNodeIds) { var request = new BrowseNodesRequest { BrowseNodeIds = browseNodeIds, Resources = new[] { "BrowseNodes.Ancestor", "BrowseNodes.Children", } }; return(await this.GetBrowseNodesAsync(request)); }
/// <summary> /// Get browseNode with a browseNodesRequest /// </summary> /// <param name="browseNodesRequest"></param> /// <returns>GetBrowseNodesResponse</returns> public async Task <GetBrowseNodesResponse> GetBrowseNodesAsync(BrowseNodesRequest browseNodesRequest) { var request = new GetBrowseNodesRequest { BrowseNodeIds = browseNodesRequest.BrowseNodeIds, LanguagesOfPreference = browseNodesRequest.LanguagesOfPreference, PartnerTag = this._partnerTag, PartnerType = "Associates", Marketplace = $"www.{this._amazonEndpointConfig.Host}", Resources = browseNodesRequest.Resources }; if (!this._amazonResourceValidator.IsResourcesValid(request.Resources, "GetBrowseNodes")) { return(new GetBrowseNodesResponse { Successful = false, ErrorMessage = "Resources has wrong values" }); } if (!this._amazonLanguageValidator.IsLanguageValid(request.LanguagesOfPreference, this._amazonEndpoint)) { return(new GetBrowseNodesResponse { Successful = false, ErrorMessage = "LanguagesOfPreference contains a language that is not available for this endpoint" }); } var json = JsonConvert.SerializeObject(request, this._jsonSerializerSettingsRequest); if (string.IsNullOrEmpty(json)) { return(new GetBrowseNodesResponse { Successful = false, ErrorMessage = "Cannot serialize object" }); } var response = await this.RequestAsync("GetBrowseNodes", json); return(this.DeserializeObject <GetBrowseNodesResponse>(response)); }