Closed shawnchapiewski closed 1 year ago
Hey there @shawnchapiewski, thank you for using passkit-generator
!
Exactly, you are right. As you can see from the migration guide from v1 to v2, there was a load
method that got removed.
I wanted to remove the need for people to possibly have a third library to download as node_module
to make http requests and make instead passkit-generator to be the last "piece of puzzle" of the whole flow.
Sorry but I've not the intention to add it again. You should fetch the "branding" data before generating the pass and add the file through addBuffer
method.
Let me know!
I appreciate the super quick response @alexandercerutti! I was able to get this working and wanted to share my solution in case others run into a similar issue while working with this package.
let getIcon = await axios.get(iconURL, {responseType: "arraybuffer"});
let bufferIcon = Buffer.from(getIcon.data, "utf-8");
pass.addBuffer("icon.png", bufferIcon);
Closing the ticket as my issue is now solved, thanks!
Running OS
macOS v12.6 ()
Running Node Version
v12.19.0
Description
Hi, I really appreciate the effort you put into creating this package and also the responsiveness I've seen on the issues created. I have been able to create passes with dynamic content besides the pass assets:
I would like a way to pull in image data from a remote source (www.example.com/icon.png) since my application deals with multiple different organizations who would like to personalize their passes and I could run some logic in the backend to show pass assets depending on the organization. I wanted to reference a feature request that was brought up at one point: #3 that had a fix to this issue back in version 1.4.0, but the function pass.load() seems to have been removed at least in the latest version of this package (not sure which version originally removed this functionality).
If there is documentation or examples that I may have missed that goes over this, apologies in advanced - if you could point me in the right direction, that would be great!
Current Code:
Currently receiving an error:
TypeError: pass.load is not a function
Expected behavior
loadRemoteFile() function that takes an image url as a parameter and generates/updates pass image assets like the icon.png, logo.png or strip.png files in pkpass file.
Steps to reproduce