Example #1
0
        /// <summary>
        /// Create and execute custom json-rpc method
        /// </summary>
        /// <typeparam name="T">Custom type. JsonConvert will try to convert json-response to you custom object</typeparam>
        /// <param name="api">Api name</param>
        /// <param name="method">Sets json-rpc "method" field</param>
        /// <param name="token">Throws a <see cref="T:System.OperationCanceledException" /> if this token has had cancellation requested.</param>
        /// <returns></returns>
        /// <exception cref="T:System.OperationCanceledException">The token has had cancellation requested.</exception>
        public Task <JsonRpcResponse <T> > CondenserCustomGetRequestAsync <T>(string api, string method, CancellationToken token)
        {
            var jsonRpc = JsonRpcRequest.CondenserRequest(api, method);

            return(ConnectionManager.RepeatExecuteAsync <T>(jsonRpc, CondenserJsonSerializerSettings, token));
        }
Example #2
0
        /// <summary>
        /// Create and execute custom json-rpc method
        /// </summary>
        /// <typeparam name="T">Custom type. JsonConvert will try to convert json-response to you custom object</typeparam>
        /// <param name="api">Api name</param>
        /// <param name="method">Sets json-rpc "method" field</param>
        /// <param name="data">Sets to json-rpc params field. JsonConvert use`s for convert array of data to string.</param>
        /// <param name="token">Throws a <see cref="T:System.OperationCanceledException" /> if this token has had cancellation requested.</param>
        /// <returns></returns>
        /// <exception cref="T:System.OperationCanceledException">The token has had cancellation requested.</exception>
        public Task <JsonRpcResponse <T> > CondenserBroadcastRequestAsync <T>(string api, string method, object data, CancellationToken token)
        {
            var jsonRpc = JsonRpcRequest.CondenserRequest(CondenserJsonSerializerSettings, api, method, data);

            return(ConnectionManager.ExecuteAsync <T>(jsonRpc, CondenserJsonSerializerSettings, token));
        }