Skip to content

Commit 9934a10

Browse files
authored
Merge pull request #9 from OneSignal/api-alignment
Update spec to be a more closer representation of the server responses
2 parents 5e08cf2 + 9655923 commit 9934a10

1 file changed

Lines changed: 111 additions & 85 deletions

File tree

api.json

Lines changed: 111 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -362,51 +362,61 @@
362362
"type": "boolean",
363363
"default": true,
364364
"description": "Indicates whether to send to all devices registered under your app's Apple iOS platform.",
365-
"writeOnly": true
365+
"writeOnly": true,
366+
"nullable": true
366367
},
367368
"isAndroid": {
368369
"type": "boolean",
369370
"description": "Indicates whether to send to all devices registered under your app's Google Android platform.",
370-
"writeOnly": true
371+
"writeOnly": true,
372+
"nullable": true
371373
},
372374
"isHuawei": {
373375
"type": "boolean",
374376
"description": "Indicates whether to send to all devices registered under your app's Huawei Android platform.",
375-
"writeOnly": true
377+
"writeOnly": true,
378+
"nullable": true
376379
},
377380
"isAnyWeb": {
378381
"type": "boolean",
379382
"description": "Indicates whether to send to all subscribed web browser users, including Chrome, Firefox, and Safari.\nYou may use this instead as a combined flag instead of separately enabling isChromeWeb, isFirefox, and isSafari, though the three options are equivalent to this one.\n",
380-
"writeOnly": true
383+
"writeOnly": true,
384+
"nullable": true
381385
},
382386
"isChromeWeb": {
383387
"type": "boolean",
384388
"writeOnly": true,
389+
"nullable": true,
385390
"description": "Indicates whether to send to all Google Chrome, Chrome on Android, and Mozilla Firefox users registered under your Chrome & Firefox web push platform."
386391
},
387392
"isFirefox": {
388393
"type": "boolean",
389394
"writeOnly": true,
395+
"nullable": true,
390396
"description": "Indicates whether to send to all Mozilla Firefox desktop users registered under your Firefox web push platform."
391397
},
392398
"isSafari": {
393399
"type": "boolean",
394400
"writeOnly": true,
401+
"nullable": true,
395402
"description": "Does not support iOS Safari. Indicates whether to send to all Apple's Safari desktop users registered under your Safari web push platform. Read more iOS Safari"
396403
},
397404
"isWP_WNS": {
398405
"type": "boolean",
399406
"writeOnly": true,
407+
"nullable": true,
400408
"description": "Indicates whether to send to all devices registered under your app's Windows platform."
401409
},
402410
"isAdm": {
403411
"type": "boolean",
404412
"writeOnly": true,
413+
"nullable": true,
405414
"description": "Indicates whether to send to all devices registered under your app's Amazon Fire platform."
406415
},
407416
"isChrome": {
408417
"type": "boolean",
409418
"writeOnly": true,
419+
"nullable": true,
410420
"description": "This flag is not used for web push Please see isChromeWeb for sending to web push users. This flag only applies to Google Chrome Apps & Extensions.\nIndicates whether to send to all devices registered under your app's Google Chrome Apps & Extension platform.\n"
411421
},
412422
"channel_for_external_user_ids": {
@@ -494,7 +504,8 @@
494504
"content_available": {
495505
"type": "boolean",
496506
"description": "Channel: Push Notifications\nPlatform: iOS\nSending true wakes your app from background to run custom native code (Apple interprets this as content-available=1). Note: Not applicable if the app is in the \"force-quit\" state (i.e app was swiped away). Omit the contents field to prevent displaying a visible notification.\n",
497-
"writeOnly": true
507+
"writeOnly": true,
508+
"nullable": true
498509
},
499510
"mutable_content": {
500511
"type": "boolean",
@@ -688,10 +699,12 @@
688699
"android_visibility": {
689700
"type": "integer",
690701
"description": "Channel: Push Notifications\nPlatform: Android 5.0_\n⚠️Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices!\nPlease use Notification Categories / Channels noted above instead to support ALL versions of Android.\n1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.)\n0 = Private (Hides message contents on lock screen if the user set \"Hide sensitive notification content\" in the system settings)\n-1 = Secret (Notification does not show on the lock screen at all)\n",
691-
"writeOnly": true
702+
"writeOnly": true,
703+
"nullable": true
692704
},
693705
"huawei_visibility": {
694706
"type": "integer",
707+
"nullable": true,
695708
"description": "Channel: Push Notifications\nPlatform: Huawei\n⚠️Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices.\nPlease also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices.\n1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.)\n0 = Private (Hides message contents on lock screen if the user set \"Hide sensitive notification content\" in the system settings)\n-1 = Secret (Notification does not show on the lock screen at all)\n",
696709
"writeOnly": true
697710
},
@@ -702,6 +715,7 @@
702715
},
703716
"ios_badgeCount": {
704717
"type": "integer",
718+
"nullable": true,
705719
"description": "Channel: Push Notifications\nPlatform: iOS\nUsed with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by.\nYou can use a negative number to decrease the badge count when used with an ios_badgeType of Increase.\n",
706720
"writeOnly": true
707721
},
@@ -721,6 +735,7 @@
721735
},
722736
"send_after": {
723737
"type": "string",
738+
"format": "date-time",
724739
"description": "Channel: All\nSchedule notification for future delivery. API defaults to UTC -1100\nExamples: All examples are the exact same date & time.\n\"Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)\"\n\"September 24th 2015, 2:00:00 pm UTC-07:00\"\n\"2015-09-24 14:00:00 GMT-0700\"\n\"Sept 24 2015 14:00:00 GMT-0700\"\n\"Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)\"\nNote: SMS currently only supports send_after parameter.\n",
725740
"writeOnly": true
726741
},
@@ -736,11 +751,13 @@
736751
},
737752
"ttl": {
738753
"type": "integer",
754+
"nullable": true,
739755
"description": "Channel: Push Notifications\nPlatform: iOS, Android, Chrome, Firefox, Safari, ChromeWeb\nTime To Live - In seconds. The notification will be expired if the device does not come back online within this time. The default is 259,200 seconds (3 days).\nMax value to set is 2419200 seconds (28 days).\n",
740756
"writeOnly": true
741757
},
742758
"priority": {
743759
"type": "integer",
760+
"nullable": true,
744761
"description": "Channel: Push Notifications\nPlatform: Android, Chrome, ChromeWeb\nDelivery priority through the push server (example GCM/FCM). Pass 10 for high priority or any other integer for normal priority. Defaults to normal priority for Android and high for iOS. For Android 6.0+ devices setting priority to high will wake the device out of doze mode.\n",
745762
"writeOnly": true
746763
},
@@ -831,6 +848,73 @@
831848
}
832849
]
833850
},
851+
"NotificationWithMeta": {
852+
"allOf": [
853+
{
854+
"$ref": "#/components/schemas/Notification"
855+
},
856+
{
857+
"$ref": "#/components/schemas/DeliveryData"
858+
},
859+
{
860+
"$ref": "#/components/schemas/OutcomesData"
861+
},
862+
{
863+
"type": "object",
864+
"properties": {
865+
"remaining": {
866+
"type": "integer",
867+
"description": "Number of notifications that have not been sent out yet. This can mean either our system is still processing the notification or you have delayed options set."
868+
},
869+
"successful": {
870+
"type": "integer",
871+
"description": "Number of notifications that were successfully delivered."
872+
},
873+
"failed": {
874+
"type": "integer",
875+
"description": "Number of notifications that could not be delivered due to those devices being unsubscribed."
876+
},
877+
"errored": {
878+
"type": "integer",
879+
"description": "Number of notifications that could not be delivered due to an error. You can find more information by viewing the notification in the dashboard."
880+
},
881+
"converted": {
882+
"type": "integer",
883+
"description": "Number of users who have clicked / tapped on your notification."
884+
},
885+
"queued_at": {
886+
"type": "integer",
887+
"format": "int64",
888+
"description": "Unix timestamp indicating when the notification was created."
889+
},
890+
"send_after": {
891+
"type": "integer",
892+
"format": "int64",
893+
"description": "Unix timestamp indicating when notification delivery should begin."
894+
},
895+
"completed_at": {
896+
"type": "integer",
897+
"format": "int64",
898+
"nullable": true,
899+
"description": "Unix timestamp indicating when notification delivery completed. The delivery duration from start to finish can be calculated with completed_at - send_after."
900+
},
901+
"platform_delivery_stats": {
902+
"$ref": "#/components/schemas/PlatformDeliveryData"
903+
},
904+
"received": {
905+
"type": "integer",
906+
"nullable": true,
907+
"description": "Confirmed Deliveries number of devices that received the push notification. Paid Feature Only. Free accounts will see 0."
908+
},
909+
"throttle_rate_per_minute": {
910+
"type": "integer",
911+
"nullable": true,
912+
"description": "number of push notifications sent per minute. Paid Feature Only. If throttling is not enabled for the app or the notification, and for free accounts, null is returned. Refer to Throttling for more details."
913+
}
914+
}
915+
}
916+
]
917+
},
834918
"Button": {
835919
"type": "object",
836920
"properties": {
@@ -1029,15 +1113,6 @@
10291113
"type": "string",
10301114
"description": "Text in Vietnamese."
10311115
}
1032-
},
1033-
"required": [
1034-
"en"
1035-
]
1036-
},
1037-
"Notifications": {
1038-
"type": "array",
1039-
"items": {
1040-
"$ref": "#/components/schemas/Notification"
10411116
}
10421117
},
10431118
"NotificationSlice": {
@@ -1055,7 +1130,7 @@
10551130
"notifications": {
10561131
"type": "array",
10571132
"items": {
1058-
"$ref": "#/components/schemas/Notification"
1133+
"$ref": "#/components/schemas/NotificationWithMeta"
10591134
}
10601135
}
10611136
}
@@ -1088,19 +1163,24 @@
10881163
"type": "object",
10891164
"properties": {
10901165
"successful": {
1091-
"type": "integer"
1166+
"type": "integer",
1167+
"nullable": true
10921168
},
10931169
"failed": {
1094-
"type": "integer"
1170+
"type": "integer",
1171+
"nullable": true
10951172
},
10961173
"errored": {
1097-
"type": "integer"
1174+
"type": "integer",
1175+
"nullable": true
10981176
},
10991177
"converted": {
1100-
"type": "integer"
1178+
"type": "integer",
1179+
"nullable": true
11011180
},
11021181
"received": {
1103-
"type": "integer"
1182+
"type": "integer",
1183+
"nullable": true
11041184
}
11051185
}
11061186
},
@@ -1284,6 +1364,7 @@
12841364
},
12851365
"timezone": {
12861366
"type": "integer",
1367+
"nullable": true,
12871368
"description": "Number of seconds away from UTC. Example: -28800\n"
12881369
},
12891370
"game_version": {
@@ -1320,10 +1401,12 @@
13201401
},
13211402
"created_at": {
13221403
"type": "integer",
1404+
"format": "int64",
13231405
"description": "Unixtime when the player joined the game"
13241406
},
13251407
"playtime": {
13261408
"type": "integer",
1409+
"format": "int64",
13271410
"description": "Seconds player was running your app."
13281411
},
13291412
"badge_count": {
@@ -1340,6 +1423,7 @@
13401423
},
13411424
"test_type": {
13421425
"type": "integer",
1426+
"nullable": true,
13431427
"description": "This is used in deciding whether to use your iOS Sandbox or Production push certificate when sending a push when both have been uploaded. Set to the iOS provisioning profile that was used to build your app.\n1 = Development\n2 = Ad-Hoc\nOmit this field for App Store builds.\n"
13441428
},
13451429
"long": {
@@ -1356,7 +1440,6 @@
13561440
}
13571441
},
13581442
"required": [
1359-
"app_id",
13601443
"device_type",
13611444
"id"
13621445
]
@@ -1409,7 +1492,8 @@
14091492
"NoSubscribersError": {
14101493
"type": "array",
14111494
"items": {
1412-
"type": "string"
1495+
"type": "string",
1496+
"format": "string"
14131497
},
14141498
"description": "Returned if no subscribed players.\n"
14151499
},
@@ -1443,7 +1527,7 @@
14431527
"in": "query",
14441528
"name": "limit",
14451529
"schema": {
1446-
"type": "string"
1530+
"type": "integer"
14471531
},
14481532
"required": false,
14491533
"description": "How many notifications to return. Max is 50. Default is 50."
@@ -1589,65 +1673,7 @@
15891673
"content": {
15901674
"application/json": {
15911675
"schema": {
1592-
"allOf": [
1593-
{
1594-
"$ref": "#/components/schemas/Notification"
1595-
},
1596-
{
1597-
"$ref": "#/components/schemas/DeliveryData"
1598-
},
1599-
{
1600-
"$ref": "#/components/schemas/OutcomesData"
1601-
},
1602-
{
1603-
"type": "object",
1604-
"properties": {
1605-
"remaining": {
1606-
"type": "integer",
1607-
"description": "Number of notifications that have not been sent out yet. This can mean either our system is still processing the notification or you have delayed options set."
1608-
},
1609-
"successful": {
1610-
"type": "integer",
1611-
"description": "Number of notifications that were successfully delivered."
1612-
},
1613-
"failed": {
1614-
"type": "integer",
1615-
"description": "Number of notifications that could not be delivered due to those devices being unsubscribed."
1616-
},
1617-
"errored": {
1618-
"type": "integer",
1619-
"description": "Number of notifications that could not be delivered due to an error. You can find more information by viewing the notification in the dashboard."
1620-
},
1621-
"converted": {
1622-
"type": "integer",
1623-
"description": "Number of users who have clicked / tapped on your notification."
1624-
},
1625-
"queued_at": {
1626-
"type": "integer",
1627-
"description": "Unix timestamp indicating when the notification was created."
1628-
},
1629-
"send_after": {
1630-
"type": "integer",
1631-
"description": "Unix timestamp indicating when notification delivery should begin."
1632-
},
1633-
"completed_at": {
1634-
"type": "integer",
1635-
"description": "Unix timestamp indicating when notification delivery completed. The delivery duration from start to finish can be calculated with completed_at - send_after."
1636-
},
1637-
"platform_delivery_stats": {
1638-
"$ref": "#/components/schemas/PlatformDeliveryData"
1639-
},
1640-
"received": {
1641-
"type": "integer",
1642-
"description": "Confirmed Deliveries number of devices that received the push notification. Paid Feature Only. Free accounts will see 0."
1643-
},
1644-
"throttle_rate_per_minute": {
1645-
"type": "integer",
1646-
"description": "number of push notifications sent per minute. Paid Feature Only. If throttling is not enabled for the app or the notification, and for free accounts, null is returned. Refer to Throttling for more details."
1647-
}
1648-
}
1649-
}
1650-
]
1676+
"$ref": "#/components/schemas/NotificationWithMeta"
16511677
}
16521678
}
16531679
}
@@ -1895,7 +1921,7 @@
18951921
"type": "object",
18961922
"properties": {
18971923
"success": {
1898-
"type": "string"
1924+
"type": "boolean"
18991925
},
19001926
"destination_url": {
19011927
"type": "string"
@@ -2277,7 +2303,7 @@
22772303
"in": "query",
22782304
"name": "limit",
22792305
"schema": {
2280-
"type": "string"
2306+
"type": "integer"
22812307
},
22822308
"required": false,
22832309
"description": "How many devices to return. Max is 300. Default is 300"

0 commit comments

Comments
 (0)