Skip to content

Commit 98544a8

Browse files
Added customMessageType to Publish, Signal, Subscribe, History, File. (#302)
* PubNub SDK v10.2.0 release. --------- Co-authored-by: PubNub Release Bot <[email protected]>
1 parent 8fd0a4e commit 98544a8

File tree

84 files changed

+992
-166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+992
-166
lines changed

.pubnub.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: kotlin
2-
version: 10.1.0
2+
version: 10.2.0
33
schema: 1
44
scm: github.com/pubnub/kotlin
55
files:
6-
- build/libs/pubnub-kotlin-10.1.0-all.jar
6+
- build/libs/pubnub-kotlin-10.2.0-all.jar
77
sdks:
88
-
99
type: library
@@ -23,8 +23,8 @@ sdks:
2323
-
2424
distribution-type: library
2525
distribution-repository: maven
26-
package-name: pubnub-kotlin-10.1.0
27-
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.1.0/pubnub-kotlin-10.1.0.jar
26+
package-name: pubnub-kotlin-10.2.0
27+
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.2.0/pubnub-kotlin-10.2.0.jar
2828
supported-platforms:
2929
supported-operating-systems:
3030
Android:
@@ -114,6 +114,11 @@ sdks:
114114
license-url: https://www.apache.org/licenses/LICENSE-2.0.txt
115115
is-required: Required
116116
changelog:
117+
- date: 2024-11-18
118+
version: v10.2.0
119+
changes:
120+
- type: feature
121+
text: "Publish, signal, share file, subscribe, and history."
117122
- date: 2024-11-06
118123
version: v10.1.0
119124
changes:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v10.2.0
2+
November 18 2024
3+
4+
#### Added
5+
- Publish, signal, share file, subscribe, and history.
6+
17
## v10.1.0
28
November 06 2024
39

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
2020
<dependency>
2121
<groupId>com.pubnub</groupId>
2222
<artifactId>pubnub-kotlin</artifactId>
23-
<version>10.1.0</version>
23+
<version>10.2.0</version>
2424
</dependency>
2525
```
2626

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RELEASE_SIGNING_ENABLED=true
1818
SONATYPE_HOST=DEFAULT
1919
SONATYPE_AUTOMATIC_RELEASE=false
2020
GROUP=com.pubnub
21-
VERSION_NAME=10.1.0
21+
VERSION_NAME=10.2.0
2222
POM_PACKAGING=jar
2323

2424
POM_NAME=PubNub SDK

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/PubNub.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import com.pubnub.api.java.v2.PNConfiguration
5757
import com.pubnub.api.java.v2.callbacks.EventEmitter
5858
import com.pubnub.api.java.v2.callbacks.StatusEmitter
5959
import com.pubnub.api.java.v2.endpoints.pubsub.PublishBuilder
60+
import com.pubnub.api.java.v2.endpoints.pubsub.SignalBuilder
6061
import com.pubnub.api.java.v2.entities.Channel
6162
import com.pubnub.api.java.v2.entities.ChannelGroup
6263
import com.pubnub.api.java.v2.entities.ChannelMetadata
@@ -183,6 +184,10 @@ interface PubNub : EventEmitter, StatusEmitter {
183184
* if more than 100 messages meet the timetoken values.
184185
*
185186
*/
187+
@Deprecated(
188+
level = DeprecationLevel.WARNING,
189+
message = "Use fetchMessages() instead",
190+
)
186191
fun history(): History
187192

188193
/**
@@ -319,6 +324,11 @@ interface PubNub : EventEmitter, StatusEmitter {
319324
* The message argument can contain any JSON serializable data, including: Objects, Arrays, Integers and Strings.
320325
* Data should not contain special Java/Kotlin classes or functions as these will not serialize.
321326
* String content can include any single-byte or multi-byte UTF-8 character.
327+
*
328+
* @param message The payload
329+
* @param channel The channel to publish message to.
330+
*
331+
* @return [PublishBuilder]
322332
*/
323333
fun publish(message: Any, channel: String): PublishBuilder
324334

@@ -360,8 +370,13 @@ interface PubNub : EventEmitter, StatusEmitter {
360370
* By default, signals are limited to a message payload size of 30 bytes.
361371
* This limit applies only to the payload, and not to the URI or headers.
362372
* If you require a larger payload size, please [contact support](mailto:[email protected]).
373+
*
374+
* @param message The payload
375+
* @param channel The channel to signal message to.
376+
*
377+
* @return [SignalBuilder]
363378
*/
364-
fun signal(message: Any, channel: String): com.pubnub.api.endpoints.pubsub.Signal
379+
fun signal(message: Any, channel: String): SignalBuilder
365380

366381
/**
367382
* Send a signal to all subscribers of a channel.

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/endpoints/FetchMessages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ public interface FetchMessages extends Endpoint<PNFetchMessagesResult> {
1818
FetchMessages includeMessageType(boolean includeMessageType);
1919

2020
FetchMessages includeUUID(boolean includeUUID);
21+
22+
FetchMessages includeCustomMessageType(boolean includeCustomMessageType);
2123
}

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/endpoints/files/PublishFileMessage.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public interface PublishFileMessage extends Endpoint<PNPublishFileMessageResult>
1515

1616
PublishFileMessage shouldStore(Boolean shouldStore);
1717

18+
PublishFileMessage customMessageType(String customMessageType);
19+
1820
interface Builder extends BuilderSteps.ChannelStep<FilesBuilderSteps.FileNameStep<FilesBuilderSteps.FileIdStep<PublishFileMessage>>> {
1921

2022
}

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/endpoints/files/SendFile.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public interface SendFile extends ExtendedRemoteAction<PNFileUploadResult> {
1717

1818
SendFile cipherKey(String cipherKey);
1919

20+
SendFile customMessageType(String customMessageType);
21+
2022
interface Builder extends BuilderSteps.ChannelStep<FilesBuilderSteps.FileNameStep<FilesBuilderSteps.InputStreamStep<SendFile>>> {
2123

2224
}

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/endpoints/pubsub/Publish.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ public interface Publish extends Endpoint<PNPublishResult> {
1717
Publish replicate(boolean replicate);
1818

1919
Publish ttl(Integer ttl);
20+
21+
Publish customMessageType(String type);
2022
}

pubnub-gson/pubnub-gson-api/src/main/java/com/pubnub/api/java/v2/endpoints/pubsub/PublishBuilder.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,63 @@
33
import com.pubnub.api.java.endpoints.Endpoint;
44
import com.pubnub.api.models.consumer.PNPublishResult;
55

6+
/**
7+
* Interface representing a builder for configuring a publish operation.
8+
* This interface extends {@link Endpoint} to provide a fluent API for setting various parameters
9+
* for the publish request.
10+
*/
611
public interface PublishBuilder extends Endpoint<PNPublishResult> {
12+
/**
13+
* Specifies whether the message should be stored in the history of the channel.
14+
*
15+
* @param shouldStore Boolean indicating whether to store the message (true) or not (false). If not specified, then the history configuration of the key is used.
16+
* @return The current instance of {@code PublishBuilder} for method chaining.
17+
*/
718
PublishBuilder shouldStore(Boolean shouldStore);
819

20+
/**
21+
* Configures the publish request to use the POST HTTP method instead of GET.
22+
*
23+
* @param usePOST Boolean indicating whether to use POST (true) or GET (false) for the request. Default is `false`
24+
* @return The current instance of {@code PublishBuilder} for method chaining.
25+
*/
926
PublishBuilder usePOST(boolean usePOST);
1027

28+
/**
29+
* Sets the metadata to be sent along with the message.
30+
* Metadata can be any custom object.
31+
*
32+
* @param meta Metadata object which can be used with the filtering ability.
33+
* @return The current instance of {@code PublishBuilder} for method chaining.
34+
*/
1135
PublishBuilder meta(Object meta);
1236

37+
38+
/**
39+
* Specifies whether the message should be replicated across datacenters.
40+
*
41+
* @param replicate Boolean indicating whether to replicate the message (true) or not (false). Default is true.
42+
* @return The current instance of {@code PublishBuilder} for method chaining.
43+
*/
1344
PublishBuilder replicate(boolean replicate);
1445

46+
/**
47+
* Sets the time-to-live (TTL) in Message Persistence.
48+
* If shouldStore = true, and ttl = 0, the message is stored with no expiry time.
49+
* If shouldStore = true and ttl = X (X is an Integer value), the message is stored with an expiry time of X hours.
50+
* If shouldStore = false, the ttl parameter is ignored.
51+
* If ttl is not specified, then expiration of the message defaults back to the expiry value for the key.
52+
*
53+
* @param ttl The TTL value in minutes for the message.
54+
* @return The current instance of {@code PublishBuilder} for method chaining.
55+
*/
1556
PublishBuilder ttl(Integer ttl);
57+
58+
/**
59+
* Specifies a custom message type for the message.
60+
*
61+
* @param customMessageType The custom message type as a string.
62+
* @return The current instance of {@code PublishBuilder} for method chaining.
63+
*/
64+
PublishBuilder customMessageType(String customMessageType);
1665
}

0 commit comments

Comments
 (0)