@brightchain/brightchat-lib
v0.31.0
Published
BrightChat shared library - request interfaces and types for BrightChain chat
Maintainers
Readme
brightchat-lib
Shared request interfaces for the BrightChat API. This library defines the typed parameter shapes used by the brightchat-react-components API client when calling BrightChat REST endpoints.
@brightchain/brightchat-lib
Shared request interfaces for the BrightChat API. This library defines the typed parameter shapes used by the brightchat-react-components API client when calling BrightChat REST endpoints.
Relationship to Other Packages
brightchain-lib ← shared data types, enums, response interfaces (IConversation, DefaultRole, etc.)
↑
brightchat-lib ← request parameter interfaces (this package)
↑
brightchat-react-components ← React UI components, hooks, API client (consumer)@brightchain/brightchain-libowns all shared data models (IConversation,IGroup,IChannel,ICommunicationMessage,IReaction, etc.) and enumerations (DefaultRole,ChannelVisibility,PresenceStatus,CommunicationEventType). These are NOT redefined here.@brightchain/brightchat-lib(this package) defines only the request parameter interfaces — the shapes of POST/PUT/DELETE request bodies sent to the BrightChat API.@brightchain/brightchat-react-componentsconsumes both packages to build the typedChatApiClient.
Exported Interfaces
| Interface | Purpose |
|-----------|---------|
| SendDirectMessageParams | POST /api/conversations — recipientId + content |
| CreateGroupParams | POST /api/groups — name + memberIds |
| SendMessageParams | POST .../messages — content (used for group & channel messages) |
| AddMembersParams | POST .../members — memberIds array |
| AssignRoleParams | PUT .../roles/:memberId — role (DefaultRole) |
| CreateChannelParams | POST /api/channels — name, topic, visibility (ChannelVisibility) |
| CreateInviteParams | POST .../invites — optional maxUses, expiresInMs |
| MuteMemberParams | POST .../mute/:memberId — durationMs |
| AddReactionParams | POST .../reactions — emoji string |
| EditMessageParams | PUT .../messages/:messageId — updated content |
| PromoteToGroupParams | POST .../promote — newMemberIds for DM→group promotion |
| PaginationParams | Cursor-based pagination — optional cursor + limit |
| SearchParams | Extends PaginationParams with required query string |
Usage
import { SendDirectMessageParams, PaginationParams } from '@brightchain/brightchat-lib';
const params: SendDirectMessageParams = {
recipientId: 'member-uuid',
content: 'Hello!',
};Build Commands
yarn nx build brightchat-lib
yarn nx test brightchat-lib
yarn nx lint brightchat-libLicense
MIT — Digital Defiance
