From 6c887152cb993309a6411a0e3e8d131dccd042ea Mon Sep 17 00:00:00 2001 From: mbasadi Date: Thu, 22 May 2025 13:36:37 -0400 Subject: [PATCH 1/2] Update version to 0.3.0 in pom.xml and add new model classes for notification options, including CallOptions, Device, EmailOptions, InAppOptions, MobilePushOptions, Options, PushProvider, PushSubscription, PushToken, SlackOptions, SmsOptions, User, WebPushOptions, and WebPushToken. Enhance NotificationRequest to support new options and parameters for improved notification handling. --- pom.xml | 2 +- .../notificationapi/model/CallOptions.java | 13 + .../com/notificationapi/model/Device.java | 43 ++ .../notificationapi/model/EmailOptions.java | 29 ++ .../notificationapi/model/InAppOptions.java | 21 + .../model/MobilePushOptions.java | 17 + .../model/NotificationRequest.java | 368 ++++++++++++++++++ .../com/notificationapi/model/Options.java | 118 ++++++ .../notificationapi/model/PushProvider.java | 6 + .../model/PushSubscription.java | 33 ++ .../com/notificationapi/model/PushToken.java | 25 ++ .../notificationapi/model/SlackOptions.java | 17 + .../com/notificationapi/model/SlackToken.java | 94 +++++ .../com/notificationapi/model/SmsOptions.java | 13 + .../java/com/notificationapi/model/User.java | 48 +++ .../notificationapi/model/WebPushOptions.java | 25 ++ .../notificationapi/model/WebPushToken.java | 13 + 17 files changed, 884 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/notificationapi/model/CallOptions.java create mode 100644 src/main/java/com/notificationapi/model/Device.java create mode 100644 src/main/java/com/notificationapi/model/EmailOptions.java create mode 100644 src/main/java/com/notificationapi/model/InAppOptions.java create mode 100644 src/main/java/com/notificationapi/model/MobilePushOptions.java create mode 100644 src/main/java/com/notificationapi/model/Options.java create mode 100644 src/main/java/com/notificationapi/model/PushProvider.java create mode 100644 src/main/java/com/notificationapi/model/PushSubscription.java create mode 100644 src/main/java/com/notificationapi/model/PushToken.java create mode 100644 src/main/java/com/notificationapi/model/SlackOptions.java create mode 100644 src/main/java/com/notificationapi/model/SlackToken.java create mode 100644 src/main/java/com/notificationapi/model/SmsOptions.java create mode 100644 src/main/java/com/notificationapi/model/WebPushOptions.java create mode 100644 src/main/java/com/notificationapi/model/WebPushToken.java diff --git a/pom.xml b/pom.xml index c9a2cff..bb09afc 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.notificationapi notificationapi-java-server-sdk - 0.2.0 + 0.3.0 jar diff --git a/src/main/java/com/notificationapi/model/CallOptions.java b/src/main/java/com/notificationapi/model/CallOptions.java new file mode 100644 index 0000000..a299728 --- /dev/null +++ b/src/main/java/com/notificationapi/model/CallOptions.java @@ -0,0 +1,13 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CallOptions { + @JsonProperty("message") + private String message; + + public String getMessage() { return message; } + public CallOptions setMessage(String message) { this.message = message; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/Device.java b/src/main/java/com/notificationapi/model/Device.java new file mode 100644 index 0000000..15bb68b --- /dev/null +++ b/src/main/java/com/notificationapi/model/Device.java @@ -0,0 +1,43 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Device { + @JsonProperty("app_id") + private String appId; + + @JsonProperty("ad_id") + private String adId; + + @JsonProperty("device_id") + private String deviceId; + + @JsonProperty("platform") + private String platform; + + @JsonProperty("manufacturer") + private String manufacturer; + + @JsonProperty("model") + private String model; + + public String getAppId() { return appId; } + public Device setAppId(String appId) { this.appId = appId; return this; } + + public String getAdId() { return adId; } + public Device setAdId(String adId) { this.adId = adId; return this; } + + public String getDeviceId() { return deviceId; } + public Device setDeviceId(String deviceId) { this.deviceId = deviceId; return this; } + + public String getPlatform() { return platform; } + public Device setPlatform(String platform) { this.platform = platform; return this; } + + public String getManufacturer() { return manufacturer; } + public Device setManufacturer(String manufacturer) { this.manufacturer = manufacturer; return this; } + + public String getModel() { return model; } + public Device setModel(String model) { this.model = model; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/EmailOptions.java b/src/main/java/com/notificationapi/model/EmailOptions.java new file mode 100644 index 0000000..2975cb1 --- /dev/null +++ b/src/main/java/com/notificationapi/model/EmailOptions.java @@ -0,0 +1,29 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EmailOptions { + @JsonProperty("subject") + private String subject; + @JsonProperty("html") + private String html; + @JsonProperty("previewText") + private String previewText; + @JsonProperty("senderName") + private String senderName; + @JsonProperty("senderEmail") + private String senderEmail; + + public String getSubject() { return subject; } + public EmailOptions setSubject(String subject) { this.subject = subject; return this; } + public String getHtml() { return html; } + public EmailOptions setHtml(String html) { this.html = html; return this; } + public String getPreviewText() { return previewText; } + public EmailOptions setPreviewText(String previewText) { this.previewText = previewText; return this; } + public String getSenderName() { return senderName; } + public EmailOptions setSenderName(String senderName) { this.senderName = senderName; return this; } + public String getSenderEmail() { return senderEmail; } + public EmailOptions setSenderEmail(String senderEmail) { this.senderEmail = senderEmail; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/InAppOptions.java b/src/main/java/com/notificationapi/model/InAppOptions.java new file mode 100644 index 0000000..65999aa --- /dev/null +++ b/src/main/java/com/notificationapi/model/InAppOptions.java @@ -0,0 +1,21 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class InAppOptions { + @JsonProperty("title") + private String title; + @JsonProperty("url") + private String url; + @JsonProperty("image") + private String image; + + public String getTitle() { return title; } + public InAppOptions setTitle(String title) { this.title = title; return this; } + public String getUrl() { return url; } + public InAppOptions setUrl(String url) { this.url = url; return this; } + public String getImage() { return image; } + public InAppOptions setImage(String image) { this.image = image; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/MobilePushOptions.java b/src/main/java/com/notificationapi/model/MobilePushOptions.java new file mode 100644 index 0000000..50d04ec --- /dev/null +++ b/src/main/java/com/notificationapi/model/MobilePushOptions.java @@ -0,0 +1,17 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class MobilePushOptions { + @JsonProperty("title") + private String title; + @JsonProperty("message") + private String message; + + public String getTitle() { return title; } + public MobilePushOptions setTitle(String title) { this.title = title; return this; } + public String getMessage() { return message; } + public MobilePushOptions setMessage(String message) { this.message = message; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/NotificationRequest.java b/src/main/java/com/notificationapi/model/NotificationRequest.java index 52270a5..9891ed6 100644 --- a/src/main/java/com/notificationapi/model/NotificationRequest.java +++ b/src/main/java/com/notificationapi/model/NotificationRequest.java @@ -18,6 +18,54 @@ public class NotificationRequest { @JsonProperty("mergeTags") private Map mergeTags; + @JsonProperty("type") + private String type; + + @JsonProperty("to") + private User to; + + @JsonProperty("forceChannels") + private java.util.List forceChannels; + + @JsonProperty("parameters") + private Map parameters; + + @JsonProperty("secondaryId") + private String secondaryId; + + @JsonProperty("templateId") + private String templateId; + + @JsonProperty("subNotificationId") + private String subNotificationId; + + @JsonProperty("options") + private Options options; + + @JsonProperty("schedule") + private String schedule; + + @JsonProperty("email") + private EmailOptions email; + + @JsonProperty("inapp") + private InAppOptions inapp; + + @JsonProperty("sms") + private SmsOptions sms; + + @JsonProperty("call") + private CallOptions call; + + @JsonProperty("web_push") + private WebPushOptions webPush; + + @JsonProperty("mobile_push") + private MobilePushOptions mobilePush; + + @JsonProperty("slack") + private SlackOptions slack; + /** * Default constructor for NotificationRequest. */ @@ -94,4 +142,324 @@ public NotificationRequest setMergeTags(Map mergeTags) { this.mergeTags = mergeTags; return this; } + + /** + * Gets the type of the notification. + * + * @return the type of the notification + */ + public String getType() { + return type; + } + + /** + * Sets the type of the notification. + * + * @param type the type of the notification to set + * @return this NotificationRequest instance + */ + public NotificationRequest setType(String type) { + this.type = type; + return this; + } + + /** + * Gets the user to send the notification to. + * + * @return the user + */ + public User getTo() { + return to; + } + + /** + * Sets the user to send the notification to. + * + * @param to the user to set + * @return this NotificationRequest instance + */ + public NotificationRequest setTo(User to) { + this.to = to; + return this; + } + + /** + * Gets the force channels for the notification. + * + * @return the force channels + */ + public java.util.List getForceChannels() { + return forceChannels; + } + + /** + * Sets the force channels for the notification. + * + * @param forceChannels the force channels to set + * @return this NotificationRequest instance + */ + public NotificationRequest setForceChannels(java.util.List forceChannels) { + this.forceChannels = forceChannels; + return this; + } + + /** + * Gets the parameters for the notification. + * + * @return the parameters + */ + public Map getParameters() { + return parameters; + } + + /** + * Sets the parameters for the notification. + * + * @param parameters the parameters to set + * @return this NotificationRequest instance + */ + public NotificationRequest setParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Gets the secondary ID for the notification. + * + * @return the secondary ID + */ + public String getSecondaryId() { + return secondaryId; + } + + /** + * Sets the secondary ID for the notification. + * + * @param secondaryId the secondary ID to set + * @return this NotificationRequest instance + */ + public NotificationRequest setSecondaryId(String secondaryId) { + this.secondaryId = secondaryId; + return this; + } + + /** + * Gets the template ID for the notification. + * + * @return the template ID + */ + public String getTemplateId() { + return templateId; + } + + /** + * Sets the template ID for the notification. + * + * @param templateId the template ID to set + * @return this NotificationRequest instance + */ + public NotificationRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Gets the sub-notification ID for the notification. + * + * @return the sub-notification ID + */ + public String getSubNotificationId() { + return subNotificationId; + } + + /** + * Sets the sub-notification ID for the notification. + * + * @param subNotificationId the sub-notification ID to set + * @return this NotificationRequest instance + */ + public NotificationRequest setSubNotificationId(String subNotificationId) { + this.subNotificationId = subNotificationId; + return this; + } + + /** + * Gets the options for the notification. + * + * @return the options + */ + public Options getOptions() { + return options; + } + + /** + * Sets the options for the notification. + * + * @param options the options to set + * @return this NotificationRequest instance + */ + public NotificationRequest setOptions(Options options) { + this.options = options; + return this; + } + + /** + * Gets the schedule for the notification. + * + * @return the schedule + */ + public String getSchedule() { + return schedule; + } + + /** + * Sets the schedule for the notification. + * + * @param schedule the schedule to set + * @return this NotificationRequest instance + */ + public NotificationRequest setSchedule(String schedule) { + this.schedule = schedule; + return this; + } + + /** + * Gets the email options for the notification. + * + * @return the email options + */ + public EmailOptions getEmail() { + return email; + } + + /** + * Sets the email options for the notification. + * + * @param email the email options to set + * @return this NotificationRequest instance + */ + public NotificationRequest setEmail(EmailOptions email) { + this.email = email; + return this; + } + + /** + * Gets the in-app options for the notification. + * + * @return the in-app options + */ + public InAppOptions getInapp() { + return inapp; + } + + /** + * Sets the in-app options for the notification. + * + * @param inapp the in-app options to set + * @return this NotificationRequest instance + */ + public NotificationRequest setInapp(InAppOptions inapp) { + this.inapp = inapp; + return this; + } + + /** + * Gets the SMS options for the notification. + * + * @return the SMS options + */ + public SmsOptions getSms() { + return sms; + } + + /** + * Sets the SMS options for the notification. + * + * @param sms the SMS options to set + * @return this NotificationRequest instance + */ + public NotificationRequest setSms(SmsOptions sms) { + this.sms = sms; + return this; + } + + /** + * Gets the call options for the notification. + * + * @return the call options + */ + public CallOptions getCall() { + return call; + } + + /** + * Sets the call options for the notification. + * + * @param call the call options to set + * @return this NotificationRequest instance + */ + public NotificationRequest setCall(CallOptions call) { + this.call = call; + return this; + } + + /** + * Gets the web push options for the notification. + * + * @return the web push options + */ + public WebPushOptions getWebPush() { + return webPush; + } + + /** + * Sets the web push options for the notification. + * + * @param webPush the web push options to set + * @return this NotificationRequest instance + */ + public NotificationRequest setWebPush(WebPushOptions webPush) { + this.webPush = webPush; + return this; + } + + /** + * Gets the mobile push options for the notification. + * + * @return the mobile push options + */ + public MobilePushOptions getMobilePush() { + return mobilePush; + } + + /** + * Sets the mobile push options for the notification. + * + * @param mobilePush the mobile push options to set + * @return this NotificationRequest instance + */ + public NotificationRequest setMobilePush(MobilePushOptions mobilePush) { + this.mobilePush = mobilePush; + return this; + } + + /** + * Gets the Slack options for the notification. + * + * @return the Slack options + */ + public SlackOptions getSlack() { + return slack; + } + + /** + * Sets the Slack options for the notification. + * + * @param slack the Slack options to set + * @return this NotificationRequest instance + */ + public NotificationRequest setSlack(SlackOptions slack) { + this.slack = slack; + return this; + } } \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/Options.java b/src/main/java/com/notificationapi/model/Options.java new file mode 100644 index 0000000..c4ee854 --- /dev/null +++ b/src/main/java/com/notificationapi/model/Options.java @@ -0,0 +1,118 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Options { + @JsonProperty("email") + private EmailOptions email; + @JsonProperty("apn") + private ApnOptions apn; + @JsonProperty("fcm") + private FcmOptions fcm; + + public EmailOptions getEmail() { return email; } + public Options setEmail(EmailOptions email) { this.email = email; return this; } + public ApnOptions getApn() { return apn; } + public Options setApn(ApnOptions apn) { this.apn = apn; return this; } + public FcmOptions getFcm() { return fcm; } + public Options setFcm(FcmOptions fcm) { this.fcm = fcm; return this; } + + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class EmailOptions { + @JsonProperty("replyToAddresses") + private List replyToAddresses; + @JsonProperty("ccAddresses") + private List ccAddresses; + @JsonProperty("bccAddresses") + private List bccAddresses; + @JsonProperty("fromName") + private String fromName; + @JsonProperty("fromAddress") + private String fromAddress; + @JsonProperty("attachments") + private List attachments; + public List getReplyToAddresses() { return replyToAddresses; } + public EmailOptions setReplyToAddresses(List replyToAddresses) { this.replyToAddresses = replyToAddresses; return this; } + public List getCcAddresses() { return ccAddresses; } + public EmailOptions setCcAddresses(List ccAddresses) { this.ccAddresses = ccAddresses; return this; } + public List getBccAddresses() { return bccAddresses; } + public EmailOptions setBccAddresses(List bccAddresses) { this.bccAddresses = bccAddresses; return this; } + public String getFromName() { return fromName; } + public EmailOptions setFromName(String fromName) { this.fromName = fromName; return this; } + public String getFromAddress() { return fromAddress; } + public EmailOptions setFromAddress(String fromAddress) { this.fromAddress = fromAddress; return this; } + public List getAttachments() { return attachments; } + public EmailOptions setAttachments(List attachments) { this.attachments = attachments; return this; } + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class Attachment { + @JsonProperty("filename") + private String filename; + @JsonProperty("url") + private String url; + public String getFilename() { return filename; } + public Attachment setFilename(String filename) { this.filename = filename; return this; } + public String getUrl() { return url; } + public Attachment setUrl(String url) { this.url = url; return this; } + } + } + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class ApnOptions { + @JsonProperty("expiry") + private Integer expiry; + @JsonProperty("priority") + private Integer priority; + @JsonProperty("collapseId") + private String collapseId; + @JsonProperty("threadId") + private String threadId; + @JsonProperty("badge") + private Integer badge; + @JsonProperty("sound") + private String sound; + @JsonProperty("contentAvailable") + private Boolean contentAvailable; + public Integer getExpiry() { return expiry; } + public ApnOptions setExpiry(Integer expiry) { this.expiry = expiry; return this; } + public Integer getPriority() { return priority; } + public ApnOptions setPriority(Integer priority) { this.priority = priority; return this; } + public String getCollapseId() { return collapseId; } + public ApnOptions setCollapseId(String collapseId) { this.collapseId = collapseId; return this; } + public String getThreadId() { return threadId; } + public ApnOptions setThreadId(String threadId) { this.threadId = threadId; return this; } + public Integer getBadge() { return badge; } + public ApnOptions setBadge(Integer badge) { this.badge = badge; return this; } + public String getSound() { return sound; } + public ApnOptions setSound(String sound) { this.sound = sound; return this; } + public Boolean getContentAvailable() { return contentAvailable; } + public ApnOptions setContentAvailable(Boolean contentAvailable) { this.contentAvailable = contentAvailable; return this; } + } + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class FcmOptions { + @JsonProperty("android") + private AndroidOptions android; + public AndroidOptions getAndroid() { return android; } + public FcmOptions setAndroid(AndroidOptions android) { this.android = android; return this; } + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class AndroidOptions { + @JsonProperty("collapseKey") + private String collapseKey; + @JsonProperty("priority") + private String priority; + @JsonProperty("ttl") + private Integer ttl; + @JsonProperty("restrictedPackageName") + private String restrictedPackageName; + public String getCollapseKey() { return collapseKey; } + public AndroidOptions setCollapseKey(String collapseKey) { this.collapseKey = collapseKey; return this; } + public String getPriority() { return priority; } + public AndroidOptions setPriority(String priority) { this.priority = priority; return this; } + public Integer getTtl() { return ttl; } + public AndroidOptions setTtl(Integer ttl) { this.ttl = ttl; return this; } + public String getRestrictedPackageName() { return restrictedPackageName; } + public AndroidOptions setRestrictedPackageName(String restrictedPackageName) { this.restrictedPackageName = restrictedPackageName; return this; } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/PushProvider.java b/src/main/java/com/notificationapi/model/PushProvider.java new file mode 100644 index 0000000..73ad8ab --- /dev/null +++ b/src/main/java/com/notificationapi/model/PushProvider.java @@ -0,0 +1,6 @@ +package com.notificationapi.model; + +public enum PushProvider { + FCM, + APN +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/PushSubscription.java b/src/main/java/com/notificationapi/model/PushSubscription.java new file mode 100644 index 0000000..53f9b6c --- /dev/null +++ b/src/main/java/com/notificationapi/model/PushSubscription.java @@ -0,0 +1,33 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PushSubscription { + @JsonProperty("endpoint") + private String endpoint; + + @JsonProperty("keys") + private Keys keys; + + public String getEndpoint() { return endpoint; } + public PushSubscription setEndpoint(String endpoint) { this.endpoint = endpoint; return this; } + + public Keys getKeys() { return keys; } + public PushSubscription setKeys(Keys keys) { this.keys = keys; return this; } + + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class Keys { + @JsonProperty("p256dh") + private String p256dh; + @JsonProperty("auth") + private String auth; + + public String getP256dh() { return p256dh; } + public Keys setP256dh(String p256dh) { this.p256dh = p256dh; return this; } + + public String getAuth() { return auth; } + public Keys setAuth(String auth) { this.auth = auth; return this; } + } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/PushToken.java b/src/main/java/com/notificationapi/model/PushToken.java new file mode 100644 index 0000000..1fba3f7 --- /dev/null +++ b/src/main/java/com/notificationapi/model/PushToken.java @@ -0,0 +1,25 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PushToken { + @JsonProperty("type") + private PushProvider type; + + @JsonProperty("token") + private String token; + + @JsonProperty("device") + private Device device; + + public PushProvider getType() { return type; } + public PushToken setType(PushProvider type) { this.type = type; return this; } + + public String getToken() { return token; } + public PushToken setToken(String token) { this.token = token; return this; } + + public Device getDevice() { return device; } + public PushToken setDevice(Device device) { this.device = device; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/SlackOptions.java b/src/main/java/com/notificationapi/model/SlackOptions.java new file mode 100644 index 0000000..d98ae12 --- /dev/null +++ b/src/main/java/com/notificationapi/model/SlackOptions.java @@ -0,0 +1,17 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SlackOptions { + @JsonProperty("text") + private String text; + @JsonProperty("blocks") + private Object blocks; + + public String getText() { return text; } + public SlackOptions setText(String text) { this.text = text; return this; } + public Object getBlocks() { return blocks; } + public SlackOptions setBlocks(Object blocks) { this.blocks = blocks; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/SlackToken.java b/src/main/java/com/notificationapi/model/SlackToken.java new file mode 100644 index 0000000..8398f55 --- /dev/null +++ b/src/main/java/com/notificationapi/model/SlackToken.java @@ -0,0 +1,94 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SlackToken { + @JsonProperty("access_token") + private String accessToken; + @JsonProperty("app_id") + private String appId; + @JsonProperty("authed_user") + private AuthedUser authedUser; + @JsonProperty("bot_user_id") + private String botUserId; + @JsonProperty("enterprise") + private Enterprise enterprise; + @JsonProperty("error") + private String error; + @JsonProperty("expires_in") + private Integer expiresIn; + @JsonProperty("incoming_webhook") + private IncomingWebhook incomingWebhook; + @JsonProperty("is_enterprise_install") + private Boolean isEnterpriseInstall; + @JsonProperty("needed") + private String needed; + @JsonProperty("ok") + private Boolean ok; + @JsonProperty("provided") + private String provided; + @JsonProperty("refresh_token") + private String refreshToken; + @JsonProperty("scope") + private String scope; + @JsonProperty("team") + private Team team; + @JsonProperty("token_type") + private String tokenType; + @JsonProperty("warning") + private String warning; + + // Getters and setters for all fields + // ... (omitted for brevity, but should be included in the actual file) + + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class AuthedUser { + @JsonProperty("access_token") + private String accessToken; + @JsonProperty("expires_in") + private Integer expiresIn; + @JsonProperty("id") + private String id; + @JsonProperty("refresh_token") + private String refreshToken; + @JsonProperty("scope") + private String scope; + @JsonProperty("token_type") + private String tokenType; + // Getters and setters + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class Enterprise { + @JsonProperty("id") + private String id; + @JsonProperty("name") + private String name; + // Getters and setters + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class IncomingWebhook { + @JsonProperty("channel") + private String channel; + @JsonProperty("channel_id") + private String channelId; + @JsonProperty("configuration_url") + private String configurationUrl; + @JsonProperty("url") + private String url; + // Getters and setters + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class Team { + @JsonProperty("id") + private String id; + @JsonProperty("name") + private String name; + // Getters and setters + } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/SmsOptions.java b/src/main/java/com/notificationapi/model/SmsOptions.java new file mode 100644 index 0000000..948ca52 --- /dev/null +++ b/src/main/java/com/notificationapi/model/SmsOptions.java @@ -0,0 +1,13 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SmsOptions { + @JsonProperty("message") + private String message; + + public String getMessage() { return message; } + public SmsOptions setMessage(String message) { this.message = message; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/User.java b/src/main/java/com/notificationapi/model/User.java index d0c5adc..5241829 100644 --- a/src/main/java/com/notificationapi/model/User.java +++ b/src/main/java/com/notificationapi/model/User.java @@ -17,6 +17,30 @@ public class User { @JsonProperty("number") private String number; + @JsonProperty("pushTokens") + private java.util.List pushTokens; + + @JsonProperty("webPushTokens") + private java.util.List webPushTokens; + + @JsonProperty("timezone") + private String timezone; + + @JsonProperty("lastSeenTime") + private String lastSeenTime; + + @JsonProperty("slackChannelName") + private String slackChannelName; + + @JsonProperty("slackToken") + private SlackToken slackToken; + + @JsonProperty("updatedAt") + private String updatedAt; + + @JsonProperty("createdAt") + private String createdAt; + /** * Default constructor for User. */ @@ -91,4 +115,28 @@ public User setNumber(String number) { this.number = number; return this; } + + public java.util.List getPushTokens() { return pushTokens; } + public User setPushTokens(java.util.List pushTokens) { this.pushTokens = pushTokens; return this; } + + public java.util.List getWebPushTokens() { return webPushTokens; } + public User setWebPushTokens(java.util.List webPushTokens) { this.webPushTokens = webPushTokens; return this; } + + public String getTimezone() { return timezone; } + public User setTimezone(String timezone) { this.timezone = timezone; return this; } + + public String getLastSeenTime() { return lastSeenTime; } + public User setLastSeenTime(String lastSeenTime) { this.lastSeenTime = lastSeenTime; return this; } + + public String getSlackChannelName() { return slackChannelName; } + public User setSlackChannelName(String slackChannelName) { this.slackChannelName = slackChannelName; return this; } + + public SlackToken getSlackToken() { return slackToken; } + public User setSlackToken(SlackToken slackToken) { this.slackToken = slackToken; return this; } + + public String getUpdatedAt() { return updatedAt; } + public User setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; return this; } + + public String getCreatedAt() { return createdAt; } + public User setCreatedAt(String createdAt) { this.createdAt = createdAt; return this; } } \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/WebPushOptions.java b/src/main/java/com/notificationapi/model/WebPushOptions.java new file mode 100644 index 0000000..bdfd81f --- /dev/null +++ b/src/main/java/com/notificationapi/model/WebPushOptions.java @@ -0,0 +1,25 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class WebPushOptions { + @JsonProperty("title") + private String title; + @JsonProperty("message") + private String message; + @JsonProperty("icon") + private String icon; + @JsonProperty("url") + private String url; + + public String getTitle() { return title; } + public WebPushOptions setTitle(String title) { this.title = title; return this; } + public String getMessage() { return message; } + public WebPushOptions setMessage(String message) { this.message = message; return this; } + public String getIcon() { return icon; } + public WebPushOptions setIcon(String icon) { this.icon = icon; return this; } + public String getUrl() { return url; } + public WebPushOptions setUrl(String url) { this.url = url; return this; } +} \ No newline at end of file diff --git a/src/main/java/com/notificationapi/model/WebPushToken.java b/src/main/java/com/notificationapi/model/WebPushToken.java new file mode 100644 index 0000000..774788d --- /dev/null +++ b/src/main/java/com/notificationapi/model/WebPushToken.java @@ -0,0 +1,13 @@ +package com.notificationapi.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class WebPushToken { + @JsonProperty("sub") + private PushSubscription sub; + + public PushSubscription getSub() { return sub; } + public WebPushToken setSub(PushSubscription sub) { this.sub = sub; return this; } +} \ No newline at end of file From fa6efa781306d4a3765a0b83f67dfadfb4add527 Mon Sep 17 00:00:00 2001 From: mbasadi Date: Thu, 22 May 2025 13:43:35 -0400 Subject: [PATCH 2/2] Update version to 0.3.0 in README.md to reflect the latest SDK release. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d393331..523cb08 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Add the following dependency to your project's `pom.xml`: com.notificationapi notificationapi-java-server-sdk - 0.1.0 + 0.3.0 ```