mirror of
https://github.com/mainflux/mainflux.git
synced 2025-05-04 22:17:59 +08:00

* Add can access by things ID endpoint to things service Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add new auth endpoint to the swagger docs Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add test for the new endpoint of the things service Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>
49 lines
704 B
Go
49 lines
704 B
Go
//
|
|
// Copyright (c) 2018
|
|
// Mainflux
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package grpc
|
|
|
|
import "github.com/mainflux/mainflux/things"
|
|
|
|
type accessReq struct {
|
|
thingKey string
|
|
chanID string
|
|
}
|
|
|
|
func (req accessReq) validate() error {
|
|
if req.chanID == "" || req.thingKey == "" {
|
|
return things.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type accessByIDReq struct {
|
|
thingID string
|
|
chanID string
|
|
}
|
|
|
|
func (req accessByIDReq) validate() error {
|
|
if req.thingID == "" || req.chanID == "" {
|
|
return things.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type identifyReq struct {
|
|
key string
|
|
}
|
|
|
|
func (req identifyReq) validate() error {
|
|
if req.key == "" {
|
|
return things.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|