ticket

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ticket provides generic functionality to interact with ticketing systems. The interfaces provided allow the cli tool to be agnostic and not bound to a single backend.

Index

Constants

This section is empty.

Variables

View Source
var ErrCredentialSaving = errors.New("Could not save credentials to system keyring")
View Source
var ErrNotFound = errors.New("Could not find issue/ticket")
View Source
var ErrNotUnauthorized = errors.New("Could not authorize with ticket system, are your credentials still valid?")
View Source
var ErrTypeAssertionAuth = errors.New("Could not parse credential data")

Functions

This section is empty.

Types

type LoginScenario

type LoginScenario func() (interface{}, error)

type System

type System string

System represent an identifier for a ticket system.

const Jira System = "jira"

Jira is a proprietary issue tracking product developed by Atlassian.

type Ticket

type Ticket struct {
	Title string
	Key   string
	Type  string
}

type TicketSystem

type TicketSystem interface {
	Authenticate(data interface{}) (User, error)

	// LoginScenario returns a function that will execute a number of prompts
	// to gather the credentials needed to authenticate with the system.
	// The return value interface{} of the returned function represent the login data.
	LoginScenario() LoginScenario

	// Ticker returns the details of a ticket in the ticket system.
	Ticket(key string) (Ticket, error)

	GetBaseFromTicketType(typ string) string

	SaveCredentials() error

	ValidateKey(key string) error
}

type User

type User struct {
	DisplayName string
	Email       string
	System      System
}

func LoadFromDisk

func LoadFromDisk() (*User, error)

LoadFromDisk reads the user from the home dir.

func (*User) SaveToDisk

func (u *User) SaveToDisk() error

SaveToDisk dumps the current user to the file system so that it can be retrieved later.

Jump to

Keyboard shortcuts

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