File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
packages/stream_feeds/lib/src Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 22
33import 'package:stream_feeds/stream_feeds.dart' ;
44
5+ late StreamFeedsClient client;
56late Feed feed;
67late Activity activity;
78late StreamAttachmentUploader attachmentUploader;
@@ -79,6 +80,14 @@ Future<void> howToUploadAFileOrImageStep4() async {
7980 );
8081}
8182
83+ Future <void > howToDeleteAFileOrImage () async {
84+ // Delete an image from the CDN
85+ await client.deleteImage (url: 'https://mycdn.com/image.png' );
86+
87+ // Delete a file from the CDN
88+ await client.deleteFile (url: 'https://mycdn.com/file.pdf' );
89+ }
90+
8291// Your custom implementation of CdnClient
8392class CustomCDN implements CdnClient {
8493 @override
Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ class StreamFeedsClientImpl implements StreamFeedsClient {
294294 @override
295295 Activity activity ({
296296 required String activityId,
297- required FeedId fid,
297+ required FeedId fid,
298298 ActivityData ? initialData,
299299 }) {
300300 return Activity (
@@ -442,8 +442,12 @@ class StreamFeedsClientImpl implements StreamFeedsClient {
442442 }
443443
444444 @override
445- Future <Result <void >> deleteFile (String url) => _cdnClient.deleteFile (url);
445+ Future <Result <void >> deleteFile ({required String url}) {
446+ return _cdnClient.deleteFile (url);
447+ }
446448
447449 @override
448- Future <Result <void >> deleteImage (String url) => _cdnClient.deleteImage (url);
450+ Future <Result <void >> deleteImage ({required String url}) {
451+ return _cdnClient.deleteImage (url);
452+ }
449453}
Original file line number Diff line number Diff line change @@ -667,7 +667,7 @@ abstract interface class StreamFeedsClient {
667667 /// ```
668668 ///
669669 /// Returns a [Result] indicating success or failure of the deletion operation.
670- Future <Result <void >> deleteFile (String url);
670+ Future <Result <void >> deleteFile ({ required String url} );
671671
672672 /// Deletes a previously uploaded image from the CDN.
673673 ///
@@ -689,7 +689,7 @@ abstract interface class StreamFeedsClient {
689689 /// ```
690690 ///
691691 /// Returns a [Result] indicating success or failure of the deletion operation.
692- Future <Result <void >> deleteImage (String url);
692+ Future <Result <void >> deleteImage ({ required String url} );
693693
694694 /// The moderation client for managing moderation-related operations.
695695 ///
You can’t perform that action at this time.
0 commit comments