Documentation
¶
Index ¶
- Variables
- type Interactor
- type ThingInteractor
- func (i *ThingInteractor) Auth(authorization, id string) error
- func (i *ThingInteractor) List(authorization string) error
- func (i *ThingInteractor) PublishData(authorization, thingID string, data []entities.Data) error
- func (i *ThingInteractor) Register(authorization, id, name string) error
- func (i *ThingInteractor) RequestData(authorization, thingID string, sensorIds []int) error
- func (i *ThingInteractor) Unregister(authorization, id string) error
- func (i *ThingInteractor) UpdateData(authorization, thingID string, data []entities.Data) error
- func (i *ThingInteractor) UpdateSchema(authorization, thingID string, schemaList []entities.Schema) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAuthNotProvided is returned when authorization token is not provided ErrAuthNotProvided = errors.New("authorization token not provided") // ErrIDNotProvided is returned when thing's id is not provided ErrIDNotProvided = errors.New("thing's id not provided") // ErrNameNotProvided is returned when thing's name is not provided ErrNameNotProvided = errors.New("thing's name not provided") // ErrSchemaNotProvided is returned when thing's schema is not provided ErrSchemaNotProvided = errors.New("thing's schema not provided") // ErrDataNotProvided is returned when thing's data is not provided ErrDataNotProvided = errors.New("thing's data not provided") // ErrSensorsNotProvided is returned when thing's sensors are not provided ErrSensorsNotProvided = errors.New("thing's sensors not provided") // ErrIDLength is returned when the thing's id have more than 16 ascii characters ErrIDLength = errors.New("id length exceeds 16 characters") // ErrIDNotHex is returned when the thing's id is not formatted in hexadecimal base ErrIDNotHex = errors.New("id is not in hexadecimal format") // ErrSchemaInvalid is returned when schema has an invalid format ErrSchemaInvalid = errors.New("invalid schema") // ErrSensorInvalid is returned when some sensorId mismatch with thing's schema ErrSensorInvalid = errors.New("sensor list is incompatible with thing's schema") // ErrSchemaUndefined is returned when the thing has no schema yet ErrSchemaUndefined = errors.New("thing has no schema") // ErrDataInvalid is returned when the provided data mismatch the thing's schema ErrDataInvalid = errors.New("data is incompatible with thing's schema") )
Functions ¶
This section is empty.
Types ¶
type Interactor ¶
type Interactor interface { Register(authorization, id, name string) error Unregister(authorization, id string) error UpdateSchema(authorization, id string, schemaList []entities.Schema) error List(authorization string) error RequestData(authorization, thingID string, sensorIds []int) error UpdateData(authorization, thingID string, data []entities.Data) error PublishData(authorization, thingID string, data []entities.Data) error Auth(authorization, id string) error }
Interactor is an interface that defines the thing's use cases operations
type ThingInteractor ¶
type ThingInteractor struct {
// contains filtered or unexported fields
}
ThingInteractor represents the thing interactor capabilities, it's composed by the necessary dependencies
func NewThingInteractor ¶
func NewThingInteractor( logger logging.Logger, publisher amqp.ClientPublisher, thingProxy http.ThingProxy, connector amqp.ConnectorPublisher, ) *ThingInteractor
NewThingInteractor creates a new ThingInteractor instance
func (*ThingInteractor) Auth ¶
func (i *ThingInteractor) Auth(authorization, id string) error
Auth is responsible to implement the thing's authentication use case
func (*ThingInteractor) List ¶
func (i *ThingInteractor) List(authorization string) error
List fetchs the registered things and return them as an array
func (*ThingInteractor) PublishData ¶
func (i *ThingInteractor) PublishData(authorization, thingID string, data []entities.Data) error
PublishData executes the use case operations to publish data from the things to cloud
func (*ThingInteractor) Register ¶
func (i *ThingInteractor) Register(authorization, id, name string) error
Register runs the use case to create a new thing
func (*ThingInteractor) RequestData ¶
func (i *ThingInteractor) RequestData(authorization, thingID string, sensorIds []int) error
RequestData executes the use case operations to request data from the thing
func (*ThingInteractor) Unregister ¶
func (i *ThingInteractor) Unregister(authorization, id string) error
Unregister runs the use case to remove a registered thing
func (*ThingInteractor) UpdateData ¶
func (i *ThingInteractor) UpdateData(authorization, thingID string, data []entities.Data) error
UpdateData executes the use case operations to update data in thing
func (*ThingInteractor) UpdateSchema ¶
func (i *ThingInteractor) UpdateSchema(authorization, thingID string, schemaList []entities.Schema) error
UpdateSchema receive the new sensor schema and update it on the thing's service