Method GetOrCreateRestClientAgentAsync
- Namespace
- Kepware.Api.ClientHandler
- Assembly
- Kepware.Api.dll
GetOrCreateRestClientAgentAsync(string, IDictionary<string, object>?, CancellationToken)
Gets or creates a REST Client agent with the specified name. If the agent exists, it is loaded and returned. If it does not exist, it is created with the specified properties.
public Task<RestClientAgent> GetOrCreateRestClientAgentAsync(string name, IDictionary<string, object>? properties = null, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the agent.
propertiesIDictionary<string, object>Optional properties to set on the agent.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<RestClientAgent>
A task that represents the asynchronous operation. The task result contains the created or loaded RestClientAgent.
Exceptions
- ArgumentException
Thrown when the name is null or empty.
- InvalidOperationException
Thrown when the agent cannot be created or loaded.