Skip to content

Commit

Permalink
feat: add support for optional recipients and update announcement fet…
Browse files Browse the repository at this point in the history
…ching
  • Loading branch information
Siolto committed Feb 4, 2025
1 parent 2adf4d8 commit a08472f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ class AnnouncementsEndpoint extends Endpoint {
transformer: (e) => (e as List).map(AnnouncementOverview.fromJson).toList(),
);

Future<ApiResponse<AnnouncementOverview>> getAnnouncement(String announcementId) => get(
'/api/v1/Announcements/$announcementId',
transformer: AnnouncementOverview.fromJson,
);

Future<ApiResponse<CreateAnnouncement>> createAnnouncement({
required String? expiresAt,
required String severity,
required List<AnnouncementText> announcementTexts,
String? expiresAt,
List<String>? recipients,
}) =>
post(
'/api/v1/Announcements',
data: {'expiresAt': expiresAt, 'severity': severity, 'texts': announcementTexts},
data: {'expiresAt': expiresAt, 'severity': severity, 'texts': announcementTexts, 'recipients': recipients},
transformer: CreateAnnouncement.fromJson,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class CreateAnnouncement {
final DateTime? expiresAt;
final String severity;
final List<AnnouncementText> texts;
final List<String> recipients;
final List<String>? recipients;

CreateAnnouncement({
required this.severity,
required this.texts,
required this.recipients,
this.recipients,
this.expiresAt,
});

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a08472f

Please sign in to comment.