webhook

package
v0.0.0-...-dc9cd6f Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Router

func Router(webhookRepo Repository, router *gin.RouterGroup)

Router creates a new Controller and add all available endpoints to a Gin RouterGroup

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller contains all the available handlers

func NewWebhookController

func NewWebhookController(service Service) *Controller

NewWebhookController creates a new Controller

func (*Controller) Create

func (ctrl *Controller) Create(c *gin.Context)

Create it's the handler function for Webhook creation endpoints

func (*Controller) Delete

func (ctrl *Controller) Delete(c *gin.Context)

Delete it's the handler function for Webhook deletion endpoints

func (*Controller) Find

func (ctrl *Controller) Find(c *gin.Context)

Find it's the handler function to retrieve Webhooks

func (*Controller) List

func (ctrl *Controller) List(c *gin.Context)

List it's the handler function for Webhook listing endpoints

func (*Controller) Run

func (ctrl *Controller) Run(c *gin.Context)

Run it's the handler function to execute Webhooks

func (*Controller) Update

func (ctrl *Controller) Update(c *gin.Context)

Update it's the handler function for Webhook update endpoints

type Read

type Read interface {
	FindWebhook(id string) (models.Webhook, error)
	FindWebhookByNameAndType(name string, webhookType string) (models.Webhook, error)
	ListWebhookByType(webhookType string) ([]models.Webhook, error)
}

Read implements the read action methods

type Repository

type Repository interface {
	Read
	Write
}

Repository describes the repository where the data will be written and read from

func NewMongoRepository

func NewMongoRepository(session *mgo.Session) Repository

NewMongoRepository creates a new Repository implementation using the MongoDB as database

type Service

type Service interface {
	Create(webhook models.Webhook) error
	Update(id string, webhook models.Webhook) error
	Delete(id string) error
	List(webhookType string) ([]models.Webhook, error)
	TriggerWebhook(element interface{}, action string) error
	WebhookExists(webhook models.Webhook) bool
	Read
}

Service describes the use case

func NewService

func NewService(r Repository) Service

NewService creates implementation of the Service interface

type Write

type Write interface {
	CreateWebhook(webhook models.Webhook) error
	UpdateWebhook(id string, webhook models.Webhook) error
	DeleteWebhook(id string) error
}

Write implements the write action methods

Jump to

Keyboard shortcuts

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