forked from dunglas/mercure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
112 lines (112 loc) · 3.88 KB
/
openapi.yaml
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
openapi: 3.0.2
info:
title: The Mercure protocol
description: "[Mercure](https://mercure.rocks) is a protocol allowing to push data updates to web browsers and other HTTP clients in a convenient, fast, reliable and battery-efficient way."
version: 0.3.2
contact:
name: Kévin Dunglas
url: https://mercure.rocks
email: [email protected]
license:
name: GNU Affero General Public License v3.0 or later
url: https://github.com/dunglas/mercure/blob/master/LICENSE
x-spdx: AGPL-3.0-or-later
servers:
- url: /hub
paths:
/:
get:
summary: Subscribe to updates
externalDocs:
description: Sucbriptions specification
url: https://github.com/dunglas/mercure/blob/master/spec/mercure.md#subscriptions
parameters:
- name: topic
in: query
description: The topic to get updates from, can be a URI template (RFC6570).
required: true
schema:
type: array
items:
type: string
- name: Last-Event-ID
in: query
description: The last received event id, to retrieve missed events.
schema:
type: string
- name: Last-Event-ID
in: header
description: The last received event id, to retrieve missed events, takes precedence over the query parameter.
schema:
type: string
responses:
'200':
description: Event stream opened.
content:
'text/event-stream': {}
'401':
description: Not authorized (missing or invalid JWT).
'400':
description: Missing topic parameter or invalid URI template.
post:
summary: Publish an update
externalDocs:
description: Publishing specification
url: https://github.com/dunglas/mercure/blob/master/spec/mercure.md#publication
requestBody:
content:
'application/x-www-form-urlencoded':
schema:
properties:
topic:
description: IRIs of the updated topic. If this key is present several times, the first occurrence is considered to be the canonical URL of the topic, and other ones are considered to be alternate URLs.
type: array
items:
type: string
data:
description: The content of the new version of this topic.
type: string
target:
description: Target audience of this update. If not provided, this update will be public.
type: array
items:
type: string
id:
description: "The topic's revision identifier: it will be used as the SSE's `id` property."
type: string
type:
description: The SSE's `event` property (a specific event type).
type: string
retry:
description: The SSE's `retry` property (the reconnection time).
type: integer
required:
- topic
- data
responses:
'200':
description: The id of this update
content:
'text/plain': {}
'401':
description: Not authorized (missing or invalid JWT)
'400':
description: Invalid request
components:
securitySchemes:
Bearer:
type: http
scheme: bearer
bearerFormat: JWT
description: Prefered for server to server
Cookie:
type: apiKey
in: cookie
name: mercureAuthorization
description: Prefered for web browsers
security:
- Bearer: []
- Cookie: []
externalDocs:
description: The Mercure protocol specification
url: https://github.com/dunglas/mercure/blob/master/spec/mercure.md