The PretixApiClient is a TypeScript class that simplifies interaction with the Pretix API. It provides methods for CRUD operations on various resources such as events, items, orders, vouchers, and more.
npm install pretix-api-clientimport PretixApiClient from 'pretix-api-client';
const client = new PretixApiClient('https://your-pretix-instance/api', 'your-api-token');
// Example: Fetching events
const events = await client.getEvents('organizer-slug');
console.log(events);Fetches a list of events for the specified organizer.
Fetches a specific event for the specified organizer.
Creates a new event for the specified organizer.
Updates an existing event for the specified organizer.
Deletes an event for the specified organizer.
Fetches a list of items for the specified event.
Fetches a specific item for the specified event.
Creates a new item for the specified event.
Updates an existing item for the specified event.
Deletes an item for the specified event.
getItemVariations(organizerSlug: string, eventSlug: string, itemId: number): Promise<ItemVariation[]>
Fetches a list of item variations for the specified item.
getItemVariation(organizerSlug: string, eventSlug: string, itemId: number, variationId: number): Promise<ItemVariation>
Fetches a specific item variation for the specified item.
createItemVariation(organizerSlug: string, eventSlug: string, itemId: number, variationData: ItemVariation): Promise<ItemVariation>
Creates a new item variation for the specified item.
updateItemVariation(organizerSlug: string, eventSlug: string, itemId: number, variationId: number, variationData: ItemVariation): Promise<ItemVariation>
Updates an existing item variation for the specified item.
deleteItemVariation(organizerSlug: string, eventSlug: string, itemId: number, variationId: number): Promise<void>
Deletes an item variation for the specified item.
Fetches a list of orders for the specified event.
Fetches a specific order for the specified event.
Creates a new order for the specified event.
updateOrder(organizerSlug: string, eventSlug: string, orderCode: string, orderData: Order): Promise<Order>
Updates an existing order for the specified event.
Deletes an order for the specified event.
Fetches a list of vouchers for the specified event.
Fetches a specific voucher for the specified event.
Creates a new voucher for the specified event.
updateVoucher(organizerSlug: string, eventSlug: string, voucherCode: string, voucherData: Voucher): Promise<Voucher>
Updates an existing voucher for the specified event.
Deletes a voucher for the specified event.
Fetches a list of discounts for the specified event.
Fetches a specific discount for the specified event.
Creates a new discount for the specified event.
updateDiscount(organizerSlug: string, eventSlug: string, discountCode: string, discountData: Discount): Promise<Discount>
Updates an existing discount for the specified event.
Deletes a discount for the specified event.
... (The rest of the content follows the same structure as above for other sections like Seating Plans, Check-In Lists, Media, Teams, Data Exports, Scheduled Exports, Shredders, Bank Transfers, PDF Exports, and Badges.)