Skip to content

Add DownloadableFileBlock interface for Pdf, File, and Image blocks#184

Merged
jomei merged 1 commit intojomei:mainfrom
aydinomer00:feature/downloadable-interface
Dec 20, 2024
Merged

Add DownloadableFileBlock interface for Pdf, File, and Image blocks#184
jomei merged 1 commit intojomei:mainfrom
aydinomer00:feature/downloadable-interface

Conversation

@aydinomer00
Copy link
Contributor

Fixes #164

This PR adds a new DownloadableFileBlock interface to unify common functionality between Pdf, FileBlock, and Image blocks.

Changes:

  • Added new DownloadableFileBlock interface
  • Implemented interface for PdfBlock, FileBlock, and ImageBlock
  • Added comprehensive test coverage including external URLs
  • All existing tests pass

The interface provides:

  • GetURL() string - returns the URL of the file
  • GetExpiryTime() *time.Time - returns the expiry time of the file

This reduces switch-case statements in client code by providing a common interface for these similar block types.

This change:
- Adds new interface to unify common functionality
- Implements interface for PdfBlock, FileBlock, and ImageBlock
- Adds comprehensive test coverage
Copy link
Owner

@jomei jomei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! thanks a lot!

@jomei jomei merged commit f2cb9bd into jomei:main Dec 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interface to unify Pdf, FileBlock, Image

2 participants