Agent

public struct Agent : Equatable, Sendable

Represents all info about an agent.

Properties

  • id

    The id of the agent.

    Declaration

    Swift

    public let id: Int
  • The first name of the agent, or nil when the backend omits or hides this field.

    Declaration

    Swift

    public let firstName: String?
  • The surname of the agent, or nil when the backend omits or hides this field.

    Declaration

    Swift

    public let surname: String?
  • The nickname of the agent.

    Declaration

    Swift

    public let nickname: String?
  • Whether the agent is a bot, or nil when the backend omits or hides this field.

    Declaration

    Swift

    public let isBotUser: Bool?
  • Whether the agent is for automated surveys, or nil when the backend omits or hides this field.

    Declaration

    Swift

    public let isSurveyUser: Bool?
  • The URL for the profile photo of the agent, or nil when unavailable or hidden by the backend.

    Declaration

    Swift

    public let imageUrl: String?

Computed Properties

  • The full name of the agent (readonly).

    Returns nil when neither firstName nor surname is available — e.g. when the backend hides the agent’s personal information — so callers can apply a fallback.

    Declaration

    Swift

    public var fullName: String? { get }

Init

  • Creates an Agent value, typically when synthesising agents for tests, previews, or mocks.

    Production code receives Agent values from the SDK on ChatThreads and in agentTyping(isTyping:agent:threadId:) events.

    Declaration

    Swift

    public init(
        id: Int,
        firstName: String? = nil,
        surname: String? = nil,
        nickname: String? = nil,
        isBotUser: Bool? = nil,
        isSurveyUser: Bool? = nil,
        imageUrl: String? = nil
    )

    Parameters

    id

    Backend identifier for the agent.

    firstName

    Agent’s first name; nil when omitted or hidden by the backend.

    surname

    Agent’s surname; nil when omitted or hidden by the backend.

    nickname

    Optional display nickname; UI typically prefers this over firstName surname.

    isBotUser

    true if the agent is an automated bot; nil when omitted or hidden by the backend.

    isSurveyUser

    true if the agent represents an automated survey flow; nil when omitted or hidden by the backend.

    imageUrl

    URL of the agent’s profile photo; nil when unavailable or hidden.