diff --git a/apier/v1/filters.go b/apier/v1/filters.go
index 448eebd07..c51a94402 100644
--- a/apier/v1/filters.go
+++ b/apier/v1/filters.go
@@ -68,8 +68,11 @@ func (apierV1 *ApierV1) GetFilter(arg utils.TenantID, reply *engine.Filter) erro
}
// GetFilterIDs returns list of Filter IDs registered for a tenant
-func (apierV1 *ApierV1) GetFilterIDs(tenant string, fltrIDs *[]string) error {
- prfx := utils.FilterPrefix + tenant + ":"
+func (apierV1 *ApierV1) GetFilterIDs(args utils.TenantArgWithPaginator, fltrIDs *[]string) error {
+ if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing
+ return utils.NewErrMandatoryIeMissing(missing...)
+ }
+ prfx := utils.FilterPrefix + args.Tenant + ":"
keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx)
if err != nil {
return err
@@ -81,7 +84,7 @@ func (apierV1 *ApierV1) GetFilterIDs(tenant string, fltrIDs *[]string) error {
for i, key := range keys {
retIDs[i] = key[len(prfx):]
}
- *fltrIDs = retIDs
+ *fltrIDs = args.PaginateStringSlice(retIDs)
return nil
}
diff --git a/apier/v1/filters_it_test.go b/apier/v1/filters_it_test.go
index 4bd3e84fc..844477f9c 100644
--- a/apier/v1/filters_it_test.go
+++ b/apier/v1/filters_it_test.go
@@ -145,7 +145,7 @@ func testFilterSetFilter(t *testing.T) {
func testFilterGetFilterIDs(t *testing.T) {
expected := []string{"Filter1"}
var result []string
- if err := filterRPC.Call("ApierV1.GetFilterIDs", "cgrates.org", &result); err != nil {
+ if err := filterRPC.Call(utils.ApierV1GetFilterIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil {
t.Error(err)
} else if len(expected) != len(result) {
t.Errorf("Expecting : %+v, received: %+v", expected, result)
diff --git a/console/filter.go b/console/filter.go
index 035e7e9d9..720746609 100644
--- a/console/filter.go
+++ b/console/filter.go
@@ -26,7 +26,7 @@ import (
func init() {
c := &CmdGetFilter{
name: "filter",
- rpcMethod: "ApierV1.GetFilter",
+ rpcMethod: utils.ApierV1GetFilter,
rpcParams: &utils.TenantID{},
}
commands[c.Name()] = c
diff --git a/console/filter_ids.go b/console/filter_ids.go
new file mode 100644
index 000000000..a3fe09685
--- /dev/null
+++ b/console/filter_ids.go
@@ -0,0 +1,65 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package console
+
+import (
+ "github.com/cgrates/cgrates/utils"
+)
+
+func init() {
+ c := &CmdGetFilterIDs{
+ name: "filter_ids",
+ rpcMethod: utils.ApierV1GetFilterIDs,
+ rpcParams: &utils.TenantArgWithPaginator{},
+ }
+ commands[c.Name()] = c
+ c.CommandExecuter = &CommandExecuter{c}
+}
+
+// Commander implementation
+type CmdGetFilterIDs struct {
+ name string
+ rpcMethod string
+ rpcParams *utils.TenantArgWithPaginator
+ *CommandExecuter
+}
+
+func (self *CmdGetFilterIDs) Name() string {
+ return self.name
+}
+
+func (self *CmdGetFilterIDs) RpcMethod() string {
+ return self.rpcMethod
+}
+
+func (self *CmdGetFilterIDs) RpcParams(reset bool) interface{} {
+ if reset || self.rpcParams == nil {
+ self.rpcParams = &utils.TenantArgWithPaginator{}
+ }
+ return self.rpcParams
+}
+
+func (self *CmdGetFilterIDs) PostprocessRpcParams() error {
+ return nil
+}
+
+func (self *CmdGetFilterIDs) RpcResult() interface{} {
+ atr := []string{}
+ return &atr
+}
diff --git a/console/filter_indexes.go b/console/filter_indexes.go
index 1981fbc32..594715ae1 100755
--- a/console/filter_indexes.go
+++ b/console/filter_indexes.go
@@ -19,13 +19,14 @@ along with this program. If not, see
package console
import (
- "github.com/cgrates/cgrates/apier/v1"
+ v1 "github.com/cgrates/cgrates/apier/v1"
+ "github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetFilterIndexes{
name: "filter_indexes",
- rpcMethod: "ApierV1.GetFilterIndexes",
+ rpcMethod: utils.ApierV1GetFilterIndexes,
rpcParams: &v1.AttrGetFilterIndexes{},
}
commands[c.Name()] = c
diff --git a/console/filter_indexes_remove.go b/console/filter_indexes_remove.go
index 4ec1d4217..430fe8885 100644
--- a/console/filter_indexes_remove.go
+++ b/console/filter_indexes_remove.go
@@ -19,13 +19,14 @@ along with this program. If not, see
package console
import (
- "github.com/cgrates/cgrates/apier/v1"
+ v1 "github.com/cgrates/cgrates/apier/v1"
+ "github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdRemoveFilterIndexes{
name: "filter_indexes_remove",
- rpcMethod: "ApierV1.RemoveFilterIndexes",
+ rpcMethod: utils.ApierV1RemoveFilterIndexes,
rpcParams: &v1.AttrRemFilterIndexes{},
}
commands[c.Name()] = c
diff --git a/console/filter_remove.go b/console/filter_remove.go
index c591aab9a..85b3b1574 100644
--- a/console/filter_remove.go
+++ b/console/filter_remove.go
@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveFilter{
name: "filter_remove",
- rpcMethod: "ApierV1.RemoveFilter",
+ rpcMethod: utils.ApierV1RemoveFilter,
rpcParams: &utils.TenantIDWithCache{},
}
commands[c.Name()] = c
diff --git a/console/filter_set.go b/console/filter_set.go
index 4e71aaa56..c5a00b522 100644
--- a/console/filter_set.go
+++ b/console/filter_set.go
@@ -18,12 +18,15 @@ along with this program. If not, see
package console
-import v1 "github.com/cgrates/cgrates/apier/v1"
+import (
+ v1 "github.com/cgrates/cgrates/apier/v1"
+ "github.com/cgrates/cgrates/utils"
+)
func init() {
c := &CmdSetFilter{
name: "filter_set",
- rpcMethod: "ApierV1.SetFilter",
+ rpcMethod: utils.ApierV1SetFilter,
rpcParams: &v1.FilterWithCache{},
}
commands[c.Name()] = c
diff --git a/utils/consts.go b/utils/consts.go
index de411219f..038e84d56 100755
--- a/utils/consts.go
+++ b/utils/consts.go
@@ -722,10 +722,12 @@ const (
ApierV1LoadTariffPlanFromFolder = "ApierV1.LoadTariffPlanFromFolder"
ApierV1GetCost = "ApierV1.GetCost"
ApierV1SetBalance = "ApierV1.SetBalance"
- ApierV1GetSupplierProfile = "ApierV1.GetSupplierProfile"
- ApierV1GetSupplierProfileIDs = "ApierV1.GetSupplierProfileIDs"
- ApierV1RemoveSupplierProfile = "ApierV1.RemoveSupplierProfile"
- ApierV1SetSupplierProfile = "ApierV1.SetSupplierProfile"
+ ApierV1GetFilter = "ApierV1.GetFilter"
+ ApierV1GetFilterIndexes = "ApierV1.GetFilterIndexes"
+ ApierV1RemoveFilterIndexes = "ApierV1.RemoveFilterIndexes"
+ ApierV1RemoveFilter = "ApierV1.RemoveFilter"
+ ApierV1SetFilter = "ApierV1.SetFilter"
+ ApierV1GetFilterIDs = "ApierV1.GetFilterIDs"
)
const (
@@ -747,18 +749,22 @@ const (
// SupplierS APIs
const (
- SupplierSv1GetSuppliers = "SupplierSv1.GetSuppliers"
- SupplierSv1Ping = "SupplierSv1.Ping"
+ SupplierSv1GetSuppliers = "SupplierSv1.GetSuppliers"
+ SupplierSv1Ping = "SupplierSv1.Ping"
+ ApierV1GetSupplierProfile = "ApierV1.GetSupplierProfile"
+ ApierV1GetSupplierProfileIDs = "ApierV1.GetSupplierProfileIDs"
+ ApierV1RemoveSupplierProfile = "ApierV1.RemoveSupplierProfile"
+ ApierV1SetSupplierProfile = "ApierV1.SetSupplierProfile"
)
// AttributeS APIs
const (
ApierV1GetAttributeProfile = "ApierV1.GetAttributeProfile"
ApierV1GetAttributeProfileIDs = "ApierV1.GetAttributeProfileIDs"
- AttributeSv1GetAttributeForEvent = "AttributeSv1.GetAttributeForEvent"
- AttributeSv1ProcessEvent = "AttributeSv1.ProcessEvent"
ApierV1RemoveAttributeProfile = "ApierV1.RemoveAttributeProfile"
ApierV2SetAttributeProfile = "ApierV2.SetAttributeProfile"
+ AttributeSv1GetAttributeForEvent = "AttributeSv1.GetAttributeForEvent"
+ AttributeSv1ProcessEvent = "AttributeSv1.ProcessEvent"
AttributeSv1Ping = "AttributeSv1.Ping"
)