mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add API's for RateProfiles
This commit is contained in:
committed by
Dan Christian Bogos
parent
75406ceaf2
commit
7d1b0a5e03
65
console/rateprofile_ids.go
Normal file
65
console/rateprofile_ids.go
Normal file
@@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdRateProfileIDs{
|
||||
name: "rateprofile_ids",
|
||||
rpcMethod: utils.APIerSv1GetRateProfileIDs,
|
||||
rpcParams: &utils.TenantArgWithPaginator{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
// Commander implementation
|
||||
type CmdRateProfileIDs struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.TenantArgWithPaginator
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdRateProfileIDs) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdRateProfileIDs) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdRateProfileIDs) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &utils.TenantArgWithPaginator{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdRateProfileIDs) PostprocessRpcParams() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdRateProfileIDs) RpcResult() interface{} {
|
||||
var atr []string
|
||||
return &atr
|
||||
}
|
||||
62
console/rateprofile_remove.go
Normal file
62
console/rateprofile_remove.go
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import "github.com/cgrates/cgrates/utils"
|
||||
|
||||
func init() {
|
||||
c := &CmdRemoveRateProfile{
|
||||
name: "rateprofile_remove",
|
||||
rpcMethod: utils.APIerSv1RemoveRateProfile,
|
||||
rpcParams: &utils.TenantIDWithCache{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdRemoveRateProfile struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.TenantIDWithCache
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdRemoveRateProfile) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdRemoveRateProfile) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdRemoveRateProfile) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &utils.TenantIDWithCache{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdRemoveRateProfile) PostprocessRpcParams() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdRemoveRateProfile) RpcResult() interface{} {
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
66
console/rateprofile_set.go
Normal file
66
console/rateprofile_set.go
Normal file
@@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
v1 "github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSetRateProfile{
|
||||
name: "rateprofile_set",
|
||||
rpcMethod: utils.APIerSv1SetRateProfile,
|
||||
rpcParams: &v1.RateProfileWithCache{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdSetRateProfile struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *v1.RateProfileWithCache
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdSetRateProfile) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdSetRateProfile) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdSetRateProfile) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &v1.RateProfileWithCache{RateProfileWithArgDispatcher: new(engine.RateProfileWithArgDispatcher)}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdSetRateProfile) PostprocessRpcParams() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdSetRateProfile) RpcResult() interface{} {
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
66
console/rateprofiles.go
Normal file
66
console/rateprofiles.go
Normal file
@@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdGetRateProfile{
|
||||
name: "rateprofile",
|
||||
rpcMethod: utils.APIerSv1GetRateProfile,
|
||||
rpcParams: &utils.TenantID{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
// Commander implementation
|
||||
type CmdGetRateProfile struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.TenantID
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdGetRateProfile) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdGetRateProfile) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdGetRateProfile) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &utils.TenantID{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdGetRateProfile) PostprocessRpcParams() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdGetRateProfile) RpcResult() interface{} {
|
||||
var atr engine.RateProfile
|
||||
return &atr
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
func init() {
|
||||
c := &CmdGetRatingProfileIDs{
|
||||
name: "ratingprofil_ids",
|
||||
name: "ratingprofile_ids",
|
||||
rpcMethod: utils.APIerSv1GetRatingProfileIDs,
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
Reference in New Issue
Block a user