/// <summary> /// Gets a Job description from Jenkins asynchronously. /// </summary> /// <param name="jobName">The Name of the Job to retrieve.</param> /// <param name="token">An optional token for aborting the request.</param> /// <exception cref="JenkinsNetException"></exception> public async Task<T> GetAsync<T>(string jobName, CancellationToken token = default(CancellationToken)) where T : class, IJenkinsJob { try { var cmd = new JobGetCommand<T>(context, jobName); await cmd.RunAsync(token); return cmd.Result; } catch (Exception error) { throw new JenkinsNetException($"Failed to get Jenkins Job '{jobName}'!", error); } }
/// <summary> /// Gets a Job description from Jenkins. /// </summary> /// <param name="jobName">The Name of the Job to retrieve.</param> /// <exception cref="JenkinsNetException"></exception> public T Get<T>(string jobName) where T : class, IJenkinsJob { try { var cmd = new JobGetCommand<T>(context, jobName); cmd.Run(); return cmd.Result; } catch (Exception error) { throw new JenkinsNetException($"Failed to get Jenkins Job '{jobName}'!", error); } }