ds

package
v0.0.0-...-c09d977 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreUsersEqual

func AreUsersEqual(left []*BasicUser, right []*BasicUser) bool

func EqualUser

func EqualUser(user *BasicUser, other *BasicUser) bool

Types

type BasicUser

type BasicUser struct {
	Name     string `bson:"name"`
	GitLabID int    `bson:"gitlab_id"`
}

type ChannelNotification

type ChannelNotification struct {
	// Team is a team that will receive a notification
	Team *Team
	// AverageCount of MRs per developer/member
	AverageCount int
	// TotalCount of uniq MRs in review state
	TotalCount int
	// LastEditedMR is the last edited MR in review state
	LastEditedMR *MergeRequest
	// FirstEditedMR is the oldest MR in review state
	FirstEditedMR *MergeRequest
}

ChannelNotification is a set of variables that can be used in channel notification templates.

type Commit

type Commit struct {
	ID             string            `bson:"id"`
	ShortID        string            `bson:"short_id"`
	Title          string            `bson:"title"`
	AuthorName     string            `bson:"author_name"`
	AuthorEmail    string            `bson:"author_email"`
	AuthoredDate   *time.Time        `bson:"authored_date"`
	CommitterName  string            `bson:"committer_name"`
	CommitterEmail string            `bson:"committer_email"`
	CommittedDate  *time.Time        `bson:"committed_date"`
	CreatedAt      *time.Time        `bson:"created_at"`
	Message        string            `bson:"message"`
	ParentIDs      []string          `bson:"parent_ids"`
	ProjectID      int               `bson:"project_id"`
	Trailers       map[string]string `bson:"trailers"`
	WebURL         string            `bson:"web_url"`
	Stats          *CommitStats      `bson:"stats"`
}

func (*Commit) IsEqual

func (a *Commit) IsEqual(b *Commit) bool

IsEqual checks if two merge requests are equal (according to basic information)

type CommitStats

type CommitStats struct {
	Additions int `bson:"additions"`
	Deletions int `bson:"deletions"`
	Total     int `bson:"total"`
}

type MergeRequest

type MergeRequest struct {
	ID           int          `bson:"id"`
	IID          int          `bson:"iid"`
	ProjectID    int          `bson:"project_id"`
	TargetBranch string       `bson:"target_branch"`
	SourceBranch string       `bson:"source_branch"`
	Title        string       `bson:"title"`
	Description  string       `bson:"description"`
	State        State        `bson:"state"`
	Author       *BasicUser   `bson:"author"`
	Assignees    []*BasicUser `bson:"assignees"`
	Reviewers    []*BasicUser `bson:"reviewers"`
	Draft        bool         `bson:"draft"`
	SHA          string       `bson:"sha"`
	URL          string       `bson:"url"`
	UpdatedAt    *time.Time   `bson:"updated_at"`
	CreatedAt    *time.Time   `bson:"created_at"`

	// Additional information
	Approves []*BasicUser `bson:"approves"`
}

func (*MergeRequest) IsEqual

func (a *MergeRequest) IsEqual(b *MergeRequest) bool

IsEqual checks if two merge requests are equal (according to basic information)

type NotificationSettings

type NotificationSettings struct {
	Enabled         bool   `bson:"enabled"`
	Cron            string `bson:"cron"`
	UserTemplate    string `bson:"user_template"`
	ChannelID       string `bson:"channel_id"`
	ChannelTemplate string `bson:"channel_template"`
	Locale          string `bson:"locale"`
}

func (NotificationSettings) IsEmpty

func (n NotificationSettings) IsEmpty() bool

type PolicyName

type PolicyName string

type Project

type Project struct {
	ID        int       `bson:"id"`
	Name      string    `bson:"name"`
	URL       string    `bson:"url"`
	CreatedAt time.Time `bson:"created_at"`
}

type State

type State string
const (
	StateOpened State = "opened"
	StateClosed State = "closed"
	StateLocked State = "locked"
	StateMerged State = "merged"
)

func (State) Is

func (s State) Is(want State) bool

type Team

type Team struct {
	ID      string  `bson:"_id"`
	Name    string  `bson:"name"`
	Members []*User `bson:"members"`
	// TODO: add PolicySettings as bson.RawDocument
	Policy        PolicyName           `bson:"policy"`
	Notifications NotificationSettings `bson:"notifications"`
	CreatedAt     time.Time            `bson:"created_at"`
}

func (*Team) Teammate

func (t *Team) Teammate(user *BasicUser) bool

Teammate checks if user is a member of a team

type User

type User struct {
	*BasicUser `bson:"basic_user"`
	SlackID    string     `bson:"slack_id"`
	Labels     UserLabels `bson:"labels"`
}

func Developers

func Developers(users []*User) []*User

Developers returns all developers of a team/list of users

func Leads

func Leads(users []*User) []*User

Leads returns leads of a team/list of users

type UserEvent

type UserEvent struct {
	Type   UserEventType
	UserID string
}

type UserEventType

type UserEventType int
const (
	UserEventTypeMRRequest UserEventType = iota
)

type UserLabel

type UserLabel string
const (
	LeadLabel      UserLabel = "lead"
	DeveloperLabel UserLabel = "developer"
)

type UserLabels

type UserLabels []UserLabel

func (UserLabels) Has

func (u UserLabels) Has(label UserLabel) bool

type UserNotification

type UserNotification struct {
	// User is a user that will receive a notification
	User *User
	// AuthoredMR list of merge requests in review that were authored by the user.
	AuthoredMR []*MergeRequest
	// ReviewerMR list of merge requests that should be reviewed.
	ReviewerMR []*MergeRequest
}

UserNotification is a set of variables that can be used in user notification templates.

Jump to

Keyboard shortcuts

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