Documentation ¶
Index ¶
- Constants
- type Action
- func (action *Action) GetDescription() ActionDescription
- func (action *Action) GetId() string
- func (action *Action) GetInput() map[string]any
- func (action *Action) GetName() string
- func (action *Action) GetStatus() string
- func (action *Action) GetThingId() string
- func (action *Action) SetErr(err error)
- type ActionDescription
- type ActionsManager
- type ActionsModel
- type AddonInfo
- type AddonStore
- type AddonsModel
- type Claims
- type Jsonwebtoken
- type JsonwebtokenStore
- type Payload
- type Settings
- type SettingsStore
- type TokenData
- type User
- type Users
- type UsersStore
Constants ¶
View Source
const ( ActionCompleted = "completed" ActionPending = "pending" ActionCreated = "created" ActionError = "error" ActionDeleted = "deleted" ActionPair = "pair" ActionUnpair = "unpair" )
View Source
const RoleUserToken = "user_token"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { Id string `json:"-"` ThingId string `json:"-"` Name string `json:"name,omitempty"` Input map[string]any `json:"input,omitempty"` Href string `json:"href,omitempty"` TimeRequested *time.Time `json:"timeRequested,omitempty"` TimeCompleted *time.Time `json:"timeCompleted,omitempty"` Status string `json:"status,omitempty"` Error error `json:"error,omitempty"` }
func NewActionModel ¶
func (*Action) GetDescription ¶
func (action *Action) GetDescription() ActionDescription
func (*Action) GetThingId ¶
type ActionDescription ¶
type ActionsManager ¶
type ActionsManager interface { AddNewThings(timeOut int) error CancelAddNewThing() RequestAction(ctx context.Context, thingId, actionName string, input map[string]any) error RemoveThing(id string) error RemoveAction(thingId string, actionId string, actionName string) error CancelRemoveThing(id string) }
type ActionsModel ¶
type ActionsModel struct {
// contains filtered or unexported fields
}
func NewActionsModel ¶
func NewActionsModel(m ActionsManager, container *container.ThingsContainer) *ActionsModel
func (*ActionsModel) Add ¶
func (m *ActionsModel) Add(a *Action) error
func (*ActionsModel) Remove ¶
func (m *ActionsModel) Remove(id string) error
type AddonStore ¶
type AddonsModel ¶
type AddonsModel struct {
Store AddonStore
}
func NewAddonsModel ¶
func NewAddonsModel(store AddonStore) *AddonsModel
type Claims ¶
type Claims struct { UserId int64 `json:"userId"` KeyId string `json:"KeyId"` Payload jwt.StandardClaims }
type Jsonwebtoken ¶
type Jsonwebtoken struct { Store JsonwebtokenStore // contains filtered or unexported fields }
func NewJsonwebtokenModel ¶
func NewJsonwebtokenModel(settingsModel *Settings, store JsonwebtokenStore) *Jsonwebtoken
func (*Jsonwebtoken) IssueToken ¶
func (j *Jsonwebtoken) IssueToken(userId int64) (string, error)
type JsonwebtokenStore ¶
type JsonwebtokenStore interface { CreateJSONWebToken(data *db.TokeDataStorage) error GetJSONWebTokenByKeyId(keyId string) (*db.TokeDataStorage, error) }
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
func NewSettingsModel ¶
func NewSettingsModel(addonUrl []string, storage SettingsStore) *Settings
func (*Settings) GetAddonInfo ¶
func (*Settings) GetTemperatureUnits ¶
func (*Settings) GetTunnelInfo ¶
type SettingsStore ¶
type TokenData ¶
type TokenData struct { User int64 `json:"user"` IssuedAt time.Time `json:"issuedAt"` PublicKey []byte `json:"publicKey"` KeyId string `json:"keyId"` Payload // contains filtered or unexported fields }
func NewTokenData ¶
func NewTokenData() *TokenData
type User ¶
type User struct { ID int64 Name string Email string Hash string MfaEnrolled bool MfaBackupCodes string }
func (*User) ComparePassword ¶
ComparePassword check the password
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
func NewUsersModel ¶
func NewUsersModel(store UsersStore) *Users
func (*Users) GetUsersCount ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.