mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-27 13:48:49 +08:00

* MF-1368 - Add internal http api package for query params reading Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix comments Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix comments Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use internal/http and internalhttp alias Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv errors types to pkg Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use httputil/query.go and remove aliases Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add blank lines after error definitions Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add ReadBoolValueQuery Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv readBoolValueQuery Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * User ErrNotFoundParam instead of pointer Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Revert ReadUintQuery to use default values Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use default values for all query readers Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
29 lines
525 B
Go
29 lines
525 B
Go
package api
|
|
|
|
import "github.com/mainflux/mainflux/pkg/errors"
|
|
|
|
type provisionReq struct {
|
|
token string
|
|
Name string `json:"name"`
|
|
ExternalID string `json:"external_id"`
|
|
ExternalKey string `json:"external_key"`
|
|
}
|
|
|
|
func (req provisionReq) validate() error {
|
|
if req.ExternalID == "" || req.ExternalKey == "" {
|
|
return errors.ErrMalformedEntity
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type mappingReq struct {
|
|
token string
|
|
}
|
|
|
|
func (req mappingReq) validate() error {
|
|
if req.token == "" {
|
|
return errUnauthorized
|
|
}
|
|
return nil
|
|
}
|