jira

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderType = domain.ProviderType("jira")

Variables

This section is empty.

Functions

func NewErr

func NewErr(statusCode int, systemCode, message, internal string, isFatal bool) domain.IError

func NewJIRAProvider

func NewJIRAProvider(httpClient *http.Client) provider.Provider

Types

type AccessibleResourcesRequest

type AccessibleResourcesRequest struct {
	BearerToken string
}

type AccessibleResourcesResponse

type AccessibleResourcesResponse []Site

type Client

type Client struct {
	HTTPClient provider.IHTTPClient
}

func (*Client) CreateIssue

func (c *Client) CreateIssue(request *CreateIssueRequest) (*CreateIssueResponse, domain.IError)

func (*Client) GetAccessibleResources

func (c *Client) GetAccessibleResources(request *AccessibleResourcesRequest) (*AccessibleResourcesResponse, domain.IError)

func (*Client) GetIssueTypes

func (c *Client) GetIssueTypes(request *GetIssueTypesRequest) (*GetIssueTypesResponse, domain.IError)

func (*Client) GetProjects

func (c *Client) GetProjects(request *GetProjectsRequest) ([]Project, domain.IError)

type CreateIssueRequest

type CreateIssueRequest struct {
	Fields      Fields `json:"fields"`
	CloudID     string `json:"-"`
	BearerToken string `json:"-"`
}

type CreateIssueResponse

type CreateIssueResponse struct {
	ID   string `json:"id"`
	Key  string `json:"key"`
	Self string `json:"self"`
}

type Fields

type Fields struct {
	Project struct {
		Key string `json:"key"`
	} `json:"project"`
	IssueType struct {
		ID string `json:"id"`
	} `json:"issuetype"`
	Summary     string                 `json:"summary"`
	Description map[string]interface{} `json:"description"`
}

type GetIssueTypesRequest

type GetIssueTypesRequest struct {
	BearerToken string
	CloudID     string
}

type GetIssueTypesResponse

type GetIssueTypesResponse []IssueType

type GetProjectsRequest

type GetProjectsRequest struct {
	BearerToken string
	CloudID     string
}

type GetProjectsResponse

type GetProjectsResponse struct {
	Self       string    `json:"self"`
	MaxResults int       `json:"maxResults"`
	NextPage   string    `json:"nextPage"`
	StartAt    int       `json:"startAt"`
	Total      int       `json:"total"`
	IsLast     bool      `json:"isLast"`
	Values     []Project `json:"values"`
}

type IssueType

type IssueType struct {
	Self             string `json:"self"`
	ID               string `json:"id"`
	Description      string `json:"description"`
	IconURL          string `json:"iconUrl"`
	Name             string `json:"name"`
	UntranslatedName string `json:"untranslatedName"`
	Subtask          bool   `json:"subtask"`
	AvatarID         int    `json:"avatarId,omitempty"`
	HierarchyLevel   int    `json:"hierarchyLevel"`
}

type OptValueResponse

type OptValueResponse struct {
	CloudID string `json:"cloud_id"`
	Rel     Rel    `json:"_rel"`
}

type Opts

type Opts struct {
	Secret     *domain.NotifierSecret
	ProjectKey string `mapstructure:"project_key"`
	IssueType  string `mapstructure:"issue_type"`
	CloudID    string `mapstructure:"cloud_id"`
}

Opts defines JIRA specific options.

func (*Opts) Extract

func (*Opts) Validate

func (o *Opts) Validate() domain.IError

Validate validates the notifier configuration and returns JIRA specific opts.

type Payload

type Payload struct {
	Summary     string                 `json:"summary"`
	Description map[string]interface{} `json:"description"`
}

Payload defines the primary content payload for the JIRA provider.

func (*Payload) Extract

func (p *Payload) Extract(body []byte) domain.IError

Extract unmarshals body to JIRA payload.

func (*Payload) Validate

func (p *Payload) Validate() domain.IError

Validate() validates the payload ensuring all mandatory properties are set. Description should ideally be validated agaings JDF (Jira Document Format)

type Project

type Project struct {
	Expand     string `json:"expand"`
	Self       string `json:"self"`
	ID         string `json:"id"`
	Key        string `json:"key"`
	Name       string `json:"name"`
	AvatarUrls struct {
		Four8X48  string `json:"48x48"`
		Two4X24   string `json:"24x24"`
		One6X16   string `json:"16x16"`
		Three2X32 string `json:"32x32"`
	} `json:"avatarUrls"`
	ProjectTypeKey string   `json:"projectTypeKey"`
	Simplified     bool     `json:"simplified"`
	Style          string   `json:"style"`
	IsPrivate      bool     `json:"isPrivate"`
	Properties     struct{} `json:"properties"`
}

type Rel

type Rel struct {
	sync.Mutex
	Data map[string]*RelValue
}

type RelValue

type RelValue struct {
	ProjectKeys Values `json:"project_key"`
	IssueTypes  Values `json:"issue_type"`
}

type Site

type Site struct {
	ID        string   `json:"id"`
	URL       string   `json:"url"`
	Name      string   `json:"name"`
	Scopes    []string `json:"scopes"`
	AvatarURL string   `json:"avatarUrl"`
}

type Value

type Value struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Values

type Values []Value

Jump to

Keyboard shortcuts

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