tasks

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BatchSize = 100
)

Variables

View Source
var ErrNotFoundResource = errors.New("not found the resource")

Functions

func CollectBoard

func CollectBoard(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64) error

func CollectChangelogs

func CollectChangelogs(
	jiraApiClient *JiraApiClient,
	source *models.JiraSource,
	boardId uint64,
	rateLimitPerSecondInt int,
	ctx context.Context,
	collector changelogCollector,
) error

func CollectIssues

func CollectIssues(
	jiraApiClient *JiraApiClient,
	source *models.JiraSource,
	boardId uint64,
	since time.Time,
	rateLimitPerSecondInt int,
	ctx context.Context,
) error

func CollectProjects added in v0.4.0

func CollectProjects(
	jiraApiClient *JiraApiClient,
	sourceId uint64,
) error
func CollectRemoteLinks(
	jiraApiClient *JiraApiClient,
	source *models.JiraSource,
	boardId uint64,
	rateLimitPerSecondInt int,
	ctx context.Context,
	collector remoteLinkCollector,
) error

func CollectSprint added in v0.4.0

func CollectSprint(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64) error

func CollectUsers added in v0.4.0

func CollectUsers(jiraApiClient *JiraApiClient,
	sourceId uint64,
) error

func ConvertBoard added in v0.6.0

func ConvertBoard(sourceId uint64, boardId uint64) error

func ConvertChangelogs added in v0.6.0

func ConvertChangelogs(sourceId uint64, boardId uint64) error

func ConvertIssueCommits added in v0.6.0

func ConvertIssueCommits(sourceId uint64, boardId uint64) error

func ConvertIssues added in v0.6.0

func ConvertIssues(sourceId uint64, boardId uint64) error

func ConvertSprint added in v0.6.0

func ConvertSprint(sourceId uint64, boardId uint64) error

func ConvertUsers added in v0.6.0

func ConvertUsers(sourceId uint64) error

func ConvertWorklog added in v0.6.0

func ConvertWorklog(sourceId uint64, boardId uint64) error

func EnrichIssues

func EnrichIssues(source *models.JiraSource, boardId uint64) (err error)
func EnrichRemotelinks(source *models.JiraSource, boardId uint64) (err error)

Types

type ChangelogItemResult added in v0.6.0

type ChangelogItemResult struct {
	SourceId          uint64 `gorm:"primaryKey"`
	ChangelogId       uint64 `gorm:"primaryKey"`
	Field             string `gorm:"primaryKey"`
	FieldType         string
	FieldId           string
	From              string
	FromString        string
	To                string
	ToString          string
	IssueId           uint64 `gorm:"index"`
	AuthorAccountId   string
	AuthorDisplayName string
	Created           time.Time
}

type Cloud added in v0.9.0

type Cloud struct {
}

func NewCloud added in v0.9.0

func NewCloud() *Cloud

func (*Cloud) CollectBoard added in v0.9.0

func (c *Cloud) CollectBoard(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64) error

func (*Cloud) CollectChangelogs added in v0.9.0

func (c *Cloud) CollectChangelogs(
	jiraApiClient *JiraApiClient,
	source *models.JiraSource,
	boardId uint64,
	rateLimitPerSecondInt int,
	ctx context.Context,
) error

func (*Cloud) CollectIssues added in v0.9.0

func (c *Cloud) CollectIssues(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64, since time.Time, rateLimitPerSecondInt int, ctx context.Context) error

func (*Cloud) CollectProjects added in v0.9.0

func (c *Cloud) CollectProjects(jiraApiClient *JiraApiClient, sourceId uint64) error
func (c *Cloud) CollectRemoteLinks(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64, rateLimitPerSecondInt int, ctx context.Context) error

func (*Cloud) CollectSprint added in v0.9.0

func (c *Cloud) CollectSprint(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64) error

func (*Cloud) CollectUsers added in v0.9.0

func (c *Cloud) CollectUsers(jiraApiClient *JiraApiClient, sourceId uint64) error

type Collector added in v0.9.0

type Collector interface {
	CollectBoard(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64) error
	CollectChangelogs(
		jiraApiClient *JiraApiClient,
		source *models.JiraSource,
		boardId uint64,
		rateLimitPerSecondInt int,
		ctx context.Context,
	) error
	CollectIssues(
		jiraApiClient *JiraApiClient,
		source *models.JiraSource,
		boardId uint64,
		since time.Time,
		rateLimitPerSecondInt int,
		ctx context.Context,
	) error
	CollectProjects(jiraApiClient *JiraApiClient, sourceId uint64) error
	CollectRemoteLinks(
		jiraApiClient *JiraApiClient,
		source *models.JiraSource,
		boardId uint64,
		rateLimitPerSecondInt int,
		ctx context.Context,
	) error
	CollectSprint(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64) error
	CollectUsers(jiraApiClient *JiraApiClient, sourceId uint64) error
}

type JiraApiAuthor

type JiraApiAuthor struct {
	Self        string `json:"self,omitempty"`
	AccountId   string `json:"accountId,omitempty"`
	DisplayName string `json:"displayName,omitempty"`
	Active      bool   `json:"active,omitempty"`
	TimeZone    string `json:"timeZone,omitempty"`
	AccountType string `json:"accountType,omitempty"`
}

type JiraApiBoard

type JiraApiBoard struct {
	Id       uint64 `json:"id"`
	Self     string `json:"self"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Location *JiraApiLocation
}

type JiraApiChangeLog

type JiraApiChangeLog struct {
	Id      string                 `json:"id,omitempty"`
	Author  JiraApiAuthor          `json:"author,omitempty"`
	Created core.Iso8601Time       `json:"created,omitempty"`
	Items   []JiraApiChangelogItem `json:"items,omitempty"`
}

type JiraApiChangelogItem

type JiraApiChangelogItem struct {
	Field      string `json:"field,omitempty"`
	FieldType  string `json:"fieldType,omitempty"`
	FieldId    string `json:"fieldId,omitempty"`
	From       string `json:"from,omitempty"`
	FromString string `json:"fromString,omitempty"`
	To         string `json:"to,omitempty"`
	ToString   string `json:"toString,omitempty"`
}

type JiraApiChangelogsResponse

type JiraApiChangelogsResponse struct {
	JiraPagination
	Values []JiraApiChangeLog `json:"values,omitempty"`
}

type JiraApiClient

type JiraApiClient struct {
	core.ApiClient
}

func NewJiraApiClient added in v0.4.0

func NewJiraApiClient(endpoint string, auth string, proxy string, scheduler *utils.WorkerScheduler) *JiraApiClient

func NewJiraApiClientBySourceId added in v0.4.0

func NewJiraApiClientBySourceId(sourceId uint64, scheduler *utils.WorkerScheduler) (*JiraApiClient, error)

func (*JiraApiClient) FetchPages

func (jiraApiClient *JiraApiClient) FetchPages(path string, query *url.Values, handler JiraPaginationHandler) error

func (*JiraApiClient) FetchWithoutPaginationHeaders added in v0.4.0

func (jiraApiClient *JiraApiClient) FetchWithoutPaginationHeaders(
	path string,
	query *url.Values,
	handler JiraSearchPaginationHandler,
) error

FetchWithoutPaginationHeaders uses pagination in a different way than FetchPages. We set the pagination params to what we want, and then we just keep making requests until the response array is empty. This is why we need to check the "next" variable on the handler, and the handler that is passed in needs to return a boolean to tell us whether or not to continue making requests. This is why we created JiraSearchPaginationHandler.

func (*JiraApiClient) GetJiraServerInfo added in v0.7.0

func (jiraApiClient *JiraApiClient) GetJiraServerInfo() (*models.JiraServerInfo, int, error)

func (*JiraApiClient) GetMyselfInfo added in v0.7.0

func (jiraApiClient *JiraApiClient) GetMyselfInfo() (*models.ApiMyselfResponse, error)

type JiraApiIssue

type JiraApiIssue struct {
	Id     string                 `json:"id"`
	Self   string                 `json:"self"`
	Key    string                 `json:"key"`
	Fields map[string]interface{} `json:"fields"`
}

type JiraApiIssueFields added in v0.6.0

type JiraApiIssueFields struct {
	Name                  string
	Summary               string
	IssueType             JiraApiIssueType
	Project               JiraApiProject
	Worklog               JiraApiWorklog
	Status                JiraApiStatus
	Creator               JiraApiUser
	Assignee              *JiraApiUser
	Priority              *JiraApiIssuePriority
	TimeTracking          JiraApiIssueTimeTracking
	AggregateTimeEstimate int64
	Parent                *JiraApiIssue
	Sprint                *JiraApiSprint
	ClosedSprints         []JiraApiSprint
	Created               core.Iso8601Time
	Updated               *core.Iso8601Time
	ResolutionDate        *core.Iso8601Time
}

type JiraApiIssuePriority added in v0.6.0

type JiraApiIssuePriority struct {
	Self    string
	IconUrl string
	Name    string
	Id      string
}

type JiraApiIssueTimeTracking added in v0.6.0

type JiraApiIssueTimeTracking struct {
	OriginalEstimate        string
	RemainingEstimate       string
	OriginalEstimateSeconds int64
	RemainingEstimatSeconds int64
}

type JiraApiIssueType added in v0.6.0

type JiraApiIssueType struct {
	Self           string
	Id             string
	Description    string
	IconUrl        string
	Name           string
	Subtask        bool
	AvatarId       int
	HierarchyLevel int
}

type JiraApiIssuesResponse

type JiraApiIssuesResponse struct {
	JiraPagination
	Issues []JiraApiIssue `json:"issues"`
}

type JiraApiLocation

type JiraApiLocation struct {
	ProjectId      uint   `json:"projectId"`
	DisplayName    string `json:"displayName"`
	ProjectName    string `json:"projectName"`
	ProjectKey     string `json:"projectKey"`
	ProjectTypeKey string `json:"projectTypeKey"`
	AvatarURI      string `json:"avatarURI"`
	Name           string `json:"name"`
}

type JiraApiProject added in v0.6.0

type JiraApiProject struct {
	Id   string `json:"id"`
	Key  string `json:"key"`
	Name string `json:"name"`
}
type JiraApiRemotelink struct {
	Id           uint64
	Self         string
	Application  json.RawMessage
	Relationship string
	Object       struct {
		Url    string
		Title  string
		Icon   json.RawMessage
		Status json.RawMessage
	}
}

type JiraApiRemotelinksResponse added in v0.6.0

type JiraApiRemotelinksResponse []json.RawMessage

need to store a origin json body into RawJson, by this approach, we dont need to Marshal it back to bytes

type JiraApiSprint added in v0.4.0

type JiraApiSprint struct {
	Id            uint64     `json:"id"`
	Self          string     `json:"self"`
	State         string     `json:"state"`
	Name          string     `json:"name"`
	StartDate     *time.Time `json:"startDate,omitempty"`
	EndDate       *time.Time `json:"endDate,omitempty"`
	CompleteDate  *time.Time `json:"completeDate,omitempty"`
	OriginBoardID uint64     `json:"originBoardId,omitempty"`
}

type JiraApiSprintsResponse added in v0.6.0

type JiraApiSprintsResponse struct {
	MaxResults int             `json:"maxResults"`
	StartAt    int             `json:"startAt"`
	Total      int             `json:"total"`
	IsLast     bool            `json:"isLast"`
	Values     []JiraApiSprint `json:"values"`
}

type JiraApiStatus added in v0.6.0

type JiraApiStatus struct {
	Self           string
	Description    string
	IconUrl        string
	Name           string
	Id             string
	StatusCategory JiraApiStatusCategory
}

type JiraApiStatusCategory added in v0.6.0

type JiraApiStatusCategory struct {
	Self      string
	Id        int
	Key       string
	ColorName string
	Name      string
}

type JiraApiUser added in v0.4.0

type JiraApiUser struct {
	AccountId   string `json:"accountId"`
	AccountType string `json:"accountType"`
	DisplayName string `json:"displayName"`
	Email       string `json:"emailAddress"`
	Timezone    string `json:"timeZone"`
	AvatarUrls  struct {
		Url string `json:"48x48"`
	} `json:"avatarUrls"`
}

type JiraApiWorklog added in v0.6.0

type JiraApiWorklog struct {
	StartAt    int `json:"startAt"`
	MaxResults int `json:"maxResults"`
	Total      int `json:"total"`
	Worklogs   []struct {
		Author struct {
			AccountID string `json:"accountId"`
		} `json:"author"`
		UpdateAuthor struct {
			AccountID string `json:"accountId"`
		} `json:"updateAuthor"`
		Updated          core.Iso8601Time `json:"updated"`
		Started          core.Iso8601Time `json:"started"`
		TimeSpent        string           `json:"timeSpent"`
		TimeSpentSeconds int              `json:"timeSpentSeconds"`
		ID               string           `json:"id"`
		IssueID          string           `json:"issueId"`
	} `json:"worklogs"`
}

type JiraPagination

type JiraPagination struct {
	StartAt    int `json:"startAt"`
	MaxResults int `json:"maxResults"`
	Total      int `json:"total"`
}

type JiraPaginationHandler

type JiraPaginationHandler func(res *http.Response) error

type JiraSearchPaginationHandler added in v0.4.0

type JiraSearchPaginationHandler func(res *http.Response) (int, error)

type JiraUserApiRes added in v0.4.0

type JiraUserApiRes []JiraApiUser

type JiraUserProjectApiRes added in v0.4.0

type JiraUserProjectApiRes []JiraApiProject

This has to be called JiraUserProjects since it is a different api call than JiraProjects. This call retreives all projects that the user has access to

type ServerVersion8 added in v0.9.0

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

func NewServerVersion8 added in v0.9.0

func NewServerVersion8(db *gorm.DB, client *JiraApiClient) *ServerVersion8

func (*ServerVersion8) CollectBoard added in v0.9.0

func (v8 *ServerVersion8) CollectBoard(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64) error

func (*ServerVersion8) CollectChangelogs added in v0.9.0

func (v8 *ServerVersion8) CollectChangelogs(
	jiraApiClient *JiraApiClient,
	source *models.JiraSource,
	boardId uint64,
	rateLimitPerSecondInt int,
	ctx context.Context,
) error

func (*ServerVersion8) CollectIssues added in v0.9.0

func (v8 *ServerVersion8) CollectIssues(
	jiraApiClient *JiraApiClient,
	source *models.JiraSource,
	boardId uint64,
	since time.Time,
	rateLimitPerSecondInt int,
	ctx context.Context,
) error

func (*ServerVersion8) CollectProjects added in v0.9.0

func (v8 *ServerVersion8) CollectProjects(jiraApiClient *JiraApiClient, sourceId uint64) error
func (v8 *ServerVersion8) CollectRemoteLinks(
	jiraApiClient *JiraApiClient,
	source *models.JiraSource,
	boardId uint64,
	rateLimitPerSecondInt int,
	ctx context.Context,
) error

func (*ServerVersion8) CollectSprint added in v0.9.0

func (v8 *ServerVersion8) CollectSprint(jiraApiClient *JiraApiClient, source *models.JiraSource, boardId uint64) error

func (*ServerVersion8) CollectUsers added in v0.9.0

func (v8 *ServerVersion8) CollectUsers(jiraApiClient *JiraApiClient, sourceId uint64) error

func (*ServerVersion8) FetchPages added in v0.9.0

func (v8 *ServerVersion8) FetchPages(path string, query *url.Values, handler JiraSearchPaginationHandler) error

func (*ServerVersion8) FetchWithoutPaginationHeaders added in v0.9.0

func (v8 *ServerVersion8) FetchWithoutPaginationHeaders(path string, query *url.Values, handler JiraSearchPaginationHandler) error

func (*ServerVersion8) Get added in v0.9.0

func (v8 *ServerVersion8) Get(path string, handler JiraSearchPaginationHandler) error

type SprintIssuesConverter added in v0.7.0

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

func NewSprintIssueConverter added in v0.7.0

func NewSprintIssueConverter() *SprintIssuesConverter

func (*SprintIssuesConverter) FeedIn added in v0.7.0

func (c *SprintIssuesConverter) FeedIn(sourceId uint64, cl ChangelogItemResult)

func (*SprintIssuesConverter) UpdateSprintIssue added in v0.7.0

func (c *SprintIssuesConverter) UpdateSprintIssue() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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