mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
added API for destinations
This commit is contained in:
@@ -45,17 +45,27 @@ func (self *Apier) GetTPDestinations(attrs AttrGetTPDestinations, reply *rater.D
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *Apier) GetDestination(tag string, reply *rater.Destination) error {
|
||||
type AttrDestination {
|
||||
Id string
|
||||
Prefixes []string
|
||||
}
|
||||
|
||||
func (self *Apier) GetDestination(tag string, reply *AttrDestination) error {
|
||||
if dst, err := self.StorDb.GetDestination(tag); err != nil {
|
||||
return errors.New(utils.ERR_NOT_FOUND)
|
||||
return errors.New(utils.ERR_NOT_FOUND)
|
||||
} else {
|
||||
*reply = *dst
|
||||
reply.Id = dst.Id
|
||||
reply.Prefixes = dst.Prefixes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *Apier) SetDestination(dest *rater.Destination, reply *rater.Destination) error {
|
||||
if err := self.StorDb.SetDestination(dest); err != nil {
|
||||
func (self *Apier) SetDestination(attr *AttrDestination, reply *rater.Destination) error {
|
||||
d := &Destination{
|
||||
Id: attr.Id
|
||||
Prefixes: attr.Prefixes
|
||||
}
|
||||
if err := self.StorDb.SetDestination(d); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -300,7 +300,37 @@ GetAllTariffPlanIds
|
||||
|
||||
6.1.5. Management API
|
||||
---------------------
|
||||
These operates on live data
|
||||
These operate on live data.
|
||||
|
||||
GetDestination
|
||||
++++++++++++++
|
||||
|
||||
Gets the destinations for the specified tag.
|
||||
|
||||
::
|
||||
type AttrDestination {
|
||||
Id string
|
||||
Prefixes []string
|
||||
}
|
||||
|
||||
|
||||
Example
|
||||
GetDestination(tag string, reply \*AttrDestination)
|
||||
|
||||
SetDestination
|
||||
++++++++++++++
|
||||
|
||||
Sets the destinations for the specified tag.
|
||||
|
||||
::
|
||||
type AttrDestination {
|
||||
Id string
|
||||
Prefixes []string
|
||||
}
|
||||
|
||||
|
||||
Example
|
||||
SetDestination(attr *AttrDestination, reply \*rater.Destination)
|
||||
|
||||
GetBalance
|
||||
++++++++++
|
||||
|
||||
Reference in New Issue
Block a user