Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
859 lines (859 loc) · 21.5 KB
/
Copy pathopenapi.yaml
File metadata and controls
859 lines (859 loc) · 21.5 KB
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
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
openapi: 3.1.0
info:
title: Pushman Public API
version: 1.0.0
description: Supported API for the Pushman CLI and developer automation.
license:
name: MIT
identifier: MIT
servers:
- url: https://api.pushman.whitekiwi.link/v1
description: Production API origin.
security:
- bearerAuth: []
tags:
- name: Authorization
description: Browser-assisted CLI account authorization.
- name: Pairing
description: Interactive CLI authorization.
- name: Messages
description: Push creation and sender history.
- name: Devices
description: Eligible receiving-device discovery.
- name: Usage
description: Account send quota.
- name: Sender
description: The authenticated paired CLI credential.
paths:
/device-authorizations:
post:
tags:
- Authorization
operationId: createDeviceAuthorization
summary: Start browser-assisted CLI account authorization.
security: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
additionalProperties: false
required:
- client_id
- suggested_name
- platform
properties:
client_id:
type: string
const: pushman-cli
scope:
type: string
const: push devices:read history:read usage:read
default: push devices:read history:read usage:read
suggested_name:
type: string
minLength: 1
maxLength: 64
platform:
type: string
enum:
- darwin
- linux
- windows
responses:
'200':
description: Device authorization created.
content:
application/json:
schema:
$ref: '#/components/schemas/DeviceAuthorization'
default:
$ref: '#/components/responses/APIError'
/oauth/token:
post:
tags:
- Authorization
operationId: exchangeDeviceCode
summary: Exchange an approved device code for a CLI credential.
security: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
additionalProperties: false
required:
- grant_type
- device_code
- client_id
properties:
grant_type:
type: string
const: urn:ietf:params:oauth:grant-type:device_code
device_code:
type: string
client_id:
type: string
const: pushman-cli
responses:
'200':
description: CLI credential issued once.
content:
application/json:
schema:
$ref: '#/components/schemas/DeviceToken'
'400':
description: Authorization is pending, denied, expired, slowed down, or invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/OAuthError'
default:
$ref: '#/components/responses/APIError'
/pairings:
post:
tags:
- Pairing
operationId: createPairing
summary: Start pairing a CLI.
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- suggestedName
- platform
properties:
suggestedName:
type: string
minLength: 1
maxLength: 64
platform:
type: string
enum:
- darwin
- linux
- windows
responses:
'201':
description: Pairing created.
content:
application/json:
schema:
$ref: '#/components/schemas/PairingCreated'
default:
$ref: '#/components/responses/APIError'
/pairings/{pairingId}:
get:
tags:
- Pairing
operationId: getPairing
summary: Poll a pairing attempt.
security: []
parameters:
- $ref: '#/components/parameters/PairingId'
- name: pairingSecret
in: header
required: true
schema:
type: string
description: One-time secret returned out of band when pairing is created.
responses:
'200':
description: Current pairing state.
content:
application/json:
schema:
$ref: '#/components/schemas/Pairing'
default:
$ref: '#/components/responses/APIError'
/messages:
post:
tags:
- Messages
operationId: createMessage
summary: Accept a push message for delivery.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MessageInput'
responses:
'202':
description: Message transaction committed and queued.
content:
application/json:
schema:
$ref: '#/components/schemas/MessageAccepted'
default:
$ref: '#/components/responses/APIError'
get:
tags:
- Messages
operationId: listOwnMessages
summary: List messages sent by the authenticated paired CLI.
parameters:
- $ref: '#/components/parameters/Cursor'
- $ref: '#/components/parameters/Limit'
responses:
'200':
description: Sent message page.
content:
application/json:
schema:
$ref: '#/components/schemas/MessagePage'
default:
$ref: '#/components/responses/APIError'
/messages/{messageId}:
get:
tags:
- Messages
operationId: getOwnMessage
summary: Get one logical message and its retained revisions sent by the authenticated paired CLI.
parameters:
- $ref: '#/components/parameters/MessageId'
responses:
'200':
description: Sent logical message detail.
content:
application/json:
schema:
$ref: '#/components/schemas/MessageDetail'
default:
$ref: '#/components/responses/APIError'
/sender-credentials/current:
get:
tags:
- Sender
operationId: getCurrentSenderCredential
summary: Show the authenticated paired CLI.
responses:
'200':
description: Current sender credential.
content:
application/json:
schema:
$ref: '#/components/schemas/SenderCredential'
default:
$ref: '#/components/responses/APIError'
patch:
tags:
- Sender
operationId: updateCurrentSenderCredential
summary: Rename the authenticated paired CLI.
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- name
properties:
name:
type: string
minLength: 1
maxLength: 64
responses:
'200':
description: Renamed sender credential.
content:
application/json:
schema:
$ref: '#/components/schemas/SenderCredential'
default:
$ref: '#/components/responses/APIError'
delete:
tags:
- Sender
operationId: revokeCurrentSenderCredential
summary: Revoke the authenticated paired CLI.
responses:
'204':
description: Credential revoked immediately.
default:
$ref: '#/components/responses/APIError'
/devices:
get:
tags:
- Devices
operationId: listDevices
summary: List receiving devices visible to the sender.
responses:
'200':
description: Receiving devices.
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/Device'
default:
$ref: '#/components/responses/APIError'
/usage:
get:
tags:
- Usage
operationId: getUsage
summary: Get current account send usage.
responses:
'200':
description: Current UTC monthly usage.
content:
application/json:
schema:
$ref: '#/components/schemas/Usage'
default:
$ref: '#/components/responses/APIError'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: opaque
parameters:
PairingId:
name: pairingId
in: path
required: true
schema:
$ref: '#/components/schemas/PairingId'
MessageId:
name: messageId
in: path
required: true
description: Any retained revision ID in the logical message.
schema:
$ref: '#/components/schemas/MessageId'
Cursor:
name: cursor
in: query
schema:
type: string
Limit:
name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 100
default: 20
responses:
APIError:
description: Request failed.
headers:
X-Request-ID:
schema:
type: string
Retry-After:
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
schemas:
Error:
type: object
additionalProperties: true
required:
- code
- message
- requestId
properties:
code:
type: string
pattern: ^[a-z][a-z0-9_]*$
message:
type: string
requestId:
type: string
retryAfter:
type: integer
minimum: 0
description: Seconds until a retry is permitted.
ErrorResponse:
type: object
additionalProperties: true
required:
- error
properties:
error:
$ref: '#/components/schemas/Error'
DeviceAuthorization:
type: object
additionalProperties: true
required:
- device_code
- user_code
- verification_uri
- verification_uri_complete
- expires_in
- interval
properties:
device_code:
type: string
description: High-entropy polling secret that must never be displayed or put in a URL.
user_code:
type: string
pattern: ^[A-Z0-9]{4}-[A-Z0-9]{4}$
verification_uri:
type: string
format: uri
verification_uri_complete:
type: string
format: uri
expires_in:
type: integer
minimum: 1
interval:
type: integer
minimum: 1
DeviceToken:
type: object
additionalProperties: true
required:
- access_token
- token_type
- scope
- sender_name
properties:
access_token:
type: string
token_type:
type: string
const: Bearer
scope:
type: string
const: push devices:read history:read usage:read
sender_name:
type: string
minLength: 1
maxLength: 64
OAuthError:
type: object
additionalProperties: true
required:
- error
properties:
error:
type: string
enum:
- authorization_pending
- slow_down
- access_denied
- expired_token
- invalid_grant
- invalid_request
error_description:
type: string
PairingId:
type: string
pattern: ^pair_[0-9A-HJKMNP-TV-Z]{26}$
PairingCreated:
type: object
additionalProperties: true
required:
- id
- userCode
- verificationUri
- expiresAt
- interval
- status
- pairingSecret
properties:
id:
$ref: '#/components/schemas/PairingId'
userCode:
type: string
pattern: ^[A-Z0-9]{4}-[A-Z0-9]{4}$
verificationUri:
type: string
format: uri
expiresAt:
type: string
format: date-time
interval:
type: integer
minimum: 1
status:
type: string
const: pending
pairingSecret:
type: string
description: One-time polling secret; never put it in a URL.
IssuedCredential:
type: object
additionalProperties: true
required:
- token
- name
description: Returned once after pairing approval or token creation.
properties:
token:
type: string
name:
type: string
Pairing:
type: object
additionalProperties: true
required:
- id
- userCode
- verificationUri
- expiresAt
- interval
- status
properties:
id:
$ref: '#/components/schemas/PairingId'
userCode:
type: string
pattern: ^[A-Z0-9]{4}-[A-Z0-9]{4}$
verificationUri:
type: string
format: uri
expiresAt:
type: string
format: date-time
interval:
type: integer
minimum: 1
description: Minimum polling interval in seconds.
status:
type: string
enum:
- pending
- approved
- denied
- expired
credential:
$ref: '#/components/schemas/IssuedCredential'
MessageId:
type: string
pattern: ^msg_[0-9A-HJKMNP-TV-Z]{26}$
LogicalMessageId:
type: string
pattern: ^lmsg_[0-9A-HJKMNP-TV-Z]{26}$
DeliveryState:
type: string
enum:
- accepted
- sent
- failed
MessageSummary:
type: object
additionalProperties: true
required:
- id
- logicalMessageId
- title
- body
- senderName
- acceptedAt
- read
- updateCount
- deliveryState
properties:
id:
$ref: '#/components/schemas/MessageId'
logicalMessageId:
$ref: '#/components/schemas/LogicalMessageId'
title:
type: string
subtitle:
type: string
body:
type: string
senderName:
type: string
acceptedAt:
type: string
format: date-time
read:
type: boolean
updateCount:
type: integer
minimum: 1
deliveryState:
$ref: '#/components/schemas/DeliveryState'
MessagePage:
type: object
additionalProperties: true
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/MessageSummary'
nextCursor:
type: string
RestrictedIdentifier:
type: string
minLength: 1
maxLength: 64
pattern: ^[A-Za-z0-9._:-]+$
MessageInput:
type: object
additionalProperties: false
required:
- body
properties:
title:
type: string
maxLength: 250
subtitle:
type: string
maxLength: 250
body:
type: string
minLength: 1
maxLength: 4096
url:
type: string
maxLength: 2048
format: uri
group:
$ref: '#/components/schemas/RestrictedIdentifier'
image:
type: string
format: uri
maxLength: 2048
pattern: ^https://
sound:
type: string
enum:
- default
- none
default: default
key:
$ref: '#/components/schemas/RestrictedIdentifier'
format:
type: string
enum:
- plain
- monospace
default: plain
devices:
type: array
minItems: 1
uniqueItems: true
description: Receiving-device nicknames. Omit to target all eligible devices.
items:
type: string
minLength: 1
maxLength: 64
MessageAccepted:
type: object
additionalProperties: true
required:
- id
- logicalMessageId
- acceptedAt
- targetCount
properties:
id:
$ref: '#/components/schemas/MessageId'
logicalMessageId:
type: string
pattern: ^lmsg_[0-9A-HJKMNP-TV-Z]{26}$
acceptedAt:
type: string
format: date-time
targetCount:
type: integer
minimum: 1
DeviceId:
type: string
pattern: ^dev_[0-9A-HJKMNP-TV-Z]{26}$
MessageDelivery:
type: object
additionalProperties: true
required:
- deviceId
- deviceName
- state
properties:
deviceId:
$ref: '#/components/schemas/DeviceId'
deviceName:
type: string
state:
$ref: '#/components/schemas/DeliveryState'
failureCode:
type: string
MessageRevision:
type: object
additionalProperties: true
required:
- id
- title
- body
- senderName
- acceptedAt
- sound
- format
- deliveries
properties:
id:
$ref: '#/components/schemas/MessageId'
title:
type: string
subtitle:
type: string
body:
type: string
senderName:
type: string
acceptedAt:
type: string
format: date-time
url:
type: string
format: uri
group:
$ref: '#/components/schemas/RestrictedIdentifier'
image:
type: string
format: uri
sound:
type: string
enum:
- default
- none
format:
type: string
enum:
- plain
- monospace
deliveries:
type: array
items:
$ref: '#/components/schemas/MessageDelivery'
MessageDetail:
type: object
additionalProperties: true
required:
- logicalMessageId
- read
- revisions
properties:
logicalMessageId:
$ref: '#/components/schemas/LogicalMessageId'
read:
type: boolean
revisions:
type: array
minItems: 1
items:
$ref: '#/components/schemas/MessageRevision'
SenderCredential:
type: object
additionalProperties: true
required:
- id
- name
- kind
- createdAt
properties:
id:
type: string
pattern: ^snd_[0-9A-HJKMNP-TV-Z]{26}$
name:
type: string
minLength: 1
maxLength: 64
kind:
type: string
enum:
- paired_cli
- automation
authorizationMethod:
type: string
enum:
- app_pair
- web_login
description: Approval path for CLI credentials; omitted for automation tokens.
createdAt:
type: string
format: date-time
lastUsedAt:
type: string
format: date-time
Device:
type: object
additionalProperties: true
required:
- id
- name
- platform
- notificationStatus
- eligible
properties:
id:
$ref: '#/components/schemas/DeviceId'
name:
type: string
minLength: 1
maxLength: 64
platform:
type: string
enum:
- ios
notificationStatus:
type: string
enum:
- enabled
- disabled
- unknown
eligible:
type: boolean
Usage:
type: object
additionalProperties: true
required:
- used
- limit
- periodStart
- periodEnd
properties:
plan:
type: string
enum:
- free
- pro
description: Currently verified capacity tier, not a claim that an unavailable paid subscription ended.
billingState:
type: string
enum:
- disabled
- synchronized
- unavailable
description: Unavailable means only independently available Free and operator-credit capacity is usable.
used:
type: integer
minimum: 0
limit:
type: integer
minimum: 0
periodStart:
type: string
format: date-time
periodEnd:
type: string
format: date-time