Create a new configuration object:
// Assumes the config items are in the environment (via dotenv etc.)
$config = new \philwc\Configuration(getenv('SUBSONIC_URL'), getenv('SUBSONIC_USER'), getenv('SUBSONIC_PASSWORD'))
Either set the config into the ClientFactory:
\philwc\ClientFactory::setConfiguration($config);
Or pass into each ClientFactory::get()
call:
$createPlaylist = \philwc\ClientFactory::get(\philwc\Call\Playlist\CreatePlaylist::class, $config);
To make the call, invoke the class:
$createPlaylist(['name' => 'Test Playlist', 'songId' => 1]);
Each call class can receive different parameters and will return a different result.
Use getAvailableFields()
, getRequiredFields()
, getResponseClass()
as appropriate.
Currently, the following calls are implemented:
- CreatePlaylist
- DeletePlaylist
- GetPlaylist
- GetPlaylists
- UpdatePlaylist
- Search2
- GetLicense
- Ping