Esempio n. 1
0
        private IFlurlRequest GetRequest(string url)
        {
            var requestUrl = new FlurlRequest($"{_config.ApiUrl}/{url}").WithClient(_flurlClient);

            if (!string.IsNullOrEmpty(_token))
            {
                requestUrl.WithOAuthBearerToken(_token);
            }
            else
            {
                if (!string.IsNullOrEmpty(_apiKey))
                {
                    requestUrl.SetQueryParam("key", _apiKey);
                }
                else
                {
                    throw new Exception("No token and no key for ipb client");
                }
            }

            return(requestUrl);
        }