eleventy-fetch icon indicating copy to clipboard operation
eleventy-fetch copied to clipboard

Pass in a custom fetching function rather than a URL

Open AleksandrHovhannisyan opened this issue 2 years ago • 1 comments

Howdy! I think it would be really nice if I could pass in a function that fetches my data from the target URL, rather than passing in the URL directly. For my use case specifically, I want to pull in data from the GitHub API at build time using their Octokit helper library. It's definitely possible to make requests by hand by assembling a request URL, but it's not as ergonomic (plus, Octokit allows you to aggregate paginated calls without needing to do this yourself). Is this something this plugin could accommodate? Maybe it would just need to accept a user-supplied key for caching since it's no longer getting a URL directly.

AleksandrHovhannisyan avatar Apr 27 '22 11:04 AleksandrHovhannisyan

I think implementing this would provide a solution to https://github.com/11ty/eleventy-fetch/issues/2.

carbontwelve avatar Sep 06 '22 08:09 carbontwelve