atlassian

package
v0.0.0-...-5f21bb7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleEmpty is used for proxying requests through.
	ModuleEmpty common.ModuleID = ""
	// ModuleJira is the module used for listing Jira issues.
	ModuleJira common.ModuleID = "jira"
	// ModuleAtlassianJiraConnect is the module used for Atlassian Connect.
	ModuleAtlassianJiraConnect common.ModuleID = "atlassian-connect"
)
View Source
const QuerySeparator = "&" // nolint:gochecknoglobals

Variables

View Source
var (
	ErrDiscoveryFailure  = errors.New("failed to collect post authentication data")
	ErrContainerNotFound = errors.New("cloud container was not found for chosen workspace")
)
View Source
var (
	ErrParsingMetadata = errors.New("couldn't parse metadata")
	ErrMissingMetadata = errors.New("there is no metadata for object")
)
View Source
var ErrMissingCloudId = errors.New("connector missing cloud id")

ErrMissingCloudId happens when cloud id was not provided via WithMetadata.

Functions

func JwtTokenGenerator

func JwtTokenGenerator(payload map[string]any, secret string) common.DynamicHeadersGenerator

JwtTokenGenerator generates the claims on a per-request basis for Atlassian Connect. The JWT needs a query request hash, an issued time and an expiration time. The implementation has been adapted from https://bitbucket.org/atlassian/atlassian-jwt-js.git.

Types

type AuthMetadataVars

type AuthMetadataVars struct {
	CloudId string
}

AuthMetadataVars is a complete list of authentication metadata associated with connector. This model serves as a documentation of map[string]string contents.

func NewAuthMetadataVars

func NewAuthMetadataVars(dictionary map[string]string) *AuthMetadataVars

NewAuthMetadataVars parses map into the model.

func (AuthMetadataVars) AsMap

func (v AuthMetadataVars) AsMap() *map[string]string

AsMap converts model back to the map.

type Connector

type Connector struct {
	Client *common.JSONHTTPClient
	Module common.Module

	*providers.ProviderInfo
	// contains filtered or unexported fields
}

func NewConnector

func NewConnector(opts ...Option) (conn *Connector, outErr error)

func (*Connector) Delete

func (c *Connector) Delete(ctx context.Context, config common.DeleteParams) (*common.DeleteResult, error)

Delete removes Jira issue.

func (*Connector) GetPostAuthInfo

func (c *Connector) GetPostAuthInfo(ctx context.Context) (*common.PostAuthInfo, error)

func (*Connector) HTTPClient

func (c *Connector) HTTPClient() *common.HTTPClient

func (*Connector) JSONHTTPClient

func (c *Connector) JSONHTTPClient() *common.JSONHTTPClient

JSONHTTPClient returns the underlying JSON HTTP client.

func (*Connector) ListObjectMetadata

func (c *Connector) ListObjectMetadata(ctx context.Context, _ []string) (*common.ListObjectMetadataResult, error)

ListObjectMetadata lists builtin and custom fields. Supports only Issue object. Therefore, objectNames argument is ignored. API Reference: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-fields/#api-rest-api-2-field-get

func (*Connector) Provider

func (c *Connector) Provider() providers.Provider

func (*Connector) Read

func (c *Connector) Read(ctx context.Context, config common.ReadParams) (*common.ReadResult, error)

Read only returns a list of Jira Issues. You can provide the following values: * ObjectName - ignored. * NextPage - to get next page which may have no elements left. * Since - to scope the time frame, precision is in minutes.

func (*Connector) String

func (c *Connector) String() string

type Option

type Option = func(params *parameters)

Option is a function which mutates the connector configuration.

func WithAuthenticatedClient

func WithAuthenticatedClient(client common.AuthenticatedHTTPClient) Option

func WithClient

func WithClient(ctx context.Context, client *http.Client,
	config *oauth2.Config, token *oauth2.Token, opts ...common.OAuthOption,
) Option

func WithMetadata

func WithMetadata(metadata map[string]string) Option

WithMetadata sets authentication metadata expected by connector.

func WithModule

func WithModule(module common.ModuleID) Option

WithModule sets the Atlassian API module to use for the connector. It's required.

func WithWorkspace

func WithWorkspace(workspaceRef string) Option

type ResponseMessagesError

type ResponseMessagesError struct {
	ErrorMessages   []string          `json:"errorMessages"`
	WarningMessages []string          `json:"warningMessages"`
	Errors          map[string]string `json:"errors"`
}

func (ResponseMessagesError) CombineErr

func (r ResponseMessagesError) CombineErr(base error) error

CombineErr will produce dynamic error from server response body. The base error serves as a main static error on top of stacked errors. That static error should be used in conditional decisions. Ex: common.ErrBadRequest.

type ResponseStatusError

type ResponseStatusError struct {
	Status    int       `json:"status"`
	Error     string    `json:"error"`
	Message   string    `json:"message"`
	Path      string    `json:"path"`
	Timestamp time.Time `json:"timestamp"`
}

func (ResponseStatusError) CombineErr

func (r ResponseStatusError) CombineErr(base error) error

Jump to

Keyboard shortcuts

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