Beispiel #1
0
 public void Configure(IApplicationBuilder app)
 {
     app.Run(async context => {
         var stream = context.Request.Body;
         using (var reader = new StreamReader(stream))
         {
             var request = await reader.ReadToEndAsync();
             _requests.Add(request);
         }
         await context.Response.WriteAsync("OK");
     });
 }
Beispiel #2
0
        /// <summary>
        /// Load all approved prayer requests for the given organization.
        /// </summary>
        /// <param name="requests"></param>
        /// <param name="organizationID"></param>
        /// <returns></returns>
        public static RequestCollection LoadApprovedRequestsByOrg(this RequestCollection requests, int organizationID)
        {
            SqlDataReader approvedRequests = new RequestData().GetApprovedRequests(organizationID);

            while (approvedRequests.Read())
            {
                Request request = new Request((int)approvedRequests["request_id"]);
                requests.Add(request);
            }
            approvedRequests.Close();

            return(requests);
        }
Beispiel #3
0
        public async Task <RequestCollection> FindPullRequests(string location, bool useCache, IEnumerable <CommitInfo> commits)
        {
            var allIssues = await IssueCache.GetIssues(this.Client, location, useCache);

            var requests = new RequestCollection(allIssues);

            foreach (var commit in commits)
            {
                string prMatch = TryExpression(SquashExpression, commit);

                if (prMatch == null)
                {
                    prMatch = TryExpression(MergeExpression, commit);
                }

                if (prMatch != null && Int32.TryParse(prMatch, out int id))
                {
                    var matchPR = allIssues.FirstOrDefault(x => x.Number == id);

                    if (matchPR != null)
                    {
                        var labels = matchPR.Labels;
                        if (labels.Count == 0)
                        {
                            var backport = TryBodyExpression(BackportExpression, matchPR.Body);
                            if (backport != null && Int32.TryParse(backport, out int backportID))
                            {
                                var matchBackport = allIssues.FirstOrDefault(x => x.Number == backportID);
                                if (matchBackport != null)
                                {
                                    labels = matchBackport.Labels;
                                }
                            }
                        }
                        if (!labels.Any(x => x == "not-notes-worthy"))
                        {
                            requests.Add(new RequestInfo(matchPR.Number, string.Format("{0:MM/dd/yyyy}", matchPR.ClosedAt), commit.Title,
                                                         commit.Description, matchPR.Title, matchPR.Body, commit.Hash, commit.Author, matchPR.Url,
                                                         labels.Where(x => IsInterestingLabel(x)).ToList()));
                        }
                    }
                }
            }
            return(requests);
        }