Exemplo n.º 1
0
        public string Post(string path, string jsonPayload, string sessionId)
        {
            support.LogRequest("POST", path, jsonPayload);

            headerGen = new SessionIdAuthHeaderGenerator(sessionId);

            byte[] payloadBytes = null;
            if (jsonPayload != null)
            {
                payloadBytes = Converter.ToBytes(jsonPayload);
            }
            else
            {
                payloadBytes = new byte[0];
            }

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

            byte[] responseBytes = HttpMethods.PostHttp(headerGen, path, payloadBytes, additionalHeaders);

            String response = Converter.ToString(responseBytes);

            support.LogResponse(response);

            return(response);
        }
Exemplo n.º 2
0
        public void Delete(string path, string jsonPayload, string sessionId)
        {
            support.LogRequest("DELETE", path);

            var payloadBytes = jsonPayload != null?Converter.ToBytes(jsonPayload) : new byte [0];

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

            headerGen = new SessionIdAuthHeaderGenerator(sessionId);
            HttpMethods.DeleteHttp(headerGen, path, payloadBytes, SetupAuthorization(sessionId));
        }
Exemplo n.º 3
0
        public string PostMultipartPackage(string path, byte[] content, string boundary, string json)
        {
            support.LogRequest("POST", path, json);

            headerGen = new ApiTokenAuthHeaderGenerator(apiKey);

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

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

            support.LogResponse(response);

            return(response);
        }
Exemplo n.º 4
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(apiKey, path, fileBytes, boundary, headerGen, additionalHeaders);

            support.LogResponse(response);

            return(response);
        }
Exemplo n.º 5
0
        public void Post(string path, string jsonPayload, string sessionId)
        {
            support.LogRequest("POST", path, jsonPayload);

            headerGen = new SessionIdAuthHeaderGenerator(sessionId);

            var payloadBytes = jsonPayload != null?Converter.ToBytes(jsonPayload) : new byte[0];

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

            byte[] responseBytes = HttpMethods.PostHttp(headerGen, path, payloadBytes, SetupAuthorization(sessionId));

            var response = Converter.ToString(responseBytes);

            support.LogResponse(response);
        }
Exemplo n.º 6
0
        public void Delete(string path, string jsonPayload, string sessionId)
        {
            support.LogRequest("DELETE", path);

            byte [] payloadBytes = null;
            if (jsonPayload != null)
            {
                payloadBytes = Converter.ToBytes(jsonPayload);
            }
            else
            {
                payloadBytes = new byte [0];
            }

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

            headerGen = new SessionIdAuthHeaderGenerator(sessionId);
            byte [] responseBytes = HttpMethods.DeleteHttp(headerGen, path, payloadBytes, additionalHeaders);
        }