-
Notifications
You must be signed in to change notification settings - Fork 13
/
openapi.yaml
500 lines (500 loc) · 17.2 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
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
openapi: 3.0.1
info:
title: In-App Messaging
description: This document represents endpoints that SDK use to manage campaigns.
Provided paths are examples (no paths are hardcoded in the SDK).
license:
name: MIT
url: https://opensource.org/licenses/MIT
version: 9.0.0
tags:
- name: Configuration
- name: Campaign
- name: Impressions
paths:
/get-config:
get:
tags:
- Configuration
summary: Get configuration to setup SDK
description: From the response from this endpoint SDK should decide to continue
initialization or disable all functionality. The response also gives endpoint
urls for all other requests. All parameters are required
operationId: getConfig
parameters:
- name: Subscription-Id
in: header
description: App subscription key
schema:
type: string
- name: locale
in: query
example: jp
required: true
schema:
type: string
- name: appVersion
in: query
example: "1.0"
required: true
schema:
type: string
- name: platform
in: query
description: iOS or Android
example: 1
required: true
schema:
type: integer
- name: appId
in: query
description: application bundle identifier
example: jp.co.company.app
required: true
schema:
type: string
- name: sdkVersion
in: query
example: 0.1.0
required: true
schema:
type: string
responses:
200:
description: success
content:
application/json:
schema:
$ref: '#/components/schemas/ConfigResponse'
429:
description: An error returned when server's load is too high.
SDK will keep retrying the request.
/ping:
post:
tags:
- Campaign
summary: Get list of campaigns targeted to this device
description: The next ping call should be scheduled using nextPingMillis property
from the response. All parameters are required
operationId: ping
parameters:
- name: Subscription-Id
in: header
schema:
type: string
example: App subscription key
- name: device_id
in: header
schema:
type: string
format: uuid
example: Device id of user's device
- name: Authorization
in: header
schema:
type: string
example: OAuth2 <access_token>
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PingRequest'
responses:
200:
description: success
content:
application/json:
schema:
$ref: '#/components/schemas/PingResponse'
401:
description: Authorization failure. Please check README
429:
description: An error returned when server's load is too high.
SDK will keep retrying the request.
/display_permission:
post:
tags:
- Campaign
summary: Check whether campaign is still valid
description: This endpoint is responsible for making final precaution checks before either allowing or stopping the SDK from showing an active campaign message. It doesn't apply for test campaigns. In case of request failure, SDK will display the campaign message. All parameters are required
operationId: displayPermission
parameters:
- name: Subscription-Id
in: header
schema:
type: string
example: App subscription key
- name: device_id
in: header
schema:
type: string
format: uuid
example: Device id of user's device
- name: Authorization
in: header
schema:
type: string
example: OAuth2 <access_token>
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DisplayPermissionRequest'
responses:
200:
description: success
content:
application/json:
schema:
type: object
properties:
display:
type: boolean
description: true - Display the campaign message
performPing:
type: boolean
description: true - Perform additional /ping call
401:
description: Authorization failure. Please check README
/impression:
post:
tags:
- Impressions
summary: Send impressions
description: This endpoint is used for persisting campaign impressions. Each request will update campaign's data (ex. maxImpressions) for this device which will be seen in next /ping response. All parameters are required
operationId: impression
parameters:
- name: Subscription-Id
in: header
schema:
type: string
example: App subscription key
- name: device_id
in: header
schema:
type: string
format: uuid
example: Device id of user's device
- name: Authorization
in: header
schema:
type: string
example: OAuth2 <access_token>
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ImpressionRequest'
responses:
200:
description: Request succeeded
401:
description: Authorization failure. Please check README
components:
schemas:
ConfigResponse:
type: object
properties:
data:
type: object
properties:
rolloutPercentage:
description: A number on which SDK decides whether it should disable itself or not
type: integer
endpoints:
type: object
properties:
ping:
type: string
format: url
example: https://.../ping
impression:
type: string
format: url
example: https://.../impression
displayPermission:
type: string
format: url
example: https://.../display_permission
PingRequest:
type: object
properties:
appVersion:
type: string
example: "1.0"
supportedCampaignTypes:
type: array
items:
type: integer
example: 1
description: 1 - Regular, 2 - Push Primer
userIdentifiers:
type: array
items:
$ref: '#/components/schemas/UserIdentifier'
PingResponse:
type: object
properties:
currentPingMillis:
type: integer
format: long
description: Timestamp in milliseconds
example: 1581305955817
nextPingMillis:
type: integer
description: Delay before next /ping call. Time in milliseconds
example: 3600000
data:
type: array
items:
type: object
properties:
campaignData:
type: object
properties:
campaignId:
type: string
maxImpressions:
type: integer
infiniteImpressions:
type: boolean
hasNoEndDate:
type: boolean
isCampaignDismissable:
type: boolean
type:
type: integer
description: Type of this in-app message. 0 - INVALID, 1 - Modal View, 2 - Full Screen, 3 - Slide Banner, 4 - Html
example: 1
isTest:
type: boolean
description: "Display imeediately if true. Used for viewing purposes."
triggers:
type: array
items:
$ref: '#/components/schemas/CampaignTrigger'
messagePayload:
type: object
properties:
title:
type: string
description: Title of the in-app message. This could be displayed on Push Notification.
header:
type: string
description: Optional. Header text if any (Image-only campaigns don't have message body).
messageBody:
type: string
description: Optional. Message body if any (Image-only campaigns don't have message body).
titleColor:
type: string
example: "#000000"
format: hexadecimal
description: Optional. Title text color if any (Image-only campaigns don't have message body).
headerColor:
type: string
example: "#000000"
format: hexadecimal
description: Optional. Header text color if any (Image-only campaigns don't have message body).
messageBodyColor:
type: string
example: "#000000"
format: hexadecimal
description: Optional. Message body text color if any (Image-only campaigns don't have message body).
backgroundColor:
type: string
example: "#000000"
format: hexadecimal
frameColor:
type: string
example: "#000000"
format: hexadecimal
resource:
type: object
properties:
assetsUrl:
type: string
description: Optional (HTML view only)
format: url
imageUrl:
type: string
description: Optional
format: url
cropType:
type: integer
example: 1
description: 0 - INVALID, 1 - Fill, 2 - Center
messageSettings:
type: object
properties:
displaySettings:
type: object
properties:
slideFrom:
type: integer
description: Optional (for slide-up only). 1 - bottom, 2 - top, 3 - left, 4 - right
example: 2
endTimeMillis:
type: integer
description: The latest time to display in-app message. (UTC Milliseconds)
format: long
example: 1582984800000
orientation:
type: integer
description: In-app message display orientation. 0 - INVALID, 1 - Portrait, 2 - Landscape
example: 1
textAlign:
type: integer
description: 0 - INVALID, 1 - Fill, 2 - Center
example: 1
optOut:
type: boolean
description: If true, message should include 'Do Not Display Again' checkbox.
delay:
type: integer
description: Min time between consecutive messages. Milliseconds.
example: 3000
html:
type: boolean
description: If true, the messageBody value is treated as HTML content
controlSettings:
type: object
properties:
content:
type: object
properties:
campaignTrigger:
$ref: '#/components/schemas/CampaignTrigger'
onClickBehavior:
$ref: '#/components/schemas/ButtonBehavior'
buttons:
type: array
description: Only up to two items supported (none, center, left + right)
items:
type: object
properties:
buttonText:
type: string
description: Optional
buttonTextColor:
type: string
example: "#000000"
format: hexadecimal
description: Optional
buttonBackgroundColor:
type: string
example: "#000000"
format: hexadecimal
description: Optional
buttonBehavior:
$ref: '#/components/schemas/ButtonBehavior'
campaignTrigger:
$ref: '#/components/schemas/CampaignTrigger'
ButtonBehavior:
type: object
properties:
action:
type: integer
example: 3
description: Actions -> 0 - INVALID, 1 - Redirect, 2 - Deeplink, 3 - Close, 4 - Push Primer
uri:
type: string
description: URI for redirect or deeplink
format: uri
CampaignTrigger:
type: object
properties:
type:
type: integer
default: 1
description: 0 - INVALID, 1 - EVENT
eventType:
type: integer
example: 4
description: 0 - INVALID, 1 - App Start, 2 - Login Successful, 3 - Purchase Successful, 4 - Custom
eventName:
type: string
attributes:
type: array
items:
type: object
properties:
name:
type: string
value:
type: string
type:
type: integer
example: 3
description: 0 - INVALID, 1 - String, 2 - Integer, 3 - Double, 4 - Boolean, 5 - Time in Milliseconds
operator:
type: integer
example: 6
description: 0 - INVALID, 1 - Equals, 2 - Is Not Equal, 3 - Greater Than, 4 - Less Than, 5 - Is Blank, 6 - Is Not Blank, 7 - Matches Regex, 8 - Does Not Match Regex
UserIdentifier:
type: object
properties:
type:
type: integer
example: 3
id:
type: string
example: userId
DisplayPermissionRequest:
type: object
properties:
campaignId:
type: string
userIdentifiers:
type: array
items:
$ref: '#/components/schemas/UserIdentifier'
locale:
type: string
example: jp
appVersion:
type: string
example: "1.0"
platform:
type: integer
description: iOS or Android
example: 1
sdkVersion:
type: string
example: 0.1.0
lastPingInMillis:
type: integer
format: long
description: Time in milliseconds of the last ping request
example: 1582984800000
ImpressionRequest:
type: object
properties:
campaignId:
type: string
isTest:
type: boolean
description: Must match campaign's `isTest` property (from /ping response)
appVersion:
type: string
example: "1.0"
sdkVersion:
type: string
example: 0.1.0
impressions:
type: array
items:
type: object
properties:
type:
type: integer
example: 6
description: 0 - INVALID, 1 - impression (display), 2 - left button, 3 - right button, 4 - close, 5 - click content, 6 - opt out
timestamp:
type: integer
format: long
description: Time in milliseconds
example: 1581910435156
userIdentifiers:
type: array
items:
$ref: '#/components/schemas/UserIdentifier'