Exemplo n.º 1
0
        public HttpMarvelApi(HttpClient client, IOptions <MarvelApiOptions> options, ILogger <HttpMarvelApi> logger)
        {
            _client = client ?? throw new ArgumentNullException(nameof(client));

            _marvelApiOptions = options?.Value ?? throw new ArgumentNullException(nameof(options));

            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _client.BaseAddress = new Uri(_marvelApiOptions.Uri);
        }
Exemplo n.º 2
0
        string GetAuthorizationString(MarvelApiOptions marvelApiOptions, int ts = 0)
        {
            var hash = ComputeHash($"{ts}{marvelApiOptions.PrivateKey}{marvelApiOptions.PublicKey}");

            return($"ts={ts}&apikey={marvelApiOptions.PublicKey}&hash={hash}");
        }