mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-07 13:33:32 +02:00
Adding ProjectVersion
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package jiradata
|
||||
|
||||
type ProjectVersion struct {
|
||||
Self string `json:"self,omitempty" yaml:"self,omitempty"`
|
||||
ID string `json:"id,omitempty" yaml:"id,omitempty"`
|
||||
Description string `json:"description,omitempty" yaml:"description,omitempty"`
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Archived bool `json:"archived,omitempty" yaml:archived,omitempty"`
|
||||
Released bool `json:"released,omitempty" yaml:released,omitempty"`
|
||||
ReleaseDate string `json:"releaseDate,omitempty" yaml:"releaseDate,omitempty"`
|
||||
UserReleaseDate string `json:"userReleaseDate,omitempty" yaml:"userReleaseDate,omitempty"`
|
||||
ProjectID int `json:"projectId,omitempty" yaml:"projectId,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package jiradata
|
||||
|
||||
type ProjectVersions []*ProjectVersion
|
||||
+21
-3
@@ -1,8 +1,6 @@
|
||||
package jira
|
||||
|
||||
import (
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
import "github.com/arenstar/go-jira/jiradata"
|
||||
|
||||
// https://docs.atlassian.com/jira/REST/cloud/#api/2/project-getProjectComponents
|
||||
func (j *Jira) GetProjectComponents(project string) (*jiradata.Components, error) {
|
||||
@@ -23,3 +21,23 @@ func GetProjectComponents(ua HttpClient, endpoint string, project string) (*jira
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
// https://developer.atlassian.com/cloud/jira/platform/rest/v2#api-api-2-project-projectIdOrKey-versions-get
|
||||
func (j *Jira) GetProjectVersions(project string) (*jiradata.ProjectVersions, error) {
|
||||
return GetProjectVersions(j.UA, j.Endpoint, project)
|
||||
}
|
||||
|
||||
func GetProjectVersions(ua HttpClient, endpoint string, project string) (*jiradata.ProjectVersions, error) {
|
||||
uri := URLJoin(endpoint, "rest/api/2/project", project, "versions")
|
||||
resp, err := ua.GetJSON(uri)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == 200 {
|
||||
results := jiradata.ProjectVersions{}
|
||||
return &results, readJSON(resp.Body, &results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user