@@ -103,6 +103,67 @@ public A notificationType(String type) {
103
103
return (A )this ;
104
104
}
105
105
106
+ /**
107
+ * Sets the X-WNS-TTL property.
108
+ *
109
+ * Specifies the TTL (expiration time) for a notification.
110
+ * This is not typically needed, but can be used if you want to ensure that your notifications are not displayed
111
+ * later than a certain time. The TTL is specified in seconds and is relative to the time that WNS receives the
112
+ * request.
113
+ *
114
+ * When a TTL is specified, the device will not display the notification after that time.
115
+ * Note that this could result in the notification never being shown at all if the TTL is too short.
116
+ * In general, an expiration time will be measured in at least minutes.
117
+ *
118
+ * This header is optional.
119
+ * If no value is specified, the notification does not expire and will be replaced under the normal notification
120
+ * replacement scheme.
121
+ *
122
+ * @param ttl the life span of the notification, in seconds, after WNS receives the request.
123
+ * @return this
124
+ */
125
+ public A ttl (Long ttl ) {
126
+ this .headers .add (Pair .of ("X-WNS-TTL" , Long .toString (ttl )));
127
+ return (A )this ;
128
+ }
129
+
130
+ /**
131
+ * Sets the X-WNS-Cache-Policy property.
132
+ *
133
+ * When the notification target device is offline, WNS will cache one badge and one tile notification per app.
134
+ * If notification cycling is enabled for the app, WNS will cache up to five tile notifications.
135
+ * By default, raw notifications are not cached, but if raw notification caching is enabled,
136
+ * one raw notification is cached.
137
+ * Items are not held in the cache indefinitely and will be dropped after a reasonable period of time.
138
+ * Otherwise, the cached content is delivered when the device next comes online.
139
+ *
140
+ * This header is optional and should be used only in cases where the cloud service wants to override the
141
+ * default caching behavior
142
+ *
143
+ * @param enabled if true caching is enabled (default)
144
+ * @return this
145
+ */
146
+ public A cache (boolean enabled ) {
147
+ this .headers .add (Pair .of ("X-WNS-Cache-Policy" , enabled ? "cache" : "no-cache" ));
148
+ return (A )this ;
149
+ }
150
+
151
+ /**
152
+ * Sets the X-WNS-RequestForStatus property.
153
+ *
154
+ * Specifies whether the response should include the device status and WNS connection status.
155
+ *
156
+ * The default value is false.
157
+ *
158
+ * @param enabled if true specifies that the response should include the device status and WNS connection status.
159
+ * else, do not return the device status and notification status.
160
+ * @return this
161
+ */
162
+ public A requestForStatus (boolean enabled ) {
163
+ this .headers .add (Pair .of ("X-WNS-RequestForStatus" , enabled ? "true" : "false" ));
164
+ return (A )this ;
165
+ }
166
+
106
167
/**
107
168
* Sets the notification channel URI that the registered callback message
108
169
* will be sent to.
0 commit comments