jira

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: BSD-2-Clause Imports: 12 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) GetProjects

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

type CloudIDInfo added in v1.1.0

type CloudIDInfo struct {
	ProjectKey []Value `json:"project_key" mapstructure:"project_key"`
}

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"`
	Reporter    *Reporter              `json:"reporter,omitempty"`
	Summary     string                 `json:"summary"`
	Description map[string]interface{} `json:"description"`
}

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"`
	Subtask        bool   `json:"subtask"`
	AvatarID       int    `json:"avatarId,omitempty"`
	HierarchyLevel int    `json:"hierarchyLevel"`
}

type OptValueResponse

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

type Opts

type Opts struct {
	Secret     *domain.NotifierSecret
	ProjectKey string `mapstructure:"project_key"`
	IssueType  string `mapstructure:"issue_type"`
	CloudID    string `mapstructure:"cloud_id"`
	ReporterID string `mapstructure:"reporter_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"`
	IssueTypes []IssueType `json:"issueTypes"`
	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 ProjectKeyInfo added in v1.1.0

type ProjectKeyInfo struct {
	IssueType []Value `json:"issue_type" mapstructure:"issue_type"`
}

type Rel

type Rel struct {
	CloudID    map[string]CloudIDInfo    `json:"cloud_id" mapstructure:"cloud_id"`
	ProjectKey map[string]ProjectKeyInfo `json:"project_key" mapstructure:"project_key"`
}

type Reporter added in v1.2.0

type Reporter struct {
	ID string `json:"id,omitempty"`
}

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