- Calls this month
- 0
- Errors
- 0
- Error rate
- No calls yet
- Avg response
- No calls yet
This month, UTC.
Definition preview
Read-only outline of the saved source. Edit it under the Edit tab.
Input fields
amount- number
Pipeline (2)
amount_okassertgivewrite collection economy_balance
Response
- Status
- 200
- Body
- keys: success, earned
Full source
sourceVersion: 1
kind: endpoint
id: economy_earn
name: Earn gold
description: Adds gold up to the per-call limit. The amount is checked on the server, never trusted blindly.
method: POST
enabled: true
input:
type: object
properties:
amount:
type: number
required:
- amount
steps:
- id: amount_ok
type: assert
check:
all:
- field: input.amount
op: '>'
value: 0
- field: input.amount
op: <=
value: '{{values.economy_limits.max_earn_per_call}}'
status: 422
errorCode: INVALID_AMOUNT
message: Amount must be between 1 and the per-call limit.
- id: give
type: write
collection: economy_balance
key: '{{steamId}}'
ops:
- op: inc
path: gold
value: '{{input.amount}}'
source: earn
reason: Earned gold
response:
status: 200
body:
success: true
earned: '{{input.amount}}'
module: economy