bam-ticketing-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.45.0 • Public • Published

BAM Ticketing SDK

SDK library for B.A.M Ticketing API.

Installation

npm i bam-ticketing-sdk

Usage

Create the main service object:

import { BAM } from  'bam-ticketing-sdk';

// Production API by default

// For development, use new BAM('https://develop.bam.fan');
const bam =  new BAM();

// Set the appropriate organizer name
// NOTE: This is not needed for `bam.account` and `bam.auth` calls
await bam.useOrganizer('org1');

// List all events with ticket configurations and occurrences
const events =  await bam.event
.listEvents({
	with: {
		ticket_config:  true,
		occurrence:  true
	}
});

// Get single event with all details (occurrences, timeslot, ticket configurations, discounts, ...)
const singleEvent =  await bam.event.getEvent({ id:  1234 })

// Create an order with 3 tickets
await bam.order.createOrder({
	format:  'PDF',
	orderItem: [{
		quantity:  3,
		ticketConfigId:  12345
	}]
});

Authentication

BAM Ticketing API uses JWT based authentication and authorization. The account/v1/auth/login is used for users (or services) with credentials, i.e. username and password.

BAM SDK uses a global method for any type of authentication with authorize. After calling this method, the internal HTTP client updates the authorization headers and successive calls will use the resolved JWT from BAM's API.

import { BAM } from  'bam-ticketing-sdk';
const bam = new BAM();

// Authorize with username and password
// Permissions are based on the account and are loaded into the instance
await bam.authorize({ username: 'admin', password: 'S3cret123' });

// Log in as guest user with a short-living guest JWT
await bam.authorize();

Reference

The BAM instance contains all properties and methods for authorization, users, events, orders and tickets.

Constructor

Create a new BAM instance.

BAM(url: 'http://api.bam.fan', version: 'v1')

Properties

Property Description
account User, organizer and account management
auth Authorization endpoints
blockchain Wallet signing operations
event Event management
identyme Identyme integration operations
order Order, order contact and ticket management
payment Payment providers operations
venue Venue information and search

License

ISC

Package Sidebar

Install

npm i bam-ticketing-sdk

Weekly Downloads

32

Version

0.45.0

License

ISC

Unpacked Size

535 kB

Total Files

312

Last publish

Collaborators

  • killenx
  • branimir.malesevic
  • wkoller.bam