/
pins.yml
553 lines (547 loc) · 15.8 KB
/
pins.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
openapi: '3.0.2'
info:
title: Axis Pinning Service
version: '0.0.1'
description: |
Implements IPFS pinning services API spec: [github.com/ipfs/pinning-services-api-spec](https://github.com/ipfs/pinning-services-api-spec)
servers:
- url: https://api.server.test/v1
paths:
/pins:
get:
summary: List of pin objects
description: |
List all the pin objects, matching optional filters; when no filter is
provided, only successful pins are returned
tags:
- pins
security:
- accessToken: []
parameters:
- $ref: '#/components/parameters/cid'
- $ref: '#/components/parameters/name'
- $ref: '#/components/parameters/match'
- $ref: '#/components/parameters/status'
- $ref: '#/components/parameters/before'
- $ref: '#/components/parameters/after'
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/meta'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PinResults'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/InsufficientFunds'
'500':
$ref: '#/components/responses/InternalServerError'
post:
summary: Add pin object
description: Add a new pin object for the current access token
tags:
- pins
security:
- accessToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pin'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/PinStatus'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/InsufficientFunds'
'500':
$ref: '#/components/responses/InternalServerError'
/pins/{requestid}:
parameters:
- name: requestid
in: path
required: true
schema:
type: string
description: |
Unique identifier of the pin object
get:
summary: Get pin object
description: Get a pin object and its status
tags:
- pins
security:
- accessToken: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PinStatus'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/InsufficientFunds'
'500':
$ref: '#/components/responses/InternalServerError'
put:
summary: Update pin object
description: Update an existing pin object.
tags:
- pins
security:
- accessToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pin'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/PinStatus'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/InsufficientFunds'
'500':
$ref: '#/components/responses/InternalServerError'
post:
summary: Update pin object
description: |
Same as PUT /pins/{requestid}. POST included to meet IPFS Pin Service API
specification.
tags:
- pins
security:
- accessToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pin'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/PinStatus'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/InsufficientFunds'
'500':
$ref: '#/components/responses/InternalServerError'
patch:
summary: Modify pin object
description: |
Modify an existing pin object.
tags:
- pins
security:
- accessToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pin'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/PinStatus'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/InsufficientFunds'
'500':
$ref: '#/components/responses/InternalServerError'
delete:
summary: Remove pin object
description: Remove a pin object
tags:
- pins
security:
- accessToken: []
responses:
'202':
description: Accepted
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/InsufficientFunds'
'500':
$ref: '#/components/responses/InternalServerError'
components:
schemas:
PinResults:
description: |
Response used for listing pin objects matching request
type: object
required:
- count
- total
- results
properties:
count:
description: |
The total number of pin objects that exist for passed query filters
type: integer
format: int32
minimum: 0
example: 1
total:
description: |
The total number of pin objects without filters
type: integer
format: int32
minimum: 0
example: 1
results:
description: An array of PinStatus results
type: array
items:
$ref: '#/components/schemas/PinStatus'
uniqueItems: true
minItems: 0
maxItems: 1000
PinStatus:
description: Pin object with status
type: object
required:
- requestid
- status
- created
- pin
- delegates
properties:
requestid:
description: |
Globally unique ID of the pin request; can be used to check the
status of ongoing pinning, modification of pin object, or pin
removal
type: string
example: "UniqueIdOfPinRequest"
status:
$ref: '#/components/schemas/Status'
created:
description: |
Immutable timestamp indicating when a pin request entered a pinning
service; can be used for filtering results and pagination
type: string
format: date-time # RFC 3339, section 5.6
example: "2020-07-27T17:32:28Z"
pin:
$ref: '#/components/schemas/Pin'
delegates:
$ref: '#/components/schemas/Delegates'
info:
$ref: '#/components/schemas/StatusInfo'
Pin:
description: Pin object
type: object
required:
- cid
properties:
cid:
description: CID to be pinned recursively
type: string
example: "QmCIDToBePinned"
name:
description: |
Optional name for pinned data; can be used for lookups later
type: string
maxLength: 255
example: 'my precious data'
origins:
$ref: '#/components/schemas/Origins'
meta:
$ref: '#/components/schemas/PinMeta'
Status:
description: Status a pin object can have at a pinning service
type: string
enum:
- queued # pinning operation is waiting in the queue; additional info can be returned in info[status_details]
- pinning # pinning in progress; additional info can be returned in info[status_details]
- pinned # pinned successfully
- failed # pinning service was unable to finish pinning operation; additional info can be found in info[status_details]
Delegates:
description: |
List of multiaddrs designated by pinning service for
transferring any new data from external peers
type: array
items:
type: string
uniqueItems: true
minItems: 1
maxItems: 20
example: ['/dnsaddr/pin-service.example.com']
Origins:
description: Optional list of multiaddrs known to provide the data
type: array
items:
type: string
uniqueItems: true
minItems: 0
maxItems: 20
example: ['/p2p/QmSourcePeerId']
PinMeta:
description: Optional metadata for pin object
type: object
additionalProperties:
type: string
minProperties: 0
maxProperties: 1000
example:
app_id: "99986338-1113-4706-8302-4420da6158aa" # Pin.meta[app_id], useful for filtering pins per app
StatusInfo:
description: Optional info for PinStatus response
type: object
additionalProperties:
type: string
minProperties: 0
maxProperties: 1000
example:
status_details: "Queue position: 7 of 9" # PinStatus.info[status_details], when status=queued
TextMatchingStrategy:
description: |
Text matching strategy. Values prefixed with an 'i' indicate
case-insensitivity
type: string
default: exact
enum:
- exact
- iexact
- partial
- ipartial
Error:
description: Base error object
type: object
required:
- error
properties:
error:
type: object
required:
- reason
properties:
reason:
type: string
description: Identifying title of the error
example: "SOME_ERROR_REASON"
details:
type: string
description: An optional, longer description of the error
example: Some error occured and here are some description about it.
parameters:
before:
description: Return results created (queued) before provided timestamp
name: before
in: query
required: false
schema:
type: string
format: date-time # RFC 3339, section 5.6
example: "2020-07-27T17:32:28Z"
after:
description: Return results created (queued) after provided timestamp
name: after
in: query
required: false
schema:
type: string
format: date-time # RFC 3339, section 5.6
example: "2020-07-27T17:32:28Z"
limit:
description: Max records to return
name: limit
in: query
required: false
schema:
type: integer
format: int32
minimum: 1
maximum: 1000
default: 10
cid:
description: |
Return pin objects responsible for pinning the specified CID(s)
name: cid
in: query
required: false
schema:
type: array
items:
type: string
uniqueItems: true
minItems: 1
maxItems: 1000
style: form # ?cid=Qm1,Qm2,bafy3
explode: false
examples:
oneId:
summary: Example of a single CID
value: [QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR] # ?cid=Qm
multipleIds:
summary: Example of multiple CIDs
value: [
QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR,
bafkreigtdgsgv2f3bkhsmxvku3bpnnqzubcxeupf7fff5f7l7tlm2v237a
] # ?cid=Qm,bafy
name:
description: |
Return pin objects with names that contain provided value (partial or
full match)
name: name
in: query
required: false
schema:
type: string
maxLength: 255
example: "my precious"
status:
description: Return pin objects for pins with the specified status
name: status
in: query
required: false
schema:
type: array
items:
$ref: '#/components/schemas/Status'
uniqueItems: true
minItems: 1
style: form # ?status=queued,pinning
explode: false
meta:
description: Return pin objects that match specified metadata
name: meta
in: query
required: false
content:
application/json: # ?meta={"foo":"bar"}
schema:
$ref: '#/components/schemas/PinMeta'
match:
description: Text matching strategy for the 'name' parameter
name: match
in: query
required: false
schema:
$ref: '#/components/schemas/TextMatchingStrategy'
offset:
description: Return pin objects starting at given offset records
name: offset
in: query
required: false
schema:
type: integer
format: int32
example: 100
default: 0
sort:
description: |
Return pin objects sorted by the given field. A unary negative may be
used to order by descending order.
name: sort
in: query
required: false
schema:
type: string
default: created
enum:
- cid
- created
- name
- status
uniqueItems: true
minItems: 1
style: form # ?sort:cid,name
explode: false
responses:
BadRequest:
description: Bad request (400)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Unauthorized (401); access token is missing or invalid
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: The specified resource was not found (404)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
InsufficientFunds:
description: Insufficient funds (409)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
InternalServerError:
description: Internal server error (500)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
securitySchemes:
accessToken:
description: |
An opaque token is required to be sent with each request in the HTTP header:
- `Authorization: Bearer <access-token>`
The `access-token` should be generated per device, and the user should have the ability to revoke each token separately.
type: http
scheme: bearer