PassTemplatesService
Manage pass template designs and configurations.
Methods
| Method | Description |
|---|---|
list(options?) | List all templates |
get(id) | Get a single template |
create(data) | Create a new template |
update(id, data) | Update a template |
delete(id) | Delete a template |
uploadImages(id, images) | Upload template images |
uploadIcon(id, file) | Upload icon image |
uploadLogo(id, file) | Upload logo image |
uploadCoverImage(id, file) | Upload cover/strip image |
setIOSDeeplink(id, config) | Configure iOS deeplink |
list()
List all pass templates with optional filtering.
typescript
const templates = await client.passTemplates.list({
filter: {
workspace_id: { _eq: 'workspace-uuid' }
},
sort: ['-date_created'],
limit: 50
});get()
Get a single pass template by ID.
typescript
const template = await client.passTemplates.get('template-uuid');
console.log(template.name);create()
Create a new pass template.
typescript
const template = await client.passTemplates.create({
name: 'Gold Member Card',
workspace_id: 'workspace-uuid',
project_id: 'project-uuid',
apple_pass_type_identifier: 'pass.com.example.loyalty',
background_color: '#1a1a2e',
label_color: '#ffffff',
value_color: '#ffd700',
barcode_type: 'qr',
top_field_label: 'POINTS',
top_field_value: '{{points}}',
front_fields: [
{ label: 'Member', value: '{{full_name}}' },
{ label: 'Tier', value: '{{tier}}' }
]
});update()
Update an existing pass template.
typescript
const updated = await client.passTemplates.update('template-uuid', {
background_color: '#2d2d44',
front_fields: [
{ label: 'Name', value: '{{full_name}}' },
{ label: 'Points', value: '{{points}}' },
{ label: 'Status', value: '{{tier}}' }
]
});delete()
Delete a pass template.
typescript
await client.passTemplates.delete('template-uuid');WARNING
Deleting a template does not delete associated passes, but they will no longer update.
uploadImages()
Upload multiple images at once.
typescript
import fs from 'fs';
const iconBuffer = fs.readFileSync('./icon.png');
const logoBuffer = fs.readFileSync('./logo.png');
await client.passTemplates.uploadImages('template-uuid', {
icon: new Blob([iconBuffer], { type: 'image/png' }),
logo: new Blob([logoBuffer], { type: 'image/png' })
});uploadIcon() / uploadLogo() / uploadCoverImage()
Upload individual images.
typescript
await client.passTemplates.uploadIcon('template-uuid', iconFile);
await client.passTemplates.uploadLogo('template-uuid', logoFile);
await client.passTemplates.uploadCoverImage('template-uuid', coverFile);setIOSDeeplink()
Configure iOS deeplink for the pass.
typescript
await client.passTemplates.setIOSDeeplink('template-uuid', {
ios_deeplink_id: 123456789,
ios_deeplink_url: 'https://apps.apple.com/app/id123456789'
});Types
typescript
interface PassTemplate {
id: string;
uuid: string;
name: string;
description?: string;
apple_pass_type_identifier: string;
workspace_id: string;
project_id: string;
background_color?: string;
label_color?: string;
value_color?: string;
logo_text?: string;
icon?: string;
logo?: string;
cover_image?: string;
barcode_type?: 'none' | 'qr' | 'aztec' | 'code128' | 'pdf417';
barcode_id?: string;
barcode_label?: string;
top_field_label?: string;
top_field_value?: string;
front_fields?: PassField[];
secondary_fields?: PassField[];
back_fields?: PassField[];
locations?: Location[];
location_message?: string;
ios_deeplink_id?: number;
ios_deeplink_url?: string;
tier_id?: string;
tier_label?: string;
statistics?: PassTemplateStatistics;
}
interface PassField {
label: string;
value: string;
}