Documentation ¶
Overview ¶
Package webhook implemented the webhook trigger and handler convertor.go implements the conversion between entity and po
Package webhook implemented the webhook trigger and handler entity.go implements the webhook template
Package webhook implemented the webhook trigger and handler handler.go implements the grpc handler of webhook trigger
Package webhook implemented the webhook trigger and handler template.go implements the webhook template
Index ¶
- type Handler
- func (h *Handler) Call(ctx context.Context, req *pb.WebhookTriggerServiceCallRequest) (*pb.WebhookTriggerServiceCallResponse, error)
- func (h *Handler) FindOneByID(ctx context.Context, req *pb.FindOneByIDRequest) (*pb.WebhookFindOneByIDResponse, error)
- func (h *Handler) PageQueryTemplate(ctx context.Context, req *pb.PageQueryTemplateRequest) (*pb.WebhookPageQueryResponse, error)
- func (h *Handler) Register(ctx context.Context, req *pb.WebhookTriggerServiceRegisterRequest) (*pb.WebhookRegisterResponse, error)
- func (h *Handler) UpdateStatus(ctx context.Context, req *pb.UpdateStatusRequest) (*pb.UpdateStatusResponse, error)
- type Trigger
- func (t *Trigger) Call(ctx context.Context, id uint) (string, error)
- func (t *Trigger) FindByID(ctx context.Context, id uint) (*TriggerTemplate, error)
- func (t *Trigger) PageQuery(ctx context.Context, p *constants.PageQuery, status pb.TriggerStatus) ([]*TriggerTemplate, int64, error)
- func (t *Trigger) Register(ctx context.Context, temp *TriggerTemplate) error
- func (t *Trigger) UpdateStatus(ctx context.Context, id uint, status pb.TriggerStatus) (int64, error)
- type TriggerTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct { pb.UnimplementedWebhookTriggerServiceServer // contains filtered or unexported fields }
Handler is the grpc handler of webhook trigger
func (*Handler) Call ¶
func (h *Handler) Call(ctx context.Context, req *pb.WebhookTriggerServiceCallRequest) ( *pb.WebhookTriggerServiceCallResponse, error)
Call handler webhook
func (*Handler) FindOneByID ¶
func (h *Handler) FindOneByID(ctx context.Context, req *pb.FindOneByIDRequest) (*pb.WebhookFindOneByIDResponse, error)
FindOneByID find one by id
func (*Handler) PageQueryTemplate ¶
func (h *Handler) PageQueryTemplate(ctx context.Context, req *pb.PageQueryTemplateRequest) (*pb.WebhookPageQueryResponse, error)
PageQueryTemplate page query
func (*Handler) Register ¶
func (h *Handler) Register(ctx context.Context, req *pb.WebhookTriggerServiceRegisterRequest) (*pb.WebhookRegisterResponse, error)
Register register a webhook trigger template
func (*Handler) UpdateStatus ¶
func (h *Handler) UpdateStatus(ctx context.Context, req *pb.UpdateStatusRequest) (*pb.UpdateStatusResponse, error)
UpdateStatus update the status of trigger
type Trigger ¶
type Trigger struct {
// contains filtered or unexported fields
}
Trigger is the webhook trigger
func NewTrigger ¶
NewTrigger create a webhook trigger
func (*Trigger) PageQuery ¶
func (t *Trigger) PageQuery(ctx context.Context, p *constants.PageQuery, status pb.TriggerStatus) ([]*TriggerTemplate, int64, error)
PageQuery page query webhook templates
func (*Trigger) Register ¶
func (t *Trigger) Register(ctx context.Context, temp *TriggerTemplate) error
Register create a webhook template
func (*Trigger) UpdateStatus ¶
func (t *Trigger) UpdateStatus(ctx context.Context, id uint, status pb.TriggerStatus) (int64, error)
UpdateStatus update webhook template status
type TriggerTemplate ¶
type TriggerTemplate struct { // ID is the id of the template ID uint // Topic the message topic Topic string `validate:"required"` // Payload the message payload Payload []byte `validate:"required"` // Message DeliverAfter time (Seconds) DeliverAfter uint64 `json:"deliver_after" validate:"required"` // LoopedTimes already loop times LoopedTimes uint64 `json:"looped_times"` // ExceptedEndTime Excepted Trigger end time, if it is 0, it means that it will not end. ExceptedEndTime time.Time `json:"excepted_end_time"` // ExceptedLoopTimes except loop times ExceptedLoopTimes uint64 `json:"excepted_loop_times"` // Status the CronTriggerTemplate status: enable offline Status pb.TriggerStatus `json:"status" validate:"required"` }
TriggerTemplate is the webhook template