ticketing

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateHash

func GenerateHash(data string) string

Types

type Github

type Github struct {
	Client      *github.Client
	Context     context.Context
	Credentials GithubCredentials
	Config      config.Config
}

func NewGithub

func NewGithub(c config.Config) *Github

func (*Github) Connect

func (g *Github) Connect() error

func (*Github) Create

func (g *Github) Create(ticket *Ticket) error

func (*Github) Fetch

func (g *Github) Fetch(ticket *Ticket) error

func (*Github) FetchRemoteTicket

func (g *Github) FetchRemoteTicket(remoteData interface{}) (Ticket, error)

func (*Github) GenerateTemplate

func (g *Github) GenerateTemplate(ticket *Ticket) (TicketTemplate, error)

func (*Github) ParseCredentials

func (g *Github) ParseCredentials(creds interface{}) error

func (*Github) TicketExists

func (g *Github) TicketExists(ticket *Ticket) (bool, TicketDetails, error)

func (*Github) Update

func (g *Github) Update(ticket *Ticket) error

type GithubCredentials

type GithubCredentials struct {
	agent.Agent
	AccessToken    string `json:"access_token"`
	InstallationID string `json:"installation_id"`
	GithubRepo
}

type GithubRepo

type GithubRepo struct {
	Repo  string `json:"repo"`
	Owner string `json:"owner"`
}

type Hash

type Hash string

type Jira

type Jira struct {
	Client      *jira.Client
	Context     context.Context
	Config      config.Config
	Credentials JiraCredentials
}

func NewJira

func NewJira(c config.Config) *Jira

func (*Jira) Connect

func (j *Jira) Connect() error

func (*Jira) Create

func (j *Jira) Create(ticket *Ticket) error

func (Jira) Fetch

func (j Jira) Fetch(ticket *Ticket) error

func (Jira) FetchRemoteTicket

func (j Jira) FetchRemoteTicket(data interface{}) (Ticket, error)

func (*Jira) GenerateTemplate

func (j *Jira) GenerateTemplate(ticket *Ticket) (TicketTemplate, error)

func (*Jira) ParseCredentials

func (j *Jira) ParseCredentials(creds interface{}) error

func (Jira) TicketExists

func (j Jira) TicketExists(ticket *Ticket) (bool, TicketDetails, error)

func (Jira) Update

func (j Jira) Update(ticket *Ticket) error

Update nolint: gocyclo

type JiraCredentials

type JiraCredentials struct {
	Username    string `json:"username"`
	Token       string `json:"token"`
	Host        string `json:"host"`
	JiraProject `json:"jira_project"`
	agent.Agent
}

type JiraProject

type JiraProject struct {
	Name string `json:"name,omitempty"`
	Key  string `json:"key,omitempty"`
}

type Status

type Status string

type Ticket

type Ticket struct {
	agent.Agent
	Level         string `json:"level"`
	LevelNumber   string `json:"level_number"`
	Bug           string `json:"bug"`
	Raw           string `json:"raw"`
	Line          string `json:"line"`
	File          string `json:"file"`
	TimesReported int    `json:"times_reported" default:"1"`

	RemoteID      string      `json:"remote_id"`
	RemoteDetails interface{} `json:"remote_details"`
	Hash          Hash        `json:"hash"`
	FileLineHash  Hash        `json:"file_line_hash"`
	State         string      `json:"state"`
	RemoteLink    string      `json:"remote_link"`
	RemoteSystem  string      `json:"remote_system"`
}

type TicketDetails added in v0.8.0

type TicketDetails struct {
	agent.Agent
	ID           string `json:"id"`
	RemoteID     string `json:"remote_id"`
	System       string `json:"system"`
	Hash         string `json:"hash"`
	FileLineHash string `json:"file_line_hash"`
}

type TicketID

type TicketID string

type TicketTemplate

type TicketTemplate struct {
	Title  string      `json:"title"`
	Body   interface{} `json:"body"`
	Labels []string    `json:"labels"`
	Level  string      `json:"level"`
}

type Ticketing

type Ticketing struct {
	Config config.Config
}

func NewTicketing

func NewTicketing(c config.Config) *Ticketing

func (Ticketing) CreateTicket

func (t Ticketing) CreateTicket(ticket *Ticket) error

func (Ticketing) CreateTicketHandler

func (t Ticketing) CreateTicketHandler(w http.ResponseWriter, r *http.Request)

func (Ticketing) TicketCreate

func (t Ticketing) TicketCreate(system TicketingSystem, creds TicketingCredentials, ticket *Ticket) error

type TicketingCredentials added in v0.8.0

type TicketingCredentials struct {
	Agent            agent.Agent
	AccessToken      string      `json:"access_token"`
	TicketingDetails interface{} `json:"ticketing_details"`
	System           string      `json:"system"`
}

type TicketingStorage added in v0.8.0

type TicketingStorage struct {
	Config  config.Config
	Context context.Context
}

func NewTicketingStorage added in v0.8.0

func NewTicketingStorage(c config.Config) *TicketingStorage

func (TicketingStorage) FetchCredentials added in v0.8.0

func (t TicketingStorage) FetchCredentials(a agent.Agent) (TicketingCredentials, error)

func (TicketingStorage) FindTicket added in v0.8.0

func (t TicketingStorage) FindTicket(details TicketDetails) (TicketDetails, error)

func (TicketingStorage) StoreCredentials added in v0.8.0

func (t TicketingStorage) StoreCredentials(credentials TicketingCredentials) error

func (TicketingStorage) StoreTicketDetails added in v0.8.0

func (t TicketingStorage) StoreTicketDetails(details TicketDetails) error

func (TicketingStorage) TicketExists added in v0.8.0

func (t TicketingStorage) TicketExists(details TicketDetails) (bool, error)

type TicketingSystem

type TicketingSystem interface {
	Connect() error

	ParseCredentials(interface{}) error
	FetchRemoteTicket(interface{}) (Ticket, error)

	Create(*Ticket) error
	Update(*Ticket) error
	Fetch(*Ticket) error

	GenerateTemplate(*Ticket) (TicketTemplate, error)
	TicketExists(*Ticket) (bool, TicketDetails, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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