rest.yaml 14.4 KB
Newer Older
Denis Arh's avatar
Denis Arh committed
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
---

# This is direct conversion from old api/*/spec.json files
# using https://www.json2yaml.com/
#
# Next step: swagger.

endpoints:
- title: Commands
  entrypoint: commands
  path: "/commands"
  authentication: []
  apis:
  - name: list
    path: "/"
    method: GET
    title: List of available commands
- title: Status
  entrypoint: status
  path: "/status"
  authentication: []
  apis:
  - name: list
    path: "/"
    method: GET
    title: See all current statuses
  - name: set
    path: "/"
    method: POST
    title: Set user's status
    parameters:
      post:
      - type: string
        name: icon
        required: false
        title: Status icon
      - type: string
        name: message
        required: false
        title: Status message
      - type: string
        name: expires
        required: false
        title: 'Clear status when it expires (eg: when-active, afternoon, tomorrow
          1h, 30m, 1 PM, 2019-05-20)'
  - name: delete
    path: "/"
    method: DELETE
    title: Clear status
- name: activity
  path: "/activity"
  entrypoint: activity
  title: User activity
  authentication: []
  apis:
  - name: send
    method: POST
    title: Sends user's activity to all subscribers; globally or per channel/message.
    path: "/"
    parameters:
      post:
      - name: channelID
        type: uint64
        required: false
        title: Channel ID, if set, activity will be send only to subscribed users
      - name: messageID
        type: uint64
        required: false
        title: Message ID, if set, channelID must be set as well
      - name: kind
        type: string
        required: true
        title: Arbitrary string
- title: Channels
  description: A channel is a representation of a sequence of messages. It has meta
    data like channel subject. Channels may be public, private or group.
  entrypoint: channel
  path: "/channels"
  authentication:
  - Client ID
  - Session ID
  imports:
    - github.com/cortezaproject/corteza-server/messaging/types
  apis:
  - name: list
    method: GET
    title: List channels
    path: "/"
    parameters:
      get:
      - type: string
        name: query
        required: false
        title: Search query
  - name: create
    method: POST
    title: Create new channel
    path: "/"
    parameters:
      post:
      - type: string
        name: name
        required: false
        title: Name of Channel
      - type: string
        name: topic
        required: false
        title: Subject of Channel
      - type: string
        name: type
        required: false
        title: Channel type
      - type: types.ChannelMembershipPolicy
        name: membershipPolicy
        required: false
        title: 'Membership policy (eg: featured, forced)?'
      - type: "[]string"
        name: members
        required: false
        title: Initial members of the channel
  - name: update
    method: PUT
    path: "/{channelID}"
    title: Update channel details
    parameters:
      path:
      - type: uint64
        name: channelID
        required: true
        title: Channel ID
      post:
      - type: string
        name: name
        required: false
        title: Name of Channel
      - type: string
        name: topic
        required: false
        title: Subject of Channel
      - type: types.ChannelMembershipPolicy
        name: membershipPolicy
        required: false
        title: 'Membership policy (eg: featured, forced)?'
      - type: string
        name: type
        required: false
        title: Channel type
      - type: uint64
        name: organisationID
        required: false
        title: Move channel to different organisation
  - name: state
    method: PUT
    path: "/{channelID}/state"
    title: Update channel state
    parameters:
      path:
      - type: uint64
        name: channelID
        required: true
        title: Channel ID
      post:
      - type: string
        name: state
        required: true
        title: 'Valid values: delete, undelete, archive, unarchive'
  - name: setFlag
    method: PUT
    path: "/{channelID}/flag"
    title: Update channel membership flag
    parameters:
      path:
      - type: uint64
        name: channelID
        required: true
        title: Channel ID
      post:
      - type: string
        name: flag
        required: true
        title: 'Valid values: pinned, hidden, ignored'
  - name: removeFlag
    method: DELETE
    path: "/{channelID}/flag"
    title: Remove channel membership flag
    parameters:
      path:
      - type: uint64
        name: channelID
        required: true
        title: Channel ID
  - name: read
    method: GET
    path: "/{channelID}"
    title: Read channel details
    parameters:
      path:
      - type: uint64
        name: channelID
        required: true
        title: Channel ID
  - name: members
    method: GET
    path: "/{channelID}/members"
    title: List channel members
    parameters:
      path:
      - name: channelID
        type: uint64
        required: true
        title: Channel ID
  - name: join
    method: PUT
    path: "/{channelID}/members/{userID}"
    title: Join channel
    parameters:
      path:
      - name: channelID
        type: uint64
        required: true
        title: Channel ID
      - name: userID
        type: uint64
        required: false
        title: Member ID
  - name: part
    method: DELETE
    path: "/{channelID}/members/{userID}"
    title: Remove member from channel
    parameters:
      path:
      - name: channelID
        type: uint64
        required: true
        title: Channel ID
      - name: userID
        type: uint64
        required: false
        title: Member ID
  - name: invite
    method: POST
    path: "/{channelID}/invite"
    title: Join channel
    parameters:
      path:
      - name: channelID
        type: uint64
        required: true
        title: Channel ID
      post:
      - name: userID
        type: "[]string"
        required: false
        title: User ID
  - name: attach
    path: "/{channelID}/attach"
    method: POST
    title: Attach file to channel
    parameters:
      path:
      - name: channelID
        type: uint64
        required: true
        title: Channel ID
      post:
      - name: replyTo
        type: uint64
        required: false
        title: Upload as a reply
      - name: upload
        type: "*multipart.FileHeader"
        required: true
        title: File to upload
- title: Messages
  path: "/channels/{channelID}/messages"
  parameters:
    path:
    - name: channelID
      type: uint64
      required: true
      title: Channel ID
  entrypoint: message
  authentication:
  - Client ID
  - Session ID
  apis:
  - name: create
    path: "/"
    method: POST
    title: Post new message to the channel
    parameters:
      post:
      - type: string
        name: message
        required: true
        sensitive: true
        title: Message contents (markdown)
  - name: executeCommand
    path: "/command/{command}/exec"
    method: POST
    title: Execute command
    parameters:
      path:
      - name: command
        type: string
        required: true
        title: Command to be executed
      post:
      - type: string
        name: input
        required: false
        title: Arbitrary command input
      - type: "[]string"
        name: params
        required: false
        title: Command parameters
  - name: markAsRead
    path: "/mark-as-read"
    method: GET
    title: Manages read/unread messages in a channel or a thread
    parameters:
      path: []
      get:
      - type: uint64
        name: threadID
        required: false
        title: 'ID of thread (messageID) '
      - type: uint64
        name: lastReadMessageID
        required: false
        title: ID of the last read message
  - name: edit
    path: "/{messageID}"
    method: PUT
    title: Edit existing message
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
      post:
      - type: string
        name: message
        required: true
        sensitive: true
        title: Message contents (markdown)
  - name: delete
    path: "/{messageID}"
    method: DELETE
    title: Delete existing message
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
  - name: replyCreate
    path: "/{messageID}/replies"
    method: POST
    title: Reply to a message
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
      post:
      - type: string
        name: message
        required: true
        sensitive: true
        title: Message contents (markdown)
  - name: pinCreate
    path: "/{messageID}/pin"
    method: POST
    title: Pin message to channel (public bookmark)
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
  - name: pinRemove
    path: "/{messageID}/pin"
    method: DELETE
    title: Pin message to channel (public bookmark)
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
  - name: bookmarkCreate
    path: "/{messageID}/bookmark"
    method: POST
    title: Bookmark a message (private bookmark)
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
  - name: bookmarkRemove
    path: "/{messageID}/bookmark"
    method: DELETE
    title: Remove boomark from message (private bookmark)
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
  - name: reactionCreate
    path: "/{messageID}/reaction/{reaction}"
    method: POST
    title: React to a message
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
      - name: reaction
        type: string
        required: true
        title: Reaction
  - name: reactionRemove
    path: "/{messageID}/reaction/{reaction}"
    method: DELETE
    title: Delete reaction from a message
    parameters:
      path:
      - name: messageID
        type: uint64
        required: true
        title: Message ID
      - name: reaction
        type: string
        required: true
        title: Reaction
- title: Attachments
  path: "/attachment/{attachmentID}"
  parameters:
    path:
    - name: attachmentID
      type: uint64
      required: true
      title: Attachment ID
    get:
    - type: string
      name: sign
      required: true
      title: Signature
    - type: uint64
      name: userID
      required: true
      title: User ID
  entrypoint: attachment
  authentication:
  - Client ID
  - Session ID
  apis:
  - name: original
    path: "/original/{name}"
    method: GET
    title: Serves attached file
    parameters:
      path:
      - name: name
        type: string
        required: true
        title: File name
      get:
      - type: bool
        name: download
        required: false
        title: Force file download
  - name: preview
    path: "/preview.{ext}"
    method: GET
    title: Serves preview of an attached file
    parameters:
      path:
      - name: ext
        type: string
        required: true
        title: Preview extension/format
- name: search
  entrypoint: search
  authentication:
  - Client ID
  - Session ID
  path: "/search"
  method: GET
  title: Search entry point
  parameters:
    get:
    - name: query
      type: string
      required: false
      title: Search query
  apis:
  - method: GET
    name: messages
    path: "/messages"
    title: Search for messages
    parameters:
      get:
      - name: channelID
        type: "[]string"
        required: false
        title: Filter by channels
      - name: afterMessageID
        type: uint64
        required: false
        title: ID of the first message in the list (exclusive)
      - name: beforeMessageID
        type: uint64
        required: false
        title: ID of the last message in the list (exclusive)
      - name: fromMessageID
        type: uint64
        required: false
        title: ID of the first message in the list (inclusive)
      - name: toMessageID
        type: uint64
        required: false
        title: ID of the last message the list (inclusive)
      - name: threadID
        type: "[]string"
        required: false
        title: Filter by thread message ID
      - name: userID
        type: "[]string"
        required: false
        title: Filter by one or more user
      - name: type
        type: "[]string"
        required: false
        title: Filter by message type (text, inlineImage, attachment, ...)
      - name: pinnedOnly
        type: bool
        required: false
        title: Return only pinned messages
      - name: bookmarkedOnly
        type: bool
        required: false
        title: Only bookmarked messages
      - name: limit
        type: uint
        required: false
        title: Max number of messages
  - method: GET
    name: threads
    path: "/threads"
    title: Search for threads
    parameters:
      get:
      - name: channelID
        type: "[]string"
        required: false
        title: Filter by channels
      - name: limit
        type: uint
        required: false
        title: Max number of messages
- title: Permissions
  entrypoint: permissions
  path: "/permissions"
  authentication:
  - Client ID
  - Session ID
  imports:
575
    - github.com/cortezaproject/corteza-server/pkg/rbac
Denis Arh's avatar
Denis Arh committed
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
  apis:
  - name: list
    path: "/"
    method: GET
    title: Retrieve defined permissions
  - name: effective
    path: "/effective"
    method: GET
    title: Effective rules for current user
    parameters:
      get:
      - name: resource
        type: string
        required: false
        title: Show only rules for a specific resource
  - name: read
    path: "/{roleID}/rules"
    method: GET
    title: Retrieve role permissions
    parameters:
      path:
      - name: roleID
        type: uint64
        required: true
        title: Role ID
  - name: delete
    path: "/{roleID}/rules"
    method: DELETE
    title: Remove all defined role permissions
    parameters:
      path:
      - name: roleID
        type: uint64
        required: true
        title: Role ID
  - name: update
    path: "/{roleID}/rules"
    method: PATCH
    title: Update permission settings
    parameters:
      path:
      - name: roleID
        type: uint64
        required: true
        title: Role ID
      post:
      - name: rules
623
        type: rbac.RuleSet
Denis Arh's avatar
Denis Arh committed
624
625
        required: true
        title: List of permission rules to set