Skip to content

Commit 411b4ef

Browse files
committed
chore: update GraphQL examples for pagination
1 parent a7120cf commit 411b4ef

File tree

1 file changed

+97
-34
lines changed

1 file changed

+97
-34
lines changed

src/content/docs/misc/downloads-service.mdx

Lines changed: 97 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,22 @@ do not receive support.
136136
## GraphQL API examples
137137

138138
Fill also supports a GraphQL API, which can be accessed at `https://fill.papermc.io/graphql`.
139+
Fill's GraphQL API uses standard pagination, which you can learn more about [here](https://graphql.org/learn/pagination/).
139140

140141
A built-in GraphQL playground is available at https://fill.papermc.io/graphiql?path=/graphql.
141142
Common API tools such as Postman will introspect the API and provide a UI for building queries.
142143

143144
### Getting the latest version
144145
```graphql
145146
query LatestVersion {
146-
project(id: "paper") {
147-
versions(last: 1) {
148-
id
147+
project(key: "paper") {
148+
key
149+
versions(first: 1, orderBy: {direction: DESC}) {
150+
edges {
151+
node {
152+
key
153+
}
154+
}
149155
}
150156
}
151157
}
@@ -158,11 +164,16 @@ query LatestVersion {
158164
{
159165
"data": {
160166
"project": {
161-
"versions": [
162-
{
163-
"id": "1.21.6"
164-
}
165-
]
167+
"key": "paper",
168+
"versions": {
169+
"edges": [
170+
{
171+
"node": {
172+
"key": "1.21.11"
173+
}
174+
}
175+
]
176+
}
166177
}
167178
}
168179
}
@@ -173,10 +184,20 @@ query LatestVersion {
173184
### Getting the latest stable build number
174185
```graphql
175186
query LatestStableBuild {
176-
project(id: "paper") {
177-
versions(last: 1) {
178-
builds(filterBy: { channel: STABLE }, last: 1) {
179-
id
187+
project(key: "paper") {
188+
key
189+
versions(first: 1, orderBy: {direction: DESC}) {
190+
edges {
191+
node {
192+
key
193+
builds(filterBy: { channel: STABLE }, first: 1, orderBy: { direction: DESC }) {
194+
edges {
195+
node {
196+
number
197+
}
198+
}
199+
}
200+
}
180201
}
181202
}
182203
}
@@ -190,15 +211,25 @@ query LatestStableBuild {
190211
{
191212
"data": {
192213
"project": {
193-
"versions": [
194-
{
195-
"builds": [
196-
{
197-
"id": 46
214+
"key": "paper",
215+
"versions": {
216+
"edges": [
217+
{
218+
"node": {
219+
"key": "1.21.10",
220+
"builds": {
221+
"edges": [
222+
{
223+
"node": {
224+
"number": 48
225+
}
226+
}
227+
]
228+
}
198229
}
199-
]
200-
}
201-
]
230+
}
231+
]
232+
}
202233
}
203234
}
204235
}
@@ -209,11 +240,27 @@ query LatestStableBuild {
209240
### Getting the latest stable build download URL
210241
```graphql
211242
query LatestStableBuildDownloadURL {
212-
project(id: "paper") {
213-
versions(last: 1) {
214-
builds(filterBy: { channel: STABLE }, last: 1) {
215-
download(name: "server:default") {
216-
url
243+
project(key: "paper") {
244+
key
245+
versions(first: 1, orderBy: {direction: DESC}) {
246+
edges {
247+
node {
248+
key
249+
builds(filterBy: { channel: STABLE }, first: 1, orderBy: { direction: DESC }) {
250+
edges {
251+
node {
252+
number
253+
download(key: "server:default") {
254+
name
255+
url
256+
checksums {
257+
sha256
258+
}
259+
size
260+
}
261+
}
262+
}
263+
}
217264
}
218265
}
219266
}
@@ -228,17 +275,33 @@ query LatestStableBuildDownloadURL {
228275
{
229276
"data": {
230277
"project": {
231-
"versions": [
232-
{
233-
"builds": [
234-
{
235-
"download": {
236-
"url": "https://fill-data.papermc.io/v1/objects/bfca155b4a6b45644bfc1766f4e02a83c736e45fcc060e8788c71d6e7b3d56f6/paper-1.21.6-46.jar"
278+
"key": "paper",
279+
"versions": {
280+
"edges": [
281+
{
282+
"node": {
283+
"key": "1.21.10",
284+
"builds": {
285+
"edges": [
286+
{
287+
"node": {
288+
"number": 48,
289+
"download": {
290+
"name": "paper-1.21.10-48.jar",
291+
"url": "https://fill-data.papermc.io/v1/objects/bfca155b4a6b45644bfc1766f4e02a83c736e45fcc060e8788c71d6e7b3d56f6/paper-1.21.10-48.jar",
292+
"checksums": {
293+
"sha256": "bfca155b4a6b45644bfc1766f4e02a83c736e45fcc060e8788c71d6e7b3d56f6"
294+
},
295+
"size": 54185955
296+
}
297+
}
298+
}
299+
]
237300
}
238301
}
239-
]
240-
}
241-
]
302+
}
303+
]
304+
}
242305
}
243306
}
244307
}

0 commit comments

Comments
 (0)