Asset Diagram Service - rettersoft/rbs-docs GitHub Wiki

RBS Asset Diagram Service

This service provides queries and mutations for diagram-based operations.

Models

Options

You can put your diagrams into options with following attributes.

{
    "optionId": "WMS_COUNT",
    "data": {
        "assets": [
            {
                "id": "SELLABLE",
                "name": "Sellable",
                "options": {
                    "ttl": {
                        "val": "exp",
                        "to": "DISCARD"
                    }
                }
            },
            {
                "id": "RESERVED",
                "name": "Reserved"
            },
            {
                "id": "SOLD",
                "name": "Sold"
            },
            {
                "id": "INVEST",
                "name": "Investigation",
                "options": {
                    "ttl": {
                        "val": 864000,
                        "to": "$back"
                    }
                }
            },
            {
                "id": "DISCARD",
                "name": "Discarded"
            }
        ],
        "rules": [
            { "direction": ["SELLABLE", "INVEST"] },
            {
                "direction": ["SELLABLE", "RESERVED"],
                "options": {
                    "ttl": {
                        "val": 300,
                        "to": "SELLABLE"
                    }
                }
            },

            { "direction": ["RESERVED", "SOLD"] },
            { "direction": ["RESERVED", "SELLABLE"] },
            { "direction": ["SOLD", "INVEST"] },
            { "direction": ["INVEST", "DISCARD"] },
            { "direction": ["INVEST", "SELLABLE"] }
        ]
    }
}

It's also possible to generate a UML form of diagram to draw a schema. Please keep reading for more information.

Counts

from represents source pool and type represents target pool.

CountItem {
    assetId: string
    attributes: string
    qty: number
}

CountInput {
    diagram: string
    type: string
    assetId: string
    attributes: string
    qty: number
    fire?: boolean
}

MoveCountInput {
    diagram: string
    from: string
    type: string
    items: CountItem[]
    fire?: boolean
}

CountFilter {
    type: string
    assetId: string
    attributes: string
}

Working With Options

rbs.ads.request.GET_OPTION : returns diagrams in JSON format

Example Request : { "optionId": "WMS_COUNT" }


rbs.ads.request.DRAW_OPTION : returns diagrams in UML format

Example Request : { "optionId": "WMS_COUNT" }

Example Response :

[<frame>Project|
    [SELLABLE | Sellable Products | active: true | ttl: DISCARD (exp) | first: true]
    [RESERVED | Reserved Products | hold: true]
    [SOLD | Sold Products | last: true]
    [INVEST | Investigation | ttl: $back (864000)]
    [DISCARD | Discarded Products]
    [SELLABLE] -> [INVEST]
    [SELLABLE] -> [RESERVED]
    [RESERVED] -> [SOLD]
    [RESERVED] -> [SELLABLE]
    [SOLD] -> [INVEST]
    [INVEST] -> [DISCARD]
    [INVEST] -> [SELLABLE]
]

Please go to nomnoml.com and paste the template above to see the operation diagram!

Working With Counts

rbs.ads.request.GET_COUNTS : returns count of current items in a pool

Example Request :

[
    {
        "type": "SELLABLE",
        "assetId": "VARIANT_GROUP_ID",
        "attributes": "SKU"
    }
]

Example Response :

[
    {
        "type": "SELLABLE",
        "assetId": "VARIANT_GROUP_ID",
        "attributes": "SKU",
        "qty": 5
    }
]

rbs.ads.request.MOVE_COUNT : moves items between two different pools

Example Request :

{
    "diagram": "WMS_STOCK",
    "from": "SELLABLE",
    "type": "RESERVED",
    "items": [
        {
            "assetId": "VARIANT_GROUP_ID",
            "attributes": "SKU",
            "qty": 1
        }
    ],
    "fire": true
}

Example Response :

{
    "diagram": "WMS_STOCK",
    "from": "SELLABLE",
    "type": "RESERVED",
    "items": [
        {
            "assetId": "VARIANT_GROUP_ID",
            "attributes": "SKU",
            "qty": 1
        }
    ],
    "fire": true
}

rbs.ads.request.INCREASE_COUNT : increases items in a pool

Example Request :

{
    "diagram": "WMS_STOCK",
    "type": "SELLABLE",
    "assetId": "VARIANT_GROUP_ID",
    "attributes": "SKU",
    "qty": 1,
    "fire": true
}

Example Response :

{
    "diagram": "WMS_STOCK",
    "type": "SELLABLE",
    "assetId": "VARIANT_GROUP_ID",
    "attributes": "SKU",
    "qty": 1,
    "fire": true
}

TODO

  • Logs ?!
⚠️ **GitHub.com Fallback** ⚠️