Skip to content

Commit 3e4f55f

Browse files
committed
Support include_external_user_ids for targeting external user IDs.
1 parent 2764ac2 commit 3e4f55f

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/main/java/com/currencyfair/onesignal/model/notification/Notification.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ public class Notification {
8888
@JsonProperty("include_player_ids")
8989
private List<String> includePlayerIds;
9090

91+
/**
92+
* RECOMMENDED - Target specific devices by custom user IDs assigned via API.
93+
* <p>
94+
* Do not combine with other targeting parameters. Not compatible with any other targeting parameters.
95+
* <p>
96+
* Example: {@code [“custom-id-assigned-by-api”]}
97+
* <p>
98+
* <i>Limit of 2,000 entries per REST API call</i>
99+
*/
100+
@JsonProperty("include_external_user_ids")
101+
private List<String> includeExternalUserIds;
102+
91103

92104

93105
// COMMON PARAMETERS
@@ -721,6 +733,14 @@ public void setIncludePlayerIds(List<String> includePlayerIds) {
721733
this.includePlayerIds = includePlayerIds;
722734
}
723735

736+
public List<String> getIncludeExternalUserIds() {
737+
return includeExternalUserIds;
738+
}
739+
740+
public void setIncludeExternalUserIds(List<String> externalUserIds) {
741+
this.includeExternalUserIds = includeExternalUserIds;
742+
}
743+
724744
public String getAppId() {
725745
return appId;
726746
}

src/main/java/com/currencyfair/onesignal/model/notification/NotificationRequestBuilder.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public final class NotificationRequestBuilder {
3535
private List<String> excludedSegments = new ArrayList<>();
3636
private List<Filter> filters = new ArrayList<>();
3737
private List<String> includePlayerIds = new ArrayList<>();
38+
private List<String> includeExternalUserIds = new ArrayList<>();
3839
private String appId;
3940
private List<String> appIds;
4041
private Map<String, String> contents = new HashMap<>();
@@ -170,6 +171,18 @@ public NotificationRequestBuilder withIncludePlayerId(String includePlayerId) {
170171
return this;
171172
}
172173

174+
public NotificationRequestBuilder withIncludeExternalUserIds(List<String> includeExternalUserIds) {
175+
this.includeExternalUserIds = includeExternalUserIds;
176+
return this;
177+
}
178+
179+
public NotificationRequestBuilder withIncludeExternalUserId(String includeExternalUserId) {
180+
if (StringUtils.isNotBlank(includeExternalUserId)) {
181+
includeExternalUserIds.add(includeExternalUserId);
182+
}
183+
return this;
184+
}
185+
173186
public NotificationRequestBuilder withAppId(String appId) {
174187
this.appId = appId;
175188
return this;
@@ -515,6 +528,7 @@ public NotificationRequest build() {
515528
notificationRequest.setExcludedSegments(excludedSegments);
516529
notificationRequest.setFilters(filters);
517530
notificationRequest.setIncludePlayerIds(includePlayerIds);
531+
notificationRequest.setIncludeExternalUserIds(includeExternalUserIds);
518532
notificationRequest.setAppId(appId);
519533
notificationRequest.setAppIds(appIds);
520534
notificationRequest.setContents(contents);

0 commit comments

Comments
 (0)