diff --git a/ack/acknowledge.go b/ack/acknowledge.go
new file mode 100644
index 0000000..6a08642
--- /dev/null
+++ b/ack/acknowledge.go
@@ -0,0 +1,26 @@
+package ack
+
+import (
+ "playground/listpr/github"
+ "time"
+)
+
+func determineAck(request github.Request) bool {
+ //return request.Assignee == nil
+ const sla = 24 * time.Hour
+ return request.UpadatedAt.Sub(request.CreatedAt) > sla
+}
+
+func getUnacknowledgedPR(pullRequests *github.PullRequestsResult) []*github.Request {
+ var unacknowledged []*github.Request
+ for _, item := range pullRequests.Items {
+ if determineAck(*item) {
+ unacknowledged = append(unacknowledged, item)
+ }
+ }
+ return unacknowledged
+}
+
+func filterByAssignee() {
+
+}
diff --git a/actions/app.go b/actions/app.go
index 2085b6a..38bdcee 100644
--- a/actions/app.go
+++ b/actions/app.go
@@ -7,7 +7,7 @@ import (
"github.com/gobuffalo/envy"
"github.com/unrolled/secure"
- "github.com/Azure/spec_sla_bot/models"
+ "github.com/Azure/spec-sla-bot/models"
"github.com/gobuffalo/x/sessions"
"github.com/rs/cors"
)
diff --git a/assigneeTemplate.tmpl b/assigneeTemplate.tmpl
new file mode 100644
index 0000000..df42a19
--- /dev/null
+++ b/assigneeTemplate.tmpl
@@ -0,0 +1,41 @@
+
+{{if .Items -}}
+ Current Requests:
+
+ Specs Repository Pull Requests
+
+ Number |
+ User |
+ Assignee |
+ Time Created |
+ Title |
+
+
+ #3172 |
+ mboersma |
+ annatisch |
+ 2018-06-01 16:31:05 +0000 UTC |
+ [AKS] update go SDK configuration and fix a consistency
+ |
+
+
+ #3171 |
+ shalinved |
+ lmazuel |
+ 2018-06-01 04:00:52 +0000 UTC |
+ Consumption specifications for cost insights and report
+ |
+
+
+ #3170 |
+ samkreter |
+ marstr |
+ 2018-05-31 23:06:20 +0000 UTC |
+ Adding June Swagger Update - Azure Container Instance
+ |
+
+
+ #3166 |
+ yaakoviyu |
+ marstr |
+ 2018-05-31 17:05:46 +0000 UTC |
+ Adding serverSecurityAlertPolicies.json from pr
+ |
+
+
+ #3165 |
+ jillcary |
+ hovsepm |
+ 2018-05-31 00:28:42 +0000 UTC |
+ Adding appRole property to ApplicationCreateParameters
+ |
+
+
+ #3164 |
+ Developer |
+ annatisch |
+ 2018-05-31 00:14:15 +0000 UTC |
+ Fixing schedule.json and definition file to conform to
+ |
+
+
+ #3162 |
+ tatliciog |
+ sergey-sh |
+ 2018-05-30 22:19:43 +0000 UTC |
+ Introduce Azure Traffic Manager 2018-04-01 API version
+ |
+
+
+ #3154 |
+ olsoro |
+ jhendrixM |
+ 2018-05-30 05:53:10 +0000 UTC |
+ Remove uiDefinitionUri property from managed app respon
+ |
+
+
+ #3152 |
+ hyonholee |
+ sarangan1 |
+ 2018-05-30 04:00:15 +0000 UTC |
+ [Compute] Fix List VM Extension API name, description u
+ |
+
+
+ #3151 |
+ lmazuel |
+ lmazuel |
+ 2018-05-30 00:23:09 +0000 UTC |
+ Python Authorization to multi api
+ |
+
+
+ #3149 |
+ juhee0202 |
+ lmazuel |
+ 2018-05-29 23:06:24 +0000 UTC |
+ Reservations RP 2018-06-01 specs
+ |
+
+
+ #3147 |
+ refortie |
+ hovsepm |
+ 2018-05-29 20:46:49 +0000 UTC |
+ Add new map types
+ |
+
+
+ #3145 |
+ cthrash |
+ anuchandy |
+ 2018-05-29 15:22:05 +0000 UTC |
+ ComputerVision - collection of fixes
+ |
+
+
+ #3139 |
+ sarangan1 |
+ jhendrixM |
+ 2018-05-25 21:42:06 +0000 UTC |
+ Suppress Operations API Implemenetation Error
+ |
+
+
+ #3124 |
+ zhangyd20 |
+ annatisch |
+ 2018-05-23 05:04:33 +0000 UTC |
+ Add APIs for integration runtime sharing feature.
+ |
+
+
+ #3121 |
+ anuchandy |
+
+ NONE |
+ 2018-05-22 20:40:33 +0000 UTC |
+ Adding express route 2018-04 multi api version entry
+ |
+
+
+ #3119 |
+ ranisha2 |
+ dsgouda |
+ 2018-05-22 13:29:21 +0000 UTC |
+ [Do Not Merge] Add Information Protection APIs
+ |
+
+
+ #3112 |
+ abversqr |
+ annatisch |
+ 2018-05-21 17:27:34 +0000 UTC |
+ Adding patch support for SQR API
+ |
+
+
+ #3111 |
+ vrdmr |
+ marstr |
+ 2018-05-21 15:47:21 +0000 UTC |
+ [Automation] Provisioning State Enum to String in DSCCo
+ |
+
+
+ #3094 |
+ ankurkhem |
+ marstr |
+ 2018-05-17 21:45:42 +0000 UTC |
+ add Azure Container Registry policies api and update Op
+ |
+
+
+ #3092 |
+ vinayada1 |
+ jianghaol |
+ 2018-05-16 23:44:04 +0000 UTC |
+ Fixexamples
+ |
+
+
+ #3085 |
+ Alexander |
+ anuchandy |
+ 2018-05-16 19:57:45 +0000 UTC |
+ [Don't Merge, service deployment scheduled for ~May-30]
+ |
+
+
+ #3084 |
+ alexeldei |
+ marstr |
+ 2018-05-16 00:56:42 +0000 UTC |
+ [App Insights/Operational Insights] New Data Plane API
+ |
+
+
+ #3076 |
+ marstr |
+ hovsepm |
+ 2018-05-15 17:22:41 +0000 UTC |
+ Sql/blob auditing
+ |
+
+
+ #3075 |
+ yaakoviyu |
+ jhendrixM |
+ 2018-05-15 06:19:09 +0000 UTC |
+ [DO NOT MERGE] Adding Vulnerability Assessment APIs on
+ |
+
+
+ #3070 |
+ vinayada1 |
+ lmazuel |
+ 2018-05-14 21:03:50 +0000 UTC |
+ Fix swagger warnings
+ |
+
+
+ #3066 |
+ promoisha |
+ hovsepm |
+ 2018-05-14 17:43:41 +0000 UTC |
+ [API Management] New Api version introduced along with
+ |
+
+
+ #3057 |
+ jaredmoo |
+ hovsepm |
+ 2018-05-11 20:13:56 +0000 UTC |
+ Added GET DB extension API
+ |
+
+
+ #3010 |
+ johanste |
+ johanste |
+ 2018-05-04 00:11:08 +0000 UTC |
+ [DO NOT MERGE] Testing code gen
+ |
+
+
+ #2987 |
+ asarkar84 |
+ jhendrixM |
+ 2018-05-01 02:14:23 +0000 UTC |
+ <Please do not review/merge> Added api specs fro GTM su
+ |
+
+
+
diff --git a/finalTemplate.tmpl b/finalTemplate.tmpl
new file mode 100644
index 0000000..dc42ab8
--- /dev/null
+++ b/finalTemplate.tmpl
@@ -0,0 +1,60 @@
+Your Requests:
+ #3159 carissasu Created: 2018-05-30 19:28:18 +0000 UTC [Disk swagger] Removing resourceUpdate, adding contents
+
+ #3154 olsoro Created: 2018-05-30 05:53:10 +0000 UTC Remove uiDefinitionUri property from managed app respon
+
+ #3152 hyonholee Created: 2018-05-30 04:00:15 +0000 UTC [Compute] Fix List VM Extension API name, description u
+
+ #3151 lmazuel Created: 2018-05-30 00:23:09 +0000 UTC Python Authorization to multi api
+
+ #3149 juhee0202 Created: 2018-05-29 23:06:24 +0000 UTC Reservations RP 2018-06-01 specs
+
+ #3147 refortie Created: 2018-05-29 20:46:49 +0000 UTC Add new map types
+
+ #3145 cthrash Created: 2018-05-29 15:22:05 +0000 UTC ComputerVision - collection of fixes
+
+ #3143 yaakoviyu Created: 2018-05-27 06:39:12 +0000 UTC Adding new value to VA baseline name
+
+ #3139 sarangan1 Created: 2018-05-25 21:42:06 +0000 UTC Suppress Operations API Implemenetation Error
+
+ #3131 mboersma Created: 2018-05-24 16:20:45 +0000 UTC [AKS] add new 2018-03-31 API
+
+ #3130 caross Created: 2018-05-24 01:25:21 +0000 UTC Admin Subscriptions move should not contain error codes
+
+ #3124 zhangyd20 Created: 2018-05-23 05:04:33 +0000 UTC Add APIs for integration runtime sharing feature.
+
+ #3121 anuchandy Created: 2018-05-22 20:40:33 +0000 UTC Adding express route 2018-04 multi api version entry
+
+ #3119 ranisha2 Created: 2018-05-22 13:29:21 +0000 UTC [Do Not Merge] Add Information Protection APIs
+
+ #3112 abversqr Created: 2018-05-21 17:27:34 +0000 UTC Adding patch support for SQR API
+
+ #3111 vrdmr Created: 2018-05-21 15:47:21 +0000 UTC [Automation] Provisioning State Enum to String in DSCCo
+
+ #3094 ankurkhem Created: 2018-05-17 21:45:42 +0000 UTC add Azure Container Registry policies api and update Op
+
+ #3092 vinayada1 Created: 2018-05-16 23:44:04 +0000 UTC Fixexamples
+
+ #3085 Alexander Created: 2018-05-16 19:57:45 +0000 UTC [Don't Merge, service deployment scheduled for ~May-30]
+
+ #3084 alexeldei Created: 2018-05-16 00:56:42 +0000 UTC [App Insights/Operational Insights] New Data Plane API
+
+ #3076 marstr Created: 2018-05-15 17:22:41 +0000 UTC Sql/blob auditing
+
+ #3075 yaakoviyu Created: 2018-05-15 06:19:09 +0000 UTC [DO NOT MERGE] Adding Vulnerability Assessment APIs on
+
+ #3070 vinayada1 Created: 2018-05-14 21:03:50 +0000 UTC Fix swagger warnings
+
+ #3066 promoisha Created: 2018-05-14 17:43:41 +0000 UTC [API Management] New Api version introduced along with
+
+ #3057 jaredmoo Created: 2018-05-11 20:13:56 +0000 UTC Added GET DB extension API
+
+ #3010 johanste Created: 2018-05-04 00:11:08 +0000 UTC [DO NOT MERGE] Testing code gen
+
+ #2987 asarkar84 Created: 2018-05-01 02:14:23 +0000 UTC <Please do not review/merge> Added api specs fro GTM su
+
+ #2976 Tiano2017 Created: 2018-04-30 18:58:46 +0000 UTC <Do Not Merge> New APIs for Microsoft.Resources
+
+ #2954 shahabhij Created: 2018-04-26 19:51:40 +0000 UTC Creating separate csharp readme for multiApi support
+
+ #2950 ericc1103 Created: 2018-04-26 02:52:55 +0000 UTC Created newer version (2018-04-01-preview) of workbook
diff --git a/github/github.go b/github/github.go
new file mode 100644
index 0000000..12a7f87
--- /dev/null
+++ b/github/github.go
@@ -0,0 +1,72 @@
+package github
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "time"
+)
+
+//PullRequestURL URL for pull request api
+const PullRequestURL = "https://api.github.com/repos/Azure/azure-rest-api-specs/pulls"
+
+type PullRequestsResult struct {
+ // TotalCount int
+ Items []*Request
+}
+
+type Request struct {
+ Number int
+ HTMLURL string `json:"html_url"`
+ ID int
+ Title string
+ State string
+ User *User
+ Assignee *Assignee
+ Assignees Assignees
+ CreatedAt time.Time `json:"created_at"`
+ UpadatedAt time.Time `json:"updated_at"`
+ Labels Labels
+ ClosedAt time.Time `json:"closed_at"`
+ MergedAt time.Time `json:"merged_at"`
+ Body string
+}
+
+type User struct {
+ Login string
+ HTMLURL string `json:"html_url"`
+}
+
+type Assignee struct {
+ Login string
+ HTMLURL string `json:"html_url"`
+}
+
+type Label struct {
+ ID int
+ Name string
+}
+
+type Assignees []*Assignee
+
+type Labels []*Label
+
+func PullRequests() (*PullRequestsResult, error) {
+ resp, err := http.Get(PullRequestURL)
+ if err != nil {
+ return nil, err
+ }
+ //Pushed onto the call stack
+ defer resp.Body.Close()
+ if resp.StatusCode != http.StatusOK {
+ //resp.Body.Close()
+ return nil, fmt.Errorf("search query failed: %s", resp.Status)
+ }
+ var result PullRequestsResult
+ if err := json.NewDecoder(resp.Body).Decode(&result.Items); err != nil {
+ //resp.Body.Close()
+ return nil, err
+ }
+ //resp.Body.Close()
+ return &result, nil
+}
diff --git a/main.go b/main.go
index 4142d0b..de955d9 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,7 @@ package main
import (
"log"
- "github.com/Azure/spec_sla_bot/actions"
+ "github.com/Azure/spec-sla-bot/actions"
)
func main() {
diff --git a/template/template.go b/template/template.go
new file mode 100644
index 0000000..ca863b1
--- /dev/null
+++ b/template/template.go
@@ -0,0 +1,57 @@
+package template
+
+import (
+ "fmt"
+ "html/template"
+ "log"
+ "os"
+ "playground/listpr/github"
+ "time"
+)
+
+func GenerateTemplate() {
+ //Map of function names to functions
+ fmap := template.FuncMap{
+ "FormatNumber": FormatNumber,
+ "FormatUser": FormatUser,
+ "FormatAssignee": FormatAssignee,
+ "FormatTime": FormatTime,
+ "FormatTitle": FormatTitle}
+ t := template.Must(template.New("assigneeTemplate.tmpl").Funcs(fmap).ParseFiles("assigneeTemplate.tmpl"))
+ result, err := github.PullRequests()
+ if err != nil {
+ log.Fatal(err)
+ }
+ handle, err := os.Create("finalTemplate.html")
+ //fred, err := ioutil.TempFile()
+ err = t.Execute(handle, *result)
+ if err != nil {
+ panic(err)
+ }
+}
+
+/*func FormatPullRequest(item github.Request) string {
+ formattedString := fmt.Sprintf("#%-5d %9.9s Created: %.55s %.55s\n",
+ item.Number, item.User.Login, item.CreatedAt, item.Title)
+ return formattedString
+}*/
+
+func FormatNumber(number int) string {
+ return fmt.Sprintf("#%-5d", number)
+}
+
+func FormatUser(user github.User) string {
+ return fmt.Sprintf("%9.9s", user.Login)
+}
+
+func FormatAssignee(assignee github.Assignee) string {
+ return fmt.Sprintf("%9.9s", assignee.Login)
+}
+
+func FormatTime(createdAt time.Time) string {
+ return fmt.Sprintf("%.55s", createdAt)
+}
+
+func FormatTitle(title string) string {
+ return fmt.Sprintf("%.55s\n", title)
+}