1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-05-06 19:29:15 +08:00
Manuel Imperiale 6ad654d7cb
MF-1263 - Move repeating errors to the separate package (#1540)
* 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>
2022-01-27 17:03:57 +01:00

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
}