Skip to main content

internal/api/notifications.go

internal/api · 138 lines · 13 declarations · source

Declarations

type notificationRegisterRequest

type notificationRegisterRequest struct {
URL string `json:"url"`
}

source

type notificationEndpointRequest

type notificationEndpointRequest struct {
ID string `json:"id"`
}

source

type notificationEndpointListRequest

type notificationEndpointListRequest struct{}

notificationEndpointListRequest takes nothing: the credential decides the project, as it does everywhere else on this surface.

source

type notificationDeliveryListRequest

type notificationDeliveryListRequest struct {
Limit int `json:"limit,omitempty"`
}

source

type notificationEndpointList

type notificationEndpointList struct {
Endpoints []pg.Endpoint `json:"endpoints"`
}

source

type notificationDeliveryList

type notificationDeliveryList struct {
Deliveries []pg.DeliveryRecord `json:"deliveries"`
}

source

type notificationDisabled

type notificationDisabled struct {
Disabled bool `json:"disabled"`
}

source

method Server.registerNotificationEndpoint

func (s *Server) registerNotificationEndpoint(w http.ResponseWriter, r *http.Request, grant credential.Grant)

registerNotificationEndpoint nominates somewhere to be told that memory formed.

The destination is checked here, when somebody types it, as well as at the moment of sending. A refusal hours later in a delivery nobody is watching is a refusal nobody reads.

source

method Server.listNotificationEndpoints

func (s *Server) listNotificationEndpoints(w http.ResponseWriter, r *http.Request, grant credential.Grant)

source

method Server.disableNotificationEndpoint

func (s *Server) disableNotificationEndpoint(w http.ResponseWriter, r *http.Request, grant credential.Grant)

source

method Server.listNotificationDeliveries

func (s *Server) listNotificationDeliveries(w http.ResponseWriter, r *http.Request, grant credential.Grant)

listNotificationDeliveries is how a parked delivery is found by asking rather than by grepping.

source

method Server.notificationsReady

func (s *Server) notificationsReady(w http.ResponseWriter) bool

notificationsReady refuses every route when the operator has named no destinations.

Refused rather than served-and-empty, because an application that registered an endpoint and got a receipt would reasonably believe it would be told, and a deployment that intends to tell nobody should say so at the first request rather than by never calling.

source

method Server.notificationError

func (s *Server) notificationError(w http.ResponseWriter, r *http.Request, grant credential.Grant, operation string, err error)

source