@noatgnu/cupcake-mint-chocolate 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,63 +1,110 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Cupcake Mint Chocolate
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `cupcake-mint-chocolate` library provides a comprehensive suite of services and models for handling real-time messaging and user notifications within the Cupcake ecosystem.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Key Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **Messaging System:** A complete messaging system with support for public and private threads, user participation, and message replies.
|
|
8
|
+
- **Notification Service:** A robust system for delivering notifications to users, with support for different types, priorities, and delivery statuses.
|
|
9
|
+
- **Real-time Communication:** WebSocket integration for real-time updates on new messages and notifications.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
ng generate component component-name
|
|
11
|
-
```
|
|
11
|
+
## Installation
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
To install the `@noatgnu/cupcake-mint-chocolate` library, run the following command:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
16
|
+
npm install @noatgnu/cupcake-mint-chocolate
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
This library is an extension of `@noatgnu/cupcake-core` and depends on it. Make sure you have `@noatgnu/cupcake-core` installed and configured in your application.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## Services
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
ng build cupcake-mint-chocolate
|
|
25
|
-
```
|
|
23
|
+
### MessageThreadService
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
The `MessageThreadService` is responsible for managing message threads:
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
- **CRUD Operations:** Create, read, update, and delete message threads.
|
|
28
|
+
- **Participant Management:** Add, remove, and list participants in a thread.
|
|
29
|
+
- **Thread Actions:** Archive, unarchive, and mark threads as read.
|
|
30
|
+
- **Querying:** Filter and search for threads based on privacy, archive status, and creator.
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
**Usage:**
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
cd dist/cupcake-mint-chocolate
|
|
36
|
-
```
|
|
34
|
+
```typescript
|
|
35
|
+
import { MessageThreadService } from '@noatgnu/cupcake-mint-chocolate';
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
@Component({ ... })
|
|
38
|
+
export class MyComponent {
|
|
39
|
+
constructor(private messageThreadService: MessageThreadService) {
|
|
40
|
+
// Get all active public threads
|
|
41
|
+
this.messageThreadService.getMessageThreads({ isPrivate: false, isArchived: false }).subscribe(response => {
|
|
42
|
+
// ...
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
### MessageService
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
The `MessageService` handles the messages within threads:
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
- **CRUD Operations:** Create, read, update, and (soft) delete messages.
|
|
53
|
+
- **Querying:** Fetch messages by thread, sender, type, or content.
|
|
54
|
+
- **Replies:** Create messages that are replies to other messages.
|
|
55
|
+
|
|
56
|
+
**Usage:**
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { MessageService } from '@noatgnu/cupcake-mint-chocolate';
|
|
60
|
+
|
|
61
|
+
@Component({ ... })
|
|
62
|
+
export class MyComponent {
|
|
63
|
+
constructor(private messageService: MessageService) {
|
|
64
|
+
const threadId = '...'; // ID of the message thread
|
|
65
|
+
this.messageService.getThreadMessages(threadId).subscribe(response => {
|
|
66
|
+
// ...
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
49
70
|
```
|
|
50
71
|
|
|
51
|
-
|
|
72
|
+
### NotificationService
|
|
52
73
|
|
|
53
|
-
|
|
74
|
+
The `NotificationService` manages user notifications:
|
|
54
75
|
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
- **CRUD Operations:** Create, read, update, and delete notifications.
|
|
77
|
+
- **Notification Management:** Mark notifications as read (individually or all at once).
|
|
78
|
+
- **Statistics:** Get statistics about a user's notifications (total, unread, etc.).
|
|
79
|
+
- **Querying:** Filter notifications by type, priority, sender, and delivery status.
|
|
80
|
+
|
|
81
|
+
**Usage:**
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { NotificationService } from '@noatgnu/cupcake-mint-chocolate';
|
|
85
|
+
|
|
86
|
+
@Component({ ... })
|
|
87
|
+
export class MyComponent {
|
|
88
|
+
constructor(private notificationService: NotificationService) {
|
|
89
|
+
// Get all unread notifications
|
|
90
|
+
this.notificationService.getUnreadNotifications().subscribe(response => {
|
|
91
|
+
// ...
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
57
95
|
```
|
|
58
96
|
|
|
59
|
-
|
|
97
|
+
### Real-time Communication
|
|
98
|
+
|
|
99
|
+
This library also includes a WebSocket service (`CommunicationWebsocketService`) that provides real-time updates for new messages and notifications, ensuring that the user interface is always up-to-date without the need for polling.
|
|
100
|
+
|
|
101
|
+
## Models
|
|
102
|
+
|
|
103
|
+
The `cupcake-mint-chocolate` library provides a set of models for type-safe interaction with the messaging and notification APIs. Key models include:
|
|
60
104
|
|
|
61
|
-
|
|
105
|
+
- `MessageThread`
|
|
106
|
+
- `Message`
|
|
107
|
+
- `Notification`
|
|
108
|
+
- `ThreadParticipant`
|
|
62
109
|
|
|
63
|
-
|
|
110
|
+
This library is a crucial component for building interactive and engaging applications on the Cupcake platform.
|