示例#1
0
        public string PostMultipartPackage(string path, byte[] content, string boundary, string json)
        {
            support.LogRequest("POST", path, json);

            headerGen = new ApiTokenAuthHeaderGenerator(apiToken);

            byte[] responseBytes = HttpMethods.MultipartPostHttp(apiToken, path, content, boundary, headerGen);
            string response      = Converter.ToString(responseBytes);

            support.LogResponse(response);

            return(response);
        }
示例#2
0
        public string PostMultipartFile(string path, byte[] fileBytes, string boundary, string sessionId, string json)
        {
            support.LogRequest("POST", path, json);

            headerGen = new SessionIdAuthHeaderGenerator(sessionId);

            byte[] responseBytes = HttpMethods.MultipartPostHttp(apiToken, path, fileBytes, boundary, headerGen);
            string response      = Converter.ToString(responseBytes);

            support.LogResponse(response);

            return(response);
        }
示例#3
0
        public string PostMultipartPackage(string path, byte[] content, string boundary, string json)
        {
            support.LogRequest("POST", path, json);

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

            string response = HttpMethods.MultipartPostHttp(apiKey, path, content, boundary, null, SetupAuthorization(null));

            support.LogResponse(response);

            return(response);
        }
示例#4
0
        public string PostMultipartFile(string path, byte[] fileBytes, string boundary, string json)
        {
            support.LogRequest("POST", path, json);

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

            string response = HttpMethods.MultipartPostHttp(apiKey, path, fileBytes, boundary, null, additionalHeaders);

            support.LogResponse(response);

            return(response);
        }
示例#5
0
        public string PostMultipartPackage(string path, byte[] content, string boundary, string json)
        {
            support.LogRequest("POST", path, json);

            headerGen = new ApiTokenAuthHeaderGenerator(apiToken);

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

            string response = HttpMethods.MultipartPostHttp(apiToken, path, content, boundary, headerGen, additionalHeaders);

            support.LogResponse(response);

            return(response);
        }
示例#6
0
        public string PostMultipartFile(string path, byte[] fileBytes, string boundary, string sessionId, string json)
        {
            support.LogRequest("POST", path, json);

            headerGen = new SessionIdAuthHeaderGenerator(sessionId);

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

            string response = HttpMethods.MultipartPostHttp(apiToken, path, fileBytes, boundary, headerGen, additionalHeaders);

            support.LogResponse(response);

            return(response);
        }
示例#7
0
        /// <summary>
        /// Uploads the Document and file in byte[] to the package.
        /// </summary>
        /// <param name="packageId">The package id.</param>
        /// <param name="fileName">The name of the document.</param>
        /// <param name="fileBytes">The file to upload in bytes.</param>
        /// <param name="document">The document object that has field settings.</param>
        internal void UploadDocument(PackageId packageId, string fileName, byte[] fileBytes, Silanis.ESL.API.Document document)
        {
            string path = template.UrlFor(UrlTemplate.DOCUMENT_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Build();

            try {
                string json         = JsonConvert.SerializeObject(document, settings);
                byte[] payloadBytes = Converter.ToBytes(json);

                string boundary = GenerateBoundary();
                byte[] content  = CreateMultipartContent(fileName, fileBytes, payloadBytes, boundary);

                Converter.ToString(HttpMethods.MultipartPostHttp(apiToken, path, content, boundary));
            } catch (Exception e) {
                throw new EslException("Could not upload document to package." + " Exception: " + e.Message);
            }
        }
示例#8
0
        public string PostMultipartFile(string path, byte[] fileBytes, string boundary, string json)
        {
            support.LogRequest("POST", path, json);

            headerGen = new ApiTokenAuthHeaderGenerator(apiToken);

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

            byte[] responseBytes = HttpMethods.MultipartPostHttp(apiToken, path, fileBytes, boundary, headerGen);
            string response      = Converter.ToString(responseBytes);

            support.LogResponse(response);

            return(response);
        }
示例#9
0
 public string PostMultipartFile(string path, byte[] fileBytes, string boundary)
 {
     byte[] responseBytes = HttpMethods.MultipartPostHttp(apiToken, path, fileBytes, boundary);
     return(Converter.ToString(responseBytes));
 }