jirarest

package
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamFields        = "fields"
	ParamJQL           = "jql"
	ParamMaxResults    = "maxResults"
	ParamStartAt       = "startAt"
	ParamValidateQuery = "validateQuery"
)
View Source
const (
	APIV2URLListCustomFields = `/rest/api/2/field`
	APIV3URLIssue            = `/rest/api/3/issue` // /rest/api/3/issue/{issueIdOrKey}

	StatusDone         = "Done"
	StatusOpen         = "Open"
	StatusCustomClosed = "Closed"

	MaxResults    = 1000
	MetaParamRank = "_rank"

	OperationAdd    = "add"
	OperationRemove = "remove"

	TimeTimeSpent                     = "Time Spent"
	TimeTimeEstimate                  = "Time Estimate"
	TimeTimeOriginalEstimate          = "Time Original Estimate"
	TimeAggregateTimeOriginalEstimate = "Aggregate Time Original Estimate"
	TimeAggregateTimeSpent            = "Aggregate Time Spent"
	TimeAggregateTimeEstimate         = "Aggregate Time Estimate"
	TimeTimeRemaining                 = "Time Remaining"
	TimeTimeRemainingOriginal         = "Time Remaining Original"

	FieldSlugType       = "type"
	FieldSlugProjectkey = "projectkey"
)
View Source
const APIURLMyself = "/rest/api/3/myself"
View Source
const (
	CustomFieldNameEpicLink = "Epic Link"
)

Variables

View Source
var (
	ErrClientCannotBeNil                = errors.New("client cannot be nil")
	ErrJiraClientCannotBeNil            = errors.New("jira client cannot be nil")
	ErrSimpleClientCannotBeNil          = errors.New("simple client cannot be nil")
	ErrCustomFieldLabelRequired         = errors.New("custom field label is required")
	ErrIssueCannotBeNil                 = errors.New("issue cannot be nil")
	ErrIssueKeyCannotBeEmpty            = errors.New("issue key cannot be empty")
	ErrKeyNotFound                      = errors.New("key not found")
	ErrIssueOrIssueKeyOrIssueIDRequired = errors.New("issue, issue id, or issue key required")
	ErrIssuesSetCannotBeNil             = errors.New("issuesSet cannot be nil")
	ErrFunctionCannotBeNil              = errors.New("function cannot be nil")
	ErrNotFound                         = errors.New("Issue does not exist or you do not have permission to see it.: request failed. Please analyze the request body for more details. Status code: 400")
)
View Source
var ErrJiraRESTClientCannotBeNil = errors.New("jirarest.Client cannot be nil")
View Source
var ErrLineageNotFound = errors.New("lineage not found")

Functions

func BacklogAPIURL

func BacklogAPIURL(baseURL string, boardID uint, qry *BoardBacklogParams) string

BacklogAPIURL returns a backlog issues API URL described at https://docs.atlassian.com/jira-software/REST/7.3.1/ . The description is here: Returns all issues from the board's backlog, for the given board Id. This only includes issues that the user has permission to view. The backlog contains incomplete issues that are not assigned to any future or active sprint. Note, if the user does not have permission to view the board, no issues will be returned at all. Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic. By default, the returned issues are ordered by rank. Reference: https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/board-getIssuesForBacklog

func DefaultHistogramMapTableConfig added in v0.11.0

func DefaultHistogramMapTableConfig(projectKeys []string) *histogram.HistogramMapTableSetConfig

func DefaultIssuesSetTableColumns

func DefaultIssuesSetTableColumns(inclInitiative, inclEpic bool) table.ColumnDefinitionSet

func GetCustomValueString

func GetCustomValueString(iss jira.Issue, customFieldKey string) (string, error)

GetCustomValueString attempts to return a string if either the custom value is a simple string or is an `IssueCustomField`, in which case it returns the `value` property.

func GetUnmarshalCustomValue

func GetUnmarshalCustomValue(iss jira.Issue, customFieldKey string, v *IssueCustomField) error

GetUnmarshalCustomValue can be used to unmarshal a value to `IssueCustomField{}`.

func IssueFieldsCustomFieldString

func IssueFieldsCustomFieldString(fields *jira.IssueFields, id string) string

IssueFieldsCustomFieldString returns a string custom field, e.g "Epic Link"

func IssueMapProjectStatusType added in v0.20.0

func IssueMapProjectStatusType(iss *jira.Issue) (map[string]string, error)

func IssueProjectkeyType added in v0.20.0

func IssueProjectkeyType(iss *jira.Issue) (string, string)

func IssueProjectkeyTypeStatus added in v0.20.0

func IssueProjectkeyTypeStatus(iss *jira.Issue) (string, string, string)

func IssueToEpic

func IssueToEpic(iss jira.Issue) (*jira.Epic, error)

func JiraClientBasicAuth

func JiraClientBasicAuth(serverURL, username, password string) (*jira.Client, error)

func JiraClientBasicAuthGoauth added in v0.15.0

func JiraClientBasicAuthGoauth(creds *goauth.CredentialsBasicAuth) (*jira.Client, error)

func NewClientHTTPBasicAuthFile added in v0.9.0

func NewClientHTTPBasicAuthFile(filename, credsKey string) (hclient *http.Client, serverURL string, err error)

func NewClientJiraBasicAuthFile added in v0.9.0

func NewClientJiraBasicAuthFile(filename, credsKey string) (*jira.Client, error)

func NewCredentialsBasicAuthGoauthFile added in v0.9.0

func NewCredentialsBasicAuthGoauthFile(filename, credsKey string) (*goauth.CredentialsBasicAuth, error)

func UserJiraToOIDC added in v0.15.0

func UserJiraToOIDC(u *jira.User, serverURL string) *oidc.UserInfo

Types

type BacklogService added in v0.6.0

type BacklogService struct {
	Client *Client
	// contains filtered or unexported fields
}

func NewBacklogService added in v0.6.0

func NewBacklogService(client *Client) *BacklogService

func (*BacklogService) GetBacklogIssuesAll added in v0.6.0

func (svc *BacklogService) GetBacklogIssuesAll(ctx context.Context, boardID uint, jql string) (*IssuesResponse, [][]byte, error)

func (*BacklogService) GetBacklogIssuesResponse added in v0.6.0

func (svc *BacklogService) GetBacklogIssuesResponse(ctx context.Context, boardID uint, qry *BoardBacklogParams) (*IssuesResponse, []byte, error)

func (*BacklogService) GetBacklogIssuesSetAll added in v0.6.0

func (svc *BacklogService) GetBacklogIssuesSetAll(ctx context.Context, boardID uint, jql string) (*IssuesSet, [][]byte, error)

type BoardBacklogParams added in v0.6.0

type BoardBacklogParams struct {
	StartAt       int    `url:"startAt"`
	MaxResults    int    `url:"maxResults"`
	JQL           string `url:"jql"`
	ValidateQuery bool   `url:"validateQuery"`
	Fields        string `url:"fields"`
	Expand        string `url:"expand"`
}

func (BoardBacklogParams) URLValues added in v0.6.0

func (p BoardBacklogParams) URLValues() url.Values

type Client added in v0.7.0

type Client struct {
	Config     *gojira.Config
	HTTPClient *http.Client
	JiraClient *jira.Client

	LoggerZ        *zerolog.Logger
	Logger         *slog.Logger
	BacklogAPI     *BacklogService
	CustomFieldAPI *CustomFieldService
	IssueAPI       *IssueService
	CustomFieldSet *CustomFieldSet
	// contains filtered or unexported fields
}

func NewClientBasicAuth added in v0.15.0

func NewClientBasicAuth(serverURL, username, password string, addCustomFieldSet bool) (*Client, error)

func NewClientGoauthBasicAuthFile added in v0.9.0

func NewClientGoauthBasicAuthFile(filename, credsKey string, addCustomFieldSet bool) (*Client, error)

func NewClientGoauthCredentials added in v0.21.0

func NewClientGoauthCredentials(c *goauth.Credentials, addCustomFieldSet bool) (*Client, error)

func NewClientGoauthCredentialsSetFile added in v0.25.3

func NewClientGoauthCredentialsSetFile(filename, accountkey string, addCustomFieldSet, inclAccountsOnError bool) (*Client, error)

func (*Client) Inflate added in v0.18.0

func (c *Client) Inflate(addCustomFieldSet bool) error

func (*Client) LoadCustomFields added in v0.18.0

func (c *Client) LoadCustomFields() error

func (*Client) LogOrNotAny added in v0.19.0

func (c *Client) LogOrNotAny(ctx context.Context, level slog.Level, msg string, attrs ...any)

func (*Client) Myself added in v0.15.0

func (c *Client) Myself(ctx context.Context) (*jira.User, *http.Response, error)

func (*Client) MyselfUserInfo added in v0.15.0

func (c *Client) MyselfUserInfo(ctx context.Context) (*oidc.UserInfo, *jira.User, *jira.Response, error)

type CustomCol

type CustomCol struct {
	Name       string
	Slug       string
	Type       string
	Func       func(im IssueMore) (string, error)
	RenderSkip bool
}

func (CustomCol) NameOrSlug added in v0.17.0

func (c CustomCol) NameOrSlug() string

type CustomField

type CustomField struct {
	ID               string            `json:"id"` // "customfield_12345"
	Key              string            `json:"key"`
	Name             string            `json:"name"`
	UntranslatedName string            `json:"untranslatedName"`
	Custom           bool              `json:"custom"`
	Orderable        bool              `json:"orderable"`
	Navigable        bool              `json:"navigable"`
	Searchable       bool              `json:"searchable"`
	ClauseNames      []string          `json:"clauseNames"`
	Schema           CustomFieldSchema `json:"schema"`
}

type CustomFieldSchema

type CustomFieldSchema struct {
	Type     string `json:"type"`
	Custom   string `json:"custom"`
	CustomID int    `json:"customId"`
}

type CustomFieldService added in v0.19.0

type CustomFieldService struct {
	JRClient *Client
}

func NewCustomFieldService added in v0.19.0

func NewCustomFieldService(client *Client) *CustomFieldService

func (*CustomFieldService) GetCustomField added in v0.19.0

func (svc *CustomFieldService) GetCustomField(customFieldName string) (CustomField, error)
func (svc *CustomFieldService) GetCustomFieldEpicLink() (CustomField, error)

func (*CustomFieldService) GetCustomFieldSet added in v0.21.0

func (svc *CustomFieldService) GetCustomFieldSet() (*CustomFieldSet, error)

func (*CustomFieldService) GetCustomFields added in v0.19.0

func (svc *CustomFieldService) GetCustomFields() (CustomFields, error)

type CustomFieldSet added in v0.18.0

type CustomFieldSet struct {
	Data map[string]CustomField
}

func NewCustomFieldSet added in v0.18.0

func NewCustomFieldSet() *CustomFieldSet

func (*CustomFieldSet) Add added in v0.18.0

func (set *CustomFieldSet) Add(fields ...CustomField) error

func (*CustomFieldSet) CreateFuncIssueToMap added in v0.21.0

func (set *CustomFieldSet) CreateFuncIssueToMap(fieldsWithDefaults map[string]string, useCustomFieldDisplayNames bool) FuncIssueToMap

CreateFuncIssueToMap creates a function to use with `IssuesSet.HistogramMapFunc`.

func (*CustomFieldSet) IDToName added in v0.21.0

func (set *CustomFieldSet) IDToName(id string) (string, error)

func (*CustomFieldSet) Init added in v0.18.0

func (set *CustomFieldSet) Init()

type CustomFields

type CustomFields []CustomField

func (CustomFields) FilterByIDs

func (cfs CustomFields) FilterByIDs(ids ...string) CustomFields

func (CustomFields) FilterByNames

func (cfs CustomFields) FilterByNames(names ...string) CustomFields

func (CustomFields) SortByName

func (cfs CustomFields) SortByName(asc bool) CustomFields

func (CustomFields) Table

func (cfs CustomFields) Table(name string) table.Table

func (CustomFields) WriteTable

func (cfs CustomFields) WriteTable(w io.Writer) error

type CustomJiraProcessor added in v0.11.0

type CustomJiraProcessor struct {
	*IssuesSet
}

type CustomTableCols

type CustomTableCols struct {
	Cols []CustomCol
}

func CustomTableColsFromStrings added in v0.17.0

func CustomTableColsFromStrings(cols []string) CustomTableCols

func (CustomTableCols) Names added in v0.17.0

func (cols CustomTableCols) Names(defaultToSlug bool) []string

type EpicsSet

type EpicsSet struct {
	EpicsMap map[string]jira.Epic
}

func NewEpicsSet

func NewEpicsSet() EpicsSet

func (*EpicsSet) AddIssues

func (es *EpicsSet) AddIssues(issues []jira.Issue) error

func (*EpicsSet) GetKeys

func (es *EpicsSet) GetKeys(jclient *jira.Client, epicKeys []string) error

type FuncIssueToMap added in v0.21.0

type FuncIssueToMap func(iss *jira.Issue) (map[string]string, error)

type GetQueryOptions added in v0.26.0

type GetQueryOptions struct {
	ExpandChangelog    bool // sent to andygrunwald SDK
	XMultiSkipNotFound bool // not sent to andygrunwald SDK; used for getting multiple issues
	XIncludeParents    bool
}

func (GetQueryOptions) Build added in v0.26.0

func (opts GetQueryOptions) Build() *jira.GetQueryOptions

Build returns a `*jira.GetQueryOptions` for the andygrunwald SDK.

type IssueCalcField added in v0.11.0

type IssueCalcField struct {
	Key     string
	ValFunc func(iss *jira.Issue) (string, error)
}

type IssueCustomField

type IssueCustomField struct {
	ID    string `json:"id"`
	Self  string `json:"self"`
	Value string `json:"value"`
}

func GetIssueCustomValueStruct

func GetIssueCustomValueStruct(iss jira.Issue) (*IssueCustomField, error)

type IssueMeta added in v0.7.0

type IssueMeta struct {
	AdditionalFields map[string]*string
	AssigneeName     string
	CreateTime       *time.Time
	CreatorName      string
	EpicName         string
	Key              string
	KeyURL           string
	Labels           []string
	ParentKey        string
	Project          string
	ProjectKey       string
	Resolution       string
	Status           string
	Summary          string
	Type             string
	UpdateTime       *time.Time
}

func (*IssueMeta) BuildKeyURL added in v0.9.0

func (im *IssueMeta) BuildKeyURL(baseURL string)

func (*IssueMeta) KeyLinkMarkdown added in v0.9.0

func (im *IssueMeta) KeyLinkMarkdown() string

KeyLinkMarkdown returns a link of both `Key` and `KeyURL` are non-empty,`Key` if `Key` is non-empty or an empty string if both are empty.

func (*IssueMeta) String added in v0.7.0

func (im *IssueMeta) String() string

type IssueMetas added in v0.7.0

type IssueMetas []IssueMeta

func (IssueMetas) HighestAboveEpic added in v0.9.0

func (ims IssueMetas) HighestAboveEpic() *IssueMeta

HighestAboveEpic returns the highest item that follows an Epic.

func (IssueMetas) HighestEpic added in v0.9.0

func (ims IssueMetas) HighestEpic() *IssueMeta

HighestEpic returns the highest most Epic.

func (IssueMetas) HighestType added in v0.9.0

func (ims IssueMetas) HighestType(issueType string) *IssueMeta

type IssueMore added in v0.7.0

type IssueMore struct {
	// contains filtered or unexported fields
}

func NewIssueMore added in v0.17.0

func NewIssueMore(iss *jira.Issue) IssueMore

func (*IssueMore) AdditionalFields added in v0.18.0

func (im *IssueMore) AdditionalFields(additionalFieldNames []string) map[string]*string

func (*IssueMore) AssigneeName added in v0.17.0

func (im *IssueMore) AssigneeName() string

func (*IssueMore) CreateTime added in v0.7.0

func (im *IssueMore) CreateTime() time.Time

func (*IssueMore) CreatorName added in v0.7.0

func (im *IssueMore) CreatorName() string

func (*IssueMore) CustomField added in v0.8.0

func (im *IssueMore) CustomField(customFieldLabel string) (IssueCustomField, error)

CustomField takes a custom value key such as `customfield_12345`.`

func (*IssueMore) CustomFieldString added in v0.17.0

func (im *IssueMore) CustomFieldString(customFieldLabel string) (string, error)

CustomFieldString takes a custom value key such as `customfield_12345`.`

func (*IssueMore) CustomFieldStringOrDefault added in v0.17.0

func (im *IssueMore) CustomFieldStringOrDefault(customFieldLabel, def string) string

CustomFieldStringOrEmpty takes a custom value key such as `customfield_12345`.`

func (*IssueMore) EpicKey added in v0.8.1

func (im *IssueMore) EpicKey() string

func (*IssueMore) EpicName added in v0.7.0

func (im *IssueMore) EpicName() string

func (*IssueMore) EpicNameOrSummary added in v0.8.1

func (im *IssueMore) EpicNameOrSummary() string

func (*IssueMore) Key added in v0.7.0

func (im *IssueMore) Key() string

func (*IssueMore) KeyLinkWebMarkdown added in v0.19.0

func (im *IssueMore) KeyLinkWebMarkdown(baseURL string) string

func (*IssueMore) KeyURLWeb added in v0.19.0

func (im *IssueMore) KeyURLWeb(baseURL string) string

func (*IssueMore) Keys added in v0.26.0

func (im *IssueMore) Keys() (keys []string, hasChangelog bool)

Keys returns a slice of all keys for this issue over time including the current key and all previous keys. The return slice is deduped sorted. This relies on pulling the changelog from the Jira API. NOTE: keys are sorted alphabetically, not by change date.

func (*IssueMore) LabelExists added in v0.11.0

func (im *IssueMore) LabelExists(label string) bool

func (*IssueMore) Labels added in v0.9.0

func (im *IssueMore) Labels(sortAsc bool) []string

func (*IssueMore) Meta added in v0.7.0

func (im *IssueMore) Meta(serverURL string, additionalFieldNames []string) IssueMeta

func (*IssueMore) ParentKey added in v0.7.0

func (im *IssueMore) ParentKey() string

func (*IssueMore) Project added in v0.7.0

func (im *IssueMore) Project() string

func (*IssueMore) ProjectKey added in v0.7.0

func (im *IssueMore) ProjectKey() string

func (*IssueMore) Resolution added in v0.7.0

func (im *IssueMore) Resolution() string

func (*IssueMore) Status added in v0.7.0

func (im *IssueMore) Status() string

func (*IssueMore) Summary added in v0.7.0

func (im *IssueMore) Summary() string

func (*IssueMore) Type added in v0.7.0

func (im *IssueMore) Type() string

func (*IssueMore) UpdateTime added in v0.7.0

func (im *IssueMore) UpdateTime() time.Time

func (*IssueMore) Value added in v0.17.0

func (im *IssueMore) Value(fieldSlug string) (string, bool)

func (*IssueMore) ValueOrDefault added in v0.20.0

func (im *IssueMore) ValueOrDefault(fieldSlug, def string) string

func (*IssueMore) WriteFileJSON added in v0.18.0

func (im *IssueMore) WriteFileJSON(filename string, perm os.FileMode, prefix, indent string) error

type IssueMores added in v0.22.0

type IssueMores []IssueMore

func (IssueMores) Keys added in v0.22.0

func (ii IssueMores) Keys(sortAsc, dedupe bool) []string

func (IssueMores) ProjectKeys added in v0.22.0

func (ii IssueMores) ProjectKeys(sortAsc, dedupe bool) []string

type IssuePatchRequestBody added in v0.18.0

type IssuePatchRequestBody struct {
	Update *IssuePatchRequestBodyUpdate          `json:"update,omitempty"`
	Fields map[string]IssuePatchRequestBodyField `json:"fields,omitempty"`
}

IssuePatchRequestBody represents a API request body to patch an issue. The Jira API uses `PUT` however this struct and associated method use `Patch` to better align with API best practices for a partial update.

func NewIssuePatchRequestBodyCustomField added in v0.19.0

func NewIssuePatchRequestBodyCustomField(customFieldLabel, customFieldValue string) IssuePatchRequestBody

NewIssuePatchRequestBodyCustomField returns a body for patching the Jira issue with a custom field value.

func NewIssuePatchRequestBodyLabelAddRemove added in v0.19.0

func NewIssuePatchRequestBodyLabelAddRemove(label string, remove bool) IssuePatchRequestBody

NewIssuePatchRequestBodyLabelAddRemove returns a body for patching the Jira issue by adding or removing a label.

func (IssuePatchRequestBody) Validate added in v0.19.0

func (body IssuePatchRequestBody) Validate() error

Validate ensures that the `add` and `remove` propererties cannot both be set at the same time.

type IssuePatchRequestBodyField added in v0.19.0

type IssuePatchRequestBodyField struct {
	Value string                      `json:"value"`
	Child *IssuePatchRequestBodyField `json:"child,omitempty"`
}

FieldPatchRequestObject can be used IssuePatchRequestBody.Fields

type IssuePatchRequestBodyUpdate added in v0.19.0

type IssuePatchRequestBodyUpdate struct {
	Labels []IssuePatchRequestBodyUpdateLabel `json:"labels,omitempty"`
}

IssuePatchRequestBodyUpdate represntes the `labels` slice in the `update` property of an issue update request.

type IssuePatchRequestBodyUpdateLabel added in v0.19.0

type IssuePatchRequestBodyUpdateLabel struct {
	// cannot have both
	Add    *string `json:"add,omitempty"`
	Remove *string `json:"remove,omitempty"`
}

IssuePatchRequestBodyUpdateLabel represents a specific label operation in the `update` property of an issue update request.

type IssueService added in v0.19.0

type IssueService struct {
	Client *Client
}

func NewIssueService added in v0.19.0

func NewIssueService(client *Client) *IssueService

func (*IssueService) GetIssuesSetForKeys added in v0.19.0

func (svc *IssueService) GetIssuesSetForKeys(keys []string) (*IssuesSet, error)

Issues returns an `IssuesSet{}` given a set of keys. If no keys are provided, any empty slice is returned.

func (*IssueService) Issue added in v0.19.0

func (svc *IssueService) Issue(ctx context.Context, issueIDOrKey string, opts *GetQueryOptions) (*jira.Issue, error)

func (*IssueService) IssuePatch added in v0.19.0

func (svc *IssueService) IssuePatch(ctx context.Context, issueKeyOrID string, issueUpdateRequestBody IssuePatchRequestBody) (*http.Response, error)

IssuePatch updates fields for an issue. See more here: https://community.developer.atlassian.com/t/update-issue-custom-field-value-via-api-without-going-forge/71161

func (*IssueService) IssuePatchCustomFieldRecursive added in v0.19.0

func (svc *IssueService) IssuePatchCustomFieldRecursive(ctx context.Context, issueKeyOrID string, iss *jira.Issue, customFieldLabel, customFieldValue string, processChildren bool, processChildrenTypes []string, skipUpdate bool) (int, error)

IssuePatchCustomFieldRecursive updates an issue, and optionally child issues, with a custom field value.

func (*IssueService) IssuePatchLabelRecursive added in v0.19.0

func (svc *IssueService) IssuePatchLabelRecursive(ctx context.Context, issueKeyOrID string, iss *jira.Issue, label string, removeLabel, processChildren bool, processChildrenTypes []string, skipUpdate bool) (int, error)

IssuePatchLabelRecursive updates fields for an issue. See more here: https://community.developer.atlassian.com/t/update-issue-custom-field-value-via-api-without-going-forge/71161

func (*IssueService) Issues added in v0.19.0

func (svc *IssueService) Issues(ctx context.Context, keys []string, opts *GetQueryOptions) (Issues, error)

Issues returns a list of issues given a set of keys. If no keys are provided, any empty slice is returned. `skipNotFound` is useful if Jira ticket key no longer exists.

func (*IssueService) IssuesSetAddParents added in v0.19.0

func (svc *IssueService) IssuesSetAddParents(set *IssuesSet) error

func (*IssueService) JQLResultsTotalCount added in v0.23.0

func (svc *IssueService) JQLResultsTotalCount(jql string) (int, error)

func (*IssueService) JQLsAddMetadata added in v0.23.0

func (svc *IssueService) JQLsAddMetadata(jqls gojira.JQLs) (gojira.JQLs, error)

JQLsAddMetadata returns all issues for a JQL query, automatically handling API pagination.

func (*IssueService) JQLsReportMarkdownLines added in v0.23.0

func (svc *IssueService) JQLsReportMarkdownLines(jqls gojira.JQLs, opts *gojira.JQLsReportMarkdownOpts) ([]string, error)

JQLsReportMarkdownLines provides Markdownlines for a set of JQLs, including querying the number of results for each JQL via the Jira API.

func (*IssueService) SearchChildrenIssues added in v0.19.0

func (svc *IssueService) SearchChildrenIssues(parentKeys []string) (Issues, error)

func (*IssueService) SearchChildrenIssuesSet added in v0.19.0

func (svc *IssueService) SearchChildrenIssuesSet(ctx context.Context, parentKeys []string, opts *GetQueryOptions) (*IssuesSet, error)

func (*IssueService) SearchIssues added in v0.19.0

func (svc *IssueService) SearchIssues(jql string) (Issues, error)

SearchIssues returns all issues for a JQL query, automatically handling API pagination.

func (*IssueService) SearchIssuesByMonth added in v0.19.0

func (svc *IssueService) SearchIssuesByMonth(jql gojira.JQL, createdGTE, createdLT time.Time, fnExec func(ii Issues, start time.Time) error) error

func (*IssueService) SearchIssuesMulti added in v0.19.0

func (svc *IssueService) SearchIssuesMulti(jqls ...string) (Issues, error)

func (*IssueService) SearchIssuesPages added in v0.19.0

func (svc *IssueService) SearchIssuesPages(jql string, limit, offset, maxPages int) (Issues, error)

SearchIssuesPage returns all issues for a JQL query, automatically handling API pagination. A `limit` value of `0` means the max results available. A `maxPages` of `0` means to retrieve all pages.

func (*IssueService) SearchIssuesSet added in v0.19.0

func (svc *IssueService) SearchIssuesSet(jql string) (*IssuesSet, error)

func (*IssueService) SearchIssuesSetParents added in v0.19.0

func (svc *IssueService) SearchIssuesSetParents(set *IssuesSet) (*IssuesSet, error)

type Issues

type Issues []jira.Issue

func IssuesReadFileJSON added in v0.7.0

func IssuesReadFileJSON(filename string) (Issues, error)

func (Issues) AddRank added in v0.6.0

func (ii Issues) AddRank() Issues

func (Issues) CountsByProjectTypeStatus

func (ii Issues) CountsByProjectTypeStatus() *histogram.HistogramSets

CountsByProjectTypeStatus returns a `*histogram.Histogram` with issue counts by project, type, and status. This can be used to export CSV and XLSX sheets for analysis.

func (Issues) CountsByType

func (ii Issues) CountsByType() map[string]int

func (Issues) IssuesSet added in v0.6.0

func (ii Issues) IssuesSet(cfg *gojira.Config) (*IssuesSet, error)

IssuesSet converts the `Issues{}` to an `*IssuesSet{}`.

func (Issues) Keys added in v0.12.0

func (ii Issues) Keys() []string

Keys returns a slice of sorted issue keys.

func (Issues) KeysSplitVenn added in v0.25.3

func (ii Issues) KeysSplitVenn(keys []string) slicesutil.Venn2ResultOrdered[string]

func (Issues) Metas added in v0.9.0

func (ii Issues) Metas(baseURL string, customFieldLabels []string) IssueMetas

func (Issues) WriteFileJSON added in v0.7.0

func (ii Issues) WriteFileJSON(filename, prefix, indent string) error

WriteFileJSON outputs a JSON file that can be read in again.

type IssuesResponse

type IssuesResponse struct {
	Issues     Issues `json:"issues" structs:"issues"`
	Expand     string `json:"expand"`
	StartAt    int    `json:"startAt" structs:"startAt"`
	MaxResults int    `json:"maxResults" structs:"maxResults"`
	Total      int    `json:"total" structs:"total"`
}

IssuesResponse is only a small wrapper around the Search (with JQL) method to be able to parse the results

func IssuesResponseReadFile

func IssuesResponseReadFile(filename string) (*IssuesResponse, error)

func ParseIssuesResponseBytes

func ParseIssuesResponseBytes(b []byte) (*IssuesResponse, error)

func ParseIssuesResponseReader

func ParseIssuesResponseReader(r io.Reader) (*IssuesResponse, error)

type IssuesSet

type IssuesSet struct {
	Config    *gojira.Config
	IssuesMap map[string]jira.Issue
	Parents   *IssuesSet
}

func IssuesSetReadDirIssuesFiles added in v0.17.0

func IssuesSetReadDirIssuesFiles(filepaths []string) (*IssuesSet, error)

IssuesSetReadDirIssuesFiles reads a list of JSON issues files.

func IssuesSetReadFileJSON added in v0.9.0

func IssuesSetReadFileJSON(filename string) (*IssuesSet, error)

func NewIssuesSet

func NewIssuesSet(cfg *gojira.Config) *IssuesSet

func (*IssuesSet) Add

func (set *IssuesSet) Add(issues ...jira.Issue) error

func (*IssuesSet) AddIssuesFile added in v0.10.0

func (set *IssuesSet) AddIssuesFile(filename string) error

AddIssuesFile reads a `Issues{}` JSON file and adds it to the `IssuesSet{}`.

func (*IssuesSet) CountWithTypeFilter added in v0.14.0

func (set *IssuesSet) CountWithTypeFilter(inclTypeFilter []string) uint

func (*IssuesSet) Counts added in v0.6.0

func (set *IssuesSet) Counts() map[string]map[string]uint

Counts returns a `map[string]map[string]uint{}` where the first key is the category and the second is the category value.

func (*IssuesSet) CountsByCustomFieldValues added in v0.11.0

func (set *IssuesSet) CountsByCustomFieldValues(customField string) (map[string]uint, error)

CountsByCustomFieldValues returns a list of custom field value counts where `customField` is in the format `customfield_12345`.

func (*IssuesSet) CountsByMetaStage added in v0.14.0

func (set *IssuesSet) CountsByMetaStage(inclTypeFilter []string) map[string]uint

func (*IssuesSet) CountsByProject added in v0.7.0

func (set *IssuesSet) CountsByProject() map[string]uint

CountsByProject returns `map[string]uint` representing issue counts by project.

func (*IssuesSet) CountsByProjectAndMetaStage added in v0.16.0

func (set *IssuesSet) CountsByProjectAndMetaStage(inclTypeFilter []string) *histogram.HistogramSet

func (*IssuesSet) CountsByProjectKey added in v0.7.0

func (set *IssuesSet) CountsByProjectKey() map[string]uint

CountsByProjectKey returns `map[string]uint` representing issue counts by project key.

func (*IssuesSet) CountsByStatus added in v0.6.0

func (set *IssuesSet) CountsByStatus() map[string]uint

CountsByStatus returns `map[string]uint` representing issue counts by status.

func (*IssuesSet) CountsByTime added in v0.6.0

func (set *IssuesSet) CountsByTime() map[string]uint

func (*IssuesSet) CountsByType added in v0.6.0

func (set *IssuesSet) CountsByType(inclLeafs, inclParents bool) map[string]uint

func (*IssuesSet) CountsByWorkstream added in v0.14.0

func (set *IssuesSet) CountsByWorkstream(wsFuncMake WorkstreamFuncMake, inclTypeFilter []string) (map[string]uint, error)

func (*IssuesSet) EpicKeys

func (set *IssuesSet) EpicKeys(customFieldID string) []string

func (*IssuesSet) ExportWorkstreamFilter added in v0.20.0

func (set *IssuesSet) ExportWorkstreamFilter(wsFuncMake WorkstreamFuncMake, wsFuncIncl WorkstreamFuncIncl, customFieldLabels []string) (*IssuesSet, error)

func (*IssuesSet) ExportWorkstreamProjectkeyStatusTablePivot added in v0.12.0

func (set *IssuesSet) ExportWorkstreamProjectkeyStatusTablePivot(wsFuncMake WorkstreamFuncMake, wsFuncIncl WorkstreamFuncIncl, useStatusCategory bool) (*table.Table, error)

func (*IssuesSet) ExportWorkstreamTypeStatusTablePivot added in v0.12.0

func (set *IssuesSet) ExportWorkstreamTypeStatusTablePivot(wsFuncMake WorkstreamFuncMake, wsFuncIncl WorkstreamFuncIncl, useStatusCategory bool) (*table.Table, error)

func (*IssuesSet) ExportWorkstreamXfieldStatusHistogramSets added in v0.12.0

func (set *IssuesSet) ExportWorkstreamXfieldStatusHistogramSets(
	wsFuncMake WorkstreamFuncMake,
	wsFuncIncl WorkstreamFuncIncl,
	xfieldSlug string,
	useStatusCategory bool) (*histogram.HistogramSets, error)

func (*IssuesSet) ExportWorkstreamXfieldStatusTablePivot added in v0.12.0

func (set *IssuesSet) ExportWorkstreamXfieldStatusTablePivot(wsFuncMake WorkstreamFuncMake, wsFuncIncl WorkstreamFuncIncl, xfieldSlug, xfieldName string, useStatusCategory bool) (*table.Table, error)

func (*IssuesSet) FilterByStatus added in v0.6.0

func (set *IssuesSet) FilterByStatus(inclStatuses, exclStatuses []string) (*IssuesSet, error)

func (*IssuesSet) FilterByType added in v0.20.0

func (set *IssuesSet) FilterByType(inclTypes ...string) (*IssuesSet, error)

func (*IssuesSet) HistogramMap added in v0.11.0

func (set *IssuesSet) HistogramMap(stdKeys []string, calcFields []IssueCalcField) (*histogram.Histogram, error)

func (*IssuesSet) HistogramMapFunc added in v0.20.0

func (set *IssuesSet) HistogramMapFunc(fn func(iss *jira.Issue) (map[string]string, error)) (*histogram.Histogram, error)

HistogramMapFunc provides a `*histogram.Histogram` given a provided function. The function param corresponds to `FuncIssueToMap`.

func (*IssuesSet) HistogramMapProjectTypeStatus added in v0.11.0

func (set *IssuesSet) HistogramMapProjectTypeStatus() (*histogram.Histogram, error)

HistogramMapProjectTypeStatus provides issue counts by: Project, Type, and Status.

func (*IssuesSet) HistogramSet added in v0.25.3

func (set *IssuesSet) HistogramSet(fieldSlug1, fieldSlug2 string) *histogram.HistogramSet

HistogramSet provides a `*histogram.HistogramSets` given two histogram fields

func (*IssuesSet) HistogramSetFunc added in v0.20.0

func (set *IssuesSet) HistogramSetFunc(fn func(iss *jira.Issue) (cat1 string, cat2 string)) *histogram.HistogramSet

HistogramSetFunc provides a `*histogram.HistogramSet` given a provided function.

func (*IssuesSet) HistogramSetProjectType added in v0.9.0

func (set *IssuesSet) HistogramSetProjectType() *histogram.HistogramSet

HistogramSetProjectType returns a list of histograms by Project and Type.

func (*IssuesSet) HistogramSetsFunc added in v0.20.0

func (set *IssuesSet) HistogramSetsFunc(fn func(iss *jira.Issue) (cat1 string, cat2 string, cat3 string)) *histogram.HistogramSets

HistogramSetsFunc provides a `*histogram.HistogramSets` given a provided function.

func (*IssuesSet) HistogramSetsProjectTypeStatus added in v0.11.0

func (set *IssuesSet) HistogramSetsProjectTypeStatus() *histogram.HistogramSets

HistogramSetsProjectTypeStatus provides issue counts by: Project, Type, and Status.

func (*IssuesSet) InflateEpicKeys

func (set *IssuesSet) InflateEpicKeys(customFieldEpicLinkID string)

func (*IssuesSet) InflateEpics

func (set *IssuesSet) InflateEpics(jclient *jira.Client, customFieldIDEpicLink string) error

InflateEpics uses the Jira REST API to inflate the Issue struct with an Epic struct.

func (*IssuesSet) Issue added in v0.22.0

func (set *IssuesSet) Issue(key string) (jira.Issue, error)

Issue returns a `jira.Issue` given an issue key.

func (*IssuesSet) IssueFirst added in v0.12.0

func (set *IssuesSet) IssueFirst() (jira.Issue, error)

IssueFirst returns the first issue by alphabetical sorting of keys. It is primarily used for testing purposes to get an issue.

func (*IssuesSet) IssueMetas added in v0.9.0

func (set *IssuesSet) IssueMetas(customFieldLabels []string) IssueMetas

func (*IssuesSet) IssueMores added in v0.22.0

func (set *IssuesSet) IssueMores(keys ...string) IssueMores

func (*IssuesSet) IssueOrParent added in v0.10.0

func (set *IssuesSet) IssueOrParent(key string) (*jira.Issue, bool)

func (*IssuesSet) Issues

func (set *IssuesSet) Issues(keys ...string) Issues

Issues returns the issues in the set as an `Issues{}` slice.

func (*IssuesSet) IssuesSetHighestType added in v0.9.0

func (set *IssuesSet) IssuesSetHighestType(issueType string) (*IssuesSet, error)

func (*IssuesSet) KeyExists added in v0.12.0

func (set *IssuesSet) KeyExists(key string, inclParents bool) bool

KeyExists returns a boolean representing the existence of an issue key.

func (*IssuesSet) Keys added in v0.7.0

func (set *IssuesSet) Keys() []string

Keys returns a slice of sorted issue keys.

func (*IssuesSet) KeysByField added in v0.19.0

func (set *IssuesSet) KeysByField(fieldLabel string) map[string]SliceMore

func (*IssuesSet) KeysForTypes added in v0.12.0

func (set *IssuesSet) KeysForTypes(types []string, inclBase, inclParents bool) []string

func (*IssuesSet) KeysParents added in v0.10.0

func (set *IssuesSet) KeysParents() []string

func (*IssuesSet) KeysParentsPopulated added in v0.10.0

func (set *IssuesSet) KeysParentsPopulated() []string

ParentsPopulated returns issue ids that are in the current set or current parent set.

func (*IssuesSet) KeysParentsUnpopulated added in v0.10.0

func (set *IssuesSet) KeysParentsUnpopulated() []string

ParentsUnpopulated returns issue ids that are not in the current set or current parent set.

func (*IssuesSet) Len added in v0.10.0

func (set *IssuesSet) Len() int

func (*IssuesSet) LenLineageTopKeysPopulated added in v0.10.0

func (set *IssuesSet) LenLineageTopKeysPopulated() int

func (*IssuesSet) LenLineageTopKeysUnpopulated added in v0.10.0

func (set *IssuesSet) LenLineageTopKeysUnpopulated() int

func (*IssuesSet) LenMap added in v0.10.0

func (set *IssuesSet) LenMap() map[string]int

LenMap provides various metrics. It is useful for determining if all parents and lineages have been loaded.

func (*IssuesSet) LenParents added in v0.10.0

func (set *IssuesSet) LenParents() int

func (*IssuesSet) LenParentsPopulated added in v0.10.0

func (set *IssuesSet) LenParentsPopulated() int

func (*IssuesSet) LenParentsUnpopulated added in v0.10.0

func (set *IssuesSet) LenParentsUnpopulated() int

func (*IssuesSet) Lineage added in v0.7.0

func (set *IssuesSet) Lineage(key string, customFieldLabels []string) (IssueMetas, error)

Lineage returns a slice of `IssueMeta` where the supplied key is in index 0 and the most senior parent is the last element of the slice. If a parent is not found in the set, an error is returned.

func (*IssuesSet) LineageTopKeysPopulated added in v0.10.0

func (set *IssuesSet) LineageTopKeysPopulated() ([]string, error)

func (*IssuesSet) LineageTopKeysUnpopulated added in v0.10.0

func (set *IssuesSet) LineageTopKeysUnpopulated() ([]string, error)

func (*IssuesSet) LineageValidateKey added in v0.10.0

func (set *IssuesSet) LineageValidateKey(key string) ([]string, error)

LineageValidateKey returns a lineage slice where the leaf key is in index position 0 (little-endian). This is done in case a parent cannot be found in which case the boolean returned is false.

func (*IssuesSet) LineageValidateSet added in v0.10.0

func (set *IssuesSet) LineageValidateSet() (popLineage []string, unpopLineage []string, allValid bool)

func (*IssuesSet) RetrieveChildrenOfType added in v0.12.0

func (set *IssuesSet) RetrieveChildrenOfType(client *Client, parentTypes, baseTypes []string) error

RetrieveChildrenOfType retrieves all children of supplied parent types. If the child matches a base type, it is inserted into the current `IssuesSet`. If it is not a baseType, it is inserted into `Parents`. Of note, this will only load children of parent types that are already in the `IssuesSet`.

func (*IssuesSet) RetrieveIssues added in v0.7.0

func (set *IssuesSet) RetrieveIssues(client *Client, ids []string) error

func (*IssuesSet) RetrieveParents added in v0.7.0

func (set *IssuesSet) RetrieveParents(client *Client) error

func (*IssuesSet) StatusesOrder added in v0.13.0

func (set *IssuesSet) StatusesOrder() []string

StatusesOrder returns the status order from `StageConfig{}`.

func (*IssuesSet) Table

func (set *IssuesSet) Table(cols CustomTableCols) (*table.Table, error)

func (*IssuesSet) TableDefault added in v0.17.0

func (set *IssuesSet) TableDefault(customCols *CustomTableCols, inclEpic bool, initiativeType string, customFieldLabels []string) (*table.Table, error)

TableDefault returns a `table.Table` where each record is a Jira issue starting with a linked issue key.

func (*IssuesSet) TableSet added in v0.9.0

func (set *IssuesSet) TableSet(customCols *CustomTableCols, inclEpic bool, initiativeType string, customFieldLabels []string) (*table.TableSet, error)

TableSet is designed to return a `table.TableSet` where the tables include a list of issues and optionally, epics, and/or initiatives.

func (*IssuesSet) TableSetProjectTypeStatus added in v0.11.0

func (set *IssuesSet) TableSetProjectTypeStatus(tsConfig *histogram.HistogramMapTableSetConfig) (*table.TableSet, error)

func (*IssuesSet) TableSimple added in v0.17.0

func (set *IssuesSet) TableSimple(cols []string) (*table.Table, error)

func (*IssuesSet) TimeSeriesCreatedMonth added in v0.15.0

func (set *IssuesSet) TimeSeriesCreatedMonth() *timeseries.TimeSeries

TimeSeriesCreatedMonth provides issue counts by month by create date

func (*IssuesSet) TimeSeriesSetCreatedMonthByCustomField added in v0.17.0

func (set *IssuesSet) TimeSeriesSetCreatedMonthByCustomField(cumulative, inflate, popLast bool, monthsFilter []time.Month, customFieldID uint) (*timeseries.TimeSeriesSet, error)

TimeSeriesSetCreatedMonthByCustomField provides issue counts by custom field and month by create date. `customFieldID` is aunit for the integer part of `customfield_12345` or `cf[12345]`.

func (*IssuesSet) TimeSeriesSetCreatedMonthByKey added in v0.17.0

func (set *IssuesSet) TimeSeriesSetCreatedMonthByKey(cumulative, inflate, popLast bool, monthsFilter []time.Month, fnKey func(iss jira.Issue) (string, error)) (*timeseries.TimeSeriesSet, error)

TimeSeriesCreatedMonth provides issue counts by month by create date

func (*IssuesSet) TimeSeriesSetCreatedMonthByProject added in v0.17.0

func (set *IssuesSet) TimeSeriesSetCreatedMonthByProject(cumulative, inflate, popLast bool, monthsFilter []time.Month) (*timeseries.TimeSeriesSet, error)

TimeSeriesSetCreatedMonthByProject provides issue counts by project and month by create date

func (*IssuesSet) TimeSeriesSetCreatedMonthByResolution added in v0.17.0

func (set *IssuesSet) TimeSeriesSetCreatedMonthByResolution(cumulative, inflate, popLast bool, monthsFilter []time.Month) (*timeseries.TimeSeriesSet, error)

TimeSeriesSetCreatedMonthByResolution provides issue counts by resolution and month by create date

func (*IssuesSet) TimeSeriesSetCreatedMonthByStatus added in v0.17.0

func (set *IssuesSet) TimeSeriesSetCreatedMonthByStatus(cumulative, inflate, popLast bool, monthsFilter []time.Month) (*timeseries.TimeSeriesSet, error)

TimeSeriesSetCreatedMonthByStatus provides issue counts by status and month by create date

func (*IssuesSet) TimeStats

func (set *IssuesSet) TimeStats() gojira.TimeStats

func (*IssuesSet) Types added in v0.12.0

func (set *IssuesSet) Types(inclBase, inclParents bool) []string

func (*IssuesSet) WriteFileJSON added in v0.7.0

func (set *IssuesSet) WriteFileJSON(name, prefix, indent string) error

WriteFileJSON writes the `IssuesSet{}` as a JSON file.

type IssuesSets added in v0.20.0

type IssuesSets struct {
	Order []string
	Data  map[string]IssuesSet
}

func NewIssuesSets added in v0.20.0

func NewIssuesSets() *IssuesSets

func (*IssuesSets) OrderOrDefault added in v0.20.0

func (sets *IssuesSets) OrderOrDefault() []string

func (*IssuesSets) TableSet added in v0.20.0

func (sets *IssuesSets) TableSet(
	tblColsMapKeys []string,
	contColumnName string,
	fnIss func(iss *jira.Issue) (map[string]string, error),
	fnRowSort func(a, b []string) int,
) (*table.TableSet, error)

func (*IssuesSets) Upsert added in v0.20.0

func (sets *IssuesSets) Upsert(setName string, set *IssuesSet)

func (*IssuesSets) UpsertIssueKeys added in v0.20.0

func (sets *IssuesSets) UpsertIssueKeys(ctx context.Context, jrClient *Client, setName string, issueKeys []string) error

type SliceMore added in v0.19.0

type SliceMore struct {
	Count  int      `json:"count"`
	Values []string `json:"values"`
}

func (*SliceMore) Inflate added in v0.19.0

func (sm *SliceMore) Inflate()

type Status

type Status struct {
	Name        string
	Description string
}

func IssueStatuses

func IssueStatuses() []Status

type WorkstreamFuncIncl added in v0.12.0

type WorkstreamFuncIncl func(ws string) bool

type WorkstreamFuncMake added in v0.12.0

type WorkstreamFuncMake func(issueKey string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL