/// <summary> /// Get the response for the given request /// </summary> /// <typeparam name="TResponse"></typeparam> /// <param name="request">The instance of a request object originally passed to CallAllAsync</param> /// <returns></returns> public TResponse Get <TResponse>(OCIRequest <TResponse> request) where TResponse : OCICommand { if (!_dict.ContainsKey(request.RequestGuid)) { throw new ArgumentException("Object was not part of request", nameof(request)); } return(_dict[request.RequestGuid] as TResponse); }
/// <summary> /// Execute a single command and receive the response /// </summary> /// <typeparam name="TResponse"></typeparam> /// <param name="command"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <TResponse> CallAsync <TResponse>(OCIRequest <TResponse> command, CancellationToken cancellationToken = default) where TResponse : OCICommand { if (command == null) { throw new ArgumentNullException(nameof(command), "Command cannot be NULL"); } if (UserDetails == null) { await LoginAsync(cancellationToken).ConfigureAwait(false); } var responses = await ExecuteCommandsAsync(new List <OCIRequest <TResponse> > { command }, cancellationToken).ConfigureAwait(false); return(responses.First() as TResponse); }