@vonage/client-sdk
Version:
The Client SDK is intended to provide a ready solution for developers to build Programmable Conversation applications across multiple Channels including: Messages, Voice, SIP, websockets, and App.
171 lines (170 loc) • 5.04 kB
TypeScript
import vonage from '../utils/vonage';
import { ConversationChannelType, ConversationState, MemberState, PersistentConversationEvent } from '../kotlin/JsUnions';
import { toEnum, unionOfValues } from './Enums';
import { Leg } from '../client';
/**
* Represents a conversation
*
* @property id The conversation id
* @property name The conversation name
* @property timestamp The conversation timestamp
* @property memberId The user member id in the conversation
* @property memberState The user member state in the conversation
* @property displayName The conversation display name
* @property imageUrl The conversation image url
* @property state The conversation state
* @property properties The conversation properties
* @interface
*/
export type Conversation = vonage.ConversationJS & {
memberState?: MemberState;
state?: ConversationState;
};
/**
* Represents a {@link Conversation} timestamps
*
* @interface
*/
export type ConversationTimestamp = vonage.ConversationTimestampJS;
/**
* Represents the properties for a {@link Conversation}
*
* @property ttl The time-to-live (TTL) for the conversation in seconds.
* @property customSortKey A string according to which Conversations will be ordered
* @property customData The Conversation custom data
* @interface
*/
export type ConversationProperties = vonage.ConversationJS.Properties;
/**
* Represents a page of conversations
*
* @property conversations The conversations in the page
* @property previousCursor The cursor to fetch the previous page
* @property nextCursor The cursor to fetch the next page
* @interface
* @group Chat
*/
export type ConversationsPage = vonage.ConversationsPageJS & {
conversations: Conversation[];
};
/**
* Represents a page of legs
*
* @property legs The legs in the page
* @property previousCursor The cursor to fetch the previous page
* @property nextCursor The cursor to fetch the next page
* @interface
* @group Voice
*/
export type LegsPage = vonage.LegsPageJS & {
legs: Leg[];
};
/**
* Represents a page of conversation events
*
* @property events The events in the page
* @property previousCursor The cursor to fetch the previous page
* @property nextCursor The cursor to fetch the next page
* @interface
* @group Chat
*/
export type EventsPage = vonage.EventsPageJS & {
events: PersistentConversationEvent[];
};
/**
* Represents the membership of a user in a conversation
*
* @property id The member id
* @property state The member state
* @property user The user associated to the member
* @property channel The member channel
* @property timestamp The member timestamp
* @interface
*/
export type Member = Omit<vonage.MemberJS, 'state' | 'channel'> & {
state?: MemberState;
channel?: MemberChannel;
};
/**
* Represents a {@link Member} timestamps
*
* @interface
*/
export type MemberTimestamp = vonage.MemberTimestampJS;
/**
* Represents a page of conversation members
*
* @property members The members in the page
* @property previousCursor The cursor to fetch the previous page
* @property nextCursor The cursor to fetch the next page
* @interface
* @group Chat
*/
export type MembersPage = vonage.MembersPageJS & {
members: Member[];
};
/**
* Represents an SDK user
*
* @property id The user id
* @property name The user name
* @property displayName The user display name
* @property channels The user channels
* @property timestamp The user timestamp
* @property imageUrl The user image url
* @property customData The user custom data
* @interface
*/
export type User = vonage.UserJS;
/**
* Represents an {@link User} timestamps
*
* @interface
*/
export type UserTimestamp = vonage.UserTimestampJS;
/**
* The type of a {@link MemberChannel}
*
* @enum
*/
export declare const MemberChannelType: toEnum<ConversationChannelType>;
export type MemberChannelType = unionOfValues<typeof MemberChannelType>;
/**
* Represents a Member Channel
*
* @property type The {@link MemberChannelType}
* @property from The from {@link Channel}
* @property to The to {@link Channel}
* @interface
*/
export type MemberChannel = Omit<vonage.MemberChannelJS, 'type'> & {
type: MemberChannelType;
};
/**
* Represents a Channel.
* It will hold either an id or a number, depending on the Channel,
* but never both of them.
*
* @property id The Channel id
* @property number The Channel number
* @interface
*/
export type Channel = vonage.ChannelJS;
/**
* Represents all the Channels of a certain {@link User}.
* For each type of Channel, it will hold an array of {@link Channel}
*
* @property app
* @property phone
* @property pstn
* @property sip
* @property vbc
* @property websocket
* @property sms
* @property mms
* @property whatsapp
* @property viber
* @property messenger
* @interface
*/
export type UserChannels = vonage.UserChannelsJS;