Documentation ¶
Index ¶
- Constants
- func Log(log *slog.Logger) func(http.Handler) http.Handler
- func WError(w http.ResponseWriter, r *http.Request, err error, code int, m string) *api.Response
- type AlertStore
- type DBStore
- type ReadingSubscriber
- type SensorStore
- type Service
- func (s Service) AuthLogin(w http.ResponseWriter, r *http.Request) *api.Response
- func (s Service) AuthLogout(w http.ResponseWriter, r *http.Request) *api.Response
- func (s Service) AuthMiddleware(next http.Handler) http.Handler
- func (s Service) CreateUser(w http.ResponseWriter, r *http.Request) *api.Response
- func (us Service) DeleteUserByID(w http.ResponseWriter, r *http.Request, id ulid.ULID) *api.Response
- func (s *Service) GetAlerts(w http.ResponseWriter, r *http.Request) *api.Response
- func (s *Service) GetSensors(w http.ResponseWriter, r *http.Request) *api.Response
- func (s *Service) GetSensorsLive(w http.ResponseWriter, r *http.Request) *api.Response
- func (us Service) GetUserByID(w http.ResponseWriter, r *http.Request, id ulid.ULID) *api.Response
- func (us Service) GetUsers(w http.ResponseWriter, r *http.Request) *api.Response
- func (s *Service) GetWebpushKey(w http.ResponseWriter, r *http.Request) *api.Response
- func (s Service) PermissionsMiddleware(next http.Handler) http.Handler
- func (s *Service) RegisterWebpush(w http.ResponseWriter, r *http.Request) *api.Response
- func (s *Service) RenameSensor(w http.ResponseWriter, r *http.Request, id string, ...) *api.Response
- type SessionStore
- type UserStore
- type WebpushStore
Constants ¶
View Source
const AuthCookieName = "idiot_session_id"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlertStore ¶
type DBStore ¶
type DBStore interface { UserStore WebpushStore SensorStore AlertStore }
type ReadingSubscriber ¶
type SensorStore ¶
type Service ¶
type Service struct { CDNHost string // contains filtered or unexported fields }
func New ¶
func New(dbstore DBStore, sessionStore SessionStore, readings ReadingSubscriber, CDNHost string) *Service
func (Service) AuthLogout ¶
Logout (POST /auth/logout)
func (Service) CreateUser ¶
(POST /users)
func (Service) DeleteUserByID ¶
func (us Service) DeleteUserByID(w http.ResponseWriter, r *http.Request, id ulid.ULID) *api.Response
(DELETE /users/{id})
func (*Service) GetSensors ¶
func (*Service) GetSensorsLive ¶
GetSensorsLive returns the live data for all of the available sensors when it's available It's all streamed through a websocket (GET /sensors/live)
func (Service) GetUserByID ¶
(GET /users/{id})
func (Service) PermissionsMiddleware ¶
func (*Service) RegisterWebpush ¶
Send a webpush notification registration payload (POST /notifications/webpush)
func (*Service) RenameSensor ¶
func (s *Service) RenameSensor(w http.ResponseWriter, r *http.Request, id string, params api.RenameSensorParams) *api.Response
(POST /sensors/{id}/rename)
type SessionStore ¶
type UserStore ¶
type UserStore interface { CreateUser(ctx context.Context, user scylla.User) error GetUsers(ctx context.Context) ([]scylla.User, error) GetUser(ctx context.Context, id ulid.ULID) (scylla.User, error) GetUserByEmail(ctx context.Context, email string) (scylla.User, error) DeleteUser(ctx context.Context, id ulid.ULID) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.