Example #1
0
        public PonyShotsResponse UploadScreenshot(string shotPath)
        {
            RestClient restClient = new RestClient(UploadUrl);
            RestRequest restRequest = new RestRequest(Method.POST);
            restRequest.AddParameter("username", Username);
            restRequest.AddParameter("apikey", ApiKey);
            restRequest.AddFile("image", shotPath, "image/png");
            var resp = restClient.Execute(restRequest);

            JPSResponse jValue = JsonConvert.DeserializeObject<JPSResponse>(resp.Content);
            PonyShotsResponse psResp = new PonyShotsResponse();

            psResp.RawResponse = resp.Content;
            psResp.Error = jValue.error;

            if (!psResp.Error)
            {   
                psResp.Slug = jValue.slug;
            }
            else
            {
                psResp.ErrorMessage = jValue.message;
            }

            return psResp;
        }
Example #2
0
        public PonyShotsResponse UploadScreenshot(string shotPath)
        {
            RestClient  restClient  = new RestClient(UploadUrl);
            RestRequest restRequest = new RestRequest(Method.POST);

            restRequest.AddParameter("username", Username);
            restRequest.AddParameter("apikey", ApiKey);
            restRequest.AddFile("image", shotPath, "image/png");
            var resp = restClient.Execute(restRequest);

            JPSResponse       jValue = JsonConvert.DeserializeObject <JPSResponse>(resp.Content);
            PonyShotsResponse psResp = new PonyShotsResponse();

            psResp.RawResponse = resp.Content;
            psResp.Error       = jValue.error;

            if (!psResp.Error)
            {
                psResp.Slug = jValue.slug;
            }
            else
            {
                psResp.ErrorMessage = jValue.message;
            }

            return(psResp);
        }