serializer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VCSTypeGithub    = "github"
	VCSTypeBitbucket = "bitbucket"
)

Variables

View Source
var (
	DefaultVCSList = map[string]*VCS{
		"github": {
			Alias:   "github",
			Type:    VCSTypeGithub,
			BaseURL: "https://github.com",
		},
		"bitbucket": {
			Alias:   "bitbucket",
			Type:    VCSTypeBitbucket,
			BaseURL: "https://bitbucket.org",
		},
	}
)

Functions

This section is empty.

Types

type CircleCIWebhookRequest

type CircleCIWebhookRequest struct {
	Status         string `json:"status"`
	BuildNum       string `json:"build_num"`
	RepoName       string `json:"repo_name"`
	Tag            string `json:"tag"`
	Commit         string `json:"commit"`
	BuildURL       string `json:"build_url"`
	CompareURL     string `json:"compare_url"`
	RepoURL        string `json:"repo_url"`
	OrgName        string `json:"org_name"`
	Branch         string `json:"branch"`
	Username       string `json:"username"`
	PullRequest    string `json:"pull_request"`
	PipelineNumber string `json:"pipeline_number"`
	JobName        string `json:"job_name"`
	WorkflowID     string `json:"workflow_id"`
}

func (*CircleCIWebhookRequest) GenerateFailurePost

func (r *CircleCIWebhookRequest) GenerateFailurePost() *model.Post

func (*CircleCIWebhookRequest) GenerateSuccessPost

func (r *CircleCIWebhookRequest) GenerateSuccessPost() *model.Post

func (*CircleCIWebhookRequest) GetSubscription

func (r *CircleCIWebhookRequest) GetSubscription() Subscription

type StringSubscription

type StringSubscription map[string]Subscription

type Subscription

type Subscription struct {
	VCSType   string `json:"vcsType"`
	BaseURL   string `json:"baseURL"`
	OrgName   string `json:"orgName"`
	RepoName  string `json:"repoName"`
	ChannelID string `json:"channelID"`
}

func (*Subscription) GetKey

func (s *Subscription) GetKey() string

GetKey returns the key against which data can be stored in a map

func (*Subscription) Validate

func (s *Subscription) Validate() error

Validate checks if the subscription has valid fields returns an error if the subscription is invalid and nil if valid

type Subscriptions

type Subscriptions struct {
	ByChannelID map[string]StringSubscription // store the list of subscriptions for a channelID
	ByKey       map[string][]string           // stores the list of channelIDs to which the message needs to be posted for a subscription
}

func NewSubscriptions

func NewSubscriptions() *Subscriptions

func SubscriptionsFromJSON

func SubscriptionsFromJSON(bytes []byte) (*Subscriptions, error)

func (*Subscriptions) Add

func (list *Subscriptions) Add(s Subscription)

Add adds a new subscription to the list of all subscriptions

func (*Subscriptions) GetChannelIDs

func (list *Subscriptions) GetChannelIDs(s Subscription) []string

GetChannelID returns the channelID to which the message for a subscription should be posted to

func (*Subscriptions) List

func (list *Subscriptions) List(channelID string) []Subscription

List returns the list for a particular channel as a formatted mattermost message

func (*Subscriptions) Remove

func (list *Subscriptions) Remove(s Subscription)

Remove removes a subscription from the list of all subscriptions

type VCS

type VCS struct {
	Alias   string `json:"alias"`
	Type    string `json:"type"`
	BaseURL string `json:"base_url"`
}

Jump to

Keyboard shortcuts

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