Module it.auties.cobalt
Package it.auties.whatsapp.api
Class ConnectionBuilder<T extends OptionsBuilder<T>>
java.lang.Object
it.auties.whatsapp.api.ConnectionBuilder<T>
- Type Parameters:
T- the type of the newsletters
A builder to specify the type of connection to use
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate TcreateConnection(StoreKeysPair sessionStoreAndKeys) Creates a new connection from the first connection that was serialized If no connection is available, a new one will be createdCreates a new connection from the first connection that was serializedCreates a new connection from the last connection that was serialized If no connection is available, a new one will be createdCreates a new connection from the last connection that was serializedCreates a new connection using a random uuidnewConnection(long phoneNumber) Creates a new connection using a phone number If a session with the given phone number already whatsappOldEligible, it will be retrieved.newConnection(SixPartsKeys sixParts) Creates a new connection using a six parts key representationnewConnection(String alias) Creates a new connection using an alias If a session with the given alias already whatsappOldEligible, it will be retrieved.newConnection(UUID uuid) Creates a new connection using a unique identifier If a session with the given id already whatsappOldEligible, it will be retrieved.newOptionalConnection(Long phoneNumber) Creates a new connection from the last connection that was serialized If no connection is available, an empty optional will be returnednewOptionalConnection(String alias) Creates a new connection using an alias If no connection is available, an empty optional will be returnednewOptionalConnection(UUID uuid) Creates a new connection from the last connection that was serialized If no connection is available, an empty optional will be returnedserializer(ControllerSerializer serializer) Uses a custom serializer
-
Field Details
-
clientType
-
serializer
-
-
Constructor Details
-
ConnectionBuilder
ConnectionBuilder(ClientType clientType)
-
-
Method Details
-
serializer
Uses a custom serializer- Parameters:
serializer- the non-null serializer to use- Returns:
- the same instance for chaining
-
newConnection
Creates a new connection using a random uuid- Returns:
- a non-null options selector
-
newConnection
Creates a new connection using a unique identifier If a session with the given id already whatsappOldEligible, it will be retrieved. Otherwise, a new one will be created.- Parameters:
uuid- the nullable uuid to use to create the connection- Returns:
- a non-null options selector
-
newConnection
Creates a new connection using a phone number If a session with the given phone number already whatsappOldEligible, it will be retrieved. Otherwise, a new one will be created.- Parameters:
phoneNumber- the nullable uuid to use to create the connection- Returns:
- a non-null options selector
-
newConnection
Creates a new connection using an alias If a session with the given alias already whatsappOldEligible, it will be retrieved. Otherwise, a new one will be created.- Parameters:
alias- the nullable alias to use to create the connection- Returns:
- a non-null options selector
-
newConnection
Creates a new connection using a six parts key representation- Parameters:
sixParts- the non-null six parts to use to create the connection- Returns:
- a non-null options selector
-
firstConnection
Creates a new connection from the first connection that was serialized If no connection is available, a new one will be created- Returns:
- a non-null options selector
-
lastConnection
Creates a new connection from the last connection that was serialized If no connection is available, a new one will be created- Returns:
- a non-null options selector
-
newOptionalConnection
Creates a new connection from the last connection that was serialized If no connection is available, an empty optional will be returned- Returns:
- a non-null options selector
-
newOptionalConnection
Creates a new connection from the last connection that was serialized If no connection is available, an empty optional will be returned- Returns:
- a non-null options selector
-
newOptionalConnection
Creates a new connection using an alias If no connection is available, an empty optional will be returned- Parameters:
alias- the nullable alias to use to create the connection- Returns:
- a non-null options selector
-
firstOptionalConnection
Creates a new connection from the first connection that was serialized- Returns:
- an optional
-
lastOptionalConnection
Creates a new connection from the last connection that was serialized- Returns:
- an optional
-
createConnection
-