Skip to content

brueggern/crestron-fusion-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crestron Fusion Handler

The Crestron Fusion Handler is able to fetch all rooms or appointments using the Crestron Fusion REST API.

Create Handler

First you need to create a new handler object and set the auth params if enabled on your API.

$handler = new CrestronFusionHandler('https://123.45.67.89/fusion/apiservice');
$handler->setAuth('some-token', 'some-user');

Fetch Rooms

Fetch all rooms.

$roomsCollection = $handler->getRooms();

Fetch Appointments

Fetch appointments of specific rooms.

$rooms = new CFCollection();
$rooms->addItem(new CFRoom(['id' => '41746b03-1803-4d65-84eb-06815688c780']));
$appointmentsCollection = $handler->getAppointments(new DateTime(), $rooms);

Collections

Instead of arrays, a collection object is always returned. For more information, see src/CFCollection.php

$collection = new CFCollection();
$collection->addItem('Room One', 'room1');
$collection->addItem('Room Two, 'room2');

$name = $collection->getItem('room1');
// $name => Room One

$collection->deleteItem('room2');
// or
$collection->deleteItem(1);

$array = $collection->get();
// Returns an array

$mergedCollection = $collection1->append($collection2)//
// Append all items of a collection to another collection

Development / Tests / Linting

composer install
cp tests/.env.testing.example tests/.env.testing

composer run test:online
composer run test:offline
composer run lint

Notes

In future versions it should also be possible to update entities such as rooms, appointments, etc.

About

Fetch data from the Crestron Fusion API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages