Skip to content

Instantly share code, notes, and snippets.

@icholy
Created November 7, 2019 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icholy/93d00a886893a2feb2fc7b458fa92484 to your computer and use it in GitHub Desktop.
Save icholy/93d00a886893a2feb2fc7b458fa92484 to your computer and use it in GitHub Desktop.
package jira
import (
"crypto/tls"
"net/http"
"github.com/andygrunwald/go-jira"
)
var BaseURL = "https://jira.accipiterradar.com:8443"
type Issue struct {
Name string
Summary string
}
func InProgress(username, password string) ([]Issue, error) {
tp := jira.BasicAuthTransport{
Username: username,
Password: password,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
client, err := jira.NewClient(tp.Client(), BaseURL)
if err != nil {
return nil, err
}
query := `status = "In Progress" AND assignee in (currentUser())`
issues, _, err := client.Issue.Search(query, nil)
if err != nil {
return nil, err
}
var ss []Issue
for _, issue := range issues {
ss = append(ss, Issue{Name: issue.Key, Summary: issue.Fields.Summary})
}
return ss, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment