diff options
author | Julien Dessaux | 2023-05-25 01:20:56 +0200 |
---|---|---|
committer | Julien Dessaux | 2023-05-25 01:20:56 +0200 |
commit | b1157af9cd66878623ad1f9fadac862e4990901c (patch) | |
tree | 3e95713b4ede9d292a2bf00af88f36e7cbe12e0d /lib/contracts.js | |
parent | Rewrote the api rate limiter with promises instead of callbacks (diff) | |
download | spacetraders-b1157af9cd66878623ad1f9fadac862e4990901c.tar.gz spacetraders-b1157af9cd66878623ad1f9fadac862e4990901c.tar.bz2 spacetraders-b1157af9cd66878623ad1f9fadac862e4990901c.zip |
Updated the lib for the new api
Diffstat (limited to 'lib/contracts.js')
-rw-r--r-- | lib/contracts.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/contracts.js b/lib/contracts.js new file mode 100644 index 0000000..9494595 --- /dev/null +++ b/lib/contracts.js @@ -0,0 +1,17 @@ +import * as api from './api.js'; + +export async function accept(ctx) { + return await api.send({endpoint: `/my/contracts/${ctx.id}/accept`, method: 'POST'}); +} + +export async function contracts() { + return await api.send({endpoint: '/my/contracts'}); +} + +export async function deliver(ctx) { + return await api.send({ endpoint: `/my/contracts/${ctx.contract}/deliver`, method: 'POST', payload: { + shipSymbol: ctx.ship, + tradeSymbol: ctx.good, + units: ctx.units, + }}); +} |