jira

package module
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

README

Build Status GoDoc License

Table of Contents

go-jira

simple command line client for Atlassian's Jira service written in Go

Install

Download

You can download one of the pre-built binaries for go-jira here.

Build

You can build and install with Go:

go get gopkg.in/Netflix-Skunkworks/go-jira.v1/cmd/jira

v1 vs v0 changes

Golang library import

For the new version of go-jira you should use:

import "gopkg.in/Netflix-Skunkworks/go-jira.v1"

If you have code that depends on the old apis, you can still use them with this import:

import "gopkg.in/Netflix-Skunkworks/go-jira.v0"
Configs per command

Instead of requiring a exectuable template to get configs for a given command now you can create a config to be applied to a command. So if you want to use template: table by default for yor jira list you can now do:

$ cat $HOME/.jira.d/list.yml
template: table

Where previously you needed something like:

# cat $HOME/.jira.d/config.yml
#!/bin/sh
case $JIRA_OPERATION in 
    list)
      echo "template: table";;
esac
Custom Commands

Now you can create your own custom commands to do common operations with jira. Please see the details Custom Commands section below for more details. If you want to create a command jira mine that lists all the issues assigned to you now you can modify your .jira.d/config.yml file to add a custom-commands section like this:

custom-commands:
  - name: mine
    help: display issues assigned to me
    script: |-
      {{jira}} list --query "resolution = unresolved and assignee=currentuser() ORDER BY created"

Then the next time you run jira help you will see your usage:

$ jira mine --help
usage: jira mine

display issues assigned to me

Flags:
      --help                 Show context-sensitive help (also try --help-long and --help-man).
  -v, --verbose ...          Increase verbosity for debugging
  -e, --endpoint=ENDPOINT    Base URI to use for Jira
  -u, --user=USER            Login name used for authentication with Jira service
      --unixproxy=UNIXPROXY  Path for a unix-socket proxy
  -k, --insecure             Disable TLS certificate verification
Incompatible command changes

Unfortunately during the rewrite between v0 and v1 there were some changes necessary that broke backwards compatibility with existing commands. Specifically the dups, blocks, add worklog and add|remove|set labels commands have had the command word swapped around:

  • jira DUPLICATE dups ISSUE => jira dup DUPLICATE ISSUE
  • jira BLOCKER blocks ISSUE => jira block BLOCKER ISSUE
  • jira add worklog => jira worklog add
  • jira add labels => jira labels add
  • jira remove labels => jira labels remove
  • jira set labels => jira labels set
Login process change

Previously jira used attempt to get a JSESSION cookies by authenticating with the webservice standard GUI login process. This has been especially problematic as users need to authenticate with various credential providers (google auth, etc). We now attempt to authenticate via the session login api. This may be problematic for users if admins have locked down the session-login api, so we might have to bring back the error-prone Basic-Auth approach. For users that are unable to authenticate via jira hopefully someone in your organization can provide me with details on a process for you to authenticate and we can try to update jira.

Configuration

go-jira uses a configuration hierarchy. When loading the configuration from disk it will recursively look through all parent directories in your current path looking for a .jira.d directory. If your current directory is not a child directory of your homedir, then your homedir will also be inspected for a .jira.d directory. From all of .jira.d directories discovered go-jira will load a <command>.yml file (ie for jira list it will load .jira.d/list.yml) then it will merge in any properties from the config.yml if found. The configuration properties found in a file closests to your current working directory will have precedence. Properties overriden with command line options will have final precedence.

The complicated configuration hierarchy is used because go-jira attempts to be context aware. For example, if you are working on a "foo" project and you cd into your project workspace, wouldn't it be nice if jira ls automatically knew to list only issues related to the "foo" project? Likewise when you cd to the "bar" project then jira ls should only list issues related to "bar" project. You can do this with by creating a configuration under your project workspace at ./.jira.d/config.yml that looks like:

project: foo

You will need to specify your local jira endpoint first, typically in your homedir like:

mkdir ~/.jira.d

cat <<EOM >~/.jira.d/config.yml
endpoint: https://jira.mycompany.com
EOM

Then use jira login to authenticate yourself as $USER. To change your username, use the -u CLI flag or set user: in your config.yml

Dynamic Configuration

If the .jira.d/config.yml file is executable, then go-jira will attempt to execute the file and use the stdout for configuration. You can use this to customize templates or other overrides depending on what type of operation you are running. For example if you would like to use the "table" template when ever you run jira ls, then you can create a template like this:

#!/bin/sh

echo "endpoint: https://jira.mycompany.com"
echo "editor: emacs -nw"

case $JIRA_OPERATION in 
    list)
      echo "template: table";;
esac

Or if you always set the same overrides when you create an issue for your project you can do something like this:

#!/bin/sh
echo "project: GOJIRA"

case $JIRA_OPERATION in
    create)
        echo "assignee: $USER"
        echo "watchers: mothra"
        ;;
esac

Custom Commands

You can now create custom commands for jira just by editing your .jira.d/config.yml config file. These commands are effectively shell-scripts that can have documented options and arguments. The basic format is like:

custom-commands:
  - command1
  - command2
Commands

Where the individual commands are maps with these keys:

  • name: string [required] This is the command name, so for jira foobar you would have name: foobar
  • help: string This is help message displayed in the usage for the command
  • hidden: bool This command will be hidden from users, but still executable. Sometimes useful for constructing complex commands where one custom command might call another.
  • default: bool Use this for compound command groups. If you wanted to have jira foo bar and jira foo baz you would have two commands with name: foo bar and name: foo baz. Then if you wanted jira foo baz to be called by default when you type jira foo you would set default: true for that custom command.
  • options: list This is the list of possible option flags that the command will accept
  • args: list This is the list of command arguments (like the ISSUE) that the command will accept.
  • aliases: string list: This is a list of alternate names that the user can provide on the command line to run the same command. Typically used to shorten the command name or provide alternatives that users might expect.
  • script: string [required] This is the script that will be executed as the action for this command. The value will be treated as a template and substitutions for options and arguments will be made before executing.
Options

These are possible keys under the command options property:

  • name: string [required] Name of the option, so name: foobar will result in --foobar option.
  • help: string The help messsage displayed in usage for the option.
  • type: string: The type of the option, can be one of these values: BOOL, COUNTER, ENUM, FLOAT32, FLOAT64, INT8, INT16, INT32, INT64, INT, STRING, STRINGMAP, UINT8, UINT16, UINT32, UINT64 and UINT. Most of these are primitive data types an should be self-explanitory. The default type is STRING. There are some special types:
    • COUNTER will be an integer type that increments each time the option is used. So something like --count --count will results in {{options.count}} of 2.
    • ENUM type is used with the enum property. The raw type is a string and must be one of the values listed in the enum property.
    • STRINGMAP is a string => string map with the format of KEY=VALUE. So --override foo=bar --override bin=baz will allow for {{options.override.foo}} to be bar and {{options.override.bin}} to be baz.
  • short: char The single character option to be used so short: c will allow for -c.
  • required: bool Indicate that this option must be provided on the command line. Conflicts with the default property.
  • default: any Specify the default value for the option. Conflicts with the required property.
  • hidden: bool Hide the option from the usage help message, but otherwise works fine. Sometimes useful for developer options that user should not play with.
  • repeat: bool Indicate that this option can be repeated. Not applicable for COUNTER and STRINGMAP types. This will turn the option value into an array that you can iterate over. So --day Monday --day Thursday can be used like {{range options.day}}Day: {{.}}{{end}}
  • enum: string list Used with the type: ENUM property, it is a list of strings values that represent the set of possible values the option accepts.
Arguments

These are possible keys under the command args property:

  • name: string [required] Name of the option, so name: ISSUE will show in the usasge as jira <command> ISSUE. This also represents the name of the argument to be used in the script template, so {{args.ISSUE}}.
  • help: string The help messsage displayed in usage for the argument.
  • type: string: The type of the argumemnt, can be one of these values: BOOL, COUNTER, ENUM, FLOAT32, FLOAT64, INT8, INT16, INT32, INT64, INT, STRING, STRINGMAP, UINT8, UINT16, UINT32, UINT64 and UINT. Most of these are primitive data types an should be self-explanitory. The default type is STRING. There are some special types:
    • COUNTER will be an integer type that increments each the argument is provided So something like jira <command> ISSUE-12 ISSUE-23 will results in {{args.ISSUE}} of 2.
    • ENUM type is used with the enum property. The raw type is a string and must be one of the values listed in the enum property.
    • STRINGMAP is a string => string map with the format of KEY=VALUE. So jira <command> foo=bar bin=baz along with a name: OVERRIDE property will allow for {{args.OVERRIDE.foo}} to be bar and {{args.OVERRIDE.bin}} to be baz.
  • required: bool Indicate that this argument must be provided on the command line. Conflicts with the default property.
  • default: any Specify the default value for the argument. Conflicts with the required property.
  • repeat: bool Indicate that this argument can be repeated. Not applicable for COUNTER and STRINGMAP types. This will turn the template value into an array that you can iterate over. So jira <command> ISSUE-12 ISSUE-23 can be used like {{range args.ISSUE}}Issue: {{.}}{{end}}
  • enum: string list Used with the type: ENUM property, it is a list of strings values that represent the set of possible values for the argument.
Script Template

The script property is a template that whould produce /bin/sh compatible syntax after the template has been processed. There are 2 key template functions {{args}} and {{options}} that return the parsed arguments and option flags as a map.

To demonstrate how you might use args and options here is a custom-test command:

custom-commands:
  - name: custom-test
    help: Testing the custom commands
    options:
      - name: abc
        short: a
        default: default
      - name: day
        type: ENUM
        enum:
          - Monday
          - Tuesday
          - Wednesday
          - Thursday
          - Friday
        required: true
    args:
      - name: ARG
        required: true
      - name: MORE
        repeat: true
    script: |
      echo COMMAND {{args.ARG}} --abc {{options.abc}} --day {{options.day}} {{range $more := args.MORE}}{{$more}} {{end}}

Then to run it:

$ jira custom-test
ERROR Invalid Usage: required flag --day not provided

$ jira custom-test --day Sunday
ERROR Invalid Usage: enum value must be one of Monday,Tuesday,Wednesday,Thursday,Friday, got 'Sunday'

$ jira custom-test --day Tuesday
ERROR Invalid Usage: required argument 'ARG' not provided

$ jira custom-test --day Tuesday arg1
COMMAND arg1 --abc default --day Tuesday

$ jira custom-test --day Tuesday arg1 more1 more2 more3
COMMAND arg1 --abc default --day Tuesday more1 more2 more3

$ jira custom-test --day Tuesday arg1 more1 more2 more3 --abc non-default
COMMAND arg1 --abc non-default --day Tuesday more1 more2 more3

$ jira custom-test --day Tuesday arg1 more1 more2 more3 -a short-non-default
COMMAND arg1 --abc short-non-default --day Tuesday more1 more2 more3

The script has access to all the environment variables that are in your current environment plus those that jira will set. jira sets environment variables for each config property it has parsed from .jira.d/config.yml or the command configs at .jira.d/<command>.yml. It might be useful to see all environment variables that jira is producing, so here is a simple custom command to list them:

custom-commands:
  - name: env
    help: print the JIRA environment variables available to custom commands
    script: |
      env | grep JIRA

You could use the environment variables automatically, so if your .jira.d/config.yml looks something like this:

project: PROJECT
custom-commands:
  - name: print-project
    help: print the name of the configured project
    script: "echo $JIRA_PROJECT"
Examples
  • jira mine for listing issues assigned to you
custom-commands:
  - name: mine
    help: display issues assigned to me
    script: |-
      if [ -n "$JIRA_PROJECT" ]; then
          # if `project: ...` configured just list the issues for current project
          {{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() and project = $JIRA_PROJECT ORDER BY priority asc, created"
      else
          # otherwise list issues for all project
          {{jira}} list --template table --query "resolution = unresolved and assignee=currentuser() ORDER BY priority asc, created"
      fi
  • jira sprint for listing issues in your current sprint
custom-commands:
  - name: sprint
    help: display issues for active sprint
    script: |-
      if [ -n "$JIRA_PROJECT" ]; then
          # if `project: ...` configured just list the issues for current project
          {{jira}} list --template table --query "sprint in openSprints() and type != epic and resolution = unresolved and project=$JIRA_PROJECT ORDER BY rank asc, created"
      else
          # otherwise list issues for all project
          echo "\"project: ...\" configuration missing from .jira.d/config.yml"
      fi

Editing

When you run command like jira edit it will open up your favorite editor with the templatized output so you can quickly edit. When the editor closes go-jira will submit the completed form. The order which go-jira attempts to determine your prefered editor is:

  • editor property in any config.yml file
  • JIRA_EDITOR environment variable
  • EDITOR environment variable
  • vim

Templates

go-jira has the ability to customize most output (and editor input) via templates. There are default templates available for all operations, which may or may not work for your actual jira implementation. Jira is endlessly customizable, so it is hard to provide default templates that will work for all issue types.

When running a command like jira edit it will look through the current directory hierarchy trying to find a file that matches .jira.d/templates/edit, if found it will use that file as the template, otherwise it will use the default edit template hard-coded into go-jira. You can export the default hard-coded templates with jira export-templates which will write them to ~/.jira.d/templates/.

Writing/Editing Templates

First the basic templating functionality is defined by the Go language 'text/template' library. The library reference documentation can be found here, and there is a good primer document here. go-jira also provides a few extra helper functions to make it a bit easlier to format the data, those functions are defined here.

Knowing what data and fields are available to any given template is not obvious. The easiest approach to determine what is available is to use the debug template on any given operation. For eample to find out what is available to the "view" templates, you can use:

jira view GOJIRA-321 -t debug

This will print out the data in JSON format that is available to the template. You can do this for any other operation, like "list":

jira list -t debug

Authentication

By default go-jira will prompt for a password automatically when get a response header from the Jira service that indicates you do not have an active session (ie the X-Ausername header is set to anonymous). Then after authentication we cache the cloud.session.token cookie returned by the service session login api and reuse that on subsequent requests. Typically this cookie will be valid for several hours (depending on the service configuration). To automatically securely store your password for easy reuse by jira You can enable a password-source via .jira.d/config.yml with possible values of keyring or pass.

keyring password source

On OSX and Linux there are a few keyring providers that go-jira can use (via this golang module). To integrate go-jira with a supported keyring just add this configuration to $HOME/.jira.d/config.yml:

password-source: keyring

After setting this and issuing a jira login, your credentials will be stored in your platform's backend (e.g. Keychain for Mac OS X) automatically. Subsequent operations, like a jira ls, should automatically login.

pass password source

An alternative to the keyring password source is the pass tool (documentation here). This uses gpg to encrypt/decrypt passwords on demand and by using gpg-agent you can cache the gpg credentials for a period of time so you will not be prompted repeatedly for decrypting the passwords. The advantage over the keyring integration is that pass can be used on more platforms than OSX and Linux, although it does require more setup. To use pass for password storage and retrieval via go-jira just add this configuration to $HOME/.jira.d/config.yml:

password-source: pass

This assumes you have already setup pass correctly on your system. Specifically you will need to have created a gpg key like this:

$ gpg --gen-key

Then you will need the GPG Key ID you want associated with pass. First list the available keys:

$ gpg --list-keys
/home/gojira/.gnupg/pubring.gpg
-------------------------------------------------
pub   2048R/A307D709 2016-12-18
uid                  Go Jira <gojira@example.com>
sub   2048R/F9A047B8 2016-12-18

Then initialize the pass tool to use the correct key:

$ pass init "Go Jira <gojira@example.com>"

You probably want to setup gpg-agent so that you dont have to type in your gpg passphrase all the time. You can get gpg-agent to automatically start by adding something like this to your $HOME/.bashrc

if [ -f $HOME/.gpg-agent-info ]; then
    . $HOME/.gpg-agent-info
    export GPG_AGENT_INFO
fi

if [ ! -f $HOME/.gpg-agent.conf ]; then
  cat <<EOM >$HOME/.gpg-agent.conf
default-cache-ttl 604800
max-cache-ttl 604800
default-cache-ttl-ssh 604800
max-cache-ttl-ssh 604800
EOM
fi

if [ -n "${GPG_AGENT_INFO}" ]; then
    nc  -U "${GPG_AGENT_INFO%%:*}" >/dev/null </dev/null
    if [ ! -S "${GPG_AGENT_INFO%%:*}" -o $? != 0 ]; then
        # set passphrase cache so I only have to type my passphrase once a day
        eval $(gpg-agent --options $HOME/.gpg-agent.conf --daemon --write-env-file $HOME/.gpg-agent-info --use-standard-socket --log-file $HOME/tmp/gpg-agent.log --verbose)
    fi
fi
export GPG_TTY=$(tty)

Usage

usage: jira [<flags>] <command> [<args> ...]

Jira Command Line Interface

Global flags:
      --help                   Show context-sensitive help (also try --help-long and --help-man).
  -v, --verbose ...            Increase verbosity for debugging
  -e, --endpoint=ENDPOINT      Base URI to use for Jira
  -k, --insecure               Disable TLS certificate verification
  -Q, --quiet                  Suppress output to console
      --unixproxy=UNIXPROXY    Path for a unix-socket proxy
      --socksproxy=SOCKSPROXY  Address for a socks proxy
  -u, --user=USER              Login name used for authentication with Jira service

Commands:
  help:                Show help.
  version:             Prints version
  acknowledge:         Transition issue to acknowledge state
  assign:              Assign user to issue
  attach create:       Attach file to issue
  attach get:          Fetch attachment
  attach list:         Prints attachment details for issue
  attach remove:       Delete attachment
  backlog:             Transition issue to Backlog state
  block:               Mark issues as blocker
  browse:              Open issue in browser
  close:               Transition issue to close state
  comment:             Add comment to issue
  component add:       Add component
  components:          Show components for a project
  create:              Create issue
  createmeta:          View 'create' metadata
  done:                Transition issue to Done state
  dup:                 Mark issues as duplicate
  edit:                Edit issue details
  editmeta:            View 'edit' metadata
  epic add:            Add issues to Epic
  epic create:         Create Epic
  epic list:           Prints list of issues for an epic with optional search criteria
  epic remove:         Remove issues from Epic
  export-templates:    Export templates for customizations
  fields:              Prints all fields, both System and Custom
  in-progress:         Transition issue to Progress state
  issuelink:           Link two issues
  issuelinktypes:      Show the issue link types
  issuetypes:          Show issue types for a project
  labels add:          Add labels to an issue
  labels remove:       Remove labels from an issue
  labels set:          Set labels on an issue
  list:                Prints list of issues for given search criteria
  login:               Attempt to login into jira server
  logout:              Deactivate session with Jira server
  rank:                Mark issues as blocker
  reopen:              Transition issue to reopen state
  request:             Open issue in requestr
  resolve:             Transition issue to resolve state
  start:               Transition issue to start state
  stop:                Transition issue to stop state
  subtask:             Subtask issue
  take:                Assign issue to yourself
  todo:                Transition issue to To Do state
  transition:          Transition issue to given state
  transitions:         List valid issue transitions
  transmeta:           List valid issue transitions
  unassign:            Unassign an issue
  unexport-templates:  Remove unmodified exported templates
  view:                Prints issue details
  vote:                Vote up/down an issue
  watch:               Add/Remove watcher to issue
  worklog add:         Add a worklog to an issue
  worklog list:        Prints the worklog data for given issue

Documentation

Index

Constants

View Source
const VERSION = "1.0.14"

Variables

This section is empty.

Functions

func AddIssueWorklog

func AddIssueWorklog(ua HttpClient, endpoint string, issue string, wp WorklogProvider) (*jiradata.Worklog, error)

func CreateComponent

func CreateComponent(ua HttpClient, endpoint string, cp ComponentProvider) (*jiradata.Component, error)

func CreateIssue

func CreateIssue(ua HttpClient, endpoint string, iup IssueUpdateProvider) (*jiradata.IssueCreateResponse, error)

func DeleteSession

func DeleteSession(ua HttpClient, endpoint string) error

func EditIssue

func EditIssue(ua HttpClient, endpoint string, issue string, iup IssueUpdateProvider) error

func EpicAddIssues added in v1.0.7

func EpicAddIssues(ua HttpClient, endpoint string, epic string, eip EpicIssuesProvider) error

func EpicRemoveIssues added in v1.0.7

func EpicRemoveIssues(ua HttpClient, endpoint string, eip EpicIssuesProvider) error

func EpicSearch added in v1.0.7

func EpicSearch(ua HttpClient, endpoint string, epic string, sp SearchProvider) (*jiradata.SearchResults, error)

func GetAttachment added in v1.0.8

func GetAttachment(ua HttpClient, endpoint string, id string) (*jiradata.Attachment, error)

func GetFields

func GetFields(ua HttpClient, endpoint string) ([]jiradata.Field, error)

func GetIssue

func GetIssue(ua HttpClient, endpoint string, issue string, iqg IssueQueryProvider) (*jiradata.Issue, error)

func GetIssueCreateMetaIssueType

func GetIssueCreateMetaIssueType(ua HttpClient, endpoint string, projectKey, issueTypeName string) (*jiradata.IssueType, error)

func GetIssueCreateMetaProject

func GetIssueCreateMetaProject(ua HttpClient, endpoint string, projectKey string) (*jiradata.CreateMetaProject, error)

func GetIssueEditMeta

func GetIssueEditMeta(ua HttpClient, endpoint string, issue string) (*jiradata.EditMeta, error)

func GetIssueLinkTypes

func GetIssueLinkTypes(ua HttpClient, endpoint string) (*jiradata.IssueLinkTypes, error)

func GetIssueTransitions

func GetIssueTransitions(ua HttpClient, endpoint string, issue string) (*jiradata.TransitionsMeta, error)

func GetProjectComponents

func GetProjectComponents(ua HttpClient, endpoint string, project string) (*jiradata.Components, error)

func GetSession

func GetSession(ua HttpClient, endpoint string) (*jiradata.CurrentUser, error)

func IssueAddComment

func IssueAddComment(ua HttpClient, endpoint string, issue string, cp CommentProvider) (*jiradata.Comment, error)

func IssueAddVote

func IssueAddVote(ua HttpClient, endpoint string, issue string) error

func IssueAddWatcher

func IssueAddWatcher(ua HttpClient, endpoint string, issue, user string) error

func IssueAssign

func IssueAssign(ua HttpClient, endpoint string, issue, name string) error

func IssueAttachFile added in v1.0.8

func IssueAttachFile(ua HttpClient, endpoint string, issue, filename string, contents io.Reader) (*jiradata.ListOfAttachment, error)

func IssueRemoveVote

func IssueRemoveVote(ua HttpClient, endpoint string, issue string) error

func IssueRemoveWatcher

func IssueRemoveWatcher(ua HttpClient, endpoint string, issue, user string) error

func LinkIssues

func LinkIssues(ua HttpClient, endpoint string, lip LinkIssueProvider) error

func NewSession

func NewSession(ua HttpClient, endpoint string, ap AuthProvider) (*jiradata.AuthSuccess, error)

func RankIssues

func RankIssues(ua HttpClient, endpoint string, rrp RankRequestProvider) error

func RemoveAttachment added in v1.0.8

func RemoveAttachment(ua HttpClient, endpoint string, id string) error
func Search(ua HttpClient, endpoint string, sp SearchProvider) (*jiradata.SearchResults, error)

func TransitionIssue

func TransitionIssue(ua HttpClient, endpoint string, issue string, iup IssueUpdateProvider) error

Types

type AuthOptions

type AuthOptions struct {
	Username string
	Password string
}

func (*AuthOptions) AuthParams

func (a *AuthOptions) AuthParams() *jiradata.AuthParams

type AuthProvider

type AuthProvider interface {
	ProvideAuthParams() *jiradata.AuthParams
}

type CommentProvider

type CommentProvider interface {
	ProvideComment() *jiradata.Comment
}

type ComponentProvider

type ComponentProvider interface {
	ProvideComponent() *jiradata.Component
}

type EpicIssuesProvider added in v1.0.7

type EpicIssuesProvider interface {
	ProvideEpicIssues() *jiradata.EpicIssues
}

type HttpClient

type HttpClient interface {
	Delete(url string) (*http.Response, error)
	Do(*http.Request) (*http.Response, error)
	GetJSON(url string) (*http.Response, error)
	Post(url, bodyType string, body io.Reader) (*http.Response, error)
	Put(url, bodyType string, body io.Reader) (*http.Response, error)
}

type IssueOptions

type IssueOptions struct {
	Fields        []string `json:"fields,omitempty" yaml:"fields,omitempty"`
	Expand        []string `json:"expand,omitempty" yaml:"expand,omitempty"`
	Properties    []string `json:"properties,omitempty" yaml:"properties,omitempty"`
	FieldsByKeys  bool     `json:"fieldsByKeys,omitempty" yaml:"fieldsByKeys,omitempty"`
	UpdateHistory bool     `json:"updateHistory,omitempty" yaml:"updateHistory,omitempty"`
}

func (*IssueOptions) ProvideIssueQueryString

func (o *IssueOptions) ProvideIssueQueryString() string

type IssueQueryProvider

type IssueQueryProvider interface {
	ProvideIssueQueryString() string
}

type IssueUpdateProvider

type IssueUpdateProvider interface {
	ProvideIssueUpdate() *jiradata.IssueUpdate
}

type Jira

type Jira struct {
	Endpoint string     `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
	UA       HttpClient `json:"-" yaml:"-"`
}

func NewJira

func NewJira(endpoint string) *Jira

func (*Jira) GetIssueCreateMetaIssueType

func (j *Jira) GetIssueCreateMetaIssueType(projectKey, issueTypeName string) (*jiradata.IssueType, error)

https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-getCreateIssueMeta

func (*Jira) GetIssueWorklog

func (j *Jira) GetIssueWorklog(issue string) (*jiradata.Worklogs, error)

type LinkIssueProvider

type LinkIssueProvider interface {
	ProvideLinkIssueRequest() *jiradata.LinkIssueRequest
}

type RankRequestProvider

type RankRequestProvider interface {
	ProvideRankRequest() *jiradata.RankRequest
}

type SearchOptions

type SearchOptions struct {
	Assignee    string `yaml:"assignee,omitempty" json:"assignee,omitempty"`
	Query       string `yaml:"query,omitempty" json:"query,omitempty"`
	QueryFields string `yaml:"query-fields,omitempty" json:"query-fields,omitempty"`
	Project     string `yaml:"project,omitempty" json:"project,omitempty"`
	Component   string `yaml:"component,omitempty" json:"component,omitempty"`
	IssueType   string `yaml:"issue-type,omitempty" json:"issue-type,omitempty"`
	Watcher     string `yaml:"watcher,omitempty" json:"watcher,omitempty"`
	Reporter    string `yaml:"reporter,omitempty" json:"reporter,omitempty"`
	Status      string `yaml:"status,omitempty" json:"status,omitempty"`
	Sort        string `yaml:"sort,omitempty" json:"sort,omitempty"`
	MaxResults  int    `yaml:"max-results,omitempty" json:"max-results,omitempty"`
}

func (*SearchOptions) ProvideSearchRequest

func (o *SearchOptions) ProvideSearchRequest() *jiradata.SearchRequest

type SearchProvider

type SearchProvider interface {
	ProvideSearchRequest() *jiradata.SearchRequest
}

type UserProvider

type UserProvider interface {
	ProvideUser() *jiradata.User
}

type WorklogProvider

type WorklogProvider interface {
	ProvideWorklog() *jiradata.Worklog
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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