jira

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BaseURLTemplate is the template for the Jira API base URL.
	BaseURLTemplate = "https://%s.atlassian.net"

	// DefaultTimeout is the default timeout for the HTTP client.
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func BasicAuthentication added in v0.3.0

func BasicAuthentication(username, token string) string

BasicAuthentication returns the username and token user-id/password pair, encoded using Base64. See: https://datatracker.ietf.org/doc/html/rfc7617

func WithBasicAuthentication added in v0.3.0

func WithBasicAuthentication(username, token string) func(*Client) error

WithBasicAuthentication returns an option to set the username and token for the client.

func WithHTTPClient added in v0.3.0

func WithHTTPClient(client *http.Client) func(*Client) error

WithHTTPClient returns an option to set the HTTP client for the client.

func WithUserAgent added in v0.3.0

func WithUserAgent(userAgent string) func(*Client) error

WithUserAgent returns an option to set the User-Agent for the client.

Types

type ApplicationRoles

type ApplicationRoles struct {
	Size           int64                  `json:"size"`
	Items          []ApplicationRolesItem `json:"items"`
	PagingCallback Callback               `json:"pagingCallback"`
	Callback       Callback               `json:"callback"`
	MaxResults     int64                  `json:"max-results"`
}

type ApplicationRolesItem

type ApplicationRolesItem struct {
	Key                  string   `json:"key"`
	Groups               []string `json:"groups"`
	Name                 string   `json:"name"`
	DefaultGroups        []string `json:"defaultGroups"`
	SelectedByDefault    bool     `json:"selectedByDefault"`
	Defined              bool     `json:"defined"`
	NumberOfSeats        int64    `json:"numberOfSeats"`
	RemainingSeats       int64    `json:"remainingSeats"`
	UserCount            int64    `json:"userCount"`
	UserCountDescription string   `json:"userCountDescription"`
	HasUnlimitedSeats    bool     `json:"hasUnlimitedSeats"`
	Platform             bool     `json:"platform"`
}

type AvatarUrls

type AvatarUrls struct {
	The16X16 string `json:"16x16"`
	The24X24 string `json:"24x24"`
	The32X32 string `json:"32x32"`
	The48X48 string `json:"48x48"`
}

type Callback

type Callback struct {
}

type Client added in v0.3.0

type Client struct {

	// BaseURL is the base URL for the Jira API.
	BaseURL url.URL

	// UserAgent is the User-Agent string used when making API requests
	// to the Jira API.
	UserAgent string

	Issue  *IssueResourceService
	Myself *MyselfResourceService
	// contains filtered or unexported fields
}

Client manages communication with the Jira API.

func NewClient added in v0.3.0

func NewClient(baseURL string, opts ...func(*Client) error) (*Client, error)

NewClient returns a new client with the given options.

func (*Client) Do added in v0.3.0

func (c *Client) Do(req *http.Request, v interface{}) error

Do sends an API request and returns the API response. The API response is decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.

func (*Client) NewRequest added in v0.3.0

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client.

type Groups

type Groups struct {
	Size           int64        `json:"size"`
	Items          []GroupsItem `json:"items"`
	PagingCallback Callback     `json:"pagingCallback"`
	Callback       Callback     `json:"callback"`
	MaxResults     int64        `json:"max-results"`
}

type GroupsItem

type GroupsItem struct {
	Name string `json:"name"`
	Self string `json:"self"`
}

type Issue added in v0.3.0

type Issue struct {
	Expand string      `json:"expand"`
	ID     string      `json:"id"`
	Self   string      `json:"self"`
	Key    string      `json:"key"`
	Fields IssueFields `json:"fields"`
}

type IssueFields added in v0.3.0

type IssueFields struct {
	Issuetype IssueType `json:"issuetype"`
	Updated   string    `json:"updated"`
	Summary   string    `json:"summary"`
}

type IssueResourceService added in v0.3.0

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

func (*IssueResourceService) GetIssue added in v0.3.0

func (i *IssueResourceService) GetIssue(ctx context.Context, key string) (*Issue, error)

type IssueType added in v0.3.0

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       int64  `json:"avatarId"`
	HierarchyLevel int64  `json:"hierarchyLevel"`
}

type MyselfResourceService added in v0.3.0

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

func (*MyselfResourceService) Myself added in v0.3.0

func (m *MyselfResourceService) Myself(ctx context.Context) (*User, error)

type User

type User struct {
	Self             string           `json:"self"`
	Key              string           `json:"key"`
	AccountID        string           `json:"accountId"`
	AccountType      string           `json:"accountType"`
	Name             string           `json:"name"`
	EmailAddress     string           `json:"emailAddress"`
	AvatarUrls       AvatarUrls       `json:"avatarUrls"`
	DisplayName      string           `json:"displayName"`
	Active           bool             `json:"active"`
	TimeZone         string           `json:"timeZone"`
	Locale           string           `json:"locale"`
	Groups           Groups           `json:"groups"`
	ApplicationRoles ApplicationRoles `json:"applicationRoles"`
	Expand           string           `json:"expand"`
}

Jump to

Keyboard shortcuts

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