Skip to content

Commit 23513ab

Browse files
committed
Introduce an BroadcastPushNotificationResponse interface
1 parent 2ffd60f commit 23513ab

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) 2025 Jon Chambers
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*/
22+
23+
package com.eatthepath.pushy.apns;
24+
25+
import java.util.Optional;
26+
import java.util.UUID;
27+
28+
public interface BroadcastPushNotificationResponse<T extends ApnsBroadcastPushNotification> {
29+
30+
/**
31+
* Returns the original broadcast push notification ent to the APNs server.
32+
*
33+
* @return the original broadcast push notification ent to the APNs server
34+
*/
35+
T getBroadcastPushNotification();
36+
37+
/**
38+
* Indicates whether the broadcast push notification was accepted by the APNs server.
39+
*
40+
* @return {@code true} if the broadcast push notification was accepted or {@code false} if it was rejected
41+
*/
42+
boolean isAccepted();
43+
44+
/**
45+
* Returns the ID assigned to this push notification by the APNs server.
46+
*
47+
* @return the ID assigned to this push notification by the APNs server
48+
*/
49+
UUID getApnsRequestId();
50+
51+
/**
52+
* Returns a unique identifier assigned by the APNs server. Note that this identifier is distinct from the identifier
53+
* returned by {@link #getApnsRequestId()}. As the documentation notes:
54+
*
55+
* <blockquote>Specify a unique identifier when raising troubleshooting requests with Apple.</blockquote>
56+
*
57+
* @return the unique identifier assigned by the APNs server
58+
*/
59+
UUID getApnsUniqueId();
60+
61+
/**
62+
* Returns the HTTP status code reported by the APNs server.
63+
*
64+
* @return the HTTP status code reported by the APNs server
65+
*/
66+
int getStatusCode();
67+
68+
/**
69+
* Returns the reason for rejection reported by the APNs gateway. If the notification was accepted, the rejection
70+
* reason will be {@code null}.
71+
*
72+
* @return the reason for rejection reported by the APNs gateway, or empty if the notification was not rejected
73+
*/
74+
Optional<String> getRejectionReason();
75+
}

pushy/src/main/java/com/eatthepath/pushy/apns/PushNotificationResponse.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public interface PushNotificationResponse<T extends ApnsPushNotification> {
6262
*/
6363
UUID getApnsId();
6464

65-
6665
/**
6766
* Returns a unique identifier set by the APNs server in development environments to facilitate testing
6867
* notifications. Note that this identifier is distinct from the identifier returned by {@link #getApnsId()}.

0 commit comments

Comments
 (0)