Documentation ¶
Index ¶
- type Handler
- type HandlerFunc
- type Request
- type Response
- type Webhook
- func (w *Webhook) CreateResponse(ctx context.Context, value any) *Response
- func (w *Webhook) HandleAction(ctx context.Context, r *Request) *Response
- func (w *Webhook) OnAction(name string, handler Handler) *Webhook
- func (w *Webhook) OnChallenge(...) *Webhook
- func (w *Webhook) OnCreateUser(...) *Webhook
- func (w *Webhook) OnDefault(fn HandlerFunc) *Webhook
- func (w *Webhook) OnDeleteUser(...) *Webhook
- func (w *Webhook) OnEvent(fn func(ctx context.Context, input *eventsv1.Event) error) *Webhook
- func (w *Webhook) OnGetUser(...) *Webhook
- func (w *Webhook) OnListUsers(...) *Webhook
- func (w *Webhook) OnUpdateUser(...) *Webhook
- func (w *Webhook) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (w *Webhook) Verify(req *Request) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
The HandlerFunc type is an adapter to allow the use of ordinary functions as action handlers.
func (HandlerFunc) HandleAction ¶
type Request ¶
Request is a wrapper for webhook requests.
func (*Request) GetSignatures ¶
GetSignatures returns the webhook signatures.
func (*Request) GetTimestamp ¶
GetTimestamp returns the webhook timestamp.
type Webhook ¶
type Webhook struct {
// contains filtered or unexported fields
}
Webhook is a parsing and dispatch helper for UserHub webhooks.
func New ¶
func New(signingSecret string, opts ...option.WebhooksOption) *Webhook
New returns a new instance of Webhook.
func (*Webhook) CreateResponse ¶
CreateResponse creates a response from an object that can be encoded using json.Marshal or error.
func (*Webhook) HandleAction ¶
HandleAction executes a handler based on specified Request.
func (*Webhook) OnChallenge ¶
func (w *Webhook) OnChallenge(fn func(ctx context.Context, input *connectionsv1.Challenge) (*connectionsv1.Challenge, error)) *Webhook
OnChallenge registers a handler for the `challenge` action.
func (*Webhook) OnCreateUser ¶
func (w *Webhook) OnCreateUser(fn func(ctx context.Context, input *connectionsv1.CustomUser) (*connectionsv1.CustomUser, error)) *Webhook
OnCreateUser registers a handler for the `users.create` action.
func (*Webhook) OnDefault ¶
func (w *Webhook) OnDefault(fn HandlerFunc) *Webhook
OnDefault registers a fallback action handler.
func (*Webhook) OnDeleteUser ¶
func (w *Webhook) OnDeleteUser(fn func(ctx context.Context, input *connectionsv1.DeleteCustomUserRequest) error) *Webhook
OnDeleteUser registers a handler for the `users.delete` action.
func (*Webhook) OnGetUser ¶
func (w *Webhook) OnGetUser(fn func(ctx context.Context, input *connectionsv1.GetCustomUserRequest) (*connectionsv1.CustomUser, error)) *Webhook
OnGetUser registers a handler for the `users.get` action.
func (*Webhook) OnListUsers ¶
func (w *Webhook) OnListUsers(fn func(ctx context.Context, input *connectionsv1.ListCustomUsersRequest) (*connectionsv1.ListCustomUsersResponse, error)) *Webhook
OnListUsers registers a handler for the `users.list` action.
func (*Webhook) OnUpdateUser ¶
func (w *Webhook) OnUpdateUser(fn func(ctx context.Context, input *connectionsv1.CustomUser) (*connectionsv1.CustomUser, error)) *Webhook
OnUpdateUser registers a handler for the `users.update` action.