Skip to content

Finn-Ashby/fixr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Go Report Card codecov

FIXR

A wrapper around FIXR's private ticket API

Installation

  1. go get github.com/pkg/errors
  2. go get github.com/ewancook/fixr
  3. Done!

Example Code:

package main

import (
	"fmt"

	"github.com/ewancook/fixr"
)

func main() {
	// Update FIXR version
	if err := fixr.UpdateVersion(); err != nil {
		fmt.Printf("FIXR version not updated (%s)\n", fixr.FixrVersion)
	} else {
		fmt.Printf("FIXR version updated (%s)\n", fixr.FixrVersion)
	}
	// Create client and logon
	c := fixr.NewClient("username")
	if err := c.Logon("password"); err != nil {
		fmt.Printf("logon failed (%v)\n", err)
	}
	// Fetch event information
	e, err := c.Event(141151926)
	if err != nil {
		fmt.Printf("failed getting event (%v)\n", err)
		return
	}
	// Determine ticket information
	for _, t := range e.Tickets {
		fmt.Printf("[%d] %s (£%.2f; Max: %d)\n", t.ID, t.Name, t.Price+t.BookingFee, t.Max)
	}
	// Book a ticket
	b, err := c.Book(&e.Tickets[0], 1, nil)
	if err != nil {
		fmt.Printf("purchase failed (%v)\n", err)
		return
	}
	fmt.Printf("booked: %s (PDF: %s)\n", b.Event, b.PDF)
}

About

A wrapper around FIXR's API (https://fixr.co)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%