public override IList <string> ToMessage(BotElement bot, Func <string, string> transform)
        {
            var formatter = new
            {
                TeamProjectCollection = transform(TeamProjectCollection),
                ProjectName           = transform(ProjectName),
                BuildDefinition       = transform(BuildDefinition),
                BuildStatus           = transform(BuildStatus.ToString()),
                BuildUrl,
                BuildNumber             = transform(BuildNumber),
                BuildReason             = transform(BuildReason.ToString()),
                RequestedFor            = transform(RequestedFor),
                RequestedForDisplayName = transform(RequestedForDisplayName),
                DisplayName             = transform(RequestedForDisplayName),
                StartTime,
                FinishTime,
                UserName      = transform(UserName),
                BuildDuration = FormatBuildDuration(bot),
                DropLocation
            };

            return(new[] { bot.Text.BuildFormat.FormatWith(formatter), transform(BuildStatus.ToString()) });
        }
Esempio n. 2
0
        public override IList <string> ToMessage(BotElement bot, Func <string, string> transform)
        {
            var formatter = new
            {
                TeamProjectCollection   = transform(TeamProjectCollection),
                ProjectName             = transform(ProjectName),
                BuildDefinition         = transform(BuildDefinition),
                BuildStatus             = transform(BuildStatus.ToString()), BuildUrl,
                BuildNumber             = transform(BuildNumber),
                BuildReason             = transform(BuildReason.ToString()),
                RequestedFor            = transform(RequestedForUniqueName),
                RequestedForDisplayName = transform(RequestedForDisplayName),
                DisplayName             = transform(RequestedForDisplayName),
                StartTime,
                FinishTime,
                UserName      = transform(UserName),
                BuildDuration = FormatBuildDuration(bot),
                DropLocation,
                NewValue = NewValue == null ? bot.Text.BuildQualityNotSet : transform(NewValue),
                OldValue = OldValue == null ? bot.Text.BuildQualityNotSet : transform(OldValue),
            };

            return(new[] { bot.Text.BuildQualityChangedFormat.FormatWith(formatter) });
        }
        /// <summary>
        /// Request a build
        /// </summary>
        /// <param name="projectName"></param>
        /// <param name="buildDefinitionId"></param>
        /// <param name="reason"></param>
        /// <param name="priority"></param>
        /// <param name="queueId"></param>
        /// <returns></returns>
        public async Task <BuildRequest> RequestBuild(string projectName, int buildDefinitionId, BuildReason reason, BuildPriority priority, int?queueId = null)
        {
            string response = await PostResponse("requests",
                                                 new { definition = new { id = buildDefinitionId }, reason = reason.ToString(), priority = priority.ToString(), queue = new { id = queueId } },
                                                 projectName);

            return(JsonConvert.DeserializeObject <BuildRequest>(response));
        }
Esempio n. 4
0
 /// <summary>
 /// Request a build
 /// </summary>
 /// <param name="projectName"></param>
 /// <param name="buildDefinitionId"></param>
 /// <param name="reason"></param>
 /// <param name="priority"></param>
 /// <param name="queueId"></param>
 /// <returns></returns>
 public async Task<BuildRequest> RequestBuild(string projectName, int buildDefinitionId, BuildReason reason, BuildPriority priority, int? queueId = null)
 {
     string response = await PostResponse("requests",
         new { definition = new { id = buildDefinitionId }, reason = reason.ToString(), priority = priority.ToString(), queue = new { id = queueId } },
         projectName);
     return JsonConvert.DeserializeObject<BuildRequest>(response);
 }