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>
33 lines
701 B
Go
33 lines
701 B
Go
// Copyright (c) Abstract Machines
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package api
|
|
|
|
import (
|
|
"github.com/absmach/magistrala/internal/api"
|
|
"github.com/absmach/magistrala/journal"
|
|
"github.com/absmach/magistrala/pkg/apiutil"
|
|
)
|
|
|
|
type retrieveJournalsReq struct {
|
|
token string
|
|
page journal.Page
|
|
}
|
|
|
|
func (req retrieveJournalsReq) validate() error {
|
|
if req.token == "" {
|
|
return apiutil.ErrBearerToken
|
|
}
|
|
if req.page.Limit > api.DefLimit {
|
|
return apiutil.ErrLimitSize
|
|
}
|
|
if req.page.Direction != "" && req.page.Direction != api.AscDir && req.page.Direction != api.DescDir {
|
|
return apiutil.ErrInvalidDirection
|
|
}
|
|
if req.page.EntityID == "" {
|
|
return apiutil.ErrMissingID
|
|
}
|
|
|
|
return nil
|
|
}
|