/home/desid573/public_html/gcdriver/square/lib/Api
Edit: /home/desid573/public_html/gcdriver/square/lib/Api/V1LocationsApi.php (7236B)
getConfig()->setHost('https://connect.squareup.com');
}
$this->apiClient = $apiClient;
}
/**
* Get API client
* @return \SquareConnect\ApiClient get the API client
*/
public function getApiClient()
{
return $this->apiClient;
}
/**
* Set the API client
* @param \SquareConnect\ApiClient $apiClient set the API client
* @return V1LocationsApi
*/
public function setApiClient(ApiClient $apiClient)
{
$this->apiClient = $apiClient;
return $this;
}
/**
* listLocations
*
* ListLocations
*
* @return \SquareConnect\Model\V1Merchant[]
* @throws \SquareConnect\ApiException on non-2xx response
*/
public function listLocations()
{
list($response, $statusCode, $httpHeader) = $this->listLocationsWithHttpInfo ();
return $response;
}
/**
* listLocationsWithHttpInfo
*
* ListLocations
*
* @return Array of \SquareConnect\Model\V1Merchant[], HTTP status code, HTTP response headers (array of strings)
* @throws \SquareConnect\ApiException on non-2xx response
*/
public function listLocationsWithHttpInfo()
{
// parse inputs
$resourcePath = "/v1/me/locations";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json'));
$headerParams['Square-Version'] = "2019-08-14";
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, 'GET',
$queryParams, $httpBody,
$headerParams, '\SquareConnect\Model\V1Merchant[]'
);
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\SquareConnect\ObjectSerializer::deserialize($response, '\SquareConnect\Model\V1Merchant[]', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \SquareConnect\ObjectSerializer::deserialize($e->getResponseBody(), '\SquareConnect\Model\V1Merchant[]', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* retrieveBusiness
*
* RetrieveBusiness
*
* @return \SquareConnect\Model\V1Merchant
* @throws \SquareConnect\ApiException on non-2xx response
*/
public function retrieveBusiness()
{
list($response, $statusCode, $httpHeader) = $this->retrieveBusinessWithHttpInfo ();
return $response;
}
/**
* retrieveBusinessWithHttpInfo
*
* RetrieveBusiness
*
* @return Array of \SquareConnect\Model\V1Merchant, HTTP status code, HTTP response headers (array of strings)
* @throws \SquareConnect\ApiException on non-2xx response
*/
public function retrieveBusinessWithHttpInfo()
{
// parse inputs
$resourcePath = "/v1/me";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json'));
$headerParams['Square-Version'] = "2019-08-14";
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, 'GET',
$queryParams, $httpBody,
$headerParams, '\SquareConnect\Model\V1Merchant'
);
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\SquareConnect\ObjectSerializer::deserialize($response, '\SquareConnect\Model\V1Merchant', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \SquareConnect\ObjectSerializer::deserialize($e->getResponseBody(), '\SquareConnect\Model\V1Merchant', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
}