forked from gematik/api-ti-messenger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TiMessengerContactManagement.yaml
322 lines (297 loc) · 9.39 KB
/
TiMessengerContactManagement.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
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
openapi: 3.0.3
info:
title: I_TiMessengerContactManagement
description: |
# Overview
This is a TI-Messenger REST interface.
It is used by TI-Messenger-Clients to manage the invite settings of contacts.
Each mxid in an active contact setting has the right to invite the
user who created the contact setting.
# Context
## Authentication
The TI-Messenger-Client uses a Matrix-OpenID-Token from his Messenger-Service for
authentication on all REST operations. The bearer token can be obtained from the
homeserver. (POST /_matrix/client/r0/user/{userId}/openid/request_token).
TI-Messenger-Client ---> Messenger-Proxy ---> Homeserver
## REST operations
The interface implements CRUD operations to manage the contact settings.
TI-Messenger-Client ---> Messenger-Proxy
# Contact
version: 1.0.2
### 1.0.2
# - raised patch number in server url due to bugfixing
# - changed MXID description and example
# changed format of mxid to normal identifier to support better handling in proxies
# and avoid security issues like https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0450
### 1.0.1
# - raised patch number in server url due to bugfixing
# - removed pointless 404 response while createContactSetting
# - added MXID description & example
### 1.0.0
# - initial version
contact:
name: gematik GmbH
email: [email protected]
url: "https://www.gematik.de"
license:
name: Apache 2.0
url: "https://www.apache.org/licenses/LICENSE-2.0"
externalDocs:
description: TI-Messenger-API
url: https://github.com/gematik/api-ti-messenger
servers:
- url: https://localhost/tim-contact-mgmt/v1.0.2/
tags:
- name: info
description: This operation returns meta data about this interface and the status of available resources
- name: contacts
description: Operations for contact management
paths:
/:
get:
tags:
- info
description: Returns the meta data of this interface.
operationId: getInfo
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/InfoObject"
"403":
$ref: "#/components/responses/Forbidden"
default:
$ref: "#/components/responses/DefaultResponse"
/contacts:
parameters:
- $ref: "#/components/parameters/mxidHeader"
get:
tags:
- getContacts
description: "Returns the contacts with invite settings."
operationId: getContacts
responses:
200:
description: "List of all contact settings of the user"
content:
application/json:
schema:
$ref: "#/components/schemas/Contacts"
default:
$ref: "#/components/responses/DefaultResponse"
post:
tags:
- createContactSetting
description: "Creates the setting for the contact {mxid}."
operationId: createContactSetting
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Contact"
responses:
"200":
description: "Contact setting for {mxid successfully created"
content:
application/json:
schema:
$ref: "#/components/schemas/Contact"
"400":
$ref: "#/components/responses/BadRequest"
default:
$ref: "#/components/responses/DefaultResponse"
put:
tags:
- updateContactSetting
description: "Updates the setting for the contact {mxid}."
operationId: updateContactSetting
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Contact"
responses:
"200":
description: "Contact setting for {mxid} successfully updated"
content:
application/json:
schema:
$ref: "#/components/schemas/Contact"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
default:
$ref: "#/components/responses/DefaultResponse"
/contacts/{mxid}:
parameters:
- $ref: "#/components/parameters/mxidHeader"
- $ref: "#/components/parameters/mxid"
get:
tags:
- getContact
description: "Returns the contacts with invite settings."
operationId: getContact
responses:
200:
description: "Retrieve the setting for the contact {mxid}."
content:
application/json:
schema:
$ref: "#/components/schemas/Contact"
default:
$ref: "#/components/responses/DefaultResponse"
delete:
tags:
- deleteContactSetting
description: "Deletes the setting for the contact {mxid}."
operationId: deleteContactSetting
responses:
"204":
description: Deleted
"400":
$ref: "#/components/responses/BadRequest"
"401":
description: Unauthorized
"404":
$ref: "#/components/responses/NotFound"
default:
$ref: "#/components/responses/DefaultResponse"
# Descriptions of common components
components:
parameters:
mxidHeader:
name: Mxid
in: header
description: MXID of the contact settings owner. MUST match with the
MXID resolved from the Matrix-OpenID-Token.
required: true
schema:
type: string
mxid:
name: mxid
in: path
description: "ID of the contact (mxid))."
required: true
schema:
type: string
responses:
DefaultResponse:
description: "The default error response"
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
NotFound:
description: "The specified resource was not found"
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
Unauthorized:
description: "Unauthorized"
Forbidden:
description: "Forbidden - you are not allowed to do this"
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
BadRequest:
description: "Bad Request"
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
schemas:
InfoObject:
description: ""
required:
- title
- version
readOnly: true
type: object
properties:
title:
type: string
description: "Der Titel der Anwendung"
example: "Contact Management des TI-Messengers"
description:
type: string
description: "Short description of the application"
example: "Contact Management des TI-Messengers. Betreiber: <Betreibername>"
contact:
type: string
description: "Contact information"
version:
type: string
description: "Version der implementierten TiMessengerContactManagement.yaml Schnittstelle (Version der TiMessengerContactManagement.yaml Datei)"
example: "1.0.0"
Contact:
description: "Contact settings."
type: object
properties:
displayName:
type: string
description: "Name of the contact."
example: "Musterfrau, Erika"
mxid:
type: string
description: "MXID of the contact (@localpart:domain)). See "
externalDocs:
url: https://spec.matrix.org/v1.3/appendices/#user-identifiers
example: "@testuser:tim.test.gematik.de"
inviteSettings:
type: object
properties:
start:
type: integer
format: int64
description: "start (Epoch Unix Timestamp, SECONDS SINCE JAN 01 1970. (UTC))"
example: "1654159585"
end:
type: integer
format: int64
description: "end (Epoch Unix Timestamp, SECONDS SINCE JAN 01 1970. (UTC))"
example: "1654169585"
required:
- start
description: "Invites from the mxid are granted between start and end date-time."
required:
- displayName
- mxid
- inviteSettings
Contacts:
description: "The list of contacts and their settings."
type: object
properties:
contacts:
description: "The list of contacts and their settings."
type: array
items:
$ref: "#/components/schemas/Contact"
readOnly: true
Error:
description: "Default error object with information about the occurred error"
type: object
properties:
errorCode:
description: "a code identifying this error"
type: string
errorMessage:
description: "a readable message describing the error"
type: string
required:
- errorCode
- errorMessage
securitySchemes:
bearerMatrixOpenIdTokenAuth: # arbitrary name for the security scheme
type: http
scheme: bearer
bearerFormat: JWT # optional, arbitrary value for documentation purposes
# the security applies to all operations
security:
- bearerMatrixOpenIdTokenAuth: [] # use the same name as above