Beispiel #1
0
        protected IFlurlRequest GetApiFlurlRequest()
        {
            var request = new FlurlRequest(this.settings.ApiBaseUri);

            request.WithOAuthBearerToken(Program.UserSettings.AccesToken);

            return(request);
        }
        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);
        }