-
Notifications
You must be signed in to change notification settings - Fork 24
/
api_notifications.yaml
345 lines (341 loc) · 10.5 KB
/
api_notifications.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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
swagger: '2.0'
info:
version: 7.19.2
title: Proxy API
description: Mobile and web proxy API gateway.
host: localhost
basePath: /api/v1
schemes:
- https
security:
- Token: []
paths:
/notify:
x-swagger-router-controller: NotificationController
post:
operationId: notify
summary: Notify a user
description: Post the notification to the user using a push notification.
parameters:
- in: body
name: body
required: true
schema:
$ref: '#/definitions/Notification'
x-examples:
application/json:
message:
content:
subject: message subject, aliquip sint nulla in estinut
markdown: >-
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas et mollis felis. Vivamus orci nisl, commodo ut
sodales ut, eleifend a libero. Donec dapibus, turpis in
mattis tempor, risus nunc malesuada ex, non aliquet metus
nunc a lacus. Aenean in arcu vitae nisl porta fermentum nec
non nibh. Phasellus tortor tellus, semper in metus eget,
eleifend laoreet nibh. Aenean feugiat lectus ut nisl
eleifend gravida.
created_at: '2018-05-03T16:21:38.167Z'
fiscal_code: TMMEXQ60A10Y526X
id: 01CCKCY7QQ7WCHWTH8NB504386
sender_service_id: 5a25abf4fcc89605c082f042c49a
sender_metadata:
department_name: Department name
organization_name: Organization name
service_name: Service name
responses:
'200':
description: Success.
schema:
$ref: '#/definitions/SuccessResponse'
examples:
application/json:
message: ok
'400':
description: Bad request
schema:
$ref: '#/definitions/ProblemJson'
'401':
description: Token null or invalid.
'500':
description: >-
There was an error in forwarding the notification to the
Notification Hub.
schema:
$ref: '#/definitions/ProblemJson'
definitions:
CreatedMessageWithContent:
type: object
properties:
id:
type: string
fiscal_code:
$ref: '#/definitions/FiscalCode'
time_to_live:
$ref: '#/definitions/TimeToLiveSeconds'
created_at:
$ref: '#/definitions/Timestamp'
content:
$ref: '#/definitions/MessageContent'
sender_service_id:
type: string
description: |-
The ID of the Service. Equals the subscriptionId of a registered
API user.
minLength: 1
required:
- id
- fiscal_code
- created_at
- content
- sender_service_id
CreatedMessageWithoutContent:
type: object
properties:
id:
type: string
fiscal_code:
$ref: '#/definitions/FiscalCode'
time_to_live:
$ref: '#/definitions/TimeToLiveSeconds'
created_at:
$ref: '#/definitions/Timestamp'
sender_service_id:
type: string
description: |-
The ID of the Service. Equals the subscriptionId of a registered
API user.
minLength: 1
required:
- id
- fiscal_code
- created_at
- sender_service_id
TimeToLiveSeconds:
type: integer
default: 3600
minimum: 3600
maximum: 604800
description: |-
This parameter specifies for how long (in seconds) the system will
try to deliver the message to the channels configured by the user.
example: 3600
SenderMetadata:
title: Sender metadata
description: Metadata associated to a sender (service).
type: object
properties:
service_name:
$ref: '#/definitions/ServiceName'
organization_name:
$ref: '#/definitions/OrganizationName'
department_name:
$ref: '#/definitions/DepartmentName'
required:
- service_name
- organization_name
- department_name
ServiceName:
type: string
description: The name of the service. Will be added to the content of sent messages.
minLength: 1
OrganizationName:
type: string
description: |-
The organization that runs the service. Will be added to the content
of sent messages to identify the sender.
minLength: 1
DepartmentName:
type: string
description: |-
The department inside the organization that runs the service. Will
be added to the content of sent messages.
minLength: 1
Timestamp:
type: string
format: UTCISODateFromString
description: A date-time field in ISO-8601 format and UTC timezone.
x-import: '@pagopa/ts-commons/lib/dates'
example: '2018-10-13T00:00:00.000Z'
FiscalCode:
type: string
description: User's fiscal code.
format: FiscalCode
x-import: '@pagopa/ts-commons/lib/strings'
example: SPNDNL80R13C555X
MessageContent:
type: object
properties:
subject:
$ref: '#/definitions/MessageSubject'
markdown:
$ref: '#/definitions/MessageBodyMarkdown'
payment_data:
$ref: '#/definitions/PaymentData'
prescription_data:
type: object
description: Metadata needed to process medical prescriptions.
properties:
nre:
description: >-
The field *Numero ricetta elettronica* identifies the medical
prescription at national level.
type: string
minLength: 15
maxLength: 15
iup:
description: >-
The field *Identificativo Unico di Prescrizione* identifies the
medical prescription at regional level.
type: string
minLength: 1
maxLength: 16
prescriber_fiscal_code:
type: string
description: Fiscal code of the Doctor that made the prescription.
format: FiscalCode
x-import: '@pagopa/ts-commons/lib/strings'
example: TCNZRO80R13C555Y
required:
- nre
eu_covid_cert:
type: object
description: Paylod with access token to retrieve a EU Covid Certificate
properties:
auth_code:
type: string
required:
- auth_code
due_date:
$ref: '#/definitions/Timestamp'
required:
- subject
- markdown
MessageSubject:
type: string
description: |-
The (optional) subject of the message - note that only some notification
channels support the display of a subject. When a subject is not provided,
one gets generated from the client attributes.
minLength: 10
maxLength: 120
example: Welcome new user !
MessageBodyMarkdown:
type: string
description: |-
The full version of the message, in plain text or Markdown format. The
content of this field will be delivered to channels that don't have any
limit in terms of content size (e.g. email, etc...).
minLength: 80
maxLength: 10000
example: |-
# This is a markdown header
to show how easily markdown can be converted to **HTML**
Remember: this has to be a long text.
PaymentNoticeNumber:
description: >-
The field ["Numero
Avviso"](https://pagopa-specifichepagamenti.readthedocs.io/it/latest/_docs/Capitolo7.html#il-numero-avviso-e-larchivio-dei-pagamenti-in-attesa)
of pagoPa, needed to identify the payment. Format is `<aux digit
(1n)>[<application code> (2n)]<codice IUV (15|17n)>`. See [pagoPa
specs](https://www.agid.gov.it/sites/default/files/repository_files/specifiche_attuative_pagamenti_1_3_1_0.pdf)
for more info on this field and the IUV.
type: string
pattern: ^[0123][0-9]{17}$
PaymentAmount:
description: >-
Amount of payment in euro cent. PagoPA accepts up to 9999999999 euro
cents.
type: integer
minimum: 1
maximum: 9999999999
PaymentData:
type: object
description: Metadata needed to process pagoPA payments.
properties:
amount:
$ref: '#/definitions/PaymentAmount'
notice_number:
$ref: '#/definitions/PaymentNoticeNumber'
invalid_after_due_date:
type: boolean
default: false
required:
- amount
- notice_number
ProblemJson:
type: object
properties:
type:
type: string
format: uri
description: |-
An absolute URI that identifies the problem type. When dereferenced,
it SHOULD provide human-readable documentation for the problem type
(e.g., using HTML).
default: about:blank
example: https://example.com/problem/constraint-violation
title:
type: string
description: |-
A short, summary of the problem type. Written in english and readable
for engineers (usually not suited for non technical stakeholders and
not localized); example: Service Unavailable
status:
type: integer
format: int32
description: >-
The HTTP status code generated by the origin server for this
occurrence
of the problem.
minimum: 100
maximum: 600
exclusiveMaximum: true
example: 200
detail:
type: string
description: |-
A human readable explanation specific to this occurrence of the
problem.
example: There was an error processing the request
instance:
type: string
format: uri
description: >-
An absolute URI that identifies the specific occurrence of the
problem.
It may or may not yield further information if dereferenced.
NotificationMessage:
x-one-of: true
allOf:
- $ref: '#/definitions/CreatedMessageWithContent'
- $ref: '#/definitions/CreatedMessageWithoutContent'
Notification:
title: Notification
description: A received Notification.
type: object
properties:
message:
$ref: '#/definitions/NotificationMessage'
sender_metadata:
$ref: '#/definitions/SenderMetadata'
required:
- message
- sender_metadata
SuccessResponse:
type: object
properties:
message:
type: string
responses: {}
parameters: {}
consumes:
- application/json
produces:
- application/json
securityDefinitions:
Token:
type: apiKey
name: token
in: query