Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 20, 2024

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