Esempio n. 1
0
        public override UploadResult ShortenURL(string url)
        {
            Dictionary <string, string> args = new Dictionary <string, string>();

            args.Add("url", url);

            string response = SendRequestMultiPart(APIUrl, args, teknik.GetAuthHeaders());
            TeknikUrlShortenerResponseWrapper apiResponse = JsonConvert.DeserializeObject <TeknikUrlShortenerResponseWrapper>(response);

            UploadResult ur = new UploadResult();

            if (apiResponse.Result != null && apiResponse.Error == null)
            {
                ur.ShortenedURL = apiResponse.Result.shortUrl;
            }

            return(ur);
        }
Esempio n. 2
0
        public override UploadResult UploadText(string text, string fileName)
        {
            Dictionary <string, string> args = new Dictionary <string, string>();

            args.Add("code", text);

            string response = SendRequestMultiPart(APIUrl, args, teknik.GetAuthHeaders());
            TeknikPasteResponseWrapper apiResponse = JsonConvert.DeserializeObject <TeknikPasteResponseWrapper>(response);

            UploadResult ur = new UploadResult();

            if (apiResponse.Result != null && apiResponse.Error == null)
            {
                ur.URL = apiResponse.Result.Url;
            }

            return(ur);
        }