Skip to content

Commit

Permalink
add apns-unique-id (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn authored Dec 18, 2023
1 parent 858b858 commit 8cc8d1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ func (c *Client) PushWithContext(ctx context.Context, n *Notification) (*Respons
r := &Response{}
r.StatusCode = response.StatusCode
r.ApnsID = response.Header.Get("apns-id")
r.ApnsUniqueID = response.Header.Get("apns-unique-id")

decoder := json.NewDecoder(response.Body)
if err := decoder.Decode(r); err != nil && err != io.EOF {
Expand Down
6 changes: 6 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ type Response struct {
// If the value of StatusCode is 410, this is the last time at which APNs
// confirmed that the device token was no longer valid for the topic.
Timestamp Time

// An identifier that is only available in the Developement enviroment.
// Use this to query Delivery Log information for the corresponding
// notification in Push Notifications Console. For more information, see
// [Testing notifications using the Push Notification Console](https://developer.apple.com/documentation/usernotifications/testing_notifications_using_the_push_notification_console).
ApnsUniqueID string
}

// Sent returns whether or not the notification was successfully sent.
Expand Down

0 comments on commit 8cc8d1a

Please sign in to comment.