From 6b974d2ee7620f32233dac886922e98baa7502eb Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 28 Mar 2023 21:25:12 -0700 Subject: update docs --- src/routes/(static)/docs/+page.svelte | 148 +++++++++++++--------------------- 1 file changed, 55 insertions(+), 93 deletions(-) (limited to 'src/routes/(static)') diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte index 8ddb98cd..a22e789a 100644 --- a/src/routes/(static)/docs/+page.svelte +++ b/src/routes/(static)/docs/+page.svelte @@ -3,23 +3,20 @@ import { Code, Icon } from '$comp'; import { PUBLIC_COINOS_URL } from '$env/static/public'; export let data; - let { token } = data; + let { user, token } = data; let api = PUBLIC_COINOS_URL + '/api'; - if (!token) token = ''; let tokenSample = `export token="${token}"`; -
-

API Documentation

+
+

Documentation

- Coinos has a simple REST API that can be used to register accounts, fetch data, and make - payments + Coinos has a simple REST API that can be used to register accounts and make payments and + queries.

-

* = required parameter

-

Base URL

{api}
@@ -28,14 +25,16 @@ >
-

Auth Token

-

This JWT authorizes you to use the API

-
-
{tokenSample}
- -
+ {#if token} +

Auth Token

+

This token authorizes you to use the API as {user.username}

+
+
{tokenSample}
+ +
+ {/if}

POST /register

Register a new user account with a username and password

@@ -47,91 +46,54 @@

POST /invoice

Create an invoice.

-
-
- type: bitcoin or lightning -
-
- amount: amount in satoshis -
-
- webhook: an endpoint to hit when the invoice is paid -
-
- secret: a secret string for the webhook to check + +
+
Request params
+
+
type
+
bitcoin or lightning
+
amount
+
amount in satoshis
+
webhook
+
(optional) endpoint to hit when the invoice is paid
+
secret
+
a secret for the webhook to check
- hey +

Sample response

+ +

You can check the received field to see how many satoshis have been paid so far

+

GET /invoice/:hash

Fetch an invoice by passing a bitcoin address or lightning payment hash

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

GET /payments

+

Get all payments sent or received by the current user

+ +
+
Query params
+
+
start
+
only payments after this unix time
+
end
+
only payments before this unix time
+
limit
+
limit to this integer number of results
+
offset
+
start limiting from this integer offset
+
+
+ + +

Websocket API

+

Subscribe to real time rates and payments

+ +
Authenticate
+ +
-- cgit v1.2.3 From b51467da14e6a3def3ce12681b5222bf49484cd5 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 28 Mar 2023 22:45:56 -0700 Subject: prettier --- src/lib/samples.js | 2 +- src/lib/translations/lang.json | 2 +- .../(app)/[username]/(profile)/+layout.svelte | 2 +- .../[username]/invoice/[hash]/tip/+page.svelte | 2 +- .../[username]/payments/[...page]/+page.svelte | 4 +-- src/routes/(app)/[username]/reset/+server.js | 2 +- src/routes/(app)/admin/+page.svelte | 2 +- src/routes/(app)/payment/[id]/+page.svelte | 4 +-- src/routes/(app)/send/invoice/[id]/+page.server.js | 2 +- src/routes/(app)/send/invoice/[id]/+page.svelte | 4 +-- src/routes/(app)/support/+page.svelte | 34 ++++++++++------------ src/routes/(static)/docs/+page.svelte | 6 ++-- 12 files changed, 32 insertions(+), 34 deletions(-) (limited to 'src/routes/(static)') diff --git a/src/lib/samples.js b/src/lib/samples.js index 159ecf6c..14d9e4e0 100644 --- a/src/lib/samples.js +++ b/src/lib/samples.js @@ -40,5 +40,5 @@ export default { "received":0 "created":1677537428134 }`, - socketAuth: `echo '{"type":"login","data":{"username":"user","password":"password"}}' | websocat -n https://coinos.io/ws` + socketAuth: `echo '{"type":"login","data":{"username":"user","password":"password"}}' | websocat -n https://coinos.io/ws` }; diff --git a/src/lib/translations/lang.json b/src/lib/translations/lang.json index fd25a359..cbf1ce4a 100644 --- a/src/lib/translations/lang.json +++ b/src/lib/translations/lang.json @@ -5,5 +5,5 @@ "de": "Deutsch", "pt": "Português", "zh": "中国人", - "fa": "فارسی " + "fa": "فارسی " } diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 6dfde23a..006bbf72 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -134,7 +134,7 @@ {/if} {#if user && user.username !== subject.username && subject.pubkey} -
+