-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmailing-list.interface.ts
More file actions
306 lines (295 loc) · 9.73 KB
/
mailing-list.interface.ts
File metadata and controls
306 lines (295 loc) · 9.73 KB
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
// Copyright The Linux Foundation and each contributor to LFX.
// SPDX-License-Identifier: MIT
import {
GroupsIOServiceStatus,
GroupsIOServiceType,
MailingListAudienceAccess,
MailingListMemberDeliveryMode,
MailingListMemberModStatus,
MailingListMemberType,
MailingListType,
} from '../enums/mailing-list.enum';
import { CommitteeReference } from './committee.interface';
import { UserInfo } from './project.interface';
/**
* Linked group reference for mailing lists
* @description Represents a committee/group linked to a mailing list
*/
export interface LinkedGroup {
/** Unique identifier for the group */
uid: string;
/** Display name of the group */
name: string;
/** Optional URL to the group page */
url?: string;
}
/**
* Groups.io service entity
* @description Represents a Groups.io service that mailing lists are associated with
*/
export interface GroupsIOService {
/** Unique service identifier */
uid: string;
/** Service type (primary, formation, shared) */
type: GroupsIOServiceType;
/** Domain for the service */
domain: string;
/** Groups.io group ID */
group_id: number;
/** Service status */
status: GroupsIOServiceStatus;
/** Global owners email addresses */
global_owners: string[];
/** Prefix for mailing lists */
prefix: string;
/** Associated project slug */
project_slug: string;
/** Associated project UID */
project_uid: string;
/** Groups.io URL */
url: string;
/** Groups.io group name */
group_name: string;
/** Whether the service is public */
public: boolean;
/** Associated project name */
project_name: string;
/** Parent primary service UID (for shared type services) */
parent_service_uid?: string;
/** Manager users who can edit/modify this resource */
writers?: UserInfo[];
/** Auditor users who can audit this resource */
auditors?: UserInfo[];
/** Whether the current user has write access (response-only, set by access check) */
writer?: boolean;
/** Creation timestamp */
created_at: string;
/** Last update timestamp */
updated_at: string;
}
/**
* Groups.io mailing list entity
* @description Full mailing list data for dashboard display
*/
export interface GroupsIOMailingList {
/** Unique mailing list identifier */
uid: string;
/** Groups.io group name (3-34 chars) */
group_name: string;
/** Whether the mailing list is publicly accessible */
public: boolean;
/** Origin: api, webhook, or mock */
source: string;
/** Mailing list type (announcement, discussion_moderated, discussion_open) */
type: MailingListType;
/** Controls who can discover and join this mailing list (public, approval_required, invite_only) */
audience_access: MailingListAudienceAccess;
/** Description of the mailing list purpose (11-500 chars) */
description: string;
/** Display title for the mailing list (5-100 chars) */
title: string;
/** Email subject prefix (optional) */
subject_tag?: string;
/** Parent service UID */
service_uid: string;
/** Associated project UID (inherited from parent service) */
project_uid: string;
/** Associated project name (inherited from parent service) */
project_name: string;
/** Associated project slug (inherited from parent service) */
project_slug: string;
/** Whether the project is a foundation (top-level entity) */
is_foundation?: boolean;
/** Parent project UID (for subprojects under a foundation) */
parent_project_uid?: string;
/** Audit timestamp (nullable) */
last_reviewed_at?: string | null;
/** Auditor user ID (nullable) */
last_reviewed_by?: string | null;
/** Manager users who can edit/modify this resource */
writers?: UserInfo[];
/** Auditor users who can audit this resource */
auditors?: UserInfo[];
/** Creation timestamp */
created_at: string;
/** Last update timestamp */
updated_at: string;
/** Linked committees with names and allowed voting statuses */
committees?: CommitteeReference[];
/** Parent service details (enriched from service lookup) */
service?: GroupsIOService;
/** Groups.io subgroup ID (nullable for legacy lists) */
group_id?: number | null;
/** Number of subscribers (read-only, maintained by service) */
subscriber_count: number;
/** Whether the current user has write access (response-only, set by access check) */
writer?: boolean;
}
/**
* Mailing list with current user's membership details
* @description Extended mailing list data including the user's subscription info for "me" lens views
*/
export interface MyMailingList extends GroupsIOMailingList {
/** User's delivery mode in this mailing list (e.g., "Normal", "Digest", "None") */
my_delivery_mode: MailingListMemberDeliveryMode;
/** User's moderation status in this mailing list (e.g., "none", "moderator", "owner") */
my_mod_status: MailingListMemberModStatus;
/** User's member UID in this mailing list */
my_member_uid?: string;
}
/**
* Request payload for creating a new mailing list
* @description Maps to Groups.io API create endpoint
*/
export interface CreateMailingListRequest {
/** Groups.io group name (3-34 chars) */
group_name: string;
/** Whether the mailing list is publicly accessible */
public: boolean;
/** Mailing list type */
type: MailingListType;
/** Controls who can discover and join this mailing list */
audience_access: MailingListAudienceAccess;
/** Description of the mailing list (11-500 chars) */
description: string;
/** Display title for the mailing list (5-100 chars) */
title?: string;
/** Parent service UID (required) */
service_uid: string;
/** Committee UID to associate (upstream accepts singular committee_uid) */
committee_uid?: string | null;
/** Linked committees with allowed voting statuses */
committees?: CommitteeReference[];
/** Email subject prefix (optional) */
subject_tag?: string;
/** Manager users who can edit/modify this resource */
writers?: UserInfo[];
/** Auditor users who can audit this resource */
auditors?: UserInfo[];
}
/**
* Request payload for creating a Groups.io service
* @description Used when creating a new Groups.io service
*/
export interface CreateGroupsIOServiceRequest {
/** Service type */
type: GroupsIOServiceType;
/** Domain for the service */
domain?: string;
/** Prefix for mailing lists (optional) */
prefix?: string;
/** Associated project UID */
project_uid: string;
/** Groups.io group name */
group_name?: string;
/** Whether the service is publicly accessible */
public?: boolean;
/** Manager users who can edit/modify this resource */
writers?: UserInfo[];
/** Auditor users who can audit this resource */
auditors?: UserInfo[];
}
/**
* Request payload for updating a Groups.io service
* @description Used when updating an existing Groups.io service
*/
export interface UpdateGroupsIOServiceRequest {
/** Domain for the service (optional) */
domain?: string;
/** Prefix for mailing lists (optional) */
prefix?: string;
/** Whether the service is publicly accessible (optional) */
public?: boolean;
/** Service status (optional) */
status?: string;
/** Manager users who can edit/modify this resource */
writers?: UserInfo[];
/** Auditor users who can audit this resource */
auditors?: UserInfo[];
}
/**
* Mailing list member entity (Groups.io member)
* @description Represents a member of a mailing list
*/
export interface MailingListMember {
/** Unique member identifier */
uid: string;
/** Parent mailing list UID */
mailing_list_uid: string;
/** Groups.io member ID */
member_id?: number;
/** Groups.io group ID for this membership */
group_id?: number;
/** Member's username/handle */
username?: string;
/** Member's first name */
first_name?: string;
/** Member's last name */
last_name?: string;
/** Member's email address */
email: string;
/** Member's organization */
organization?: string;
/** Member's job title */
job_title?: string;
/** How member was added (committee or direct) */
member_type: MailingListMemberType;
/** Email delivery mode (normal, digest, none) */
delivery_mode: MailingListMemberDeliveryMode;
/** Moderation status (none, moderator, owner) */
mod_status: MailingListMemberModStatus;
/** Member active status */
status: string;
/** Last review timestamp */
last_reviewed_at?: string | null;
/** User who last reviewed */
last_reviewed_by?: string | null;
/** Creation timestamp */
created_at: string;
/** Last update timestamp */
updated_at: string;
}
/**
* Request payload for creating a mailing list member
* @description Input payload for adding members to mailing lists
*/
export interface CreateMailingListMemberRequest {
/** Member's email address (required) */
email: string;
/** Member's username/handle */
username?: string | null;
/** Member's first name */
first_name?: string | null;
/** Member's last name */
last_name?: string | null;
/** Member's organization */
organization?: string | null;
/** Member's job title */
job_title?: string | null;
/** How member was added */
member_type?: MailingListMemberType;
/** Email delivery mode */
delivery_mode?: MailingListMemberDeliveryMode;
/** Moderation status */
mod_status?: MailingListMemberModStatus;
}
/**
* Request payload for updating a mailing list member
* @description Partial update for existing members (email is immutable)
*/
export interface UpdateMailingListMemberRequest {
/** Member's username/handle */
username?: string | null;
/** Member's first name */
first_name?: string | null;
/** Member's last name */
last_name?: string | null;
/** Member's organization */
organization?: string | null;
/** Member's job title */
job_title?: string | null;
/** Email delivery mode */
delivery_mode?: MailingListMemberDeliveryMode;
/** Moderation status */
mod_status?: MailingListMemberModStatus;
}