Migrating from jonathanraftery/bullhorn-rest-client

Both packages can be installed side by side, so you can move one call at a time. They keep their sessions apart, so for a while Bullhorn sees two logins instead of one.

The client

jonathanraftery darvis/bullhorn-api
new Client([...options]) with a credentials provider and a data store app(Client::class) in Laravel; new Client(new Config(...), store: new FileTokenStore(...)) elsewhere
LocalFileDataStore, written relative to the working directory the Laravel cache, encrypted; or FileTokenStore with an absolute path outside the web root
The constructor calls loginInfo Nothing is called before the first request
initiateSession(), refreshSession(), refreshOrInitiateSession() Not needed: the client logs in and renews by itself
sessionIsValid() ping() when you need to know; usually not needed

Requests

jonathanraftery darvis/bullhorn-api
rawRequest('GET', 'entity/Candidate/1?fields=id') get('entity/Candidate/1', ['fields' => 'id']) or entity('Candidate', 1, 'id')
rawRequest('PUT', 'entity/Candidate', ['body' => json_encode($data)]) createEntity('Candidate', $data)
rawRequest('POST', 'entity/Candidate/1', ['body' => json_encode($data)]) updateEntity('Candidate', 1, $data)
rawRequest('GET', 'search/Candidate', ['query' => [...]]) search('Candidate', $lucene, $fields, $query)
rawRequest('POST', $path, ['multipart' => [['name' => 'file', 'contents' => fopen($file, 'r')]]]) upload('POST', $path, basename($file), file_get_contents($file), $mime)
createEntity($type, $props), deleteEntity($type, $id) the same names
fetchEntities($type, $ids, $params) entity($type, $ids, $fields, $query)
searchEntities($type, $query, $params) search($type, $query, $fields, $params)

rawRequest() returned a PSR-7 response that you decoded yourself. The new methods return the decoded array. When you decoded with json_decode($response->getBody()) into objects, read the array keys instead.

Errors

jonathanraftery darvis/bullhorn-api
A Guzzle ClientException, its message cut off at 120 characters BullhornException with the whole response in the message, errorKey() and invalidFields()
BullhornAuthException and its subclasses AuthenticationException

Config

Rename the variables to the ones on Installation: BULLHORN_CLIENT_ID, BULLHORN_CLIENT_SECRET, BULLHORN_USERNAME, BULLHORN_PASSWORD. Remove a custom credentials provider and data store, and delete the old bullhorn-auth-store.json files: they hold a session token and a refresh token, and one may sit in public/.

Tests

The old client called Bullhorn from its constructor and drove Guzzle directly, so it could only be mocked. The new one works with Http::fake(); see Testing.