Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

API Reference [experimental]

Defelo edited this page May 31, 2020 · 9 revisions

Inventory

/inventory/list

Returns a list of all the items in your inventory

No parameters.

Responses:

  • Success:
{
  "elements": [{
    "element_uuid": "<UUID of the item [string, UUID]>",
    "element_name": "<Name of the item [string]>",
    "related_ms": "<Microservice related to the item [string]>",
    "owner": "<UUID of the owner of the item [string, UUID]>"
  }]
}

/inventory/trade

Send an item to another user

Required parameters:

  • element_uuid: UUID of the element [string, UUID]
  • target: UUID of the new owner of the element [string, UUID]

Responses:

  • Success:
{"ok": true}
  • The element does not exist for this user:
{"error": "item_not_found"}
  • The element is already owned by the target user:
{"error": "cannot_trade_with_yourself"}
  • The target user does not exist:
{"error": "user_uuid_does_not_exist"}

/inventory/exists [MS]

Returns whether a user owns a specific item

Required parameters:

  • item_name: Name of the item [string]
  • owner: UUID of the user [string, UUID]

Responses:

  • The item exists:
{"exists": true}
  • The item does not exist:
{"exists": false}

/inventory/create [MS]

Add a new item to the inventory of a user

Required parameters:

  • item_name: Name of the item [string]
  • owner: UUID of the user [string, UUID]
  • related_ms: Name of the related microservice [string]

Responses:

  • Success:
{
  "element_uuid": "<UUID of the item [string, UUID]>",
  "element_name": "<Name of the item [string]>",
  "related_ms": "<Microservice related to the item [string]>",
  "owner": "<UUID of the owner of the item [string, UUID]>"
}
  • The item does not exist in the game config:
{"error": "item_not_found"}

/inventory/remove [MS]

Remove an item from the inventory of a user

Required parameters:

  • item_uuid: UUID of the item [string, UUID]

Responses:

  • Success:
{"ok": true}
  • The item does not exist:
{"error": "item_not_found"}

/inventory/list [MS]

Returns a list of all the items of a user

Required parameters:

  • owner: UUID of the user [string, UUID]

Responses:

  • Success:
{
  "elements": [{
    "element_uuid": "<UUID of the item [string, UUID]>",
    "element_name": "<Name of the item [string]>",
    "related_ms": "<Microservice related to the item [string]>",
    "owner": "<UUID of the owner of the item [string, UUID]>"
  }]
}

/inventory/summary [MS]

Returns the names of the items of a user as a dict

Required parameters:

  • owner: UUID of the user [string, UUID]

Responses:

  • Success:
{
  "elements": {
    "<Name of the item [string]>": "<Number of elements with this name [number]"
  }
}

/inventory/delete_by_name [MS]

Remove an item from the inventory of a user by its name

Required parameters:

  • owner: UUID of the user [string, UUID]
  • item_name: Name of the item [string]

Responses:

  • Success:
{"ok": true}
  • The item does not exist:
{"error": "item_not_found"}

/delete_user [MS]

Deletes all items of a user

Required parameters:

  • user_uuid UUID of the user to delete [string, UUID]

Responses:

  • Success:
{"ok": true}

Shop

/shop/list

Returns all products available in the shop

No parameters.

Responses:

  • Success:
{
  "categories": {
    "<Name of the category [string]>": {
      "index": "<index of category [integer, zero based]>",
      "items": {
        "<Name of the product [string]>": {
          "price": "<Price of the product [number]>",
          "related_ms": "<Microservice related to the product [string]>"
        }
      },
      "categories": {
        "<Name of the subcategory [string]>": {
          "index": "<index of category [integer, zero based]>",
          "items": {
            "<Name of the product [string]>": {
              "price": "<Price of the product [number]>",
              "related_ms": "<Microservice related to the product [string]>"
            }
          },
          "categories": {}
        }
      }
    }
  }
}

/shop/info

Returns more information about a product

Required parameters:

  • product: Name of the product [string]

Responses:

  • Success:
{
  "name": "<Name of the product [string]>",
  "price": "<Price of the product [number]>",
  "related_ms": "<Microservice related to the product [string]>",
  "category": "<Category of the product [string]>"
}
  • The product does not exist in the shop:
{"error": "item_not_found"}

/shop/buy

Buy an item in the shop

Required parameters:

  • products: Map with product names as keys and amount as values [map of string->integer]
  • wallet_uuid: UUID of the wallet used for payment [string, UUID]
  • key: Secure key of the wallet [string, 10 digit hexadecimal key]

Responses:

  • Success:
{
  "bought_products": [{
    "element_uuid": "<UUID of the item [string, UUID]>",
    "element_name": "<Name of the item [string]>",
    "related_ms": "<Microservice related to the item [string]>",
    "owner": "<UUID of the owner of the item [string, UUID]>"
  }]
}
  • One of the products does not exist in the shop:
{"error": "item_not_found"}
  • The wallet does not exist:
{"error": "wallet_not_found"}
  • key is wrong:
{"error": "permission_denied"}
  • There are not enough coins on the wallet:
{"error": "not_enough_coins"}