예제 #1
0
        /// <summary>
        /// Remove the specified path.
        /// </summary>
        /// <param name="path">Path</param>
        public async Task <RemoveRequest> Remove(string path)
        {
            var request = new RemoveRequest(_requestId.CurrentAndIncrement, path);

            RequestManager.StartRequest(request);
            await _link.Connector.Write(new JObject
            {
                new JProperty("requests", new JArray
                {
                    request.Serialize()
                })
            });

            return(request);
        }
예제 #2
0
        /// <summary>
        /// Send request to list a path.
        /// </summary>
        /// <param name="path">Remote path to list</param>
        /// <param name="callback">Callback event</param>
        public async Task <ListRequest> List(string path, Action <ListResponse> callback)
        {
            var request = new ListRequest(_requestId.CurrentAndIncrement, callback, path);

            RequestManager.StartRequest(request);
            await _link.Connector.Write(new JObject
            {
                new JProperty("requests", new JArray
                {
                    request.Serialize()
                })
            });

            return(request);
        }
예제 #3
0
        /// <summary>
        /// Set the specified path's value.
        /// </summary>
        /// <param name="path">Path</param>
        /// <param name="permission">Permission</param>
        /// <param name="value">Value</param>
        public async Task <SetRequest> Set(string path, Permission permission, Value value)
        {
            var request = new SetRequest(_requestId.CurrentAndIncrement, path, permission, value);

            RequestManager.StartRequest(request);
            await _link.Connector.Write(new JObject
            {
                new JProperty("requests", new JArray
                {
                    request.Serialize()
                })
            });

            return(request);
        }
        /// <summary>
        /// Invoke the specified path.
        /// </summary>
        /// <param name="path">Path</param>
        /// <param name="permission">Permission</param>
        /// <param name="parameters">Parameters</param>
        /// <param name="callback">Callback</param>
        public async Task <InvokeRequest> Invoke(string path, Permission permission, JObject parameters, Action <InvokeResponse> callback)
        {
            var request = new InvokeRequest(_requestId.Next, path, permission, parameters, callback);

            RequestManager.StartRequest(request);
            await _link.Connector.Write(new JObject
            {
                new JProperty("requests", new JArray
                {
                    request.Serialize()
                })
            });

            return(request);
        }