monorail

package
v0.0.0-...-34cbb95 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

README

Monorail v1 API is deprecrated and new API users are expected to use the v3 API. See go/monorail-v3-api and go/dogfood-monorail-v3-api for more information. Note that there is no Go client library available for the v3 API: https://bugs.chromium.org/p/monorail/issues/detail?id=8257

Documentation

Index

Constants

View Source
const (

	// Project specific field constants.
	ChromiumPriorityFieldName = "projects/chromium/fieldDefs/11"
	ChromiumTypeFieldName     = "projects/chromium/fieldDefs/10"
	SkiaPriorityFieldName     = "projects/skia/fieldDefs/9"
	SkiaTypeFieldName         = "projects/skia/fieldDefs/8"

	RestrictViewGoogleLabelName = "Restrict-View-Google"
)

Variables

View Source
var (
	ProjectToPriorityFieldNames = map[string]string{
								// contains filtered or unexported fields
	}

	ProjectToTypeFieldNames = map[string]string{
							// contains filtered or unexported fields
	}
)

Functions

This section is empty.

Types

type IMonorailService

type IMonorailService interface {
	// GetEmail returns the registered email of the provided user name.
	GetEmail(userName string) (*MonorailUser, error)

	// SetOwnerAndAddComment sets the provided owner for the monorail issue with
	// the provided comment.
	SetOwnerAndAddComment(instance, owner, comment, id string) error

	// GetIssueLink returns a link that points to the provided monorail issue.
	GetIssueLink(instance, id string) string

	// GetIssue returns a MonorailIssue object for the provided issue name.
	// Issue names look like this: "projects/skia/issues/13158".
	GetIssue(issueName string) (*MonorailIssue, error)

	// MakeIssue creates a new monorail issue.
	MakeIssue(instance, owner, summary, description, status, priority, issueType string, labels, componentDefIDs, ccUsers []string) (*MonorailIssue, error)

	// SearchIssuesWithPagination returns monorail issue results by autoamtically
	// paginating till end of results.
	// Monorail results are limited to 100 (see https://source.chromium.org/chromium/infra/infra/+/master:appengine/monorail/api/v3/api_proto/issues.proto;l=179).
	// It paginates till all results are received.
	SearchIssuesWithPagination(instance, query string) ([]MonorailIssue, error)
}

IMonorailService is the interface implemented by all monorail service impls.

type MonorailIssue

type MonorailIssue struct {
	Name  string `json:"name"`
	State struct {
		Status string `json:"status"`
	} `json:"status"`
	FieldValues []struct {
		Field string `json:"field"`
		Value string `json:"value"`
	} `json:"fieldValues"`
	Owner struct {
		User string `json:"user"`
	} `json:"owner"`

	CreatedTime  time.Time `json:"createTime"`
	ModifiedTime time.Time `json:"modifyTime"`
	ClosedTime   time.Time `json:"closeTime"`

	Title string `json:"summary"`
}

type MonorailService

type MonorailService struct {
	HttpClient *http.Client
}

func New

func New(ctx context.Context, serviceAccountFilePath string) (*MonorailService, error)

func (*MonorailService) GetEmail

func (m *MonorailService) GetEmail(userName string) (*MonorailUser, error)

GetEmail implements the IMonorailService interface.

func (*MonorailService) GetIssue

func (m *MonorailService) GetIssue(issueName string) (*MonorailIssue, error)

GetIssue implements the IMonorailService interface.

func (m *MonorailService) GetIssueLink(instance, id string) string

GetIssueLink implements the IMonorailService interface.

func (*MonorailService) MakeIssue

func (m *MonorailService) MakeIssue(instance, owner, summary, description, status, priority, issueType string, labels, componentDefIDs, ccUsers []string) (*MonorailIssue, error)

MakeIssue implements the IMonorailService interface. If the specified instance is not found in ProjectToPriorityFieldNames and/or ProjectToTypeFieldNames then the priority/type is instead added as labels instead of as custom fields.

func (*MonorailService) SearchIssuesWithPagination

func (m *MonorailService) SearchIssuesWithPagination(instance, query string) ([]MonorailIssue, error)

SearchIssuesWithPagination implements the IMonorailService interface.

func (*MonorailService) SetOwnerAndAddComment

func (m *MonorailService) SetOwnerAndAddComment(instance, owner, comment, id string) error

SetOwnerAndAddComment implements the IMonorailService interface.

type MonorailUser

type MonorailUser struct {
	DisplayName string `json:"displayName"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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