diff --git a/console/user_addindex.go b/console/user_addindex.go new file mode 100644 index 000000000..bc0b0b2b6 --- /dev/null +++ b/console/user_addindex.go @@ -0,0 +1,63 @@ +/* +Rating system designed to be used in VoIP Carriers World +Copyright (C) 2012-2015 ITsysCOM + +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 + +func init() { + c := &CmdUserAddIndex{ + name: "user_addindex", + rpcMethod: "UsersV1.AddIndex", + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdUserAddIndex struct { + name string + rpcMethod string + rpcParams *[]string + *CommandExecuter +} + +func (self *CmdUserAddIndex) Name() string { + return self.name +} + +func (self *CmdUserAddIndex) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdUserAddIndex) RpcParams(ptr bool) interface{} { + if self.rpcParams == nil { + self.rpcParams = &[]string{} + } + if ptr { + return self.rpcParams + } + return *self.rpcParams +} + +func (self *CmdUserAddIndex) PostprocessRpcParams() error { + return nil +} + +func (self *CmdUserAddIndex) RpcResult() interface{} { + var s string + return &s +} diff --git a/console/user_remove.go b/console/user_remove.go new file mode 100644 index 000000000..ccdac6ad3 --- /dev/null +++ b/console/user_remove.go @@ -0,0 +1,65 @@ +/* +Rating system designed to be used in VoIP Carriers World +Copyright (C) 2012-2015 ITsysCOM + +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/engine" + +func init() { + c := &CmdUserRemove{ + name: "user_remove", + rpcMethod: "UsersV1.RemoveUser", + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdUserRemove struct { + name string + rpcMethod string + rpcParams *engine.UserProfile + *CommandExecuter +} + +func (self *CmdUserRemove) Name() string { + return self.name +} + +func (self *CmdUserRemove) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdUserRemove) RpcParams(ptr bool) interface{} { + if self.rpcParams == nil { + self.rpcParams = &engine.UserProfile{} + } + if ptr { + return self.rpcParams + } + return *self.rpcParams +} + +func (self *CmdUserRemove) PostprocessRpcParams() error { + return nil +} + +func (self *CmdUserRemove) RpcResult() interface{} { + var s string + return &s +} diff --git a/console/user_set.go b/console/user_set.go new file mode 100644 index 000000000..618b09a79 --- /dev/null +++ b/console/user_set.go @@ -0,0 +1,65 @@ +/* +Rating system designed to be used in VoIP Carriers World +Copyright (C) 2012-2015 ITsysCOM + +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/engine" + +func init() { + c := &CmdSetUser{ + name: "user_set", + rpcMethod: "UsersV1.SetUser", + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdSetUser struct { + name string + rpcMethod string + rpcParams *engine.UserProfile + *CommandExecuter +} + +func (self *CmdSetUser) Name() string { + return self.name +} + +func (self *CmdSetUser) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdSetUser) RpcParams(ptr bool) interface{} { + if self.rpcParams == nil { + self.rpcParams = &engine.UserProfile{} + } + if ptr { + return self.rpcParams + } + return *self.rpcParams +} + +func (self *CmdSetUser) PostprocessRpcParams() error { + return nil +} + +func (self *CmdSetUser) RpcResult() interface{} { + var s string + return &s +} diff --git a/console/user_update.go b/console/user_update.go new file mode 100644 index 000000000..e9867be1d --- /dev/null +++ b/console/user_update.go @@ -0,0 +1,65 @@ +/* +Rating system designed to be used in VoIP Carriers World +Copyright (C) 2012-2015 ITsysCOM + +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/engine" + +func init() { + c := &CmdUpdateUser{ + name: "user_update", + rpcMethod: "UsersV1.UpdateUser", + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdUpdateUser struct { + name string + rpcMethod string + rpcParams *engine.UserProfile + *CommandExecuter +} + +func (self *CmdUpdateUser) Name() string { + return self.name +} + +func (self *CmdUpdateUser) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdUpdateUser) RpcParams(ptr bool) interface{} { + if self.rpcParams == nil { + self.rpcParams = &engine.UserProfile{} + } + if ptr { + return self.rpcParams + } + return *self.rpcParams +} + +func (self *CmdUpdateUser) PostprocessRpcParams() error { + return nil +} + +func (self *CmdUpdateUser) RpcResult() interface{} { + var s string + return &s +} diff --git a/console/users.go b/console/users.go new file mode 100644 index 000000000..2d3b648fb --- /dev/null +++ b/console/users.go @@ -0,0 +1,66 @@ +/* +Rating system designed to be used in VoIP Carriers World +Copyright (C) 2012-2015 ITsysCOM + +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/engine" + +func init() { + c := &CmdGetUsers{ + name: "users", + rpcMethod: "UsersV1.GetUsers", + rpcParams: &engine.UserProfile{}, + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdGetUsers struct { + name string + rpcMethod string + rpcParams *engine.UserProfile + *CommandExecuter +} + +func (self *CmdGetUsers) Name() string { + return self.name +} + +func (self *CmdGetUsers) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdGetUsers) RpcParams(ptr bool) interface{} { + if self.rpcParams == nil { + self.rpcParams = &engine.UserProfile{} + } + if ptr { + return self.rpcParams + } + return *self.rpcParams +} + +func (self *CmdGetUsers) PostprocessRpcParams() error { + return nil +} + +func (self *CmdGetUsers) RpcResult() interface{} { + s := []*engine.UserProfile{} + return &s +} diff --git a/engine/users.go b/engine/users.go index ea85cd253..e15b5965f 100644 --- a/engine/users.go +++ b/engine/users.go @@ -201,21 +201,21 @@ func NewProxyUserService(addr string, attempts, reconnects int) (*ProxyUserServi } func (ps *ProxyUserService) SetUser(ud UserProfile, reply *string) error { - return ps.Client.Call("UserService.SetUser", ud, reply) + return ps.Client.Call("UsersV1.SetUser", ud, reply) } func (ps *ProxyUserService) RemoveUser(ud UserProfile, reply *string) error { - return ps.Client.Call("UserService.RemoveUser", ud, reply) + return ps.Client.Call("UsersV1.RemoveUser", ud, reply) } func (ps *ProxyUserService) UpdateUser(ud UserProfile, reply *string) error { - return ps.Client.Call("UserService.UpdateUser", ud, reply) + return ps.Client.Call("UsersV1.UpdateUser", ud, reply) } func (ps *ProxyUserService) GetUsers(ud UserProfile, users *[]*UserProfile) error { - return ps.Client.Call("UserService.GetUsers", ud, users) + return ps.Client.Call("UsersV1.GetUsers", ud, users) } func (ps *ProxyUserService) AddIndex(indexes []string, reply *string) error { - return ps.Client.Call("UserService.AddIndex", indexes, reply) + return ps.Client.Call("UsersV1.AddIndex", indexes, reply) }