protected function _queryFollowNext($query_type, $query, $url = null) { //next url has not been supplied if (is_null($url)) { $result = $this->oauth2Client->call_api('get', $query_type . '/?q=' . urlencode($query)); } else { $result = $this->oauth2Client->rawGetRequest($url); } if ($result && isset($result['records']) && $result['records']) { if (isset($result['nextRecordsUrl']) && $result['nextRecordsUrl']) { $new_result = $this->_queryFollowNext($query_type, $query, $result['nextRecordsUrl']); if ($new_result && isset($new_result['records'])) { $result['records'] = array_merge($result['records'], $new_result['records']); } } } return $result; }
public function __construct($config = []) { if (isset($config['bulk_base_uri'])) { $base_uri = $config['bulk_base_uri']; } else { $base_uri = 'https://' . SalesforceConfig::get('salesforce.api.domain'); } $client_config = ['base_uri' => $base_uri, 'auth' => 'bulk']; if (isset($config['handler'])) { $client_config['handler'] = $config['handler']; } $this->oauth2Client = new BulkClient($client_config); parent::__construct(array_replace($config, $client_config)); }
public function externalUpsert($external_field_name, $external_id, $type, $data) { return new SobjectInsertResponse($this->oauth2Client->call_api('patch', 'sobjects/' . $type . '/' . $external_field_name . '/' . $external_id, ['http_errors' => false, 'body' => json_encode($data), 'headers' => ['Content-type' => 'application/json']])); }