public class UserMessage extends Object implements ChatMessage
Constructor and Description |
---|
UserMessage(Content... contents)
Creates a
UserMessage from contents. |
UserMessage(List<Content> contents)
Creates a
UserMessage from contents. |
UserMessage(String text)
Creates a
UserMessage from a text. |
UserMessage(String name,
Content... contents)
Creates a
UserMessage from a name and contents. |
UserMessage(String name,
List<Content> contents)
Creates a
UserMessage from a name and contents. |
UserMessage(String name,
String text)
Creates a
UserMessage from a name and a text. |
Modifier and Type | Method and Description |
---|---|
List<Content> |
contents()
The contents of the message.
|
boolean |
equals(Object o) |
static UserMessage |
from(Content... contents)
Create a
UserMessage from contents. |
static UserMessage |
from(List<Content> contents)
Create a
UserMessage from contents. |
static UserMessage |
from(String text)
Create a
UserMessage from a text. |
static UserMessage |
from(String name,
Content... contents)
Create a
UserMessage from a name and contents. |
static UserMessage |
from(String name,
List<Content> contents)
Create a
UserMessage from a name and contents. |
static UserMessage |
from(String name,
String text)
Create a
UserMessage from a name and a text. |
int |
hashCode() |
boolean |
hasSingleText()
Whether this message has a single text content.
|
String |
name()
The name of the user.
|
String |
text()
Deprecated.
|
String |
toString() |
ChatMessageType |
type()
The type of the message.
|
static UserMessage |
userMessage(Content... contents)
Create a
UserMessage from contents. |
static UserMessage |
userMessage(List<Content> contents)
Create a
UserMessage from contents. |
static UserMessage |
userMessage(String text)
Create a
UserMessage from a text. |
static UserMessage |
userMessage(String name,
Content... contents)
Create a
UserMessage from a name and contents. |
static UserMessage |
userMessage(String name,
List<Content> contents)
Create a
UserMessage from a name and contents. |
static UserMessage |
userMessage(String name,
String text)
Create a
UserMessage from a name and a text. |
public UserMessage(String text)
UserMessage
from a text.text
- the text.public UserMessage(String name, String text)
UserMessage
from a name and a text.name
- the name.text
- the text.public UserMessage(Content... contents)
UserMessage
from contents.
Will have a {code null} name.
contents
- the contents.public UserMessage(String name, Content... contents)
UserMessage
from a name and contents.name
- the name.contents
- the contents.public UserMessage(List<Content> contents)
UserMessage
from contents.
Will have a {code null} name.
contents
- the contents.public UserMessage(String name, List<Content> contents)
UserMessage
from a name and contents.name
- the name.contents
- the contents.public String name()
null
if not set.@Deprecated public String text()
ChatMessage
text
in interface ChatMessage
public boolean hasSingleText()
true
if this message has a single text content, false
otherwise.public ChatMessageType type()
ChatMessage
type
in interface ChatMessage
public static UserMessage from(String text)
UserMessage
from a text.text
- the text.UserMessage
.public static UserMessage from(String name, String text)
UserMessage
from a name and a text.name
- the name.text
- the text.UserMessage
.public static UserMessage from(Content... contents)
UserMessage
from contents.contents
- the contents.UserMessage
.public static UserMessage from(String name, Content... contents)
UserMessage
from a name and contents.name
- the name.contents
- the contents.UserMessage
.public static UserMessage from(List<Content> contents)
UserMessage
from contents.contents
- the contents.UserMessage
.public static UserMessage from(String name, List<Content> contents)
UserMessage
from a name and contents.name
- the name.contents
- the contents.UserMessage
.public static UserMessage userMessage(String text)
UserMessage
from a text.text
- the text.UserMessage
.public static UserMessage userMessage(String name, String text)
UserMessage
from a name and a text.name
- the name.text
- the text.UserMessage
.public static UserMessage userMessage(Content... contents)
UserMessage
from contents.contents
- the contents.UserMessage
.public static UserMessage userMessage(String name, Content... contents)
UserMessage
from a name and contents.name
- the name.contents
- the contents.UserMessage
.public static UserMessage userMessage(List<Content> contents)
UserMessage
from contents.contents
- the contents.UserMessage
.public static UserMessage userMessage(String name, List<Content> contents)
UserMessage
from a name and contents.name
- the name.contents
- the contents.UserMessage
.Copyright © 2024. All rights reserved.