/// <inheritDoc/> public ITriggerResult Trigger(Event[] events) { var bodyData = CreateBatchTriggerBody(events); IRestResponse response = ExecuteTrigger("/batch_events", bodyData); TriggerResult result = new TriggerResult(response); return(result); }
/// <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); }
/// <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); }
private void DebugTriggerResponse(TriggerResult response) { _options.TraceLogger?.Trace($"Response{Environment.NewLine}StatusCode: {response.StatusCode}{Environment.NewLine}Body: {response.OriginalContent}"); }
private void DebugTriggerResponse(TriggerResult response) { Debug.WriteLine($"Response{Environment.NewLine}StatusCode: {response.StatusCode}{Environment.NewLine}Body: {response.OriginalContent}"); }