-
Notifications
You must be signed in to change notification settings - Fork 3
/
web-notifications.d.ts
254 lines (252 loc) · 7.44 KB
/
web-notifications.d.ts
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
import { A as ApiCallOptions } from './invoke-fetch-types-0Dw3a71T.js';
import './auth-types-PkN9CAF_.js';
/**
* An error object.
*/
type Error = {
/** The error code. */
code: string;
/** A human-readable explanation specific to this occurrence of the problem. */
message?: string;
/** The HTTP status code. */
status?: number;
/** Summary of the problem. */
title: string;
};
/**
* A representation of the errors encountered from the HTTP request.
*/
type Errors = {
errors?: Error[];
};
/**
* Notifications links
*/
type Links = {
next?: {
href?: string;
};
prev?: {
href?: string;
};
self?: {
href?: string;
};
};
/**
* Notifications meta data
*/
type Meta = {
/** The total number of unread notification. */
unreadCount?: number;
};
type Notification = {
readonly action?: string;
readonly body: string;
readonly createdAt: string;
readonly id: string;
meta: unknown;
read: boolean;
readonly resourceId?: string;
resourceType?: string;
readonly spaceId?: string;
spaceType?: string;
subResourceType?: string;
readonly tenantId?: string;
readonly updatedAt: string;
readonly userId: string;
};
/**
* A JSON Patch document as defined in http://tools.ietf.org/html/rfc6902.
*/
type NotificationPatch = {
/** The operation to be performed. */
op: "replace";
/** The path for the given resource field to patch. */
path: "/read";
/** The value to be used for this operation. */
value: string;
};
/**
* An array of JSON Patch documents
*/
type NotificationPatchSchema = NotificationPatch[];
type Notifications = {
data?: Notification[];
/** Notifications links */
links?: Links;
/** Notifications meta data */
meta?: Meta;
};
/**
* Retrieve notifications matching the query.
*
* @param query an object with query parameters
* @throws GetNotificationsHttpError
*/
declare const getNotifications: (query: {
/** The number of notification entries to retrieved. */
limit?: number;
/** Page number */
page?: number;
/** Read status of the notification */
read?: boolean;
/** Filter by resource types. If passing more than 1 resource type, use comma seperated string. */
resourceType?: string;
/** The field to sort by, with +/- prefix indicating sort order */
sort?: "+createdAt" | "-createdAt" | "+updatedAt" | "-updatedAt";
}, options?: ApiCallOptions) => Promise<GetNotificationsHttpResponse>;
type GetNotificationsHttpResponse = {
data: Notifications;
headers: Headers;
status: number;
prev?: (options?: ApiCallOptions) => Promise<GetNotificationsHttpResponse>;
next?: (options?: ApiCallOptions) => Promise<GetNotificationsHttpResponse>;
};
type GetNotificationsHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Delete all notifications.
*
* @throws DeleteNotificationsHttpError
*/
declare const deleteNotifications: (options?: ApiCallOptions) => Promise<DeleteNotificationsHttpResponse>;
type DeleteNotificationsHttpResponse = {
data: Meta;
headers: Headers;
status: number;
};
type DeleteNotificationsHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Patch all notifications.
*
* @param body an object with the body content
* @throws PatchNotificationsHttpError
*/
declare const patchNotifications: (body: NotificationPatchSchema, options?: ApiCallOptions) => Promise<PatchNotificationsHttpResponse>;
type PatchNotificationsHttpResponse = {
data: Meta;
headers: Headers;
status: number;
};
type PatchNotificationsHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Delete a notification.
*
* @param notificationId The id of the notification to delete.
* @throws DeleteNotificationHttpError
*/
declare const deleteNotification: (notificationId: string, options?: ApiCallOptions) => Promise<DeleteNotificationHttpResponse>;
type DeleteNotificationHttpResponse = {
data: Meta;
headers: Headers;
status: number;
};
type DeleteNotificationHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Retrieve a single notification by Id.
*
* @param notificationId The id of the notification to retrieve.
* @throws GetNotificationHttpError
*/
declare const getNotification: (notificationId: string, options?: ApiCallOptions) => Promise<GetNotificationHttpResponse>;
type GetNotificationHttpResponse = {
data: Notification;
headers: Headers;
status: number;
};
type GetNotificationHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Patch a notification.
*
* @param notificationId The id of the notification to update.
* @param body an object with the body content
* @throws PatchNotificationHttpError
*/
declare const patchNotification: (notificationId: string, body: NotificationPatchSchema, options?: ApiCallOptions) => Promise<PatchNotificationHttpResponse>;
type PatchNotificationHttpResponse = {
data: Meta;
headers: Headers;
status: number;
};
type PatchNotificationHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Clears the cache for web-notifications api requests.
*/
declare function clearCache(): void;
interface WebNotificationsAPI {
/**
* Retrieve notifications matching the query.
*
* @param query an object with query parameters
* @throws GetNotificationsHttpError
*/
getNotifications: typeof getNotifications;
/**
* Delete all notifications.
*
* @throws DeleteNotificationsHttpError
*/
deleteNotifications: typeof deleteNotifications;
/**
* Patch all notifications.
*
* @param body an object with the body content
* @throws PatchNotificationsHttpError
*/
patchNotifications: typeof patchNotifications;
/**
* Delete a notification.
*
* @param notificationId The id of the notification to delete.
* @throws DeleteNotificationHttpError
*/
deleteNotification: typeof deleteNotification;
/**
* Retrieve a single notification by Id.
*
* @param notificationId The id of the notification to retrieve.
* @throws GetNotificationHttpError
*/
getNotification: typeof getNotification;
/**
* Patch a notification.
*
* @param notificationId The id of the notification to update.
* @param body an object with the body content
* @throws PatchNotificationHttpError
*/
patchNotification: typeof patchNotification;
/**
* Clears the cache for web-notifications api requests.
*/
clearCache: typeof clearCache;
}
/**
* Functions for the web-notifications api
*/
declare const webNotificationsExport: WebNotificationsAPI;
export { type DeleteNotificationHttpError, type DeleteNotificationHttpResponse, type DeleteNotificationsHttpError, type DeleteNotificationsHttpResponse, type Error, type Errors, type GetNotificationHttpError, type GetNotificationHttpResponse, type GetNotificationsHttpError, type GetNotificationsHttpResponse, type Links, type Meta, type Notification, type NotificationPatch, type NotificationPatchSchema, type Notifications, type PatchNotificationHttpError, type PatchNotificationHttpResponse, type PatchNotificationsHttpError, type PatchNotificationsHttpResponse, type WebNotificationsAPI, clearCache, webNotificationsExport as default, deleteNotification, deleteNotifications, getNotification, getNotifications, patchNotification, patchNotifications };