Inheritance: RequestResult, ITriggerResult
コード例 #1
0
        /// <inheritDoc/>
        public ITriggerResult Trigger(Event[] events)
        {
            var           bodyData = CreateBatchTriggerBody(events);
            IRestResponse response = ExecuteTrigger("/batch_events", bodyData);
            TriggerResult result   = new TriggerResult(response);

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Triggers an event on the specified channels.
        /// </summary>
        /// <param name="channelNames"></param>
        /// <param name="eventName">The name of the event.</param>
        /// <param name="data">The data to be sent with the event. The event payload.</param>
        /// <param name="options">Additional options to be used when triggering the event. See <see cref="ITriggerOptions" />.</param>
        /// <returns>The result of the call to the REST API</returns>
        public ITriggerResult Trigger(string[] channelNames, string eventName, object data, ITriggerOptions options)
        {
            var           bodyData = CreateTriggerBody(channelNames, eventName, data, options);
            IRestResponse response = ExecuteTrigger("/events", bodyData);
            TriggerResult result   = new TriggerResult(response);

            return(result);
        }
コード例 #3
0
ファイル: Pusher.cs プロジェクト: ThinkingUp/QSample
        /// <summary>
        /// Triggers an event on the specified channels.
        /// </summary>
        /// <param name="channelNames"></param>
        /// <param name="eventName">The name of the event.</param>
        /// <param name="data">The data to be sent with the event. The event payload.</param>
        /// <param name="options">Additional options to be used when triggering the event. See <see cref="ITriggerOptions" />.</param>
        /// <returns>The result of the call to the REST API</returns>
        public ITriggerResult Trigger(string[] channelNames, string eventName, object data, ITriggerOptions options)
        {
            TriggerBody bodyData = new TriggerBody()
            {
                name     = eventName,
                data     = BodySerializer.Serialize(data),
                channels = channelNames
            };

            if (string.IsNullOrEmpty(options.SocketId) == false)
            {
                bodyData.socket_id = options.SocketId;
            }

            IRestResponse response = ExecuteTrigger(channelNames, eventName, bodyData);
            TriggerResult result   = new TriggerResult(response);

            return(result);
        }
コード例 #4
0
 private void DebugTriggerResponse(TriggerResult response)
 {
     _options.TraceLogger?.Trace($"Response{Environment.NewLine}StatusCode: {response.StatusCode}{Environment.NewLine}Body: {response.OriginalContent}");
 }
コード例 #5
0
ファイル: Pusher.cs プロジェクト: TradePeg/pusher-http-dotnet
 private void DebugTriggerResponse(TriggerResult response)
 {
     Debug.WriteLine($"Response{Environment.NewLine}StatusCode: {response.StatusCode}{Environment.NewLine}Body: {response.OriginalContent}");
 }