Пример #1
0
        public ConnectionStatus PostSync(string path, string data)
        {
            var restRequest = new RestRequest();
            restRequest.Method = Method.POST;
            restRequest.Uri = path;

            if (!string.IsNullOrEmpty(data))
            {
                restRequest.Body = Encoding.UTF8.GetBytes(data);
            }
            restRequest.Headers = new Dictionary<string, string>();
            restRequest.Headers.Add("Content-Type", "application/json");
            RestResponse result = GetClient().execute(restRequest);
            return new ConnectionStatus(DecodeStr(result.Body));
        }
Пример #2
0
        public void Get(string path, Action<ConnectionStatus> callback)
        {
            var restRequest = new RestRequest();
            restRequest.Method = Method.GET;
            restRequest.Uri = path;

            restRequest.Headers = new Dictionary<string, string>();
            restRequest.Headers.Add("Content-Type", "application/json");
            GetClient().execute(restRequest);
        }
Пример #3
0
        public void Post(string path, string data, Action<ConnectionStatus> callback)
        {
            var restRequest = new RestRequest();
            restRequest.Method = Method.POST;
            restRequest.Uri = path;

            if (!string.IsNullOrEmpty(data))
            {
                restRequest.Body = Encoding.UTF8.GetBytes(data);
            }
            restRequest.Headers = new Dictionary<string, string>();
            restRequest.Headers.Add("Content-Type", "application/json");
            GetClient().execute(restRequest);
        }
Пример #4
0
        public ConnectionStatus GetSync(string path)
        {
            var restRequest = new RestRequest();
            restRequest.Method = Method.POST;
            restRequest.Uri = path;

            restRequest.Headers = new Dictionary<string, string>();
            restRequest.Headers.Add("Content-Type", "application/json");
            RestResponse result = GetClient().execute(restRequest);
            return new ConnectionStatus(DecodeStr(result.Body));
        }
Пример #5
0
 public RestResponse execute(RestRequest request)
 {
     send_execute(request);
     return recv_execute();
 }
Пример #6
0
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
         field = iprot.ReadFieldBegin();
         if (field.Type == TType.Stop)
         {
             break;
         }
         switch (field.ID)
         {
             case 1:
                 if (field.Type == TType.Struct)
                 {
                     request = new RestRequest();
                     request.Read(iprot);
                     __isset.request = true;
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             default:
                 TProtocolUtil.Skip(iprot, field.Type);
                 break;
         }
         iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Пример #7
0
 public void send_execute(RestRequest request)
 {
     oprot_.WriteMessageBegin(new TMessage("execute", TMessageType.Call, seqid_));
     var args = new execute_args();
     args.Request = request;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }