public static LogEntry For(SetTriggeringRequest request) { LogEntry entry = new LogEntry("SetTriggeringRequest"); entry.Add("RequestHeader", For(request.RequestHeader)); entry.Add("SubscriptionId", For(request.SubscriptionId)); entry.Add("TriggeringItemId", For(request.TriggeringItemId)); entry.Add("LinksToAdd", For(request.LinksToAdd)); entry.Add("LinksToRemove", For(request.LinksToRemove)); return(entry); }
public async Task SetTriggeringAsync() { var response = new SetTriggeringResponse(); var request = new SetTriggeringRequest(); var channel = new TestRequestChannel(response); var ret = await channel.SetTriggeringAsync(request); ret .Should().BeSameAs(response); channel.Request .Should().BeSameAs(request); }
/// <summary> /// Creates and deletes triggering links for a triggering item. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="SetTriggeringRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="SetTriggeringResponse"/>.</returns> public static async Task <SetTriggeringResponse> SetTriggeringAsync(this IRequestChannel channel, SetTriggeringRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((SetTriggeringResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Creates and deletes triggering links for a triggering item. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="SetTriggeringRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="SetTriggeringResponse"/>.</returns> public static async Task <SetTriggeringResponse> SetTriggeringAsync(this IRequestChannel channel, SetTriggeringRequest request, CancellationToken token = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((SetTriggeringResponse)await channel.RequestAsync(request, token).ConfigureAwait(false)); }
/// <summary> /// Begins an asynchronous invocation of the SetTriggering service. /// </summary> public IAsyncResult BeginSetTriggering( RequestHeader requestHeader, uint subscriptionId, uint triggeringItemId, UInt32Collection linksToAdd, UInt32Collection linksToRemove, AsyncCallback callback, object asyncState) { SetTriggeringRequest request = new SetTriggeringRequest(); request.RequestHeader = requestHeader; request.SubscriptionId = subscriptionId; request.TriggeringItemId = triggeringItemId; request.LinksToAdd = linksToAdd; request.LinksToRemove = linksToRemove; UpdateRequestHeader(request, requestHeader == null, "SetTriggering"); if (UseTransportChannel) { return TransportChannel.BeginSendRequest(request, callback, asyncState); } return InnerChannel.BeginSetTriggering(new SetTriggeringMessage(request), callback, asyncState); }
/// <summary> /// Invokes the SetTriggering service. /// </summary> public virtual ResponseHeader SetTriggering( RequestHeader requestHeader, uint subscriptionId, uint triggeringItemId, UInt32Collection linksToAdd, UInt32Collection linksToRemove, out StatusCodeCollection addResults, out DiagnosticInfoCollection addDiagnosticInfos, out StatusCodeCollection removeResults, out DiagnosticInfoCollection removeDiagnosticInfos) { SetTriggeringRequest request = new SetTriggeringRequest(); SetTriggeringResponse response = null; request.RequestHeader = requestHeader; request.SubscriptionId = subscriptionId; request.TriggeringItemId = triggeringItemId; request.LinksToAdd = linksToAdd; request.LinksToRemove = linksToRemove; UpdateRequestHeader(request, requestHeader == null, "SetTriggering"); try { if (UseTransportChannel) { IServiceResponse genericResponse = TransportChannel.SendRequest(request); if (genericResponse == null) { throw new ServiceResultException(StatusCodes.BadUnknownResponse); } ValidateResponse(genericResponse.ResponseHeader); response = (SetTriggeringResponse)genericResponse; } else { SetTriggeringResponseMessage responseMessage = InnerChannel.SetTriggering(new SetTriggeringMessage(request)); if (responseMessage == null || responseMessage.SetTriggeringResponse == null) { throw new ServiceResultException(StatusCodes.BadUnknownResponse); } response = responseMessage.SetTriggeringResponse; ValidateResponse(response.ResponseHeader); } addResults = response.AddResults; addDiagnosticInfos = response.AddDiagnosticInfos; removeResults = response.RemoveResults; removeDiagnosticInfos = response.RemoveDiagnosticInfos; } finally { RequestCompleted(request, response, "SetTriggering"); } return response.ResponseHeader; }
/// <summary> /// Initializes the message with the body. /// </summary> public SetTriggeringMessage(SetTriggeringRequest SetTriggeringRequest) { this.SetTriggeringRequest = SetTriggeringRequest; }