mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Formatting SetAccountActions api documentation
This commit is contained in:
@@ -211,14 +211,18 @@ type AttrAccount struct {
|
||||
ActionTimingsId string
|
||||
}
|
||||
|
||||
// Ads a new account into dataDb. If already defined, returns success.
|
||||
func (self *Apier) AddAccount(attr *AttrAccount, reply *float64) error {
|
||||
if missing := utils.MissingStructFields(&attrs, []string{"Tenant", "Direction","Account","Type","ActionTimingsId"}); len(missing) != 0 {
|
||||
return fmt.Errorf("%s:%v", utils.ERR_MANDATORY_IE_MISSING, missing)
|
||||
}
|
||||
tag := fmt.Sprintf("%s:%s:%s", attr.Direction, attr.Tenant, attr.Account)
|
||||
ub := &rater.UserBalance{
|
||||
Id: tag,
|
||||
Type: attr.Type,
|
||||
}
|
||||
if err := self.DataDb.SetUserBalance(ub); err != nil {
|
||||
return err
|
||||
return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error())
|
||||
}
|
||||
if attr.ActionTimingsId != "" {
|
||||
if ats, err := self.DataDb.GetActionTimings(attr.ActionTimingsId); err == nil {
|
||||
@@ -231,7 +235,7 @@ func (self *Apier) AddAccount(attr *AttrAccount, reply *float64) error {
|
||||
self.Sched.Restart()
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
56
docs/api_accounts.rst
Normal file
56
docs/api_accounts.rst
Normal file
@@ -0,0 +1,56 @@
|
||||
Apier.SetAccountActions
|
||||
+++++++++++++++++++++++
|
||||
|
||||
|
||||
Process dependencies and load a specific AccountActions profile from storDb into dataDb.
|
||||
|
||||
**Request**:
|
||||
|
||||
Data:
|
||||
::
|
||||
|
||||
type AttrSetAccountActions struct {
|
||||
TPid string
|
||||
AccountActionsId string
|
||||
}
|
||||
|
||||
Mandatory parameters: ``[]string{"TPid", "AccountActionsId"}``
|
||||
|
||||
*JSON sample*:
|
||||
::
|
||||
|
||||
{
|
||||
"id": 0,
|
||||
"method": "Apier.SetAccountActions",
|
||||
"params": [
|
||||
{
|
||||
"AccountActionsId": "SAMPLE_AA_1",
|
||||
"TPid": "SAMPLE_TP_1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
**Reply**:
|
||||
|
||||
Data:
|
||||
::
|
||||
|
||||
string
|
||||
|
||||
Possible answers:
|
||||
``OK`` - Success.
|
||||
|
||||
*JSON sample*:
|
||||
::
|
||||
|
||||
{
|
||||
"error": null,
|
||||
"id": 0,
|
||||
"result": "OK"
|
||||
}
|
||||
|
||||
**Errors**:
|
||||
|
||||
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
|
||||
|
||||
``SERVER_ERROR`` - Server error occurred.
|
||||
@@ -344,63 +344,8 @@ Example
|
||||
AddAccount(attr \*AttrAccount, reply \*float64)
|
||||
|
||||
|
||||
Apier.SetAccountAction
|
||||
++++++++++++++++++++++
|
||||
|
||||
|
||||
Process dependencies and load a specific account action from storDb into dataDb.
|
||||
|
||||
**Request**:
|
||||
|
||||
Data:
|
||||
::
|
||||
|
||||
type AttrSetAccountAction struct {
|
||||
TPid string
|
||||
AccountActionId string
|
||||
}
|
||||
|
||||
Mandatory parameters: ``[]string{"TPid", "AccountActionId"}``
|
||||
|
||||
*JSON sample*:
|
||||
::
|
||||
|
||||
{
|
||||
"id": 0,
|
||||
"method": "Apier.SetAccountAction",
|
||||
"params": [
|
||||
{
|
||||
"AccountActionId": "ACC_SAMPLE_1",
|
||||
"TPid": "TPID_SAMPLE_1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
**Reply**:
|
||||
|
||||
Data:
|
||||
::
|
||||
|
||||
string
|
||||
|
||||
Possible answers:
|
||||
``OK`` - Success.
|
||||
|
||||
*JSON sample*:
|
||||
::
|
||||
|
||||
{
|
||||
"error": null,
|
||||
"id": 0,
|
||||
"result": "OK"
|
||||
}
|
||||
|
||||
**Errors**:
|
||||
|
||||
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
|
||||
|
||||
``SERVER_ERROR`` - Server error occurred.
|
||||
|
||||
RatingProfiles
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
@@ -409,5 +354,15 @@ RatingProfiles
|
||||
|
||||
api_ratingprofiles
|
||||
|
||||
Accounts
|
||||
~~~~~~~~
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
api_accounts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user