mirror of
https://github.com/mainflux/mainflux.git
synced 2025-05-06 19:29:15 +08:00

* MF-1263 - Mv duplicated errors to pkg/errors Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Revert test build flags Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix merge Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix comment Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
58 lines
906 B
Go
58 lines
906 B
Go
// Copyright (c) Mainflux
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package grpc
|
|
|
|
import "github.com/mainflux/mainflux/pkg/errors"
|
|
|
|
type AccessByKeyReq struct {
|
|
thingKey string
|
|
chanID string
|
|
}
|
|
|
|
func (req AccessByKeyReq) validate() error {
|
|
if req.chanID == "" || req.thingKey == "" {
|
|
return errors.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type accessByIDReq struct {
|
|
thingID string
|
|
chanID string
|
|
}
|
|
|
|
func (req accessByIDReq) validate() error {
|
|
if req.thingID == "" || req.chanID == "" {
|
|
return errors.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type channelOwnerReq struct {
|
|
owner string
|
|
chanID string
|
|
}
|
|
|
|
func (req channelOwnerReq) validate() error {
|
|
if req.owner == "" || req.chanID == "" {
|
|
return errors.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type identifyReq struct {
|
|
key string
|
|
}
|
|
|
|
func (req identifyReq) validate() error {
|
|
if req.key == "" {
|
|
return errors.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|