diff --git a/docs/api/btc-ln-receive.mdx b/docs/api/btc-ln-receive.mdx index b92efbd8..0ec282e7 100644 --- a/docs/api/btc-ln-receive.mdx +++ b/docs/api/btc-ln-receive.mdx @@ -90,6 +90,6 @@ query Me { :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ac3751d8-c116-408b-9129-d6e365da590b) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ac3751d8-c116-408b-9129-d6e365da590b) to find examples in multiple programming languages. ::: diff --git a/docs/api/btc-ln-send.mdx b/docs/api/btc-ln-send.mdx index 57114c4c..a92815d2 100644 --- a/docs/api/btc-ln-send.mdx +++ b/docs/api/btc-ln-send.mdx @@ -88,6 +88,6 @@ mutation LnInvoicePaymentSend($input: LnInvoicePaymentInput!) { :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ac3751d8-c116-408b-9129-d6e365da590b) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ac3751d8-c116-408b-9129-d6e365da590b) to find examples in multiple programming languages. ::: diff --git a/docs/api/btc-onchain-receive.mdx b/docs/api/btc-onchain-receive.mdx index 64ecb641..239b1198 100644 --- a/docs/api/btc-onchain-receive.mdx +++ b/docs/api/btc-onchain-receive.mdx @@ -90,6 +90,6 @@ query Me { :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ac3751d8-c116-408b-9129-d6e365da590b) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ac3751d8-c116-408b-9129-d6e365da590b) to find examples in multiple programming languages. ::: diff --git a/docs/api/btc-onchain-send.mdx b/docs/api/btc-onchain-send.mdx index a4b9f465..407b2093 100644 --- a/docs/api/btc-onchain-send.mdx +++ b/docs/api/btc-onchain-send.mdx @@ -83,6 +83,6 @@ mutation onChainUsdPaymentSend($input: OnChainUsdPaymentSendInput!) { :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ac3751d8-c116-408b-9129-d6e365da590b) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ac3751d8-c116-408b-9129-d6e365da590b) to find examples in multiple programming languages. ::: diff --git a/docs/api/pagination.md b/docs/api/pagination.md new file mode 100644 index 00000000..a8e7d651 --- /dev/null +++ b/docs/api/pagination.md @@ -0,0 +1,157 @@ +--- +id: pagination +title: Pagination +slug: /api/pagination +--- + +When you access the list of transactions all items will have an associated cursor position. This cursor can be used to paginate through the list by defining the `after` and / or `before` variable in the GraphQL request. + +## Example request with pagination + +Note the `pageInfo` object containing the cursor and page values. The `edges` object contains the transaction data. + +* `endCursor`: When paginating forwards, the cursor to continue. +* `hasNextPage`: When paginating forwards, are there more items? +* `hasPreviousPage`: When paginating backwards, are there more items? +* `startCursor`: When paginating backwards, the cursor to continue. + +```graphql +query transactionsForAccount($walletIds: [WalletId], $first: Int, $after: String) { + me { + id + defaultAccount { + transactions(walletIds: $walletIds, first: $first, after: $after) { + pageInfo { + endCursor + hasNextPage + hasPreviousPage + startCursor + } + edges { + cursor + node { + direction + settlementCurrency + settlementDisplayAmount + status + } + } + } + } + } +} +``` + +## Variables + +* `first`: Returns the first n items from the list. +* `after`: Returns the items in the list that come after the specified cursor. +* `last`: Returns the last n items from the list. +* `before`: Returns the items in the list that come before the specified cursor. + +The variables used in the request to show the first 2 transactions for the default account: + +```json +{ + "first": 2, + "after": null +} +``` + +Sample response showing the first 2 transactions: +```json +{ + "data": { + "me": { + "id": "dd3771d0-66b2-4b28-8757-b1a5db0f8fcf", + "defaultAccount": { + "transactions": { + "pageInfo": { + "endCursor": "6538b68c491e13fd6416722d", + "hasNextPage": true, + "hasPreviousPage": false, + "startCursor": "6538bda9491e13fd6416b5f3" + }, + "edges": [ + { + "cursor": "6538bda9491e13fd6416b5f3", + "node": { + "direction": "RECEIVE", + "settlementCurrency": "USD", + "settlementDisplayAmount": "0.01", + "status": "SUCCESS" + } + }, + { + "cursor": "6538b68c491e13fd6416722d", + "node": { + "direction": "RECEIVE", + "settlementCurrency": "USD", + "settlementDisplayAmount": "1.00", + "status": "SUCCESS" + } + } + ] + } + } + } + } +} +``` + +## Request to show the next two transactions + +To show the next two transactions the `endCursor` value from the previous response is used as the `after` variable in the next request: + +```json +{ + "first": 2, + "after": "653787e933905fc03c13e2bc" +} +``` + +Response showing the next two transactions: +```json +{ + "data": { + "me": { + "id": "dd3771d0-66b2-4b28-8757-b1a5db0f8fcf", + "defaultAccount": { + "transactions": { + "pageInfo": { + "endCursor": "653787c033905fc03c13e0a3", + "hasNextPage": true, + "hasPreviousPage": false, + "startCursor": "653787e933905fc03c13e286" + }, + "edges": [ + { + "cursor": "653787e933905fc03c13e286", + "node": { + "direction": "SEND", + "settlementCurrency": "BTC", + "settlementDisplayAmount": "-0.47", + "status": "SUCCESS" + } + }, + { + "cursor": "653787c033905fc03c13e0a3", + "node": { + "direction": "SEND", + "settlementCurrency": "BTC", + "settlementDisplayAmount": "-0.47", + "status": "SUCCESS" + } + } + ] + } + } + } + } +} +``` + +:::tip +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ae685bc1-d637-48b2-8e32-4600eefc9a4e) to find examples in multiple programming languages. +::: diff --git a/docs/api/usd-ln-receive.mdx b/docs/api/usd-ln-receive.mdx index e4560305..e1c5374d 100644 --- a/docs/api/usd-ln-receive.mdx +++ b/docs/api/usd-ln-receive.mdx @@ -93,6 +93,6 @@ query Me { :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ed78e464-9874-4bf7-9b7b-92e5a898db83) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ed78e464-9874-4bf7-9b7b-92e5a898db83) to find examples in multiple programming languages. ::: diff --git a/docs/api/usd-ln-send.mdx b/docs/api/usd-ln-send.mdx index 187065cd..b87b0ea8 100644 --- a/docs/api/usd-ln-send.mdx +++ b/docs/api/usd-ln-send.mdx @@ -89,6 +89,6 @@ mutation LnInvoicePaymentSend($input: LnInvoicePaymentInput!) { :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ed78e464-9874-4bf7-9b7b-92e5a898db83) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ed78e464-9874-4bf7-9b7b-92e5a898db83) to find examples in multiple programming languages. ::: diff --git a/docs/api/usd-onchain-receive.mdx b/docs/api/usd-onchain-receive.mdx index 7f50ad44..c8bdccb7 100644 --- a/docs/api/usd-onchain-receive.mdx +++ b/docs/api/usd-onchain-receive.mdx @@ -92,6 +92,6 @@ query Me { :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ed78e464-9874-4bf7-9b7b-92e5a898db83) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ed78e464-9874-4bf7-9b7b-92e5a898db83) to find examples in multiple programming languages. ::: diff --git a/docs/api/usd-onchain-send.mdx b/docs/api/usd-onchain-send.mdx index 5e8aaad7..a88c50f3 100644 --- a/docs/api/usd-onchain-send.mdx +++ b/docs/api/usd-onchain-send.mdx @@ -104,6 +104,6 @@ mutation onChainUsdPaymentSendAsBtcDenominated($input: OnChainUsdPaymentSendAsBt :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ed78e464-9874-4bf7-9b7b-92e5a898db83) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#ed78e464-9874-4bf7-9b7b-92e5a898db83) to find examples in multiple programming languages. ::: diff --git a/docs/api/webhooks.md b/docs/api/webhooks.md index 8b354095..1d1502c9 100644 --- a/docs/api/webhooks.md +++ b/docs/api/webhooks.md @@ -31,8 +31,8 @@ Example payload sent on a `receive.lightning` event: The calls to register, list and remove webhooks are made through the GraphQL API as described below. :::tip -To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging. -Can also use the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#0be26540-d31c-4d0e-b7ac-400fc73bdb80) to find examples in multiple programming languages. +To test the GraphQL requests further use the GraphQL playground at [api.blink.sv/graphql](https://api.blink.sv/graphql) for mainnet or [api.staging.galoy.io/graphql](https://api.staging.galoy.io/graphql) for staging.
+Check out the [Galoy API Postman collection](https://documenter.getpostman.com/view/29391384/2s9YCAQq3z#0be26540-d31c-4d0e-b7ac-400fc73bdb80) to find examples in multiple programming languages. ::: ## Add a callback endpoint diff --git a/sidebars.js b/sidebars.js index d3407b84..c7aa8ce9 100644 --- a/sidebars.js +++ b/sidebars.js @@ -87,10 +87,11 @@ const sidebars = { }, ], }, + 'api/pagination', + 'api/webhooks', 'api/errors', ], }, - 'api/webhooks', 'api/postman', 'api/learn-more' ],