Skip to content

steffen25/go-firmafon

Repository files navigation

go-firmafon

Go library for accessing the Firmafon API.

Build Status Test suite Status Go Report Card codecov

Installation

go get github.com/steffen25/go-firmafon

Usage

import "github.com/steffen25/go-firmafon"

Construct a new Firmafon client using an access token which you can generate here Generate Token

client := firmafon.NewClient("token")

List all employees

client := firmafon.NewClient("token")

// list all employees for your organization
users, _, err := client.Employees.All()
if err != nil {
	// Handle error
}

// print each employee's name
for _, u := range users {
	fmt.Println(u.Name)
}

Phone calls

Get a list of calls to or from one or more numbers.

Get all

client := firmafon.NewClient("token")

// List all calls to and from all numbers
calls, _, err := client.Calls.GetAll()
if err != nil {
	// Handle error
}

// print each call's UUID
for _, c := range calls {
	fmt.Println(c.CallUUID)
}

Get a single call by UUID

client := firmafon.NewClient("token")

// List all calls to and from all numbers
call, _, err := client.Calls.Get("UUID_HERE")
if err != nil {
	// Handle error
}

// print call UUID
fmt.Println(call.CallUUID)