Documentation ¶
Overview ¶
SPDX-License-Identifier: Apache-2.0 Copyright 2024 Eric Evans <eevans@wikimedia.org>, Wikimedia Foundation, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type ByID
- type Config
- type Corto
- func (c *Corto) CreateIncident(title string) (*Task, error)
- func (c *Corto) GetIncident(id int) (*Task, error)
- func (c *Corto) ListOpen() ([]*Task, error)
- func (c *Corto) ResolveIncident(id int) (*Task, error)
- func (c *Corto) TitleIncident(PHID string, new_title string) (bool, error)
- func (c *Corto) UpdateIC(id int, coordinator string) (*Task, error)
- type Document
- type GoogleDocument
- type ManiphestTaskManager
- func (p *ManiphestTaskManager) AddComment(id int, comment string) error
- func (p *ManiphestTaskManager) Assign(id int, user string) (*Task, error)
- func (p *ManiphestTaskManager) Close(id int) (*Task, error)
- func (p *ManiphestTaskManager) Create(title, description string) (*Task, error)
- func (p *ManiphestTaskManager) Get(id int) (*Task, error)
- func (p *ManiphestTaskManager) ListComments(id int, author string) ([]TaskComment, error)
- func (p *ManiphestTaskManager) ListOpen() ([]*Task, error)
- func (p *ManiphestTaskManager) LookupPHID(name string) (string, error)
- func (p *ManiphestTaskManager) QueryPHID(phid string) (string, error)
- type Task
- type TaskComment
- type TaskManager
- type UserError
Constants ¶
const ( StatusOpen status = iota StatusResolved StatusStalled StatusInvalid StatusDeclined PriorityHigh priority = iota PriorityUnbreakNow PriorityNeedsTriage PriorityMedium PriorityLow )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { GoogleDriveId string `yaml:"google_drive_id"` GoogleDriveCredsPath string `yaml:"google_drive_creds_path"` IrcConfig ircConfig `yaml:"irc_config"` Phabricator struct { Project string `yaml:"project"` URL string `yaml:"url"` Token string `yaml:"token"` User string `yaml:"user"` Policy struct { View string `yaml:"view"` Edit string `yaml:"edit"` } } `yaml:"phabricator"` }
Config represents a Corto configuration.
func ReadConfig ¶
ReadConfig returns a Config struct from the contents of a byte array.
type Corto ¶
type Corto struct {
// contains filtered or unexported fields
}
func NewCorto ¶
func NewCorto(config *Config, tasks TaskManager, gDoc *GoogleDocument) (*Corto, error)
func (*Corto) CreateIncident ¶
CreateIncident creates a new incident (Google Doc & Phabricator task), given an incident title.
func (*Corto) GetIncident ¶
GetIncident loads an existing Incident from its task ID
func (*Corto) TitleIncident ¶
type GoogleDocument ¶
type GoogleDocument struct {
// contains filtered or unexported fields
}
func NewGoogleDocument ¶
func NewGoogleDocument(ctx context.Context, driveID, credsFile string) (*GoogleDocument, error)
type ManiphestTaskManager ¶
type ManiphestTaskManager struct { URL string // contains filtered or unexported fields }
ManiphestTaskManager is a Phabricator implementation of the TaskManager interface.
func NewManiphestTaskManager ¶
func NewManiphestTaskManager(token, url, project, viewPolicy, editPolicy string) (*ManiphestTaskManager, error)
NewManiphestTaskManager creates a PhabricatorIncidents from a token, URL, and project name.
func (*ManiphestTaskManager) AddComment ¶
func (p *ManiphestTaskManager) AddComment(id int, comment string) error
AddComment creates a new comment on the Task associated with the id argument, using content corresponding to the comment arg.
func (*ManiphestTaskManager) Assign ¶
func (p *ManiphestTaskManager) Assign(id int, user string) (*Task, error)
Assign (re)assigns the owner of a Task
func (*ManiphestTaskManager) Close ¶
func (p *ManiphestTaskManager) Close(id int) (*Task, error)
Close sets an existing Task (corresponding to its ID) to StatusClosed. Upon success, a corresponding Task is returned, otherwise an error.
func (*ManiphestTaskManager) Create ¶
func (p *ManiphestTaskManager) Create(title, description string) (*Task, error)
Create creates a new (open) task given a title and description. A corresponding Task struct is returned upon success, or an error otherwise.
func (*ManiphestTaskManager) Get ¶
func (p *ManiphestTaskManager) Get(id int) (*Task, error)
Get returns a Task corresponding to its ID.
func (*ManiphestTaskManager) ListComments ¶
func (p *ManiphestTaskManager) ListComments(id int, author string) ([]TaskComment, error)
ListComments returns a list of TaskComments according to a Task id and author.
func (*ManiphestTaskManager) ListOpen ¶
func (p *ManiphestTaskManager) ListOpen() ([]*Task, error)
ListOpen returns a list of open tasks.
func (*ManiphestTaskManager) LookupPHID ¶
func (p *ManiphestTaskManager) LookupPHID(name string) (string, error)
LookupPHID returns the Phabricator PHID for a name.
type Task ¶
type Task struct { ID int // incident ID (i.e. the task ID) Started time.Time // incident start time (i.e. task open) Title string // self explanatory Status status // the incident status (open, closed, etc) Description string // corresponds with ticket description Coordinator string // IC; coordinates w/ "assigned" Tags []string // ??? URL string // Task URL }
Task represents a task ("ticket", etc) in a task tracking system.
type TaskComment ¶
TaskComment represents a comment associated with a Task.
type TaskManager ¶
type TaskManager interface { Create(title, description string) (*Task, error) Close(id int) (*Task, error) ListOpen() ([]*Task, error) Get(id int) (*Task, error) Assign(id int, user string) (*Task, error) AddComment(id int, comment string) error ListComments(id int, author string) ([]TaskComment, error) }
TaskManager defines an interface for task managment implementations (ticketing systems).