Example #1
0
        private async Task <string> DownloadString(string url)
        {
            var args = new Dictionary <string, object> {
                { "url", url }
            };
            var argsJson = JsonConvert.SerializeObject(args);
            var id       = API.PerformHttpRequestInternal(argsJson, argsJson.Length);
            var req      = _pendingRequests[id] = new PendingRequest(id);

            return(await req.Task);
        }
Example #2
0
        private async Task <string> UploadString(string url, string body)
        {
            var args = new Dictionary <string, object> {
                { "url", url },
                { "method", "POST" },
                { "data", body },
                { "headers", new Dictionary <string, string> {
                      { "Content-Type", "application/json" }
                  } }
            };
            var argsJson = JsonConvert.SerializeObject(args);
            var id       = API.PerformHttpRequestInternal(argsJson, argsJson.Length);
            var req      = _pendingRequests[id] = new PendingRequest(id);

            return(await req.Task);
        }