jdalrymple / gitbeaker

🦊🧪 A comprehensive and typed Gitlab SDK for Node.js, Browsers, Deno and CLI
Other
1.57k stars 299 forks source link

Cache a request response #3634

Open dicolasi opened 1 month ago

dicolasi commented 1 month ago

Description Hi all, I cannot find anything in documention that suggests how to create a custom requesterFn. In can see that the method signature it expects is (resourceOptions: ResourceOptions) => RequesterType but I cannot even import those types. What I am trying to achieve it to simply use a cache library (like https://www.npmjs.com/package/flat-cache) to check if the data has been already asked, and return it if cache hit... or ask for the data in case of cache miss. If anyone can help would be great (if you have an example I could use even better :) )

I would like to create a custom requesterFn that cache the response.

Checklist

ahedadja commented 1 month ago

@jdalrymple I would also like to know how to implement a custom requester function. I tried to look through the docs for one because I noticed it was required but didn't find anything. Do you mind posting or linking an example of how this would be done please?