File size: 2,634 Bytes
61d39e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Notification Endpoints

Endpoints for managing notifications.

## POST `/notif/mark-ack` (auth required)

### Description

The `/notif/mark-ack` endpoint marks the specified notification
as "acknowledged". This indicates that the user has chosen to either
dismiss or act on this notification.

### Parameters

| Name | Description | Default Value |
| ---- | ----------- | -------- |
| uid | UUID associated with the notification | **required** |

### Response

This endpoint responds with an empty object (`{}`).


## POST `/notif/mark-read` (auth required)

### Description

The `/notif/mark-read` endpoint marks that the specified notification
has been shown to the user. It will not "pop up" as a new notification
if they load the gui again.

### Parameters

| Name | Description | Default Value |
| ---- | ----------- | -------- |
| uid | UUID associated with the notification | **required** |

### Response

This endpoint responds with an empty object (`{}`).

### Request Example

```javascript

await fetch("https://api.puter.local/notif/mark-read", {

  headers: {

    "Content-Type": "application/json",

    "Authorization": `Bearer ${puter.authToken}`,

  },

  body: JSON.stringify({

    uid: 'a14ea3d5-828b-42f9-9613-35f43b0a3cb8',

  }),

  method: "POST",

});

```
## ENTITY STORAGE `puter-notifications`

The `puter-notifications` driver is an Entity Storage driver.
It is read-only.

### Request Examples

#### Select Unread Notifications

```javascript

await fetch("http://api.puter.localhost:4100/drivers/call", {

  "headers": {

    "Content-Type": "application/json",

    "Authorization": `Bearer ${puter.authToken}`,

  },

  "body": JSON.stringify({

    interface: 'puter-notifications',

    method: 'select',

    args: { predicate: ['unread'] }

  }),

  "method": "POST",

});

```

#### Select First 200 Notifications

```javascript

await fetch("http://api.puter.localhost:4100/drivers/call", {

  "headers": {

    "Content-Type": "application/json",

    "Authorization": `Bearer ${puter.authToken}`,

  },

  "body": JSON.stringify({

    interface: 'puter-notifications',

    method: 'select',

    args: {}

  }),

  "method": "POST",

});

```

#### Select Next 200 Notifications

```javascript

await fetch("http://api.puter.localhost:4100/drivers/call", {

  "headers": {

    "Content-Type": "application/json",

    "Authorization": `Bearer ${puter.authToken}`,

  },

  "body": JSON.stringify({

    interface: 'puter-notifications',

    method: 'select',

    args: { offset: 200 }

  }),

  "method": "POST",

});

```