示例#1
0
        public ClientRestSharp CreateClient(ClientRestSharp clientToAdd)
        {
            var request = new RestRequest();

            request.Resource      = "clients";
            request.Method        = Method.POST;
            request.RootElement   = "data";
            request.RequestFormat = DataFormat.Json;
            request.AddBody(new { client = clientToAdd });

            return(Execute <ClientRestSharp>(request));
        }
示例#2
0
        public ClientRestSharp UpdateClient(ClientRestSharp updatedClient)
        {
            var request = new RestRequest();

            request.Resource      = "clients/{client_id}";
            request.Method        = Method.PUT;
            request.RootElement   = "data";
            request.RequestFormat = DataFormat.Json;
            request.AddBody(new { client = updatedClient });
            request.AddParameter("client_id", updatedClient.id.Value, ParameterType.UrlSegment);

            return(Execute <ClientRestSharp>(request));
        }