WebPubSubChatServiceClient class
A client for managing chat resources in an Azure Web PubSub Chat hub.
Constructors
| Web |
Create from connection string |
| Web |
Create from endpoint and credential |
Properties
| pipeline | The pipeline used by this client to make requests |
Methods
Constructor Details
WebPubSubChatServiceClient(string, string, WebPubSubChatServiceClientOptions)
Create from connection string
new WebPubSubChatServiceClient(connectionString: string, hub: string, options?: WebPubSubChatServiceClientOptions)
Parameters
- connectionString
-
string
- hub
-
string
WebPubSubChatServiceClient(string, TokenCredential | AzureKeyCredential, string, WebPubSubChatServiceClientOptions)
Create from endpoint and credential
new WebPubSubChatServiceClient(endpointParam: string, credential: TokenCredential | AzureKeyCredential, hub: string, options?: WebPubSubChatServiceClientOptions)
Parameters
- endpointParam
-
string
- credential
- hub
-
string
Property Details
pipeline
Method Details
createOrReplaceRole(string, ChatRoleCreateOrReplace, CreateOrReplaceRoleOptionalParams)
Create or replace a role.
function createOrReplaceRole(roleName: string, role: ChatRoleCreateOrReplace, options?: CreateOrReplaceRoleOptionalParams): Promise<ChatRole>
Parameters
- roleName
-
string
Returns
Promise<ChatRole>
createOrReplaceRoom(string, ChatRoomCreateOrReplace, CreateOrReplaceRoomOptionalParams)
Create or replace a room with a client-specified ID.
function createOrReplaceRoom(roomId: string, room: ChatRoomCreateOrReplace, options?: CreateOrReplaceRoomOptionalParams): Promise<ChatRoom>
Parameters
- roomId
-
string
Returns
Promise<ChatRoom>
createOrReplaceRoomMember(string, string, ChatRoomMemberCreateOrReplace, CreateOrReplaceRoomMemberOptionalParams)
Create or replace a room member.
function createOrReplaceRoomMember(roomId: string, userId: string, member: ChatRoomMemberCreateOrReplace, options?: CreateOrReplaceRoomMemberOptionalParams): Promise<ChatRoomMember>
Parameters
- roomId
-
string
- userId
-
string
Returns
Promise<ChatRoomMember>
createOrReplaceTopic(string, string, ChatTopicCreateOrReplace, CreateOrReplaceTopicOptionalParams)
Create or replace a topic with a client-specified identifier.
function createOrReplaceTopic(roomId: string, topicId: string, topic: ChatTopicCreateOrReplace, options?: CreateOrReplaceTopicOptionalParams): Promise<ChatTopic>
Parameters
- roomId
-
string
Room containing the topic.
- topicId
-
string
Topic identifier, unique within the room.
- topic
- ChatTopicCreateOrReplace
Topic title and optional lifecycle state.
Conditional headers and request options.
Returns
Promise<ChatTopic>
The created or replaced topic.
createOrReplaceUser(string, HumanChatUserCreateOrReplace, CreateOrReplaceUserOptionalParams)
Create or replace a user. The request body is a polymorphic ChatUser (e.g. HumanChatUser) selected by the kind discriminator.
function createOrReplaceUser(userId: string, user: HumanChatUserCreateOrReplace, options?: CreateOrReplaceUserOptionalParams): Promise<ChatUserUnion>
Parameters
- userId
-
string
Returns
Promise<ChatUserUnion>
deleteMessage(string, string, DeleteMessageOptionalParams)
Delete a message.
function deleteMessage(conversationId: string, messageId: string, options?: DeleteMessageOptionalParams): Promise<void>
Parameters
- conversationId
-
string
- messageId
-
string
- options
- DeleteMessageOptionalParams
Returns
Promise<void>
deleteRole(string, DeleteRoleOptionalParams)
Delete a role.
function deleteRole(roleName: string, options?: DeleteRoleOptionalParams): Promise<void>
Parameters
- roleName
-
string
- options
- DeleteRoleOptionalParams
Returns
Promise<void>
deleteRoom(string, DeleteRoomOptionalParams)
Delete a room.
function deleteRoom(roomId: string, options?: DeleteRoomOptionalParams): Promise<void>
Parameters
- roomId
-
string
- options
- DeleteRoomOptionalParams
Returns
Promise<void>
deleteRoomMember(string, string, DeleteRoomMemberOptionalParams)
Delete a room member.
function deleteRoomMember(roomId: string, userId: string, options?: DeleteRoomMemberOptionalParams): Promise<void>
Parameters
- roomId
-
string
- userId
-
string
- options
- DeleteRoomMemberOptionalParams
Returns
Promise<void>
deleteTopic(string, string, DeleteTopicOptionalParams)
Soft delete a topic.
function deleteTopic(roomId: string, topicId: string, options?: DeleteTopicOptionalParams): Promise<void>
Parameters
- roomId
-
string
Room containing the topic.
- topicId
-
string
Topic to delete.
- options
- DeleteTopicOptionalParams
Conditional headers and request options.
Returns
Promise<void>
deleteUser(string, DeleteUserOptionalParams)
Delete a user.
function deleteUser(userId: string, options?: DeleteUserOptionalParams): Promise<void>
Parameters
- userId
-
string
- options
- DeleteUserOptionalParams
Returns
Promise<void>
getClientAccessToken(GetClientAccessTokenOptions)
Generate a token for a client to connect to the Azure Web PubSub service.
When using AzureKeyCredential, the token is generated locally using JWT signing. When using TokenCredential, the token is generated by calling the Web PubSub service's REST API.
function getClientAccessToken(options?: GetClientAccessTokenOptions): Promise<ClientAccessToken>
Parameters
- options
- GetClientAccessTokenOptions
Returns
Promise<ClientAccessToken>
getConversation(string, GetConversationOptionalParams)
Get conversation information.
function getConversation(conversationId: string, options?: GetConversationOptionalParams): Promise<ChatConversation>
Parameters
- conversationId
-
string
- options
- GetConversationOptionalParams
Returns
Promise<ChatConversation>
getRole(string, GetRoleOptionalParams)
Get role information.
function getRole(roleName: string, options?: GetRoleOptionalParams): Promise<ChatRole>
Parameters
- roleName
-
string
- options
- GetRoleOptionalParams
Returns
Promise<ChatRole>
getRoom(string, GetRoomOptionalParams)
Get room information.
function getRoom(roomId: string, options?: GetRoomOptionalParams): Promise<ChatRoom>
Parameters
- roomId
-
string
- options
- GetRoomOptionalParams
Returns
Promise<ChatRoom>
getTopic(string, string, GetTopicOptionalParams)
Get a topic's title, state, and conversation identifier.
function getTopic(roomId: string, topicId: string, options?: GetTopicOptionalParams): Promise<ChatTopic>
Parameters
- roomId
-
string
Room containing the topic.
- topicId
-
string
Topic to retrieve.
- options
- GetTopicOptionalParams
Request options.
Returns
Promise<ChatTopic>
The topic.
getUser(string, GetUserOptionalParams)
Get a user's profile. The response is a polymorphic ChatUser (e.g. HumanChatUser) selected by the kind discriminator.
function getUser(userId: string, options?: GetUserOptionalParams): Promise<ChatUserUnion>
Parameters
- userId
-
string
- options
- GetUserOptionalParams
Returns
Promise<ChatUserUnion>
listMessages(string, ListMessagesOptionalParams)
Message IDs are used as pagination cursors. Follow the response nextLink, which contains the message ID cursor, to retrieve the next page.
function listMessages(conversationId: string, options?: ListMessagesOptionalParams): PagedAsyncIterableIterator<ChatMessage, ChatMessage[], PageSettings>
Parameters
- conversationId
-
string
- options
- ListMessagesOptionalParams
Returns
PagedAsyncIterableIterator<ChatMessage, ChatMessage[], PageSettings>
listRoles(ListRolesOptionalParams)
Query roles in a hub.
function listRoles(options?: ListRolesOptionalParams): PagedAsyncIterableIterator<ChatRole, ChatRole[], PageSettings>
Parameters
- options
- ListRolesOptionalParams
Returns
PagedAsyncIterableIterator<ChatRole, ChatRole[], PageSettings>
listRoomMembers(string, ListRoomMembersOptionalParams)
Get room members.
function listRoomMembers(roomId: string, options?: ListRoomMembersOptionalParams): PagedAsyncIterableIterator<ChatRoomMember, ChatRoomMember[], PageSettings>
Parameters
- roomId
-
string
- options
- ListRoomMembersOptionalParams
Returns
PagedAsyncIterableIterator<ChatRoomMember, ChatRoomMember[], PageSettings>
listRooms(ListRoomsOptionalParams)
List rooms in the hub.
function listRooms(options?: ListRoomsOptionalParams): PagedAsyncIterableIterator<ChatRoom, ChatRoom[], PageSettings>
Parameters
- options
- ListRoomsOptionalParams
Pagination and request options.
Returns
PagedAsyncIterableIterator<ChatRoom, ChatRoom[], PageSettings>
An iterator over rooms, or pages through byPage().
listRoomsForUser(string, ListRoomsForUserOptionalParams)
List rooms associated with a user.
function listRoomsForUser(userId: string, options?: ListRoomsForUserOptionalParams): PagedAsyncIterableIterator<ChatUserRoom, ChatUserRoom[], PageSettings>
Parameters
- userId
-
string
User whose rooms to list.
- options
- ListRoomsForUserOptionalParams
Pagination and request options.
Returns
PagedAsyncIterableIterator<ChatUserRoom, ChatUserRoom[], PageSettings>
An iterator over rooms, or pages through byPage().
listTopics(string, ListTopicsOptionalParams)
List topics in a room.
function listTopics(roomId: string, options?: ListTopicsOptionalParams): PagedAsyncIterableIterator<ChatTopic, ChatTopic[], PageSettings>
Parameters
- roomId
-
string
Room whose topics to list.
- options
- ListTopicsOptionalParams
Pagination and request options.
Returns
PagedAsyncIterableIterator<ChatTopic, ChatTopic[], PageSettings>
An iterator over topics, or pages through byPage().
listUsers(ListUsersOptionalParams)
List users in the hub.
function listUsers(options?: ListUsersOptionalParams): PagedAsyncIterableIterator<ChatUserUnion, ChatUserUnion[], PageSettings>
Parameters
- options
- ListUsersOptionalParams
Pagination and request options.
Returns
PagedAsyncIterableIterator<ChatUserUnion, ChatUserUnion[], PageSettings>
An iterator over user profiles, or pages through byPage().
updateMessage(string, string, ChatMessageUpdate, UpdateMessageOptionalParams)
Update a message.
function updateMessage(conversationId: string, messageId: string, message: ChatMessageUpdate, options?: UpdateMessageOptionalParams): Promise<ChatMessage>
Parameters
- conversationId
-
string
- messageId
-
string
- message
- ChatMessageUpdate
- options
- UpdateMessageOptionalParams
Returns
Promise<ChatMessage>
updateTopic(string, string, ChatTopicUpdate, UpdateTopicOptionalParams)
Update a topic's title or lifecycle state.
function updateTopic(roomId: string, topicId: string, topic: ChatTopicUpdate, options?: UpdateTopicOptionalParams): Promise<ChatTopic>
Parameters
- roomId
-
string
Room containing the topic.
- topicId
-
string
Topic to update.
- topic
- ChatTopicUpdate
Properties to change; omitted properties are unchanged.
- options
- UpdateTopicOptionalParams
Conditional headers and request options.
Returns
Promise<ChatTopic>
The updated topic.