Beispiel #1
0
        /// <summary>
        /// Sets the current vsts profile.
        /// </summary>
        /// <param name="dataBag">The data bag.</param>
        /// <param name="profile">The profile.</param>
        public static void SetProfile(this IBotDataBag dataBag, VstsProfile profile)
        {
            dataBag.ThrowIfNull(nameof(dataBag));
            profile.ThrowIfNull(nameof(profile));

            dataBag.SetValue(Profile, profile);
        }
Beispiel #2
0
        /// <summary>
        /// Sets the current vsts profile.
        /// </summary>
        /// <param name="data">The bot data.</param>
        /// <param name="profile">The profile.</param>
        public static void SetProfile(this BotData data, VstsProfile profile)
        {
            data.ThrowIfNull(nameof(data));
            profile.ThrowIfNull(nameof(profile));

            data.SetProperty(Profile, profile);
        }
        /// <inheritdoc />
        public async Task ChangeApprovalStatus(string account, string teamProject, VstsProfile profile, int approvalId, ApprovalStatus status, string comments)
        {
            account.ThrowIfNullOrWhiteSpace(nameof(account));
            teamProject.ThrowIfNullOrWhiteSpace(nameof(teamProject));
            profile.ThrowIfNull(nameof(profile));

            var token = profile.Token;

            using (var client = await this.ConnectAsync <ReleaseHttpClient2>(token, account))
            {
                var approval = await client.GetApprovalAsync(teamProject, approvalId);

                approval.Status   = status;
                approval.Comments = comments;

                await client.UpdateReleaseApprovalAsync(approval, teamProject, approvalId);
            }
        }
        /// <inheritdoc/>
        public async Task <IList <ReleaseApproval> > GetApprovals(string account, string teamProject, VstsProfile profile)
        {
            account.ThrowIfNullOrWhiteSpace(nameof(account));
            teamProject.ThrowIfNullOrWhiteSpace(nameof(teamProject));
            profile.ThrowIfNull(nameof(profile));

            using (var client = await this.ConnectAsync <ReleaseHttpClient2>(profile.Token, account))
            {
                return(await client.GetApprovalsAsync2(teamProject, profile.DisplayName));
            }
        }