mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
ee3716623c
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
26 lines
439 B
Go
26 lines
439 B
Go
// Copyright (c) Abstract Machines
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package api
|
|
|
|
import (
|
|
"github.com/absmach/magistrala/pkg/apiutil"
|
|
"github.com/absmach/magistrala/pkg/messaging"
|
|
)
|
|
|
|
type publishReq struct {
|
|
msg *messaging.Message
|
|
token string
|
|
}
|
|
|
|
func (req publishReq) validate() error {
|
|
if req.token == "" {
|
|
return apiutil.ErrBearerKey
|
|
}
|
|
if len(req.msg.Payload) == 0 {
|
|
return apiutil.ErrEmptyMessage
|
|
}
|
|
|
|
return nil
|
|
}
|