Add ws link to curl examples (#3063)

This commit is contained in:
Arc 2025-03-31 10:58:26 +01:00 committed by GitHub
parent 681730a4af
commit 0c76efa2b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 10 deletions

View file

@ -85,7 +85,12 @@
<q-card-section> <q-card-section>
<code><span class="text-light-green">GET</span> /api/v1/wallet</code> <code><span class="text-light-green">GET</span> /api/v1/wallet</code>
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5> <h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": "<i v-text="wallet.inkey"></i>"}</code><br /> <code
>{"X-Api-Key": "<i
v-text="inkeyHidden ? '****************' : wallet.inkey"
></i
>"}</code
><br />
<h5 class="text-caption q-mt-sm q-mb-none"> <h5 class="text-caption q-mt-sm q-mb-none">
Returns 200 OK (application/json) Returns 200 OK (application/json)
</h5> </h5>
@ -96,7 +101,8 @@
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5> <h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code <code
>curl <span v-text="baseUrl"></span>api/v1/wallet -H "X-Api-Key: >curl <span v-text="baseUrl"></span>api/v1/wallet -H "X-Api-Key:
<i v-text="wallet.inkey"></i>"</code <i v-text="inkeyHidden ? '****************' : wallet.inkey"></i
>"</code
> >
</q-card-section> </q-card-section>
</q-card> </q-card>
@ -112,7 +118,12 @@
<q-card-section> <q-card-section>
<code><span class="text-light-green">POST</span> /api/v1/payments</code> <code><span class="text-light-green">POST</span> /api/v1/payments</code>
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5> <h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": "<i v-text="wallet.inkey"></i>"}</code><br /> <code
>{"X-Api-Key": "<i
v-text="inkeyHidden ? '****************' : wallet.inkey"
></i
>"}</code
><br />
<h5 class="text-caption q-mt-sm q-mb-none">Body (application/json)</h5> <h5 class="text-caption q-mt-sm q-mb-none">Body (application/json)</h5>
<code <code
>{"out": false, "amount": &lt;int&gt;, "memo": &lt;string&gt;, >{"out": false, "amount": &lt;int&gt;, "memo": &lt;string&gt;,
@ -130,8 +141,9 @@
<code <code
>curl -X POST <span v-text="baseUrl"></span>api/v1/payments -d >curl -X POST <span v-text="baseUrl"></span>api/v1/payments -d
'{"out": false, "amount": &lt;int&gt;, "memo": &lt;string&gt;}' -H '{"out": false, "amount": &lt;int&gt;, "memo": &lt;string&gt;}' -H
"X-Api-Key: <i v-text="wallet.inkey"></i>" -H "Content-type: "X-Api-Key:
application/json"</code <i v-text="inkeyHidden ? '****************' : wallet.inkey"></i>" -H
"Content-type: application/json"</code
> >
</q-card-section> </q-card-section>
</q-card> </q-card>
@ -218,7 +230,12 @@
/api/v1/payments/&lt;payment_hash&gt;</code /api/v1/payments/&lt;payment_hash&gt;</code
> >
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5> <h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": "{{ wallet.inkey }}"}</code> <code
>{"X-Api-Key": "<i
v-text="inkeyHidden ? '****************' : wallet.inkey"
></i
>"}</code
>
<h5 class="text-caption q-mt-sm q-mb-none"> <h5 class="text-caption q-mt-sm q-mb-none">
Returns 200 OK (application/json) Returns 200 OK (application/json)
</h5> </h5>
@ -227,11 +244,33 @@
<code <code
>curl -X GET >curl -X GET
<span v-text="baseUrl"></span>api/v1/payments/&lt;payment_hash&gt; -H <span v-text="baseUrl"></span>api/v1/payments/&lt;payment_hash&gt; -H
"X-Api-Key: <i v-text="wallet.inkey"></i>" -H "Content-type: "X-Api-Key:
application/json"</code <i v-text="inkeyHidden ? '****************' : wallet.inkey"></i>" -H
"Content-type: application/json"</code
> >
</q-card-section> </q-card-section>
</q-card> </q-card>
<q-card>
<q-card-section>
<code
><span class="text-pink">WS</span>
/api/v1/ws/&lt;invoice_key&gt;</code
>
<h5
class="text-caption q-mt-sm q-mb-none"
v-text="$t('websocket_example')"
></h5>
<code
>wscat -c <span v-text="websocketUrl"></span>/<span
v-text="inkeyHidden ? '****************' : wallet.inkey"
></span
></code>
<h5 class="text-caption q-mt-sm q-mb-none">
Returns 200 OK (application/json)/payments
</h5>
<code>{"balance": &lt;int&gt;, "payment": &lt;object&gt;}</code>
</q-card-section>
</q-card>
</q-expansion-item> </q-expansion-item>
<q-separator></q-separator> <q-separator></q-separator>
<q-card-section> <q-card-section>

File diff suppressed because one or more lines are too long

View file

@ -568,5 +568,6 @@ window.localisation.en = {
view_list: 'View wallets as list', view_list: 'View wallets as list',
view_column: 'View wallets as rows', view_column: 'View wallets as rows',
filter_payments: 'Filter payments', filter_payments: 'Filter payments',
filter_date: 'Filter by date' filter_date: 'Filter by date',
websocket_example: 'Websocket example'
} }

View file

@ -4,6 +4,7 @@ window.WalletPageLogic = {
return { return {
origin: window.location.origin, origin: window.location.origin,
baseUrl: `${window.location.protocol}//${window.location.host}/`, baseUrl: `${window.location.protocol}//${window.location.host}/`,
websocketUrl: `${'http:' ? 'ws://' : 'wss://'}${window.location.host}/api/v1/ws`,
parse: { parse: {
show: false, show: false,
invoice: null, invoice: null,