2019-10-07 08:14:47 -06:00
|
|
|
// Copyright (c) Mainflux
|
2018-08-26 13:15:48 +02:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2018-05-15 17:13:09 +02:00
|
|
|
package grpc
|
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
import "github.com/mainflux/mainflux/things"
|
2018-05-15 17:13:09 +02:00
|
|
|
|
2019-10-21 15:24:45 -06:00
|
|
|
type AccessByKeyReq struct {
|
2018-05-15 17:13:09 +02:00
|
|
|
thingKey string
|
2018-12-05 13:09:25 +01:00
|
|
|
chanID string
|
2018-05-15 17:13:09 +02:00
|
|
|
}
|
|
|
|
|
2019-10-21 15:24:45 -06:00
|
|
|
func (req AccessByKeyReq) validate() error {
|
2018-12-05 13:09:25 +01:00
|
|
|
if req.chanID == "" || req.thingKey == "" {
|
2018-05-15 17:13:09 +02:00
|
|
|
return things.ErrMalformedEntity
|
|
|
|
}
|
2019-07-15 18:28:15 +02:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type accessByIDReq struct {
|
|
|
|
thingID string
|
|
|
|
chanID string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req accessByIDReq) validate() error {
|
|
|
|
if req.thingID == "" || req.chanID == "" {
|
|
|
|
return things.ErrMalformedEntity
|
|
|
|
}
|
|
|
|
|
2018-05-15 17:13:09 +02:00
|
|
|
return nil
|
|
|
|
}
|
2018-05-17 20:17:02 +02:00
|
|
|
|
|
|
|
type identifyReq struct {
|
|
|
|
key string
|
|
|
|
}
|
2019-07-15 18:28:15 +02:00
|
|
|
|
|
|
|
func (req identifyReq) validate() error {
|
|
|
|
if req.key == "" {
|
|
|
|
return things.ErrMalformedEntity
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|