Beispiel #1
0
        public dynamic Request(string url, Dictionary <string, string> query = null)
        {
            log.LogInformation($"Access Token: {accessToken}");
            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Authorization", $"Bearer {accessToken}" }
            };

            if (query != null)
            {
                url += "?";
                foreach (KeyValuePair <string, string> q in query)
                {
                    if (q.Value != null)
                    {
                        url = $"{url}&{q.Key}={q.Value}";
                    }
                }
            }

            dynamic data_response = Leo.GetJSONResponse(log, url, headers: headers);

            if (data_response?.error != null)
            {
                log.LogError($"{data_response}");
            }
            return(data_response);
        }