mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-06-14 23:45:03 +02:00
Merge branch 'develop' of https://github.com/EvgenKostenko/go-jira into EvgenKostenko-develop
* 'develop' of https://github.com/EvgenKostenko/go-jira: cosmetic fix in boards imports, tests in projects add delete board with tests + go fmt add board create with tests go fmt boards Implement BoardService and get boards list with parameters remove old project Add boards and fix some bugs in project add boards service
This commit is contained in:
27
jira.go
27
jira.go
@ -7,6 +7,9 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
|
||||
"github.com/google/go-querystring/query"
|
||||
)
|
||||
|
||||
// A Client manages communication with the JIRA API.
|
||||
@ -24,6 +27,7 @@ type Client struct {
|
||||
Authentication *AuthenticationService
|
||||
Issue *IssueService
|
||||
Project *ProjectService
|
||||
Board *BoardService
|
||||
}
|
||||
|
||||
// NewClient returns a new JIRA API client.
|
||||
@ -50,6 +54,7 @@ func NewClient(httpClient *http.Client, baseURL string) (*Client, error) {
|
||||
c.Authentication = &AuthenticationService{client: c}
|
||||
c.Issue = &IssueService{client: c}
|
||||
c.Project = &ProjectService{client: c}
|
||||
c.Board = &BoardService{client: c}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
@ -92,6 +97,28 @@ func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Requ
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// addOptions adds the parameters in opt as URL query parameters to s. opt
|
||||
// must be a struct whose fields may contain "url" tags.
|
||||
func addOptions(s string, opt interface{}) (string, error) {
|
||||
v := reflect.ValueOf(opt)
|
||||
if v.Kind() == reflect.Ptr && v.IsNil() {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
u, err := url.Parse(s)
|
||||
if err != nil {
|
||||
return s, err
|
||||
}
|
||||
|
||||
qs, err := query.Values(opt)
|
||||
if err != nil {
|
||||
return s, err
|
||||
}
|
||||
|
||||
u.RawQuery = qs.Encode()
|
||||
return u.String(), nil
|
||||
}
|
||||
|
||||
// NewMultiPartRequest creates an API request including a multi-part file.
|
||||
// A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client.
|
||||
// Relative URLs should always be specified without a preceding slash.
|
||||
|
Reference in New Issue
Block a user