aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(static)/docs
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-01 20:04:13 -0800
committerAdam Soltys <[email protected]>2023-12-01 20:04:13 -0800
commit216a600224fde22ce76b367557a02094ec693886 (patch)
treed1189bbaa39db204633523132a7d4767b952717d /src/routes/(static)/docs
parent7d9bc1f54dfd04172e8d6d43ebc2efd6f407e833 (diff)
downloadcoinos-ui-216a600224fde22ce76b367557a02094ec693886.tar.gz
coinos-ui-216a600224fde22ce76b367557a02094ec693886.zip
prettier
Diffstat (limited to 'src/routes/(static)/docs')
-rw-r--r--src/routes/(static)/docs/+page.server.js4
-rw-r--r--src/routes/(static)/docs/+page.svelte201
2 files changed, 107 insertions, 98 deletions
diff --git a/src/routes/(static)/docs/+page.server.js b/src/routes/(static)/docs/+page.server.js
index e80365fa..41176b14 100644
--- a/src/routes/(static)/docs/+page.server.js
+++ b/src/routes/(static)/docs/+page.server.js
@@ -1,4 +1,4 @@
export let load = async ({ cookies }) => {
- let token = cookies.get('token');
- return { token };
+ let token = cookies.get("token");
+ return { token };
};
diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte
index 63173173..6e08c2e8 100644
--- a/src/routes/(static)/docs/+page.svelte
+++ b/src/routes/(static)/docs/+page.svelte
@@ -1,121 +1,130 @@
<script>
- import { copyNoNewlines as copy } from '$lib/utils';
- import { Code, Icon } from '$comp';
- import { PUBLIC_COINOS_URL } from '$env/static/public';
- export let data;
- let { user, token } = data;
- let api = 'https://coinos.io/api';
+ import { copyNoNewlines as copy } from "$lib/utils";
+ import { Code, Icon } from "$comp";
+ import { PUBLIC_COINOS_URL } from "$env/static/public";
+ export let data;
+ let { user, token } = data;
+ let api = "https://coinos.io/api";
- let tokenSample = token ? `export token="${token}"` : `export token=<your auth token>`;
+ let tokenSample = token
+ ? `export token="${token}"`
+ : `export token=<your auth token>`;
</script>
<div class="space-y-8 lg:text-xl mt-20 pt-20 md:pt-0 w-full max-w-full">
- <h1 class="text-4xl">Documentation</h1>
+ <h1 class="text-4xl">Documentation</h1>
- <p class="text-secondary">
- Coinos has a simple REST API that can be used to register accounts and make payments and
- queries. The following examples show how you can call the API with <a
- href="https://curl.se/"
- class="font-bold">curl</a
- > from your command line.
- </p>
+ <p class="text-secondary">
+ Coinos has a simple REST API that can be used to register accounts and make
+ payments and queries. The following examples show how you can call the API
+ with <a href="https://curl.se/" class="font-bold">curl</a> from your command
+ line.
+ </p>
- <h2 class="text-2xl">API Base URL</h2>
- <div class="bg-black text-white rounded-lg p-4 flex gap-4">
- <div>{api}</div>
- <button class="ml-auto my-auto invert opacity-90" on:click={() => copy(api)}
- ><Icon icon="copy" style="w-10 max-w-none" /></button
- >
- </div>
+ <h2 class="text-2xl">API Base URL</h2>
+ <div class="bg-black text-white rounded-lg p-4 flex gap-4">
+ <div>{api}</div>
+ <button class="ml-auto my-auto invert opacity-90" on:click={() => copy(api)}
+ ><Icon icon="copy" style="w-10 max-w-none" /></button
+ >
+ </div>
- <h2 class="text-2xl">Auth Token</h2>
- <p class="text-secondary">
- {#if user && token}
- This token authorizes you to use the API as <b>{user.username}</b>.
- {:else}
- <a href="/login" class="font-bold">Sign in</a> to view your auth token here, or get one from the
- /login endpoint.
- {/if}
+ <h2 class="text-2xl">Auth Token</h2>
+ <p class="text-secondary">
+ {#if user && token}
+ This token authorizes you to use the API as <b>{user.username}</b>.
+ {:else}
+ <a href="/login" class="font-bold">Sign in</a> to view your auth token here,
+ or get one from the /login endpoint.
+ {/if}
- Save it in a variable called <b>$token</b> to run the examples.
- </p>
+ Save it in a variable called <b>$token</b> to run the examples.
+ </p>
- <div class="bg-black text-white rounded-lg p-4 flex gap-4">
- <div class="w-full break-all">{tokenSample}</div>
- <button class="ml-auto my-auto invert opacity-90" on:click={() => copy(tokenSample)}
- ><Icon icon="copy" style="w-10 max-w-none" /></button
- >
- </div>
+ <div class="bg-black text-white rounded-lg p-4 flex gap-4">
+ <div class="w-full break-all">{tokenSample}</div>
+ <button
+ class="ml-auto my-auto invert opacity-90"
+ on:click={() => copy(tokenSample)}
+ ><Icon icon="copy" style="w-10 max-w-none" /></button
+ >
+ </div>
- <h2 class="text-2xl">POST /register</h2>
- <p class="text-secondary">Register a new user account with a username and password</p>
- <Code sample="register" />
+ <h2 class="text-2xl">POST /register</h2>
+ <p class="text-secondary">
+ Register a new user account with a username and password
+ </p>
+ <Code sample="register" />
- <h2 class="text-2xl">POST /login</h2>
- <p class="text-secondary">Login to an account to get its auth token</p>
- <Code sample="login" />
+ <h2 class="text-2xl">POST /login</h2>
+ <p class="text-secondary">Login to an account to get its auth token</p>
+ <Code sample="login" />
- <h2 class="text-2xl">POST /invoice</h2>
- <p class="text-secondary">Create an invoice.</p>
+ <h2 class="text-2xl">POST /invoice</h2>
+ <p class="text-secondary">Create an invoice.</p>
- <div class="text-secondary">
- <div>Request params</div>
- <div class="grid grid-cols-3 ml-2">
- <div class="font-bold">type</div>
- <div class="col-span-2">bitcoin or lightning</div>
- <div class="font-bold">amount</div>
- <div class="col-span-2">amount in satoshis</div>
- <div class="font-bold">webhook</div>
- <div class="col-span-2">(optional) endpoint to hit when the invoice is paid</div>
- <div class="font-bold">secret</div>
- <div class="col-span-2">a secret for the webhook to check</div>
- </div>
- </div>
+ <div class="text-secondary">
+ <div>Request params</div>
+ <div class="grid grid-cols-3 ml-2">
+ <div class="font-bold">type</div>
+ <div class="col-span-2">bitcoin or lightning</div>
+ <div class="font-bold">amount</div>
+ <div class="col-span-2">amount in satoshis</div>
+ <div class="font-bold">webhook</div>
+ <div class="col-span-2">
+ (optional) endpoint to hit when the invoice is paid
+ </div>
+ <div class="font-bold">secret</div>
+ <div class="col-span-2">a secret for the webhook to check</div>
+ </div>
+ </div>
- <p>Get a lightning invoice to receive funds</p>
- <Code sample="lightningInvoice" />
+ <p>Get a lightning invoice to receive funds</p>
+ <Code sample="lightningInvoice" />
- <p>Get a bitcoin address to receive funds</p>
- <Code sample="bitcoinAddress" />
+ <p>Get a bitcoin address to receive funds</p>
+ <Code sample="bitcoinAddress" />
- <p>Sample response</p>
- <Code sample="invoiceResponse" />
- <p>You can check the <b>received</b> field to see how much has been paid</p>
+ <p>Sample response</p>
+ <Code sample="invoiceResponse" />
+ <p>You can check the <b>received</b> field to see how much has been paid</p>
- <p>Specify a webhook to be called when an invoice is paid</p>
- <Code sample="webhook" />
+ <p>Specify a webhook to be called when an invoice is paid</p>
+ <Code sample="webhook" />
- <h2 class="text-2xl">GET /invoice/:hash</h2>
- <p class="text-secondary">
- Fetch an invoice by passing a bitcoin address or lightning payment hash
- </p>
- <Code sample="fetchInvoice" />
+ <h2 class="text-2xl">GET /invoice/:hash</h2>
+ <p class="text-secondary">
+ Fetch an invoice by passing a bitcoin address or lightning payment hash
+ </p>
+ <Code sample="fetchInvoice" />
- <h2 class="text-2xl">POST /payments</h2>
- <p class="text-secondary">Send a lightning payment</p>
- <Code sample="lightning" />
+ <h2 class="text-2xl">POST /payments</h2>
+ <p class="text-secondary">Send a lightning payment</p>
+ <Code sample="lightning" />
- <p class="text-secondary">Send a bitcoin payment</p>
- <Code sample="bitcoin" />
+ <p class="text-secondary">Send a bitcoin payment</p>
+ <Code sample="bitcoin" />
- <p class="text-secondary">Send an internal payment to another user</p>
- <Code sample="internal" />
+ <p class="text-secondary">Send an internal payment to another user</p>
+ <Code sample="internal" />
- <h2 class="text-2xl">GET /payments</h2>
- <p class="text-secondary">Get all payments sent or received by the current user</p>
+ <h2 class="text-2xl">GET /payments</h2>
+ <p class="text-secondary">
+ Get all payments sent or received by the current user
+ </p>
- <div class="text-secondary">
- <div>Query params</div>
- <div class="grid grid-cols-3 ml-2">
- <div class="font-bold">start</div>
- <div class="col-span-2">only payments after this unix time</div>
- <div class="font-bold">end</div>
- <div class="col-span-2">only payments before this unix time</div>
- <div class="font-bold">limit</div>
- <div class="col-span-2">limit to this integer number of results</div>
- <div class="font-bold">offset</div>
- <div class="col-span-2">start limiting from this integer offset</div>
- </div>
- </div>
- <Code sample="payments" />
+ <div class="text-secondary">
+ <div>Query params</div>
+ <div class="grid grid-cols-3 ml-2">
+ <div class="font-bold">start</div>
+ <div class="col-span-2">only payments after this unix time</div>
+ <div class="font-bold">end</div>
+ <div class="col-span-2">only payments before this unix time</div>
+ <div class="font-bold">limit</div>
+ <div class="col-span-2">limit to this integer number of results</div>
+ <div class="font-bold">offset</div>
+ <div class="col-span-2">start limiting from this integer offset</div>
+ </div>
+ </div>
+ <Code sample="payments" />
</div>