gitlab

package
v0.0.0-...-69ce26b Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthBaseUrl = "https://gitlab.com"
	ApiBaseUrl  = "https://gitlab.com/api/v4"
)

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken(ctx context.Context, code string) (*oauth2.Token, error)

func GetGitlabProjects

func GetGitlabProjects(workspace *model.Workspace, accessToken string) ([]*modelInputs.GitlabProject, error)

func GetOAuthConfig

func GetOAuthConfig() (*oauth2.Config, []oauth2.AuthCodeOption, error)

func GetRefreshToken

func GetRefreshToken(ctx context.Context, oldToken *oauth2.Token) (*oauth2.Token, error)

func RevokeGitlabAccessToken

func RevokeGitlabAccessToken(accessToken string) error

func SearchGitlabIssues

func SearchGitlabIssues(accessToken string, query string) ([]*modelInputs.IssuesSearchResult, error)

Types

type Author

type Author struct {
	ID        int    `json:"id"`
	Username  string `json:"username"`
	Name      string `json:"name"`
	State     string `json:"state"`
	Locked    bool   `json:"locked"`
	AvatarURL string `json:"avatar_url"`
	WebURL    string `json:"web_url"`
}

type GitlabIssue

type GitlabIssue struct {
	ID                   int                  `json:"id"`
	IID                  int                  `json:"iid"`
	ProjectID            int                  `json:"project_id"`
	Title                string               `json:"title"`
	Description          string               `json:"description"`
	State                string               `json:"state"`
	CreatedAt            time.Time            `json:"created_at"`
	UpdatedAt            time.Time            `json:"updated_at"`
	ClosedAt             *time.Time           `json:"closed_at"`
	ClosedBy             *int                 `json:"closed_by"`
	Labels               []string             `json:"labels"`
	Milestone            *int                 `json:"milestone"`
	Assignees            []int                `json:"assignees"`
	Author               Author               `json:"author"`
	Type                 string               `json:"type"`
	Assignee             *int                 `json:"assignee"`
	UserNotesCount       int                  `json:"user_notes_count"`
	MergeRequestsCount   int                  `json:"merge_requests_count"`
	Upvotes              int                  `json:"upvotes"`
	Downvotes            int                  `json:"downvotes"`
	DueDate              *time.Time           `json:"due_date"`
	Confidential         bool                 `json:"confidential"`
	DiscussionLocked     *bool                `json:"discussion_locked"`
	IssueType            string               `json:"issue_type"`
	WebURL               string               `json:"web_url"`
	TimeStats            TimeStats            `json:"time_stats"`
	TaskCompletionStatus TaskCompletionStatus `json:"task_completion_status"`
	BlockingIssuesCount  int                  `json:"blocking_issues_count"`
	HasTasks             bool                 `json:"has_tasks"`
	TaskStatus           string               `json:"task_status"`
	Links                Links                `json:"_links"`
	References           References           `json:"references"`
	Severity             string               `json:"severity"`
	Subscribed           bool                 `json:"subscribed"`
	MovedToID            *int                 `json:"moved_to_id"`
	ServiceDeskReplyTo   *string              `json:"service_desk_reply_to"`
}

func CreateGitlabTask

func CreateGitlabTask(accessToken string, projectId string, payload NewGitlabIssuePayload) (*GitlabIssue, error)

type GitlabProjectResponse

type GitlabProjectResponse struct {
	ID                int       `json:"id"`
	Description       *string   `json:"description"`
	Name              string    `json:"name"`
	NameWithNamespace string    `json:"name_with_namespace"`
	Path              string    `json:"path"`
	PathWithNamespace string    `json:"path_with_namespace"`
	CreatedAt         time.Time `json:"created_at"`
	DefaultBranch     string    `json:"default_branch"`
	TagList           []string  `json:"tag_list"`
	Topics            []string  `json:"topics"`
	SSHURLToRepo      string    `json:"ssh_url_to_repo"`
	HTTPURLToRepo     string    `json:"http_url_to_repo"`
	WebURL            string    `json:"web_url"`
	ReadmeURL         string    `json:"readme_url"`
	ForksCount        int       `json:"forks_count"`
	AvatarURL         *string   `json:"avatar_url"`
	StarCount         int       `json:"star_count"`
	LastActivityAt    time.Time `json:"last_activity_at"`
	Namespace         Namespace `json:"namespace"`
}

type GitlabTokenResponse

type GitlabTokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"`
	Scope        string `json:"scope"`
	TokenType    string `json:"token_type"`
}
type Links struct {
	Self                string  `json:"self"`
	Notes               string  `json:"notes"`
	AwardEmoji          string  `json:"award_emoji"`
	Project             string  `json:"project"`
	ClosedAsDuplicateOf *string `json:"closed_as_duplicate_of"`
}

type Namespace

type Namespace struct {
	ID        int     `json:"id"`
	Name      string  `json:"name"`
	Path      string  `json:"path"`
	Kind      string  `json:"kind"`
	FullPath  string  `json:"full_path"`
	ParentID  *int    `json:"parent_id"`
	AvatarURL *string `json:"avatar_url"`
	WebURL    string  `json:"web_url"`
}

type NewGitlabIssuePayload

type NewGitlabIssuePayload struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

type References

type References struct {
	Short    string `json:"short"`
	Relative string `json:"relative"`
	Full     string `json:"full"`
}

type TaskCompletionStatus

type TaskCompletionStatus struct {
	Count          int `json:"count"`
	CompletedCount int `json:"completed_count"`
}

type TimeStats

type TimeStats struct {
	TimeEstimate        *int    `json:"time_estimate"`
	TotalTimeSpent      *int    `json:"total_time_spent"`
	HumanTimeEstimate   *string `json:"human_time_estimate"`
	HumanTotalTimeSpent *string `json:"human_total_time_spent"`
}

Jump to

Keyboard shortcuts

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