From 2545ae46c0b09e09f548d4e7fec06302ace14438 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 28 Feb 2023 00:43:53 -0800 Subject: docs --- src/components/Code.svelte | 22 +++++++++++++++++++--- src/lib/samples.js | 9 +++++---- src/routes/(static)/docs/+page.svelte | 29 ++++++++++++++++++++--------- 3 files changed, 44 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/components/Code.svelte b/src/components/Code.svelte index b3181d0a..0e09191e 100644 --- a/src/components/Code.svelte +++ b/src/components/Code.svelte @@ -5,11 +5,27 @@ export let sample; -
-
{samples[sample]}
+
+
+
{samples[sample]}
+
+ + diff --git a/src/lib/samples.js b/src/lib/samples.js index 4af61822..93b9aa24 100644 --- a/src/lib/samples.js +++ b/src/lib/samples.js @@ -1,13 +1,13 @@ export default { - register: `curl -s "https://coinos.io/api/register" -H "application/json" -d '{ + register: `curl "https://coinos.io/api/register" -H "application/json" -d '{ "username": "adam", "password": "hunter2" }'`, - login: `curl -s "https://coinos.io/api/login" -H "application/json" -d '{ + login: `curl "https://coinos.io/api/login" -H "application/json" -d '{ "username": "adam", "password": "hunter2" }'`, - invoice: `curl -s "https://coinos.io/api/invoice" + invoice: `curl "https://coinos.io/api/invoice" -H "application/json" -H "Authorization: Bearer $token" -d '{ @@ -18,5 +18,6 @@ export default { "secret": "hunter2" }, }'`, - fetchInvoice: `curl -s "https://coinos.io/api/invoice/bc1qmhfk9stzffhd9umzmld92vff7zg3mdlh7rvvaj" -H "application/json" }'` + fetchInvoice: `curl "https://coinos.io/api/invoice/bc1qmhfk9stzffhd9umzmld92vff7zg3mdlh7rvvaj" + -H "application/json"'` }; diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte index d44204d8..cb82bd05 100644 --- a/src/routes/(static)/docs/+page.svelte +++ b/src/routes/(static)/docs/+page.svelte @@ -1,10 +1,16 @@ -
+

API Documentation

@@ -16,15 +22,19 @@

Base URL

-
https://coinos.io/api
-
+
{api}
+

Auth Token

This JWT authorizes you to use the API

-
export token="{token}"
-
+
{tokenSample}
+

POST /register

@@ -42,17 +52,17 @@ type: bitcoin or lightning
- amount: integer satoshis (optional) + amount: amount in satoshis
- webhook: a URL that we'll POST to when the invoice is - paid (optional) + webhook: an endpoint to hit when the invoice is paid
- secret: a secret to send with the POST (optional) + secret: a secret string for the webhook to check
+ hey

GET /invoice/:hash

@@ -123,4 +133,5 @@ + -- cgit v1.2.3