From bc8265757ffc9840c482150fe2175435a012da59 Mon Sep 17 00:00:00 2001 From: adragusin Date: Thu, 14 May 2020 18:01:11 +0300 Subject: [PATCH] Added GetActionsCount API --- apier/v2/apier.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apier/v2/apier.go b/apier/v2/apier.go index 74c8f5d3c..90ed8500a 100644 --- a/apier/v2/apier.go +++ b/apier/v2/apier.go @@ -216,6 +216,21 @@ func (apiv2 *APIerSv2) GetActions(attr AttrGetActions, reply *map[string]engine. return nil } +type AttrGetActionsCount struct{} + +// GetActionsCount get +func (apiv2 *APIerSv2) GetActionsCount(attr AttrGetActionsCount, reply *int) (err error) { + var actionKeys []string + if actionKeys, err = apiv2.DataManager.DataDB().GetKeysForPrefix(utils.ACTION_PREFIX); err != nil { + return err + } + *reply = len(actionKeys) + if len(actionKeys) == 0 { + return utils.ErrNotFound + } + return nil +} + type AttrGetDestinations struct { DestinationIDs []string }