Skip to content

Commit d14a4c9

Browse files
authored
docs: standardize graphql examples (#3391)
* docs: standardize graphql api examples Implemented the 3-tabbed panel for all GraphQL examples. This affected the following pages: - Integration - Requirements - Assets - Integration - Requirements - Peers - Integration - Requirements - Wallet addresses - Integration - Requirements - Sending fees * docs: adding wrap to one of the json examples * docs: fixed links Changed hardcoded links to relative links * docs: changing arguments to variables
1 parent 4905027 commit d14a4c9

10 files changed

Lines changed: 329 additions & 435 deletions

File tree

packages/documentation/src/content/docs/admin/liquidity/asset-liquidity.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ You can deposit and withdraw asset liquidity through the Rafiki Admin applicatio
3838
}
3939
```
4040
</TabItem>
41-
<TabItem label="Arguments">
41+
<TabItem label="Variables">
4242
```json
4343
{
4444
"input": {
@@ -78,7 +78,7 @@ mutation CreateAssetLiquidityWithdrawal($input: CreateAssetLiquidityWithdrawalIn
7878
````
7979

8080
</TabItem>
81-
<TabItem label="Arguments">
81+
<TabItem label="Variables">
8282
```json
8383
{
8484
"input": {

packages/documentation/src/content/docs/admin/liquidity/payment-liquidity.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ For more information about how Rafiki handles liquidity, see the [Accounting](/o
3939
}
4040
```
4141
</TabItem>
42-
<TabItem label="Arguments">
42+
<TabItem label="Variables">
4343
```json
4444
{
4545
"input": {
@@ -75,7 +75,7 @@ For more information about how Rafiki handles liquidity, see the [Accounting](/o
7575
}
7676
```
7777
</TabItem>
78-
<TabItem label="Arguments">
78+
<TabItem label="Variables">
7979
```json
8080
{
8181
"input": {
@@ -110,7 +110,7 @@ For more information about how Rafiki handles liquidity, see the [Accounting](/o
110110
}
111111
```
112112
</TabItem>
113-
<TabItem label="Arguments">
113+
<TabItem label="Variables">
114114
```json
115115
{
116116
"input": {

packages/documentation/src/content/docs/admin/liquidity/peer-liquidity.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ You can deposit and withdraw peer liquidity through the Rafiki Admin application
3636
}
3737
```
3838
</TabItem>
39-
<TabItem label="Arguments">
39+
<TabItem label="Variables">
4040
```json
4141
{
4242
"input": {
@@ -77,7 +77,7 @@ For more information about this mutation's input object, see [`DepositPeerLiquid
7777
}
7878
```
7979
</TabItem>
80-
<TabItem label="Arguments">
80+
<TabItem label="Variables">
8181
```json
8282
{
8383
"input": {

packages/documentation/src/content/docs/admin/liquidity/two-phase-transfers.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ If the timeout interval passes before the transaction posts or is voided, the tr
4040
}
4141
```
4242
</TabItem>
43-
<TabItem label="Arguments">
43+
<TabItem label="Variables">
4444
```json
4545
{
4646
"input": {
@@ -76,7 +76,7 @@ If the timeout interval passes before the transaction posts or is voided, the tr
7676
}
7777
```
7878
</TabItem>
79-
<TabItem label="Arguments">
79+
<TabItem label="Variables">
8080
```json
8181
{
8282
"input": {
Lines changed: 47 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,61 @@
11
---
22
title: Assets
3+
tableOfContents:
4+
maxHeadingLevel: 4
35
---
46

7+
import { Tabs, TabItem } from '@astrojs/starlight/components'
58
import { Badge } from '@astrojs/starlight/components'
69
import { Mermaid, CodeBlock, LinkOut } from '@interledger/docs-design-system'
710

811
An asset represents an item of value that can be transferred via the Interledger Protocol. Assets in Rafiki can be added through the Backend Admin API or the [Rafiki Admin](/admin/admin-user-guide/#assets) application.
912

10-
## Add an asset using the `CreateAsset` GraphQL mutation
11-
12-
<CodeBlock title='CreateAsset mutation'>
13-
14-
```graphql
15-
mutation CreateAsset($input: CreateAssetInput!) {
16-
createAsset(input: $input) {
17-
code
18-
success
19-
message
20-
asset {
21-
id
22-
code
23-
scale
13+
## Add an asset
14+
15+
<Tabs>
16+
<TabItem label="Operation">
17+
```graphql
18+
mutation CreateAsset($input: CreateAssetInput!) {
19+
createAsset(input: $input) {
20+
code
21+
success
22+
message
23+
asset {
24+
id
25+
code
26+
scale
27+
}
28+
}
2429
}
25-
}
26-
}
27-
```
28-
29-
</CodeBlock>
30-
31-
### Example
32-
33-
To add US dollars, for example, as an asset type to your Rafiki instance, call the `CreateAsset` mutation and pass the `input` parameters for the asset `code`, represented by its <LinkOut href="https://en.wikipedia.org/wiki/ISO_4217">ISO 4217 currency code</LinkOut> (USD), and `scale` variables as follows:
34-
35-
<CodeBlock title='Example JSON request'>
36-
37-
```json
38-
{
39-
"input": {
40-
"code": "USD",
41-
"scale": 2
42-
}
43-
}
44-
```
45-
46-
</CodeBlock>
47-
48-
| Variable | Description |
49-
| -------- | --------------------------------------------------------------------------------- |
50-
| `code` | The asset code, generally an ISO 4217 currency code where available. |
51-
| `scale` | Difference in order of magnitude between the standard unit and a fractional unit. |
52-
53-
<CodeBlock title='Example JSON response'>
54-
55-
```json
56-
{
57-
"data": {
58-
"createAsset": {
59-
"code": "200",
60-
"success": true,
61-
"message": "Created Asset",
62-
"asset": {
63-
"id": "b3dffeda-1e0e-47d4-82a3-69b1a622eeb9",
30+
```
31+
</TabItem>
32+
<TabItem label="Variables">
33+
```json
34+
{
35+
"input": {
6436
"code": "USD",
6537
"scale": 2
6638
}
6739
}
68-
}
69-
}
70-
```
71-
72-
</CodeBlock>
40+
```
41+
For more information about this mutation's input object, see [`CreateAssetInput`](/apis/graphql/backend/inputobjects/#createassetinput).
42+
</TabItem>
43+
<TabItem label="Response">
44+
```json
45+
{
46+
"data": {
47+
"createAsset": {
48+
"code": "200",
49+
"success": true,
50+
"message": "Created Asset",
51+
"asset": {
52+
"id": "b3dffeda-1e0e-47d4-82a3-69b1a622eeb9",
53+
"code": "USD",
54+
"scale": 2
55+
}
56+
}
57+
}
58+
}
59+
```
60+
</TabItem>
61+
</Tabs>

packages/documentation/src/content/docs/integration/requirements/open-payments/grants-revoking.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ query Grants(
6969
```
7070
</TabItem>
7171

72-
<TabItem label='Arguments'>
72+
<TabItem label="Variables">
7373
```json
7474
{
7575
"input": {
@@ -88,6 +88,7 @@ query Grants(
8888
}
8989
}
9090
```
91+
For more information about this query's variables, see [`grants`](/apis/graphql/auth/queries/#grants).
9192
</TabItem>
9293

9394
<TabItem label='Response'>
@@ -161,14 +162,15 @@ mutation revokeGrant($input: RevokeGrantInput!) {
161162
```
162163
</TabItem>
163164

164-
<TabItem label='Arguments'>
165+
<TabItem label="Variables">
165166
```json
166167
{
167168
"input": {
168169
"grantId": "2117891e-4b89-42ae-984e-e0762d5888c1"
169170
}
170171
}
171172
```
173+
For more information about this mutation's input object, see [`RevokeGrantInput`](/apis/graphql/auth/inputobjects/#revokegrantinput).
172174
</TabItem>
173175

174176
<TabItem label='Response'>

packages/documentation/src/content/docs/integration/requirements/open-payments/wallet-keys.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ mutation CreateWalletAddressKey($input: CreateWalletAddressKeyInput!) {
4040
```
4141
</TabItem>
4242

43-
<TabItem label='Arguments'>
43+
<TabItem label="Variables">
4444

4545
```json
4646
{
@@ -127,7 +127,7 @@ mutation RevokeWalletAddressKey($input: RevokeWalletAddressKeyInput!) {
127127

128128
</TabItem>
129129

130-
<TabItem label = 'Arguments'>
130+
<TabItem label = 'Variables'>
131131
```json
132132
{
133133
"input": {

0 commit comments

Comments
 (0)