%PDF-
%PDF-
Mini Shell
Mini Shell
<?php
namespace OntraportAPI;
/**
* Class BaseApi
*
* @author ONTRAPORT
*
* @package OntraportAPI
*/
abstract class BaseApi
{
/**
* @var Ontraport instance
*/
protected $client;
/**
* @var string endpoint for all objects retrieve meta functions
*/
const META = "meta";
/**
* @var string endpoint for all objects saveorupdate functions
*/
const SAVE_OR_UPDATE = "saveorupdate";
/**
* @var string endpoint for all objects getInfo functions
*/
const GET_INFO = "getInfo";
/**
* @var string constant for Content-Type header value type JSON-encoded
*/
const CONTENT_TYPE_JSON = "json";
/**
* @var string constant for Content-Type header value type form-encoded
*/
const CONTENT_TYPE_FORM = "form";
/**
* @var string endpoint for object
*/
protected $_endpoint = NULL;
/**
* @var string plural endpoint for object
*/
protected $_endpointPlural = NULL;
/**
* @param Ontraport $client
*/
public function __construct(Ontraport $client)
{
$this->client = $client;
}
/**
* @brief Retrieve a single specified object
*
* @param mixed[] $requestParams The parameters to submit with GET request.
* Varies by object.
*
* @return string JSON formatted HTTP response or error message
*/
protected function _retrieveSingle($requestParams)
{
$requiredParams = array("id");
return $this->client->request($requestParams, $this->_endpoint, "get", $requiredParams, $options = NULL);
}
/**
* @brief Retrieve multiple objects according to specific criteria, handle pagination
*
* @param $requestParams mixed[] Array of parameters to submit with GET request. If "ids"
* are not specified, all will be selected.
* Possible array keys: "objectID" (required),"ids","start","range","sort","sortDir",
* "condition","search","searchNotes","group_ids","performAll",
* "externs","listFields"
*
* @return string JSON formatted array of paginated response data: each page of data will be an element in that array
*/
protected function _retrieveMultiplePaginated($requestParams)
{
$collection = json_decode($this->_retrieveCollectionInfo($requestParams), true);
$requestParams["start"] = $requestParams["start"] ?: 0;
$requestParams["range"] = $requestParams["range"] ?: 50;
$object_data = array();
while ($requestParams["start"] < $collection["data"]["count"])
{
$object_data[] = json_decode($this->_retrieveMultiple($requestParams), true);
$requestParams["start"] += $requestParams["range"];
}
return json_encode($object_data);
}
/**
* @brief Retrieve multiple objects according to specific criteria
*
* @param mixed[] $requestParams Array of parameters to submit with GET request.
* Varies by object.
*
* @return string JSON formatted HTTP response or error message.
*/
protected function _retrieveMultiple($requestParams)
{
return $this->client->request($requestParams, $this->_endpointPlural, "get", $requiredParams = NULL, $options = NULL);
}
/**
* @brief Create an object
*
* @param mixed[] $requestParams Array of parameters to submit with POST request.
* Varies by object.
*
* @return string JSON formatted HTTP response or error message
*/
protected function _create($requestParams)
{
$options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
return $this->client->request($requestParams, $this->_endpointPlural, "post", $requiredParams = NULL, $options);
}
/**
* @brief Delete a single specified object
*
* @param mixed[] $requestParams Array of the parameters to submit with DELETE request.
* Varies by object.
*
* @return string JSON formatted HTTP response or error message
*/
protected function _deleteSingle($requestParams)
{
$requiredParams = array("id");
return $this->client->request($requestParams, $this->_endpoint, "delete", $requiredParams, $options = NULL);
}
/**
* @brief Delete multiple objects according to specific criteria
*
* @param mixed[] $requestParams The parameters to submit with DELETE request.
* Varies by object.
*
* @return string JSON formatted HTTP response or error message
*/
protected function _deleteMultiple($requestParams)
{
return $this->client->request($requestParams, $this->_endpointPlural, "delete", $requiredParams = NULL, $options = NULL);
}
/**
* @brief Update an object's data
*
* @param mixed[] $requestParams The parameters to submit with PUT request.
* Varies by object.
*
* @return string JSON formatted HTTP response or error message
*/
protected function _update($requestParams)
{
$requiredParams = array("id");
$options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
return $this->client->request($requestParams, $this->_endpointPlural, "put", $requiredParams, $options);
}
/**
* @brief Retrieve meta for an object
*
* @param mixed[] $requestParams The parameters to submit with GET request. Ignored if not sent.
*
* @return string JSON formatted meta for an object
*/
protected function _retrieveMeta()
{
return $this->client->request($requestParams = NULL, $this->_endpointPlural . "/" . self::META, "get", $requiredParams = NULL, $options = NULL);
}
/**
* @brief Either create an object or merge with an existing object on unique field
*
* @param mixed[] $requestParams The parameters to submit with PUT request.
* Varies by object.
*
* @return string JSON formatted HTTP response or error message
*/
protected function _saveOrUpdate($requestParams)
{
$options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::SAVE_OR_UPDATE, "post", $requiredParams = NULL, $options);
}
/**
* @brief Retrieve information (such as number of objects) about a collection
*
* @param mixed[] $requestParams Array of parameters to submit with GET request.
* Varies by object.
*
* @return string JSON formatted HTTP response or error message
*/
protected function _retrieveCollectionInfo($requestParams)
{
return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::GET_INFO, "get", $requiredParams = NULL, $options = NULL);
}
protected static function retrieveContentTypeHeader($encoding)
{
if ($encoding == self::CONTENT_TYPE_FORM)
{
return array("Content-Type" => "application/x-www-form-urlencoded");
}
else if ($encoding == self::CONTENT_TYPE_JSON)
{
return array("Content-Type" => "application/json");
}
}
}
Zerion Mini Shell 1.0
Custom Staffing Solutions | Beyond A Resume
Skip to content
Distinguish Your Business From The Rest With The People That Make Up Your Team
We go Beyond a Resume to find high value, committed people
ready, willing, and able to add true value toward your organization's mission.
The right people make or break your business
We focus on resolving two types of challenges surrounding staffing and recruiting at Beyond a Resume: The first challenge comes when a business continues to grow, but does not have the full-time, internal, talent acquisition resources to hire the right people or talent necessary to keep up with their rate of progression as a company.
The second is a business that has a dedicated internal Human Resources Team, but requires outsourced assistance when the volume of people and talent needed exceeds short term internal capacity, OR the position(s) they seek to fill demand a specific skill set that is difficult to find, requiring added bandwidth.
In nearly any line of business, growth is a challenge in and of itself. Yet, the real problems arise in managing growth to ensure your progress remains profitable, sustainable, and repeatable. The biggest factor in this equation is usually found in your people. When you have the right people, success is unlimited. On the other hand, when you don’t have the right people in place or are having trouble finding enough of the right people, failure or stagnation is imminent.
The frustration that comes with the process of “hiring” can bring you to new levels of stress as the time cost involved eats away at your production elsewhere. If you have experienced this in the past, or are currently struggling with this issue, you’re certainly not alone. You may simply need the right partner to take the worst parts of this process off your plate so you can concentrate on your responsibilities, while we work diligently to reduce the noise and deliver only the ideal candidates worth your time and attention.
People can make or break your business and we go Beyond a Resume to find high value, committed people ready, willing, and able to add true value.
Primary Industry Experience
Healthcare and Home Healthcare
Talent Acquisition Solutions
Statement of Work Projects
Scroll To Top