diff --git a/apier/tpdestinations.go b/apier/tpdestinations.go index 3db7bf067..d582cac1d 100644 --- a/apier/tpdestinations.go +++ b/apier/tpdestinations.go @@ -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 diff --git a/docs/apicalls.rst b/docs/apicalls.rst index bd20c6b38..0c395c98b 100644 --- a/docs/apicalls.rst +++ b/docs/apicalls.rst @@ -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 ++++++++++