예제 #1
0
        /// <summary>
        /// Get the Jenkins job data.
        /// </summary>
        /// <param name="jobName">Name of the job</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>Jenkins job data</returns>
        /// <remarks><include file="Comments.xml" path="comments/comment[@id='job']/*"/></remarks>
        public async Task <JenkinsModelAbstractItem> GetJobAsync(string jobName, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(jobName))
            {
                throw new ArgumentNullException(nameof(jobName));
            }

            JenkinsModelAbstractItem job = await GetApiJobAsync <JenkinsModelAbstractItem>($"job/{jobName}", cancellationToken);

            return(job);
        }
예제 #2
0
        /// <summary>
        /// Get the Jenkins job data.
        /// </summary>
        /// <param name="jobName">Name of the job</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>Jenkins job data</returns>
        public async Task <JenkinsModelAbstractItem> GetJobAsync(string jobName, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(jobName))
            {
                throw new ArgumentNullException(nameof(jobName));
            }

            string str = await GetStringAsync($"job/{jobName}/api/xml", cancellationToken);

            JenkinsModelAbstractItem job = Deserialize <JenkinsModelAbstractItem>(str, jobTypes);

            return(job);
        }