/// <summary> /// Amazon Product Advertising Client /// </summary> /// <param name="amazonAuthentication"></param> /// <param name="amazonEndpoint"></param> /// <param name="partnerTag"></param> /// <param name="userAgent"></param> /// <param name="strictJsonMapping"></param> public AmazonProductAdvertisingClient(AmazonAuthentication amazonAuthentication, AmazonEndpoint amazonEndpoint, string partnerTag, string userAgent = null, bool strictJsonMapping = false) { this._httpClient = new HttpClient(new LoggingHandler(new HttpClientHandler())); this._httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(userAgent ?? "Nager.AmazonProductAdvertising"); this._credentials = new ImmutableCredentials(amazonAuthentication.AccessKey, amazonAuthentication.SecretKey, null); this._amazonEndpoint = amazonEndpoint; this._partnerTag = partnerTag; this._jsonSerializerSettingsRequest = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; this._jsonSerializerSettingsResponse = new JsonSerializerSettings { MissingMemberHandling = strictJsonMapping ? MissingMemberHandling.Error : MissingMemberHandling.Ignore }; var amazonConfigEndpointConfigRepository = new AmazonEndpointConfigRepository(); this._amazonEndpointConfig = amazonConfigEndpointConfigRepository.Get(amazonEndpoint); this._amazonResourceValidator = new AmazonResourceValidator(); this._amazonLanguageValidator = new AmazonLanguageValidator(); }
public AmazonSign(AmazonAuthentication amazonAuthentication, AmazonEndpoint amazonEndpoint) { var domain = AmazonDomain.GetDomain(amazonEndpoint); var secret = Encoding.UTF8.GetBytes(amazonAuthentication.SecretKey); this.endPoint = $"webservices.{domain}"; this.akid = amazonAuthentication.AccessKey; this.signer = new HMACSHA256(secret); }
public AmazonWrapper(AmazonAuthentication authentication, AmazonEndpoint endpoint, string associateTag = "nagerat-21") { this._authentication = authentication; this._endpoint = endpoint; this._associateTag = associateTag; }