You are here

public function SalesforceCommands::restVersion in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 src/Commands/SalesforceCommands.php \Drupal\salesforce\Commands\SalesforceCommands::restVersion()
  2. 5.0.x src/Commands/SalesforceCommands.php \Drupal\salesforce\Commands\SalesforceCommands::restVersion()

Display information about the current REST API version.

@command salesforce:rest-version @aliases sfrv,sf-rest-version @field-labels label: Label url: Path version: Version login_url: Login URL latest: Latest Version? @default-fields label,url,version,login_url,latest

Return value

\Consolidation\OutputFormatters\StructuredData\PropertyList The version info.

File

src/Commands/SalesforceCommands.php, line 47

Class

SalesforceCommands
A Drush commandfile.

Namespace

Drupal\salesforce\Commands

Code

public function restVersion() {
  $version_id = $this->authMan
    ->getProvider()
    ->getApiVersion();
  $versions = $this->client
    ->getVersions();
  $version = $versions[$version_id];
  $latest = array_pop($versions);
  foreach ($version as $key => $value) {
    $rows[$key] = $value;
  }
  $rows['login_url'] = $this->authMan
    ->getCredentials()
    ->getLoginUrl();
  $rows['latest'] = strcmp($version_id, $latest['version']) ? $latest['version'] : 'Yes';
  return new PropertyList($rows);
}