public function RestClient::setApiVersion in Salesforce Suite 8.3
Setter for config salesforce.settings rest_api_version and use_latest.
Parameters
bool $use_latest: Use the latest version, instead of an explicit version number.
int $version: The explicit version number. Mutually exclusive with $use_latest.
Throws
\Exception
\GuzzleHttp\Exception\RequestException
Overrides RestClientInterface::setApiVersion
Deprecated
in 8.x-4.0 and does not have an exact analog, refer to \Drupal::config('salesforce.settings')->set('rest_api_version.version') instead.
File
- src/
Rest/ RestClient.php, line 373
Class
- RestClient
- Objects, properties, and methods to communicate with the Salesforce REST API.
Namespace
Drupal\salesforce\RestCode
public function setApiVersion($use_latest = TRUE, $version = NULL) {
if ($use_latest) {
$this->mutableConfig
->set('use_latest', $use_latest);
}
else {
$versions = $this
->getVersions();
if (empty($versions[$version])) {
throw new \Exception("Version {$version} is not available.");
}
$version = $versions[$version];
$this->mutableConfig
->set('rest_api_version', $version);
}
$this->mutableConfig
->save();
}