@polar-sh/astro
#2523
Closed
isaacharrisholt
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
After some discussion with @birkjernstrom, I've decided to create an Astro integration for Polar. I've written a little design doc (below). Please let me know your feedback!
The goal
A simple-to-use SDK (
@polar-sh/astro) for integrating Astro sites with Polar.Requirements
V1
V2
<Paywall>V3
API
I suggest using a builder pattern for the API that allows users to transform and filter articles based on the Astro frontmatter data and entry properties.
For example:
This could be achieved using a construct like a
PolarUploadBuilderclass, for example:Thus the types in the above example would look like so:
Where:
The way we avoid early execution of the upload is by making
PolarUploadBuilderextend thePromiseLike<PolarResult<...>>type, where the.then()method contains the upload logic.We can then use a similar pattern for downloading articles when we get to implementing V3 of the package.
I also recommend the
Polarclass has apublic client: PolarAPIproperty to allow users to interact with the API directly if so desired. By having@polar-sh/sdkas a peer dependency, we can ensure users can always have up-to-date API access without having to manually update this package.Discussion points
transformfunction is providedvisibility,publish_date,title, etcBeta Was this translation helpful? Give feedback.
All reactions