UNPKG

@prass/botpress-native

Version:

A simple and powerful SDK for integrating Botpress Chat API with React Native,

257 lines (256 loc) 7.07 kB
/** * Represents the response structure for user-related data. */ export interface CreateUserResponse extends UserResponse { /** * A unique key associated with the user, often used for authentication or identification purposes. */ key: string; } export interface UserResponse { /** * The user object containing details about the user. */ user: { /** * The unique identifier for the user. */ id: string; /** * The full name of the user. */ name: string; /** * The URL of the user's profile picture. */ pictureUrl: string; /** * A brief description or bio of the user. */ profile: string; /** * The timestamp when the user was created. * Format: ISO 8601 (e.g., "2025-02-20T13:34:21.655Z"). */ createdAt: string; /** * The timestamp when the user was last updated. * Format: ISO 8601 (e.g., "2025-02-20T13:34:21.655Z"). */ updatedAt: string; }; } /** * Represents the response structure for user-related data. */ export interface GetOrCreateUserResponse extends UserResponse { } export interface Conversation { /** * The unique identifier for the newly created conversation. */ id: string; /** * The timestamp when the conversation was created. * Format: ISO 8601 (e.g., "2025-02-20T13:34:21.655Z"). */ createdAt: string; /** * The timestamp when the conversation was last updated. * For a newly created conversation, this will typically match the `createdAt` timestamp. * Format: ISO 8601 (e.g., "2025-02-20T13:34:21.655Z"). */ updatedAt: string; } /** * Represents the response structure for conversation-related data. */ export interface GetConversationResponse { /** * The conversation object containing details about the conversation. */ conversation: Conversation; } /** * Represents the response structure when a conversation is successfully created. */ export interface CreateConversationResponse { /** * The conversation object containing details about the newly created conversation. */ conversation: Conversation; } /** * Represents the response structure when a user requests a list of conversations. */ export interface ListConversationsResponse { /** * An array of conversation objects, each containing details about a conversation. */ conversations: Array<Conversation>; /** * Metadata for pagination and additional information about the response. */ meta: { /** * A token used to fetch the next set of conversations in a paginated list. * If `null` or `undefined`, there are no more conversations to fetch. */ nextToken: string | null; }; } /** * Represents a collection of messages and associated metadata. */ export interface ListMessagesResponse { /** * An array of individual message objects. */ messages: Array<MessageResponse["message"]>; /** * Metadata containing pagination information. */ meta: { /** * Token used for pagination to fetch the next set of messages. * @example "page2_token_xyz" */ nextToken: string; }; } export interface MessageResponse { message: { /** * Unique identifier for the message. * @example "msg_123456" */ id: string; /** * ISO 8601 timestamp of when the message was created. * @example "2025-02-20T13:34:21.655Z" */ createdAt: string; /** * The content payload of the message. */ payload: Record<string, string> & { /** * The type of content in the payload. * @example "audio" */ type: "text" | "video" | "image" | "markdown" | "file" | "dropdown" | "choice" | "carousel" | "card" | "audio"; }; /** * Identifier of the user who sent the message. * @example "user_789" */ userId: string; /** * Identifier of the conversation this message belongs to. * @example "conv_456" */ conversationId: string; }; } export interface Participant { /** * Unique identifier for the participant. * @example "part_123456" */ id: string; /** * Display name of the participant. * @example "John Doe" */ name: string; /** * URL to the participant's profile picture. * @example "https://example.com/images/john_doe.jpg" */ pictureUrl: string; /** * Profile description or bio of the participant. * @example "Software Engineer at xAI" */ profile: string; /** * ISO 8601 timestamp of when the participant was created. * @example "2025-02-22T07:37:19.663Z" */ createdAt: string; /** * ISO 8601 timestamp of when the participant was last updated. * @example "2025-02-22T07:37:19.663Z" */ updatedAt: string; } /** * Represents the response payload when adding a participant to a conversation. */ export interface AddParticipantResponse { /** * Details of the participant that was added. */ participant: Participant; } /** * Represents a response containing a list of participants and pagination metadata. * Typically returned when fetching participants of a conversation or group. */ export interface ListParticipantsResponse { /** * Array of participant objects in the response. */ participants: Array<Participant>; /** * Metadata containing pagination information. */ meta: { /** * Token used to fetch the next page of participants. * @example "next_page_token_789" */ nextToken: string; }; } /** * Represents a response containing details of an event. * Typically returned when an event is created, retrieved, or referenced in the system. */ export interface EventResponse { /** * Details of the event. */ event: Event; } /** * Represents an event entity within the system. */ export interface Event { /** * Unique identifier for the event. * @example "evt_123456" */ id: string; /** * ISO 8601 timestamp of when the event was created. * @example "2025-02-22T07:37:19.663Z" */ createdAt: string; /** * Payload containing event-specific data. * Can be any structured data relevant to the event (e.g., message content, metadata). * @example { "type": "message_sent", "text": "Hello" } */ payload: Record<string, any>; /** * Identifier of the conversation this event belongs to. * @example "conv_789" */ conversationId: string; /** * Identifier of the user associated with this event. * @example "user_456" */ userId: string; }