Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateAPIKey(length int) (key string, err error)
- type Device
- type DeviceApiKey
- type DeviceWebhook
- type Storage
- func (s *Storage) ChangeID(id, newID string) error
- func (s *Storage) Delete(id string) error
- func (s *Storage) GenNewDevAPIKey(deviceID string) error
- func (s *Storage) GetByAPIToken(token string) (*Device, error)
- func (s *Storage) GetByID(id string) (*Device, error)
- func (s *Storage) ListByOwnerID(ownerID uint) ([]Device, error)
- func (s *Storage) Rename(id, newName string) error
- func (s *Storage) Save(d *Device) error
- func (s *Storage) SaveWebhook(wh *DeviceWebhook) error
- type StorageProvider
- type WebhookData
Constants ¶
View Source
const (
APIKeyLength = 32
)
Variables ¶
View Source
var (
ErrDeviceNotFound = internal.NewError(internal.ENOTFOUND, "Device not found", "device.not_found")
)
Functions ¶
func GenerateAPIKey ¶
Types ¶
type Device ¶
type Device struct { ID string `json:"id"` Name string `json:"name"` OwnerID uint `json:"owner_id"` LinkedAt time.Time `json:"linked_at"` ApiKey DeviceApiKey `json:"api_key"` Webhook *DeviceWebhook `json:"webhook"` }
type DeviceApiKey ¶
type DeviceWebhook ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func NewStorage(provider StorageProvider, pbCli pb.ControllerServiceClient) *Storage
func (*Storage) GenNewDevAPIKey ¶
func (*Storage) SaveWebhook ¶
func (s *Storage) SaveWebhook(wh *DeviceWebhook) error
type StorageProvider ¶
type StorageProvider interface { ListByOwnerID(uint) ([]Device, error) GetByID(string) (*Device, error) Save(*Device) error Patch(*Device) error Delete(string) error SaveAPIKey(*DeviceApiKey) error GetByAPIToken(string) (*Device, error) SaveWebhook(*DeviceWebhook) error // Deprecated ChangeID(id, newID string) error }
type WebhookData ¶
Click to show internal directories.
Click to hide internal directories.