You are here

function salesforce_drush_command in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 salesforce.drush.inc \salesforce_drush_command()
  2. 7.3 salesforce.drush.inc \salesforce_drush_command()
  3. 5.0.x salesforce.drush.inc \salesforce_drush_command()

Implements hook_drush_command().

File

./salesforce.drush.inc, line 15
Drush integration for Salesforce.

Code

function salesforce_drush_command() {
  $items['sf-rest-version'] = [
    'description' => 'Displays information about the current REST API version',
    'aliases' => [
      'sfrv',
    ],
  ];
  $items['sf-list-objects'] = [
    'description' => 'List the objects that are available in your organization and available to the logged-in user.',
    'aliases' => [
      'sflo',
    ],
  ];
  $items['sf-describe-object'] = [
    'description' => 'Retrieve all the metadata for an object, including information about each field, URLs, and child relationships.',
    'aliases' => [
      'sfdo',
    ],
    'arguments' => [
      'object' => 'The object name in Salesforce.',
    ],
    'options' => [
      'output' => "Specify an output type.\nOptions are:\ninfo: (default) Display metadata about an object\nfields: Display information about fields that are part of the object\nfield-data FIELDNAME: Display information about a specific field that is part of an object\nraw: Display the complete, raw describe response.",
    ],
    'examples' => [
      'drush sfdo Contact' => 'Show metadata about Contact SObject type.',
      'drush sfdo Contact --output=fields' => 'Show addtional metadata about Contact fields.',
      'drush sfdo Contact --output=field --field=Email' => 'Show full metadata about Contact.Email field.',
      'drush sfdo Contact --output=raw' => 'Display the full metadata for Contact SObject type.',
    ],
  ];
  $items['sf-list-resources'] = [
    'description' => 'Lists the resources available for the specified API version. It provides the name and URI of each resource.',
    'aliases' => [
      'sflr',
    ],
  ];
  $items['sf-read-object'] = [
    'description' => 'Retrieve all the data for an object with a specific ID.',
    'aliases' => [
      'sfro',
    ],
    'arguments' => [
      'id' => 'The object ID in Salesforce.',
    ],
    'options' => [
      'format' => [
        'description' => 'Format to output the object. Use "print_r" for print_r (default), "export" for var_export, and "json" for JSON.',
        'example-value' => 'export',
      ],
    ],
  ];
  $items['sf-create-object'] = [
    'description' => 'Create an object with specified data.',
    'aliases' => [
      'sfco',
    ],
    'arguments' => [
      'object' => 'The object type name in Salesforce (e.g. Account).',
      'data' => 'The data to use when creating the object (default is JSON format). Use \'-\' to read the data from STDIN.',
    ],
    'options' => [
      'format' => [
        'description' => 'Format to parse the object. Use  "json" for JSON (default) or "query" for data formatted like a query string, e.g. \'Company=Foo&LastName=Bar\'.',
        'example-value' => 'json',
      ],
    ],
  ];
  $items['sf-query-object'] = [
    'description' => 'Query an object using SOQL with specified conditions.',
    'aliases' => [
      'sfqo',
    ],
    'arguments' => [
      'object' => 'The object type name in Salesforce (e.g. Account).',
    ],
    'options' => [
      'format' => [
        'description' => 'Format to output the objects. Use "print_r" for print_r (default), "export" for var_export, and "json" for JSON.',
        'example-value' => 'export',
      ],
      'where' => [
        'description' => 'A WHERE clause to add to the SOQL query',
      ],
      'fields' => [
        'description' => 'A comma-separated list fields to select in the SOQL query. If absent, an API call is used to find all fields',
      ],
      'limit' => [
        'description' => 'Integer limit on the number of results to return for the query.',
      ],
      'order' => [
        'description' => 'Comma-separated fields by which to sort results. Make sure to enclose in quotes for any whitespace.',
      ],
    ],
  ];
  $items['sf-execute-query'] = [
    'description' => 'Execute a SOQL query.',
    'aliases' => [
      'sfeq',
      'soql',
    ],
    'arguments' => [
      'query' => 'The query to execute.',
    ],
  ];
  $items['sf-pull-query'] = [
    'description' => 'Given a mapping, enqueue records for pull from Salesforce, ignoring modification timestamp. This command is useful, for example, when seeding content for a Drupal site prior to deployment.',
    'aliases' => [
      'sfpq',
      'sfiq',
    ],
    'arguments' => [
      'name' => 'Machine name of the Salesforce Mapping for which to queue pull records.',
    ],
    'options' => [
      'where' => [
        'description' => 'A WHERE clause to add to the SOQL pull query. Default behavior is to query and pull all records.',
      ],
    ],
    'examples' => [
      'drush sfpq' => 'Interactively select a mapping for which to queue records.',
      'drush sfpq user' => 'Query and queue all records for "user" Salesforce mapping.',
      'drush sfpq user --where="Email like \'%foo%\' AND (LastName = \'bar\' OR FirstName = \'bar\')"' => 'Query and queue all records for "user" Salesforce mapping with Email field containing the string "foo" and First or Last name equal to "bar"',
    ],
  ];
  $items['sf-pull-file'] = [
    'description' => 'Given a mapping, enqueue a list of object IDs to be pulled from a CSV file, e.g. a Salesforce report. The first column of the CSV file must be SFIDs. Additional columns will be ignored.',
    'aliases' => [
      'sfpf',
      'sfif',
    ],
    'arguments' => [
      'file' => 'CSV file name of 15- or 18-character Salesforce ids to be pulled. ',
      'name' => 'Machine name of the Salesforce Mapping for which to queue pull records.',
    ],
  ];
  return $items;
}