Repository navigation
feat: template image variants, per-pass images and changeMessage - #8
Merged
Merged
Conversation
Templates can now hold named variants of the strip, thumbnail and
background images, and passes can opt into one. Lets a stamp card swap
its strip per stamp count without a template per state.
- templates.uploadImage(id, slot, data, { variant }) PUTs base64 image
data; encoding uses btoa rather than Buffer so it works on Workers.
- templates.deleteImage(id, slot, { variant }) removes an image/variant.
- passes.create/update accept imageVariant (null on update clears it).
- Pass.image_variant, Template.image_variants, and exported
TemplateImage / TemplateImageSlot / VariantImageSlot /
TemplateImageOptions types.
The platform already accepts it and spreads it into pass.json; it's the only thing that makes Apple show a lock-screen notification when a field changes on update. Must contain %@ (replaced with the new value).
A pass can now carry its own strip, thumbnail or background image (e.g. a member photo), layered over its template variant and base image. - passes.uploadImage(id, slot, data) PUTs base64 image data (reusing the runtime-agnostic encoder) and passes.deleteImage(id, slot) removes the override; both return the updated Pass and send no Idempotency-Key. - Pass.images reports each resolved slot's source (pass/variant/template); EventPass gains image_variant. - Export PassImageSlot (alias of VariantImageSlot), PassImageSource and PassImages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SDK support for the new pass image APIs:
templates.uploadImage/deleteImage(optionalvariantfor strip/thumbnail/background),Template.image_variantsimageVariantonpasses.create/passes.update(nullclears),Pass.image_variantpasses.uploadImage/deleteImagefor per-pass images,Pass.images(resolved source per slot)TemplateField.changeMessage(the lock-screen notification text)EventPass.image_variantBase64 encoding avoids
Buffer, so it works on Workers. README has stamp-card and member-photo examples. Minor changeset (→ 0.4.0).Depends on the matching platform endpoints being deployed.