mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Adding documentation for Apier.GetTPDestination and Apier.GetTPDestinationIds methods
This commit is contained in:
@@ -21,28 +21,14 @@ package apier
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/cgrates/cgrates/rater"
|
||||
"github.com/cgrates/cgrates/rater"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
// Return destinations profile for a destination tag received as parameter
|
||||
func (self *Apier) GetTPDestinationIds(TPid string, reply *[]string) error {
|
||||
if TPid == "" {
|
||||
return fmt.Errorf("%s:TPid", utils.ERR_MANDATORY_IE_MISSING)
|
||||
}
|
||||
if ids, err := self.StorDb.GetTPDestinationIds(TPid); err != nil {
|
||||
return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error())
|
||||
} else if ids == nil {
|
||||
return errors.New(utils.ERR_NOT_FOUND)
|
||||
} else {
|
||||
*reply = ids
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AttrGetTPDestination struct {
|
||||
TPid string
|
||||
DestinationId string
|
||||
TPid string // Tariff plan id
|
||||
DestinationId string // Destination id
|
||||
}
|
||||
|
||||
// Return destinations profile for a destination tag received as parameter
|
||||
@@ -61,9 +47,9 @@ func (self *Apier) GetTPDestination(attrs AttrGetTPDestination, reply *rater.Des
|
||||
}
|
||||
|
||||
type AttrSetTPDestination struct {
|
||||
TPid string
|
||||
DestinationId string
|
||||
Prefixes []string
|
||||
TPid string // Tariff plan id
|
||||
DestinationId string // Destination id
|
||||
Prefixes []string // Set of prefixes attached to this destination
|
||||
}
|
||||
|
||||
func (self *Apier) SetTPDestination(attrs AttrSetTPDestination, reply *string) error {
|
||||
|
||||
@@ -174,34 +174,82 @@ Errors:
|
||||
SERVER_ERROR - Server error occurred.
|
||||
DUPLICATE - The specified combination of TPid/DestinationId already exists in StorDb.
|
||||
|
||||
**GetTPDestination**
|
||||
Gets a JSON destination structure.
|
||||
**Apier.GetTPDestination**
|
||||
|
||||
Parametrs:
|
||||
Queries a specific destination.
|
||||
|
||||
TPid
|
||||
A string containing traiff plan id
|
||||
Request:
|
||||
|
||||
Tag
|
||||
A destination tag string
|
||||
Data:
|
||||
::
|
||||
|
||||
Example
|
||||
GetTPDestination("1dec2012", "DAN_NET")
|
||||
|
||||
Reply: '{"Reply": {"Tag": "DAN_NET", "Prefixes": ["4917", "4918"]}}'
|
||||
type AttrGetTPDestination struct {
|
||||
TPid string // Tariff plan id
|
||||
DestinationId string // Destination id
|
||||
}
|
||||
|
||||
**GetAllTPDestinations**
|
||||
Get all destinations
|
||||
JSON output example:
|
||||
::
|
||||
|
||||
Parametrs:
|
||||
{"params": [{"DestinationId": "FIRST_DST2", "TPid": "FIRST_TP"}], "method": "Apier.GetTPDestination", "id": 0}
|
||||
|
||||
TPid
|
||||
A string containing traiff plan id
|
||||
|
||||
Example
|
||||
GetAllTPDestinations("1dec2012")
|
||||
Reply:
|
||||
|
||||
Reply: '{"Reply": [{"Tag": "DAN_NET", "Prefixes": ["4917", "4918"]}, {"Tag": "RIF_NET", "Prefixes": ["40723"]}]}'
|
||||
Data:
|
||||
::
|
||||
|
||||
type Destination struct {
|
||||
Id string
|
||||
Prefixes []string
|
||||
}
|
||||
|
||||
JSON output example:
|
||||
::
|
||||
|
||||
{"id":0,"result":{"Id":"FIST_DST2","Prefixes":["123","345"]},"error":null}
|
||||
|
||||
Errors:
|
||||
MANDATORY_IE_MISSING - Mandatory parameter missing from request.
|
||||
SERVER_ERROR - Server error occurred.
|
||||
NOT_FOUND - Requested destination not found.
|
||||
|
||||
|
||||
**Apier.GetTPDestinationIds**
|
||||
|
||||
Queries destination identities on specific tariff plan.
|
||||
|
||||
Request:
|
||||
|
||||
Data:
|
||||
::
|
||||
|
||||
type AttrGetTPDestinationIds struct {
|
||||
TPid string // Tariff plan id
|
||||
}
|
||||
|
||||
JSON output example:
|
||||
::
|
||||
|
||||
{"params": [{"TPid": "FIST_TP"}], "method": "Apier.GetTPDestinationIds", "id": 1}
|
||||
|
||||
|
||||
Reply:
|
||||
|
||||
Data:
|
||||
::
|
||||
|
||||
[]string
|
||||
|
||||
JSON output example:
|
||||
::
|
||||
|
||||
{"id":1,"result":["FIST_DST","FIST_DST1","FIST_DST2","FIST_DST3","FIST_DST4"],"error":null}
|
||||
|
||||
Errors:
|
||||
MANDATORY_IE_MISSING - Mandatory parameter missing from request.
|
||||
SERVER_ERROR - Server error occurred.
|
||||
NOT_FOUND - Requested tariff plan not found.
|
||||
|
||||
Timings
|
||||
+++++++
|
||||
|
||||
Reference in New Issue
Block a user