api

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 124 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MimeTypeJpeg = "image/jpeg"
	MimeTypeGif  = "image/gif"
	MimeTypePng  = "image/png"
)
View Source
const (
	KeycloakPortalIDAttribute = "portal_id"
	OurAudience               = ""
)
View Source
const (
	DefaultFirmwarePattern = "^(.+main.+)$"
)
View Source
const ISO8601 = "2006-01-02T15:04:05-0700"
View Source
const RFC2822 = "Mon Jan 02 15:04:05 -0700 2006"
View Source
const (
	TailLength = 20
)

Variables

View Source
var (
	ErrNoConfig = errors.New("insufficient config")
)
View Source
var (
	KeyOrder = []string{
		"nonce",
		"name",
		"username",
		"email",
		"external_id",
		"require_activation",
	}
)
View Source
var (
	NameMap = map[string]string{
		"distance":    "modules.distance",
		"weather":     "modules.weather",
		"diagnostics": "modules.diagnostics",
		"ultrasonic":  "modules.distance",
	}
)

Functions

func Authenticate

func Authenticate(ctx context.Context, a common.AuthAttempt) (context.Context, error)

func AuthorizationHeaderMiddleware

func AuthorizationHeaderMiddleware(sessionKey string) (func(h http.Handler) http.Handler, error)

func CreateApi

func CreateApi(ctx context.Context, controllerOptions *ControllerOptions) (http.Handler, error)

func CreateGoaV3Handler

func CreateGoaV3Handler(ctx context.Context, options *ControllerOptions) (http.Handler, error)

func ExpeditionDefaultPicture

func ExpeditionDefaultPicture(id int64) ([]byte, error)

func FirmwareSummariesType

func FirmwareSummariesType(firmwares []*data.Firmware) []*firmware.FirmwareSummary

func FirmwareSummaryType

func FirmwareSummaryType(fw *data.Firmware) *firmware.FirmwareSummary

func FirmwaresType

func FirmwaresType(firmwares []*data.Firmware) *firmware.Firmwares

func InterceptDownloadResponses

func InterceptDownloadResponses(defaultEncoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(ctx context.Context, w http.ResponseWriter) goahttp.Encoder

func Logger

func Logger(ctx context.Context) *zap.Logger

func MakeExportStatus

func MakeExportStatus(signer *Signer, de *data.DataExport) (*exportService.ExportStatus, error)

func MakeExportStatuses

func MakeExportStatuses(signer *Signer, all []*data.DataExport) ([]*exportService.ExportStatus, error)

func NewRawQueryParamsFromCsvExport

func NewRawQueryParamsFromCsvExport(payload *exportService.CsvPayload) (*backend.RawQueryParams, error)

func NewRawQueryParamsFromJSONLinesExport

func NewRawQueryParamsFromJSONLinesExport(payload *exportService.JSONLinesPayload) (*backend.RawQueryParams, error)

func NewRawQueryParamsFromSensorData

func NewRawQueryParamsFromSensorData(payload *sensor.DataPayload) (*backend.RawQueryParams, error)

func NewTestableApi

func NewTestableApi(e *tests.TestEnv) (http.Handler, error)

func NewTransmissionToken

func NewTransmissionToken(now time.Time, user *data.User) *jwtgo.Token

func ProjectDefaultPicture

func ProjectDefaultPicture(id int64) ([]byte, error)

func ProjectType

func ProjectType(signer *Signer, dm *data.Project, numberOfFollowers int32, userRelationship *data.UserProjectRelationship) (*project.Project, error)

func ProjectUserType

func ProjectUserType(signer *Signer, dm *data.ProjectUserAndUser) (*user.ProjectUser, error)

func ProjectUsersType

func ProjectUsersType(signer *Signer, users []*data.ProjectUserAndUser, invites []*data.ProjectInvite) (*user.ProjectUsers, error)

func ProjectsType

func ProjectsType(signer *Signer, projects []*data.Project, followers []*data.FollowersSummary, relationships map[int32]*data.UserProjectRelationship) (*project.Projects, error)

func StationDefaultPicture

func StationDefaultPicture(id int64) ([]byte, error)

func ThreadedPage

func ThreadedPage(page *data.PageOfDiscussion) ([]*discService.ThreadedPost, error)

func ThreadedPost

func ThreadedPost(dp *data.DiscussionPost, users map[int32]*data.User) (*discService.ThreadedPost, error)

func UserDefaultPicture

func UserDefaultPicture(id int64) ([]byte, error)

func UserType

func UserType(signer *Signer, dm *data.User) (*user.User, error)

func VerifyToken

func VerifyToken(ctx context.Context, a common.AuthAttempt) (jwt.MapClaims, int32, error)

func ViewDataEvent

func ViewDataEvent(de *data.DataEvent, users map[int32]*data.User) (*eventsService.DataEvent, error)

func ViewDataEvents

func ViewDataEvents(des []*data.DataEvent, users map[int32]*data.User) ([]*eventsService.DataEvent, error)

Types

type ActivitiesByCreatedAt

type ActivitiesByCreatedAt []*activity.ActivityEntry

func (ActivitiesByCreatedAt) Len

func (s ActivitiesByCreatedAt) Len() int

func (ActivitiesByCreatedAt) Less

func (s ActivitiesByCreatedAt) Less(i, j int) bool

func (ActivitiesByCreatedAt) Swap

func (s ActivitiesByCreatedAt) Swap(i, j int)

type ActivityService

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

func NewActivityService

func NewActivityService(ctx context.Context, options *ControllerOptions) *ActivityService

func (*ActivityService) JWTAuth

func (s *ActivityService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*ActivityService) Project

func (*ActivityService) Station

type AfterAuthenticationFunc

type AfterAuthenticationFunc func(ctx context.Context, userID int32) error

type ApiConfiguration

type ApiConfiguration struct {
	ApiHost       string
	SessionKey    string
	MapboxToken   string
	Emailer       string
	Domain        string
	PortalDomain  string
	EmailOverride string
	Buckets       *BucketNames
}

func (*ApiConfiguration) MakeApiUrl

func (ac *ApiConfiguration) MakeApiUrl(f string, args ...interface{}) string

type AuthServer

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

func NewAuthServer

func NewAuthServer() (*AuthServer, error)

func (*AuthServer) Login

func (as *AuthServer) Login(ctx context.Context, email, password string) (*gocloak.JWT, error)

func (*AuthServer) UpdateAuthentication

func (as *AuthServer) UpdateAuthentication(ctx context.Context, user *data.User, password string) error

type AuthenticationErrorResponseBody

type AuthenticationErrorResponseBody struct {
	Name      string `form:"name" json:"name" xml:"name"`
	ID        string `form:"id" json:"id" xml:"id"`
	Message   string `form:"message" json:"message" xml:"message"`
	Temporary bool   `form:"temporary" json:"temporary" xml:"temporary"`
	Timeout   bool   `form:"timeout" json:"timeout" xml:"timeout"`
	Fault     bool   `form:"fault" json:"fault" xml:"fault"`
}

type BlocksSummaryRow

type BlocksSummaryRow struct {
	Size   int64
	Blocks data.Int64Range
}

type BucketNames

type BucketNames struct {
	Media   []string
	Streams []string
}

type Claims

type Claims struct {
	Name     string `json:"name"`
	Given    string `json:"given_name"`
	Family   string `json:"family_name"`
	Email    string `json:"email"`
	Verified bool   `json:"email_verified"`
}

type ControllerOptions

type ControllerOptions struct {
	Config       *ApiConfiguration
	Session      *session.Session
	Database     *sqlxcache.DB
	Querier      *data.Querier
	JWTHMACKey   []byte
	Emailer      email.Emailer
	Domain       string
	PortalDomain string
	Metrics      *logging.Metrics
	Publisher    jobs.MessagePublisher
	MediaFiles   files.FileArchive

	// Twitter
	ConsumerKey    string
	ConsumerSecret string
	// contains filtered or unexported fields
}

func CreateServiceOptions

func CreateServiceOptions(ctx context.Context, config *ApiConfiguration, database *sqlxcache.DB, publisher jobs.MessagePublisher, mediaFiles files.FileArchive,
	awsSession *session.Session, metrics *logging.Metrics, que *gue.Client, influxConfig *querying.InfluxDBConfig, timeScaleConfig *storage.TimeScaleDBConfig) (controllerOptions *ControllerOptions, err error)

func NewServiceOptions

func NewServiceOptions(e *tests.TestEnv) (*ControllerOptions, error)

func (*ControllerOptions) Close

func (o *ControllerOptions) Close() error

type CsvService

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

func NewCsvService

func NewCsvService(ctx context.Context, options *ControllerOptions) *CsvService

func (*CsvService) JWTAuth

func (s *CsvService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*CsvService) Noop

func (s *CsvService) Noop(ctx context.Context) error

type DataService

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

func NewDataService

func NewDataService(ctx context.Context, options *ControllerOptions) *DataService

func (*DataService) DeviceSummary

func (*DataService) JWTAuth

func (s *DataService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

type DiscourseAuth

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

func NewDiscourseAuth

func NewDiscourseAuth(options *ControllerOptions, config *DiscourseAuthConfig) *DiscourseAuth

func (*DiscourseAuth) Validate

func (sa *DiscourseAuth) Validate(ssoVal string, sigVal string) (*ValidatedDiscourseAttempt, error)

type DiscourseAuthConfig

type DiscourseAuthConfig struct {
	RedirectURL  string
	SharedSecret string
	AdminKey     string
}

func NewDiscourseAuthConfig

func NewDiscourseAuthConfig() *DiscourseAuthConfig

type DiscourseService

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

func NewDiscourseService

func NewDiscourseService(ctx context.Context, options *ControllerOptions) *DiscourseService

func (*DiscourseService) Authenticate

type DiscussionPermissions

type DiscussionPermissions interface {
	Permissions
	Discussion() *data.DiscussionPost
	CanDelete() error
}

type DiscussionService

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

func NewDiscussionService

func NewDiscussionService(ctx context.Context, options *ControllerOptions) *DiscussionService

func (*DiscussionService) Data

func (*DiscussionService) DeleteMessage

func (c *DiscussionService) DeleteMessage(ctx context.Context, payload *discService.DeleteMessagePayload) error

func (*DiscussionService) JWTAuth

func (s *DiscussionService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*DiscussionService) PostMessage

func (*DiscussionService) Project

func (*DiscussionService) UpdateMessage

type DownloadResponseBody

type DownloadResponseBody struct {
	Length      int64
	ContentType string
	Body        []byte
	Etag        string
}

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

type EventsService

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

func NewEventsService

func NewEventsService(ctx context.Context, options *ControllerOptions) *EventsService

func (*EventsService) AddDataEvent

func (*EventsService) DataEventsEndpoint

func (c *EventsService) DataEventsEndpoint(ctx context.Context, payload *eventsService.DataEventsPayload) (*eventsService.DataEvents, error)

func (*EventsService) DeleteDataEvent

func (c *EventsService) DeleteDataEvent(ctx context.Context, payload *eventsService.DeleteDataEventPayload) error

func (*EventsService) JWTAuth

func (s *EventsService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

type ExportService

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

func NewExportService

func NewExportService(ctx context.Context, options *ControllerOptions) *ExportService

func (*ExportService) Csv

func (*ExportService) Download

func (*ExportService) JSONLines

func (*ExportService) JWTAuth

func (s *ExportService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*ExportService) ListMine

func (*ExportService) Status

type ExternalMedia

type ExternalMedia struct {
	URL         string
	ContentType string
}

type FirmwareService

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

func NewFirmwareService

func NewFirmwareService(ctx context.Context, options *ControllerOptions) *FirmwareService

func (*FirmwareService) Add

func (s *FirmwareService) Add(ctx context.Context, payload *firmware.AddPayload) error

func (*FirmwareService) Delete

func (s *FirmwareService) Delete(ctx context.Context, payload *firmware.DeletePayload) error

func (*FirmwareService) Download

func (*FirmwareService) JWTAuth

func (s *FirmwareService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*FirmwareService) List

type FollowingService

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

func NewFollowingService

func NewFollowingService(ctx context.Context, options *ControllerOptions) *FollowingService

func (*FollowingService) Follow

func (c *FollowingService) Follow(ctx context.Context, payload *following.FollowPayload) error

func (*FollowingService) Followers

func (c *FollowingService) Followers(ctx context.Context, payload *following.FollowersPayload) (page *following.FollowersPage, err error)

func (*FollowingService) JWTAuth

func (s *FollowingService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*FollowingService) Unfollow

func (c *FollowingService) Unfollow(ctx context.Context, payload *following.UnfollowPayload) error

type InformationService

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

func NewInformationService

func NewInformationService(ctx context.Context, options *ControllerOptions) *InformationService

func (*InformationService) DeviceLayout

func (*InformationService) FirmwareStatistics

func (*InformationService) JWTAuth

func (s *InformationService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

type IngestionService

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

func NewIngestionService

func NewIngestionService(ctx context.Context, options *ControllerOptions) *IngestionService

func (*IngestionService) Delete

func (c *IngestionService) Delete(ctx context.Context, payload *ingestion.DeletePayload) (err error)

func (*IngestionService) JWTAuth

func (s *IngestionService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*IngestionService) ProcessIngestion

func (c *IngestionService) ProcessIngestion(ctx context.Context, payload *ingestion.ProcessIngestionPayload) (err error)

func (*IngestionService) ProcessPending

func (c *IngestionService) ProcessPending(ctx context.Context, payload *ingestion.ProcessPendingPayload) (err error)

func (*IngestionService) ProcessStation

func (c *IngestionService) ProcessStation(ctx context.Context, payload *ingestion.ProcessStationPayload) (err error)

func (*IngestionService) ProcessStationIngestions

func (c *IngestionService) ProcessStationIngestions(ctx context.Context, payload *ingestion.ProcessStationIngestionsPayload) (err error)

func (*IngestionService) RefreshViews

func (c *IngestionService) RefreshViews(ctx context.Context, payload *ingestion.RefreshViewsPayload) (err error)

func (*IngestionService) WalkEverything

func (c *IngestionService) WalkEverything(ctx context.Context, payload *ingestion.WalkEverythingPayload) (err error)

type KeycloakConfig

type KeycloakConfig struct {
	Realm       string
	URL         string
	ApiUser     string
	ApiPassword string
	ApiRealm    string
}

func NewKeycloakConfig

func NewKeycloakConfig() *KeycloakConfig

func (*KeycloakConfig) Valid

func (c *KeycloakConfig) Valid() bool

type LinkState

type LinkState struct {
	After *string `json:"after"`
}

type Listener

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

func NewListener

func NewListener(options *ControllerOptions, stream notifications.ListenServerStream, afterAuth AfterAuthenticationFunc) (l *Listener)

type ListenerError

type ListenerError struct {
	Message   string
	Connected bool
}

func (*ListenerError) Error

func (e *ListenerError) Error() string

type MetaResult

type MetaResult struct {
	Sensors []*SensorMeta `json:"sensors"`
	Modules interface{}   `json:"modules"`
}

type ModulesService

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

func NewModulesService

func NewModulesService(ctx context.Context, options *ControllerOptions) *ModulesService

func (*ModulesService) Meta

type NoteMediaWithNoteID

type NoteMediaWithNoteID struct {
	NoteID *int64 `db:"note_id,omitempty"`
	data.FieldNoteMedia
}

type NotesService

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

func NewNotesService

func NewNotesService(ctx context.Context, options *ControllerOptions) *NotesService

func (*NotesService) DeleteMedia

func (s *NotesService) DeleteMedia(ctx context.Context, payload *notes.DeleteMediaPayload) error

func (*NotesService) DownloadMedia

func (*NotesService) Get

func (s *NotesService) Get(ctx context.Context, payload *notes.GetPayload) (*notes.FieldNotes, error)

func (*NotesService) JWTAuth

func (s *NotesService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*NotesService) Update

func (s *NotesService) Update(ctx context.Context, payload *notes.UpdatePayload) (*notes.FieldNotes, error)

func (*NotesService) UploadMedia

func (s *NotesService) UploadMedia(ctx context.Context, payload *notes.UploadMediaPayload, body io.ReadCloser) (*notes.NoteMedia, error)

type NotificationsService

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

func NewNotificationsService

func NewNotificationsService(ctx context.Context, options *ControllerOptions) *NotificationsService

func (*NotificationsService) JWTAuth

func (s *NotificationsService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*NotificationsService) Listen

func (*NotificationsService) Seen

type OidcAuth

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

func NewOidcAuth

func NewOidcAuth(ctx context.Context, options *ControllerOptions, config *OidcAuthConfig) (*OidcAuth, error)

type OidcAuthConfig

type OidcAuthConfig struct {
	ClientID     string
	ClientSecret string
	ConfigURL    string
	RedirectURL  string
}

func NewOidcAuthConfig

func NewOidcAuthConfig() *OidcAuthConfig

type OidcService

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

func NewOidcService

func NewOidcService(ctx context.Context, options *ControllerOptions) *OidcService

func (*OidcService) Authenticate

func (*OidcService) Required

func (*OidcService) URL

type Permissions

type Permissions interface {
	Unwrap() (permissions Permissions, err error)
	UserID() int32
	Anonymous() bool
	MaybeUserID() *int32
	RefreshToken() string
	RequireAdmin() error
	IsAdmin() bool
	ForProjectByID(id int32) (permissions ProjectPermissions, err error)
	ForProject(project *data.Project) (permissions ProjectPermissions, err error)
	ForStationByID(id int) (permissions StationPermissions, err error)
	ForStationByDeviceID(id []byte) (permissions StationPermissions, err error)
	ForStation(station *data.Station) (permissions StationPermissions, err error)
	ForDiscussions(discussion *data.DiscussionPost) (permissions DiscussionPermissions, err error)
}

func NewPermissions

func NewPermissions(ctx context.Context, options *ControllerOptions) Permissions

type PhotoCache

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

func NewPhotoCache

func NewPhotoCache(originals files.FileArchive, metrics *logging.Metrics) *PhotoCache

func (*PhotoCache) Load

func (pc *PhotoCache) Load(ctx context.Context, media *ExternalMedia, resize *PhotoResizeSettings, crop *PhotoCropSettings, ifNoneMatch *string) (*PhotoFromCache, error)

type PhotoCropSettings

type PhotoCropSettings struct {
	X uint
	Y uint
}

type PhotoFromCache

type PhotoFromCache struct {
	Bytes       []byte
	Size        uint
	ContentType string
	Etag        string
	EtagMatch   bool
}

type PhotoResizeSettings

type PhotoResizeSettings struct {
	Size int32
}

type Pile

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

func NewPile

func NewPile(metrics *logging.Metrics, name string) *Pile

func (*Pile) Add

func (pile *Pile) Add(ctx context.Context, key PileKey, reader io.Reader) error

func (*Pile) AddBytes

func (pile *Pile) AddBytes(ctx context.Context, key PileKey, data []byte) error

func (*Pile) Close

func (pile *Pile) Close() error

func (*Pile) Delete

func (pile *Pile) Delete(ctx context.Context) error

func (*Pile) Find

func (pile *Pile) Find(ctx context.Context, key PileKey) (io.Reader, int64, error)

func (*Pile) IsOpen

func (pile *Pile) IsOpen() bool

func (*Pile) Open

func (pile *Pile) Open(ctx context.Context) error

type PileKey

type PileKey string

type PileMeta

type PileMeta struct {
	Size int64        `json:"size"`
	Tail []*pileEntry `json:"tail"`
}

type ProjectPermissions

type ProjectPermissions interface {
	Permissions
	Project() *data.Project
	CanView() error
	CanModify() error
}

type ProjectService

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

func NewProjectService

func NewProjectService(ctx context.Context, options *ControllerOptions) *ProjectService

func (*ProjectService) AcceptInvite

func (c *ProjectService) AcceptInvite(ctx context.Context, payload *project.AcceptInvitePayload) (err error)

func (*ProjectService) AcceptProjectInvite

func (c *ProjectService) AcceptProjectInvite(ctx context.Context, payload *project.AcceptProjectInvitePayload) (err error)

func (*ProjectService) Add

func (*ProjectService) AddStation

func (c *ProjectService) AddStation(ctx context.Context, payload *project.AddStationPayload) error

func (*ProjectService) AddUpdate

func (c *ProjectService) AddUpdate(ctx context.Context, payload *project.AddUpdatePayload) (pu *project.ProjectUpdate, err error)

func (*ProjectService) Delete

func (c *ProjectService) Delete(ctx context.Context, payload *project.DeletePayload) error

func (*ProjectService) DeleteUpdate

func (c *ProjectService) DeleteUpdate(ctx context.Context, payload *project.DeleteUpdatePayload) (err error)

func (*ProjectService) DownloadPhoto

func (*ProjectService) EditUser

func (c *ProjectService) EditUser(ctx context.Context, payload *project.EditUserPayload) error

func (*ProjectService) Get

func (*ProjectService) Invite

func (c *ProjectService) Invite(ctx context.Context, payload *project.InvitePayload) error

func (*ProjectService) Invites

func (c *ProjectService) Invites(ctx context.Context, payload *project.InvitesPayload) (invites *project.PendingInvites, err error)

func (*ProjectService) JWTAuth

func (s *ProjectService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*ProjectService) ListCommunity

func (c *ProjectService) ListCommunity(ctx context.Context, payload *project.ListCommunityPayload) (*project.Projects, error)

func (*ProjectService) ListMine

func (c *ProjectService) ListMine(ctx context.Context, payload *project.ListMinePayload) (*project.Projects, error)

func (*ProjectService) LookupInvite

func (c *ProjectService) LookupInvite(ctx context.Context, payload *project.LookupInvitePayload) (invites *project.PendingInvites, err error)

func (*ProjectService) ModifyUpdate

func (c *ProjectService) ModifyUpdate(ctx context.Context, payload *project.ModifyUpdatePayload) (pu *project.ProjectUpdate, err error)

func (*ProjectService) ProjectsStation

func (c *ProjectService) ProjectsStation(ctx context.Context, payload *project.ProjectsStationPayload) (*project.Projects, error)

func (*ProjectService) RejectInvite

func (c *ProjectService) RejectInvite(ctx context.Context, payload *project.RejectInvitePayload) (err error)

func (*ProjectService) RejectProjectInvite

func (c *ProjectService) RejectProjectInvite(ctx context.Context, payload *project.RejectProjectInvitePayload) (err error)

func (*ProjectService) RemoveStation

func (c *ProjectService) RemoveStation(ctx context.Context, payload *project.RemoveStationPayload) error

func (*ProjectService) RemoveUser

func (c *ProjectService) RemoveUser(ctx context.Context, payload *project.RemoveUserPayload) error

func (*ProjectService) Update

func (c *ProjectService) Update(ctx context.Context, payload *project.UpdatePayload) (*project.Project, error)

func (*ProjectService) UploadPhoto

func (s *ProjectService) UploadPhoto(ctx context.Context, payload *project.UploadPhotoPayload, body io.ReadCloser) error

type ProvisionSummaryRow

type ProvisionSummaryRow struct {
	GenerationID []byte          `db:"generation"`
	Type         string          `db:"type"`
	Blocks       data.Int64Range `db:"blocks"`
}

type RecordsService

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

func NewRecordsService

func NewRecordsService(ctx context.Context, options *ControllerOptions) *RecordsService

func (*RecordsService) Data

func (*RecordsService) JWTAuth

func (s *RecordsService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*RecordsService) Meta

func (*RecordsService) Resolved

type ResizedImage

type ResizedImage struct {
	Size        int64
	ContentType string
	Body        io.Reader
	Data        []byte
}

type ResolveFunc

type ResolveFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type SamlAuth

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

func NewSamlAuth

func NewSamlAuth(options *ControllerOptions, config *SamlAuthConfig) *SamlAuth

func (*SamlAuth) Mount

func (sa *SamlAuth) Mount(ctx context.Context, app http.Handler) (http.Handler, error)

type SamlAuthConfig

type SamlAuthConfig struct {
	CertPath           string
	KeyPath            string
	ServiceProviderURL string
	LoginURLTemplate   string
	IDPMetaURL         string
}

type SensorMeta

type SensorMeta struct {
	ID  int64  `json:"id"`
	Key string `json:"key"`
}

type SensorService

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

func NewSensorService

func NewSensorService(ctx context.Context, options *ControllerOptions, influxConfig *querying.InfluxDBConfig, timeScaleConfig *storage.TimeScaleDBConfig) *SensorService

func (*SensorService) Bookmark

func (*SensorService) Data

func (*SensorService) JWTAuth

func (s *SensorService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*SensorService) Meta

func (*SensorService) Recently

func (*SensorService) Resolve

func (*SensorService) SensorMeta

func (c *SensorService) SensorMeta(ctx context.Context) (*sensor.SensorMetaResult, error)

func (*SensorService) StationMeta

func (*SensorService) Tail

type Signer

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

func NewSigner

func NewSigner(key []byte) (s *Signer)

func (*Signer) SignAndBustURL

func (s *Signer) SignAndBustURL(url string, key *string) (*string, error)

func (*Signer) SignURL

func (s *Signer) SignURL(url string) (string, error)

func (*Signer) Verify

func (s *Signer) Verify(token string) error

type StationPermissions

type StationPermissions interface {
	Permissions
	Station() *data.Station
	CanView() error
	CanModify() error
	IsReadOnly() (bool, error)
}

type StationService

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

func NewStationService

func NewStationService(ctx context.Context, options *ControllerOptions) *StationService

func (*StationService) Add

func (c *StationService) Add(ctx context.Context, payload *station.AddPayload) (response *station.StationFull, err error)

func (*StationService) AdminSearch

func (*StationService) DefaultPhoto

func (c *StationService) DefaultPhoto(ctx context.Context, payload *station.DefaultPhotoPayload) (err error)

func (*StationService) Delete

func (c *StationService) Delete(ctx context.Context, payload *station.DeletePayload) error

func (*StationService) DownloadPhoto

func (*StationService) Get

func (c *StationService) Get(ctx context.Context, payload *station.GetPayload) (response *station.StationFull, err error)

func (*StationService) JWTAuth

func (s *StationService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*StationService) ListAll

func (*StationService) ListAssociated

func (c *StationService) ListAssociated(ctx context.Context, payload *station.ListAssociatedPayload) (response *station.AssociatedStations, err error)

func (*StationService) ListMine

func (c *StationService) ListMine(ctx context.Context, payload *station.ListMinePayload) (response *station.StationsFull, err error)

func (*StationService) ListProject

func (c *StationService) ListProject(ctx context.Context, payload *station.ListProjectPayload) (response *station.StationsFull, err error)

func (*StationService) ListProjectAssociated

func (c *StationService) ListProjectAssociated(ctx context.Context, payload *station.ListProjectAssociatedPayload) (response *station.AssociatedStations, err error)

func (*StationService) Progress

func (c *StationService) Progress(ctx context.Context, payload *station.ProgressPayload) (response *station.StationProgress, err error)

func (*StationService) Transfer

func (c *StationService) Transfer(ctx context.Context, payload *station.TransferPayload) (err error)

func (*StationService) Update

func (c *StationService) Update(ctx context.Context, payload *station.UpdatePayload) (response *station.StationFull, err error)

func (*StationService) UpdateModule

func (c *StationService) UpdateModule(ctx context.Context, payload *station.UpdateModulePayload) (response *station.StationFull, err error)

type StationsMeta

type StationsMeta struct {
	Stations map[int32][]*repositories.StationSensor `json:"stations"`
}

type StreamAndCacheFriendlyEncoder

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

func (*StreamAndCacheFriendlyEncoder) Encode

func (e *StreamAndCacheFriendlyEncoder) Encode(v interface{}) error

func (*StreamAndCacheFriendlyEncoder) EncodeDownload

func (e *StreamAndCacheFriendlyEncoder) EncodeDownload(body *DownloadResponseBody) error

type Subscriptions

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

func NewSubscriptions

func NewSubscriptions() (s *Subscriptions)

func (*Subscriptions) Add

func (s *Subscriptions) Add(ctx context.Context, userID int32, listener *Listener) error

func (*Subscriptions) Publish

func (s *Subscriptions) Publish(ctx context.Context, userID int32, data []map[string]interface{}) error

func (*Subscriptions) Remove

func (s *Subscriptions) Remove(ctx context.Context, userID int32, listener *Listener) error

type TasksService

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

func NewTasksService

func NewTasksService(ctx context.Context, options *ControllerOptions) *TasksService

func (*TasksService) Five

func (c *TasksService) Five(ctx context.Context) error

TODO This should be authenticated.

func (*TasksService) JWTAuth

func (s *TasksService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

type TestService

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

func NewTestSevice

func NewTestSevice(ctx context.Context, options *ControllerOptions) *TestService

func (*TestService) Email

func (sc *TestService) Email(ctx context.Context, payload *test.EmailPayload) error

func (*TestService) Error

func (sc *TestService) Error(ctx context.Context) error

func (*TestService) Get

func (sc *TestService) Get(ctx context.Context, payload *test.GetPayload) error

func (*TestService) JWTAuth

func (s *TestService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

type UserService

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

func NewUserService

func NewUserService(ctx context.Context, options *ControllerOptions) *UserService

func (*UserService) AcceptTnc

func (s *UserService) AcceptTnc(ctx context.Context, payload *user.AcceptTncPayload) (*user.User, error)

func (*UserService) Add

func (s *UserService) Add(ctx context.Context, payload *user.AddPayload) (*user.User, error)

func (*UserService) AdminDelete

func (s *UserService) AdminDelete(outerCtx context.Context, payload *user.AdminDeletePayload) error

func (*UserService) AdminSearch

func (c *UserService) AdminSearch(ctx context.Context, payload *user.AdminSearchPayload) (*user.AdminSearchResult, error)

func (*UserService) AdminTermsAndConditions

func (c *UserService) AdminTermsAndConditions(ctx context.Context, payload *user.AdminTermsAndConditionsPayload) error

func (*UserService) ChangePassword

func (s *UserService) ChangePassword(ctx context.Context, payload *user.ChangePasswordPayload) (*user.User, error)

func (*UserService) DownloadPhoto

func (s *UserService) DownloadPhoto(ctx context.Context, payload *user.DownloadPhotoPayload) (*user.DownloadedPhoto, error)

func (*UserService) GetCurrent

func (s *UserService) GetCurrent(ctx context.Context, payload *user.GetCurrentPayload) (*user.User, error)

func (*UserService) IssueTransmissionToken

func (s *UserService) IssueTransmissionToken(ctx context.Context, payload *user.IssueTransmissionTokenPayload) (*user.TransmissionToken, error)

func (*UserService) JWTAuth

func (s *UserService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)

func (*UserService) ListByProject

func (s *UserService) ListByProject(ctx context.Context, payload *user.ListByProjectPayload) (*user.ProjectUsers, error)

func (*UserService) Login

func (s *UserService) Login(ctx context.Context, payload *user.LoginPayload) (*user.LoginResult, error)

func (*UserService) Logout

func (s *UserService) Logout(ctx context.Context, payload *user.LogoutPayload) error

func (*UserService) Mentionables

func (c *UserService) Mentionables(ctx context.Context, payload *user.MentionablesPayload) (*user.MentionableOptions, error)

func (*UserService) ProjectRoles

func (s *UserService) ProjectRoles(ctx context.Context) (user.ProjectRoleCollection, error)

func (*UserService) Recovery

func (s *UserService) Recovery(ctx context.Context, payload *user.RecoveryPayload) error

func (*UserService) RecoveryLookup

func (s *UserService) RecoveryLookup(ctx context.Context, payload *user.RecoveryLookupPayload) error

func (*UserService) Refresh

func (s *UserService) Refresh(ctx context.Context, payload *user.RefreshPayload) (*user.RefreshResult, error)

func (*UserService) Resume

func (s *UserService) Resume(ctx context.Context, payload *user.ResumePayload) (*user.ResumeResult, error)

func (*UserService) Roles

func (s *UserService) Roles(ctx context.Context, payload *user.RolesPayload) (*user.AvailableRoles, error)

func (*UserService) SendValidation

func (s *UserService) SendValidation(ctx context.Context, payload *user.SendValidationPayload) error

func (*UserService) Update

func (s *UserService) Update(ctx context.Context, payload *user.UpdatePayload) (*user.User, error)

func (*UserService) UploadPhoto

func (s *UserService) UploadPhoto(ctx context.Context, payload *user.UploadPhotoPayload, body io.ReadCloser) error

func (*UserService) Validate

func (s *UserService) Validate(ctx context.Context, payload *user.ValidatePayload) (*user.ValidateResult, error)

type ValidatedDiscourseAttempt

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

func (*ValidatedDiscourseAttempt) Finish

func (va *ValidatedDiscourseAttempt) Finish(userID, email, name, username string, requireActivation bool) (string, error)

Jump to

Keyboard shortcuts

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