Ejemplo n.º 1
0
        public string DeleteDocument(string authToken, TitanDocument document)
        {
            if (String.IsNullOrEmpty(authToken))
            {
                throw new ArgumentException("authToken cannot be null or empty.");
            }
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            string         result        = null;
            HttpWebRequest crsGetRequest = (HttpWebRequest)WebRequest.Create(DeleteDocumentUrl(document.documentId));

            crsGetRequest.Accept = "application/json";
            crsGetRequest.Method = "DELETE";
            crsGetRequest.Headers.Add("Version", "1");
            crsGetRequest.Headers.Add("X-Client-Id", "482a16dc-a6a6-4e28-8ff5-cb050731d933");
            crsGetRequest.Headers.Add("X-Auth-Token", authToken);

            using (WebResponse crsGetResponse = crsGetRequest.GetResponse())
            {
                using (Stream stream = crsGetResponse.GetResponseStream())
                {
                    StreamReader reader = new StreamReader(stream, Encoding.UTF8);
                    result = reader.ReadToEnd();
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        private TitanDocument waitForDocument(String authToken, String fileName)
        {
            Stopwatch            timer = Stopwatch.StartNew();
            List <TitanDocument> docs  = GetPrintQueue(authToken);

            while (!docs.Exists(x => x.name == fileName) && timer.Elapsed.Seconds < 30)
            {
                Thread.Sleep(1000);
                docs = GetPrintQueue(authToken);
            }

            TitanDocument doc = docs.FirstOrDefault(x => x.name == fileName);

            if (doc == null)
            {
                throw CreateException("Unable to verify document was uploaded after 30 seconds.");
            }

            return(doc);
        }
Ejemplo n.º 3
0
 public string DeleteDocument(TitanUser requestor, TitanDocument document)
 {
     return(DeleteDocument(Login(requestor), document));
 }