From bec7c805021716cdfa4d0a8665fe98b4bb5344df Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Thu, 3 Oct 2024 17:39:00 +0200 Subject: [PATCH] feat: refine widdershins parameter --- Earthfile | 2 +- docs/api/README.md | 257 ++++++++++++++------------------------------- 2 files changed, 79 insertions(+), 180 deletions(-) diff --git a/Earthfile b/Earthfile index 25b01d874..cbcc1f80f 100644 --- a/Earthfile +++ b/Earthfile @@ -168,7 +168,7 @@ openapi-markdown: FROM node:20-alpine RUN npm install -g widdershins COPY openapi/v2.yaml openapi.yaml - RUN widdershins openapi.yaml -o README.md --search false --language_tabs 'http:HTTP' + RUN widdershins openapi.yaml -o README.md --search false --language_tabs 'http:HTTP' --summary SAVE ARTIFACT README.md AS LOCAL docs/api/README.md tidy: diff --git a/docs/api/README.md b/docs/api/README.md index 7c7f8d143..13dbe2824 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -35,7 +35,7 @@ Base URLs:

ledger.v2

-## v2GetInfo +## Show server information @@ -50,8 +50,6 @@ Accept: application/json `GET /v2/_info` -*Show server information* - > Example responses > 200 Response @@ -63,7 +61,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -76,7 +74,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2ListLedgers +## List ledgers @@ -91,9 +89,7 @@ Accept: application/json `GET /v2` -*List ledgers* - -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -134,7 +130,7 @@ No other parameters can be set when this parameter is set. } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -146,7 +142,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2GetLedger +## Get a ledger @@ -161,9 +157,7 @@ Accept: application/json `GET /v2/{ledger}` -*Get a ledger* - -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -186,7 +180,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -198,7 +192,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2CreateLedger +## Create a ledger @@ -214,8 +208,6 @@ Accept: application/json `POST /v2/{ledger}` -*Create a ledger* - > Body parameter ```json @@ -231,7 +223,7 @@ Accept: application/json } ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -250,7 +242,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -262,7 +254,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:write ) -## v2UpdateLedgerMetadata +## Update ledger metadata @@ -278,8 +270,6 @@ Accept: application/json `PUT /v2/{ledger}/metadata` -*Update ledger metadata* - > Body parameter ```json @@ -288,7 +278,7 @@ Accept: application/json } ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -307,7 +297,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -320,7 +310,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:write ) -## v2DeleteLedgerMetadata +## Delete ledger metadata by key @@ -335,9 +325,7 @@ Accept: application/json `DELETE /v2/{ledger}/metadata/{key}` -*Delete ledger metadata by key* - -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -356,7 +344,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -368,7 +356,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:write ) -## v2GetLedgerInfo +## Get information about a ledger @@ -383,9 +371,7 @@ Accept: application/json `GET /v2/{ledger}/_info` -*Get information about a ledger* - -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -413,7 +399,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -425,7 +411,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2CreateBulk +## Bulk request @@ -441,8 +427,6 @@ Accept: application/json `POST /v2/{ledger}/_bulk` -*Bulk request* - > Body parameter ```json @@ -475,7 +459,7 @@ Accept: application/json ] ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -579,7 +563,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -592,7 +576,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:write ) -## v2CountAccounts +## Count the accounts from a ledger @@ -608,15 +592,13 @@ Accept: application/json `HEAD /v2/{ledger}/accounts` -*Count the accounts from a ledger* - > Body parameter ```json {} ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -636,7 +618,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -654,7 +636,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2ListAccounts +## List accounts from a ledger @@ -670,8 +652,6 @@ Accept: application/json `GET /v2/{ledger}/accounts` -*List accounts from a ledger* - List accounts from a ledger, sorted by address in descending order. > Body parameter @@ -680,7 +660,7 @@ List accounts from a ledger, sorted by address in descending order. {} ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -747,7 +727,7 @@ No other parameters can be set when this parameter is set. } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -759,7 +739,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2GetAccount +## Get account by its address @@ -774,9 +754,7 @@ Accept: application/json `GET /v2/{ledger}/accounts/{address}` -*Get account by its address* - -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -831,7 +809,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -843,7 +821,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2AddMetadataToAccount +## Add metadata to an account @@ -860,8 +838,6 @@ Idempotency-Key: string `POST /v2/{ledger}/accounts/{address}/metadata` -*Add metadata to an account* - > Body parameter ```json @@ -870,7 +846,7 @@ Idempotency-Key: string } ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -899,45 +875,43 @@ Idempotency-Key: string } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|No Content|None| |default|Default|Error|[V2ErrorResponse](#schemav2errorresponse)| -

Response Schema

+

Response Schema

-## v2DeleteAccountMetadata +## Delete metadata by key - + > Code samples ```http -DELETE http://localhost:8080/v2/{ledger}/accounts/{address}/metadata/{key} HTTP/1.1 +DELETE http://localhost:8080/v2/{ledger}/transactions/{id}/metadata/{key} HTTP/1.1 Host: localhost:8080 Accept: application/json ``` -`DELETE /v2/{ledger}/accounts/{address}/metadata/{key}` - -*Delete metadata by key* +`DELETE /v2/{ledger}/transactions/{id}/metadata/{key}` Delete metadata by key -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |ledger|path|string|true|Name of the ledger.| -|address|path|string|true|Account address| +|id|path|integer(bigint)|true|Transaction ID.| |key|path|string|true|The key to remove.| > Example responses @@ -952,21 +926,21 @@ Delete metadata by key } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |2XX|Unknown|Key deleted|None| |default|Default|Error|[V2ErrorResponse](#schemav2errorresponse)| -

Response Schema

+

Response Schema

-## v2ReadStats +## Get statistics from a ledger @@ -981,11 +955,9 @@ Accept: application/json `GET /v2/{ledger}/stats` -*Get statistics from a ledger* - Get statistics from a ledger. (aggregate metrics on accounts and transactions) -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1004,7 +976,7 @@ Get statistics from a ledger. (aggregate metrics on accounts and transactions) } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -1016,7 +988,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2CountTransactions +## Count the transactions from a ledger @@ -1032,15 +1004,13 @@ Accept: application/json `HEAD /v2/{ledger}/transactions` -*Count the transactions from a ledger* - > Body parameter ```json {} ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1060,7 +1030,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -1078,7 +1048,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2ListTransactions +## List transactions from a ledger @@ -1094,8 +1064,6 @@ Accept: application/json `GET /v2/{ledger}/transactions` -*List transactions from a ledger* - List transactions from a ledger, sorted by id in descending order. > Body parameter @@ -1104,7 +1072,7 @@ List transactions from a ledger, sorted by id in descending order. {} ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1232,7 +1200,7 @@ No other parameters can be set when this parameter is set. } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -1244,7 +1212,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2CreateTransaction +## Create a new transaction to a ledger @@ -1261,8 +1229,6 @@ Idempotency-Key: string `POST /v2/{ledger}/transactions` -*Create a new transaction to a ledger* - > Body parameter ```json @@ -1289,7 +1255,7 @@ Idempotency-Key: string } ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1397,7 +1363,7 @@ Idempotency-Key: string } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -1409,7 +1375,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:write ) -## v2GetTransaction +## Get transaction from a ledger by its ID @@ -1424,9 +1390,7 @@ Accept: application/json `GET /v2/{ledger}/transactions/{id}` -*Get transaction from a ledger by its ID* - -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1527,7 +1491,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -1539,7 +1503,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2AddMetadataOnTransaction +## Set the metadata of a transaction by its ID @@ -1556,8 +1520,6 @@ Idempotency-Key: string `POST /v2/{ledger}/transactions/{id}/metadata` -*Set the metadata of a transaction by its ID* - > Body parameter ```json @@ -1566,7 +1528,7 @@ Idempotency-Key: string } ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1588,74 +1550,21 @@ Idempotency-Key: string } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|No Content|None| |default|Default|Error|[V2ErrorResponse](#schemav2errorresponse)| -

Response Schema

- - - -## v2DeleteTransactionMetadata - - - -> Code samples - -```http -DELETE http://localhost:8080/v2/{ledger}/transactions/{id}/metadata/{key} HTTP/1.1 -Host: localhost:8080 -Accept: application/json - -``` - -`DELETE /v2/{ledger}/transactions/{id}/metadata/{key}` - -*Delete metadata by key* - -Delete metadata by key - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|ledger|path|string|true|Name of the ledger.| -|id|path|integer(bigint)|true|Transaction ID.| -|key|path|string|true|The key to remove.| - -> Example responses - -> default Response - -```json -{ - "errorCode": "VALIDATION", - "errorMessage": "[VALIDATION] invalid 'cursor' query param", - "details": "https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|2XX|Unknown|Key deleted|None| -|default|Default|Error|[V2ErrorResponse](#schemav2errorresponse)| - -

Response Schema

+

Response Schema

-## v2RevertTransaction +## Revert a ledger transaction by its ID @@ -1670,9 +1579,7 @@ Accept: application/json `POST /v2/{ledger}/transactions/{id}/revert` -*Revert a ledger transaction by its ID* - -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1774,7 +1681,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -1786,7 +1693,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:write ) -## v2GetBalancesAggregated +## Get the aggregated balances from selected accounts @@ -1802,15 +1709,13 @@ Accept: application/json `GET /v2/{ledger}/aggregate/balances` -*Get the aggregated balances from selected accounts* - > Body parameter ```json {} ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1832,7 +1737,7 @@ Accept: application/json } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -1844,7 +1749,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2GetVolumesWithBalances +## Get list of volumes with balances for (account/asset) @@ -1860,15 +1765,13 @@ Accept: application/json `GET /v2/{ledger}/volumes` -*Get list of volumes with balances for (account/asset)* - > Body parameter ```json {} ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1914,7 +1817,7 @@ No other parameters can be set when this parameter is set. } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -1926,7 +1829,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:read ) -## v2ListLogs +## List the logs from a ledger @@ -1942,8 +1845,6 @@ Accept: application/json `GET /v2/{ledger}/logs` -*List the logs from a ledger* - List the logs from a ledger, sorted by ID in descending order. > Body parameter @@ -1952,7 +1853,7 @@ List the logs from a ledger, sorted by ID in descending order. {} ``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -1995,7 +1896,7 @@ No other parameters can be set when this parameter is set. } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -2061,7 +1962,7 @@ To perform this operation, you must be authenticated by means of one of the foll Authorization ( Scopes: ledger:write ) -## v2ExportLogs +## Export logs @@ -2076,9 +1977,7 @@ Accept: application/octet-stream `POST /v2/{ledger}/logs/export` -*Export logs* - -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -2088,7 +1987,7 @@ Accept: application/octet-stream > default Response -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---|