Added cgr-console suppliers related APIs

This commit is contained in:
edwardro22
2017-12-13 17:20:07 +02:00
committed by Dan Christian Bogos
parent 55872d572a
commit ac96f48d27
4 changed files with 260 additions and 0 deletions

66
console/suppliers.go Normal file
View 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 := &CmdGetSuppliers{
name: "suppliers",
rpcMethod: "ApierV1.GetSupplierProfile",
rpcParams: &utils.TenantID{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetSuppliers struct {
name string
rpcMethod string
rpcParams *utils.TenantID
*CommandExecuter
}
func (self *CmdGetSuppliers) Name() string {
return self.name
}
func (self *CmdGetSuppliers) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetSuppliers) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantID{}
}
return self.rpcParams
}
func (self *CmdGetSuppliers) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetSuppliers) RpcResult() interface{} {
atr := engine.SupplierProfile{}
return &atr
}

View File

@@ -0,0 +1,64 @@
/*
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"
//rename to suppliers everything
func init() {
c := &CmdRemoveSuppliers{
name: "suppliers_remove",
rpcMethod: "ApierV1.RemSupplierProfile",
rpcParams: &utils.TenantID{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdRemoveSuppliers struct {
name string
rpcMethod string
rpcParams *utils.TenantID
*CommandExecuter
}
func (self *CmdRemoveSuppliers) Name() string {
return self.name
}
func (self *CmdRemoveSuppliers) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRemoveSuppliers) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantID{}
}
return self.rpcParams
}
func (self *CmdRemoveSuppliers) PostprocessRpcParams() error {
return nil
}
func (self *CmdRemoveSuppliers) RpcResult() interface{} {
var s string
return &s
}

63
console/suppliers_set.go Normal file
View File

@@ -0,0 +1,63 @@
/*
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"
func init() {
c := &CmdSetSuppliers{
name: "suppliers_set",
rpcMethod: "ApierV1.SetSupplierProfile",
rpcParams: &engine.SupplierProfile{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdSetSuppliers struct {
name string
rpcMethod string
rpcParams *engine.SupplierProfile
*CommandExecuter
}
func (self *CmdSetSuppliers) Name() string {
return self.name
}
func (self *CmdSetSuppliers) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetSuppliers) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.SupplierProfile{}
}
return self.rpcParams
}
func (self *CmdSetSuppliers) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetSuppliers) RpcResult() interface{} {
var s string
return &s
}

67
console/suppliers_sort.go Normal file
View File

@@ -0,0 +1,67 @@
/*
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 := &CmdSuppliersSort{
name: "suppliers_sort",
rpcMethod: "SupplierSv1.GetSuppliers",
rpcParams: new(utils.CGREvent),
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdSuppliersSort struct {
name string
rpcMethod string
rpcParams *utils.CGREvent
clientArgs []string
*CommandExecuter
}
func (self *CmdSuppliersSort) Name() string {
return self.name
}
func (self *CmdSuppliersSort) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSuppliersSort) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(utils.CGREvent)
}
return self.rpcParams
}
func (self *CmdSuppliersSort) PostprocessRpcParams() error {
return nil
}
func (self *CmdSuppliersSort) RpcResult() interface{} {
atr := engine.SupplierProfile{}
return &atr
}