From 9bae11097a23e23bca985fd84872bd8c12450a9d Mon Sep 17 00:00:00 2001 From: TeoV Date: Sun, 17 Feb 2019 11:40:01 +0200 Subject: [PATCH] Add chargers_for_event command in cgr-console --- console/chargers_for_event.go | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 console/chargers_for_event.go diff --git a/console/chargers_for_event.go b/console/chargers_for_event.go new file mode 100644 index 000000000..28a78f64d --- /dev/null +++ b/console/chargers_for_event.go @@ -0,0 +1,66 @@ +/* +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/dispatchers" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" +) + +func init() { + c := &CmdGetChargersForEvent{ + name: "chargers_for_event", + rpcMethod: utils.ChargerSv1GetChargersForEvent, + rpcParams: &dispatchers.CGREvWithApiKey{}, + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +type CmdGetChargersForEvent struct { + name string + rpcMethod string + rpcParams *dispatchers.CGREvWithApiKey + *CommandExecuter +} + +func (self *CmdGetChargersForEvent) Name() string { + return self.name +} + +func (self *CmdGetChargersForEvent) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdGetChargersForEvent) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + self.rpcParams = &dispatchers.CGREvWithApiKey{} + } + return self.rpcParams +} + +func (self *CmdGetChargersForEvent) PostprocessRpcParams() error { + return nil +} + +func (self *CmdGetChargersForEvent) RpcResult() interface{} { + atr := engine.ChargerProfiles{} + return &atr +}