public string GetUnauthenticated(string path)
        {
            if (proxyConfiguration != null)
            {
                HttpMethods.proxyConfiguration = proxyConfiguration;
            }

            byte[] responseBytes = HttpMethods.GetHttp(path);
            return(Converter.ToString(responseBytes));
        }
Example #2
0
        public DownloadedFile GetBytes(string path)
        {
            support.LogRequest("GET", path);

            if (proxyConfiguration != null)
            {
                HttpMethods.proxyConfiguration = proxyConfiguration;
            }

            return(HttpMethods.GetHttp(apiToken, path, additionalHeaders));
        }
Example #3
0
        public DownloadedFile GetBytes(string path)
        {
            support.LogRequest("GET", path);

            if (proxyConfiguration != null)
            {
                HttpMethods.ProxyConfiguration = proxyConfiguration;
            }

            return(HttpMethods.GetHttp(apiKey, path, SetupAuthorization(null)));
        }
Example #4
0
        public byte[] GetBytes(string path)
        {
            support.LogRequest("GET", path);

            if (proxyConfiguration != null)
            {
                HttpMethods.proxyConfiguration = proxyConfiguration;
            }

            return(HttpMethods.GetHttp(apiToken, path));
        }
        /// <summary>
        /// Downloads the evidence summary from the package and returns it in a byte array.
        /// </summary>
        /// <returns>The evidence summary in byte array.</returns>
        /// <param name="packageId">The package id.</param>
        public byte[] DownloadEvidenceSummary(PackageId packageId)
        {
            string path = template.UrlFor(UrlTemplate.EVIDENCE_SUMMARY_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Build();

            try {
                return(HttpMethods.GetHttp(apiToken, path));
            } catch (Exception e) {
                throw new EslException("Could not download the evidence summary." + " Exception: " + e.Message);
            }
        }
        /// <summary>
        /// Downloads the documents from the package in a zip file and returns it in a byte array.
        /// </summary>
        /// <returns>The zipped documents in byte array.</returns>
        /// <param name="packageId">.</param>
        public byte[] DownloadZippedDocuments(PackageId packageId)
        {
            string path = template.UrlFor(UrlTemplate.ZIP_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Build();

            try {
                return(HttpMethods.GetHttp(apiToken, path));
            } catch (Exception e) {
                throw new EslException("Could not download the documents to a zip file." + " Exception: " + e.Message);
            }
        }
        /// <summary>
        /// Downloads a document from the package and returns it in a byte array.
        /// </summary>
        /// <returns>The document to download.</returns>
        /// <param name="packageId">The package id.</param>
        /// <param name="documentId">The id of the document to download.</param>
        public byte[] DownloadDocument(PackageId packageId, String documentId)
        {
            string path = template.UrlFor(UrlTemplate.PDF_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Replace("{documentId}", documentId)
                          .Build();

            try {
                return(HttpMethods.GetHttp(apiToken, path));
            } catch (Exception e) {
                throw new EslException("Could not download the pdf document." + " Exception: " + e.Message);
            }
        }
Example #8
0
        /// <summary>
        /// Gets the field summary for the package and returns a list of field summaries.
        /// </summary>
        /// <returns>A list of field summaries.</returns>
        /// <param name="packageId">The package id.</param>
        public List <FieldSummary> GetFieldSummary(PackageId packageId)
        {
            string path = template.UrlFor(UrlTemplate.FIELD_SUMMARY_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Build();

            try {
                string response = Converter.ToString(HttpMethods.GetHttp(apiToken, path));
                return(JsonConvert.DeserializeObject <List <FieldSummary> > (response));
            } catch (Exception e) {
                throw new EslException("Could not get the field summary." + " Exception: " + e.Message);
            }
        }
        /// <summary>
        /// Gets the package.
        /// </summary>
        /// <returns>The package.</returns>
        /// <param name="packageId">The package id.</param>
        internal Silanis.ESL.API.Package GetPackage(PackageId packageId)
        {
            string path = template.UrlFor(UrlTemplate.PACKAGE_ID_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Build();

            try {
                string response = Converter.ToString(HttpMethods.GetHttp(apiToken, path));

                return(JsonConvert.DeserializeObject <Silanis.ESL.API.Package> (response, settings));
            } catch (Exception e) {
                throw new EslException("Could not get package." + " Exception: " + e.Message);
            }
        }
Example #10
0
        /// <summary>
        /// Gets the audit trail for a package and returns a list of audits.
        /// </summary>
        /// <returns>A list of audits.</returns>
        /// <param name="packageId">The package id.</param>
        public List <Audit> GetAudit(PackageId packageId)
        {
            string path = template.UrlFor(UrlTemplate.AUDIT_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Build();

            try {
                string response = Converter.ToString(HttpMethods.GetHttp(apiToken, path));
                Dictionary <string, object> eventList = JsonConvert.DeserializeObject <Dictionary <string, object> > (response);
                if (eventList.ContainsKey("audit-events"))
                {
                    return(JsonConvert.DeserializeObject <List <Audit> > (eventList ["audit-events"].ToString()));
                }
                return(null);
            } catch (Exception e) {
                throw new EslException("Could not get audit." + " Exception: " + e.Message);
            }
        }
Example #11
0
        public Page <DocumentPackage> GetPackages(DocumentPackageStatus status, PageRequest request)
        {
            string path = template.UrlFor(UrlTemplate.PACKAGE_LIST_PATH)
                          .Replace("{status}", status.ToString())
                          .Replace("{from}", request.From.ToString())
                          .Replace("{to}", request.To.ToString())
                          .Build();

            try
            {
                string response = Converter.ToString(HttpMethods.GetHttp(apiToken, path));
                Silanis.ESL.API.Result <Silanis.ESL.API.Package> results = JsonConvert.DeserializeObject <Silanis.ESL.API.Result <Silanis.ESL.API.Package> > (response, settings);

                return(ConvertToPage(results, request));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                throw new EslException("Could not get package list. Exception: " + e.Message);
            }
        }
Example #12
0
        public SigningStatus GetSigningStatus(PackageId packageId, string signerId, string documentId)
        {
            String path = template.UrlFor(UrlTemplate.SIGNING_STATUS_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Replace("{signerId}", !String.IsNullOrEmpty(signerId) ? signerId : "")
                          .Replace("{documentId}", !String.IsNullOrEmpty(documentId) ? documentId : "")
                          .Build();

            try {
                string         response = Converter.ToString(HttpMethods.GetHttp(apiToken, path));
                JsonTextReader reader   = new JsonTextReader(new StringReader(response));

                //Loop 'till we get to the status value
                while (reader.Read() && reader.TokenType != JsonToken.String)
                {
                }

                return(SigningStatusUtility.FromString(reader.Value.ToString()));
            } catch (Exception e) {
                throw new EslException("Could not get signing status. Exception: " + e.Message);
            }
        }
Example #13
0
        public byte[] GetBytes(string path)
        {
//            support.LogRequest("GET", path);
            return(HttpMethods.GetHttp(apiToken, path));
        }
Example #14
0
        public string Get(string path)
        {
//            support.LogRequest("GET", path);
            byte[] responseBytes = HttpMethods.GetHttp(apiToken, path);
            return(Converter.ToString(responseBytes));
        }
 public string GetUnauthenticated(string path)
 {
     byte[] responseBytes = HttpMethods.GetHttp(path);
     return(Converter.ToString(responseBytes));
 }