diff --git a/config/schema/jsonapi_reference.schema.yml b/config/schema/jsonapi_reference.schema.yml index 87611c353c0c3abb8bde8f516ad26dbfdb232434..98a8ecad1b197c1c5a0392fcf280ec16f506272c 100644 --- a/config/schema/jsonapi_reference.schema.yml +++ b/config/schema/jsonapi_reference.schema.yml @@ -11,10 +11,10 @@ jsonapi_reference.settings: mapping: endpoint: type: string - label: 'Endpoint containing JSON:API objects to which we refer' + label: 'Entrypoint containing JSON:API objects to which we refer' username: type: string - label: 'Username for accessing endpoint' + label: 'Username for accessing the entrypoint' password: type: string - label: 'Password for accessing endpoint' + label: 'Password for accessing the entrypoint' diff --git a/jsonapi_reference.permissions.yml b/jsonapi_reference.permissions.yml index c37b8360b6f695a83d61d0f992bc45efd08b132e..530a5852e2dc5dbe9e4bbbc1cc79b5a3cf40cdc7 100644 --- a/jsonapi_reference.permissions.yml +++ b/jsonapi_reference.permissions.yml @@ -1,6 +1,6 @@ access jsonapi autocomplete: title: 'Access JSON:API autocomplete' - description: 'Allow access to the JSON:API autocomplete endpoint. This can expose all data exposed from the external JSON:API endpoint.' + description: 'Allow access to the JSON:API autocomplete entrypoint. This can expose all data exposed from the external JSON:API entrypoint.' configure jsonapi reference: title: 'Configure JSON:API reference' diff --git a/src/Controller/TypedResourceController.php b/src/Controller/TypedResourceController.php index 1b34ab06526734bea4f3acb22b26e1dd99c28211..3f764dd25a27943d048b1bbdfb75311757ac6474 100644 --- a/src/Controller/TypedResourceController.php +++ b/src/Controller/TypedResourceController.php @@ -16,7 +16,7 @@ use Symfony\Component\HttpFoundation\Request; class TypedResourceController extends ControllerBase { /** - * Client to talk to our JSON:API endpoint. + * Client to talk to our JSON:API entrypoint. * * @var \Drupal\jsonapi_reference\JsonApiClientInterface */ @@ -26,7 +26,7 @@ class TypedResourceController extends ControllerBase { * TypedResourceController constructor. * * @param \Drupal\jsonapi_reference\JsonApiClientInterface $client - * Client to talk to our JSON:API endpoint. + * Client to talk to our JSON:API entrypoint. */ public function __construct(JsonApiClientInterface $client) { $this->client = $client; diff --git a/src/Form/JsonApiReferenceConfigForm.php b/src/Form/JsonApiReferenceConfigForm.php index 2df6f57cb01a5187220db55ca7328f57ae13d577..ae0f3b654efc2b8d1d4f20b32369e744f226f611 100644 --- a/src/Form/JsonApiReferenceConfigForm.php +++ b/src/Form/JsonApiReferenceConfigForm.php @@ -31,10 +31,10 @@ class JsonApiReferenceConfigForm extends ConfigFormBase { */ public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('jsonapi_reference.settings'); - $form['endpoint'] = [ + $form['entrypoint'] = [ '#type' => 'textfield', - '#title' => $this->t('Endpoint'), - '#description' => $this->t('The root JSON:API endpoint, for example, https://example.com/jsonapi'), + '#title' => $this->t('Entrypoint'), + '#description' => $this->t('The root JSON:API entrypoint, for example, https://example.com/jsonapi'), '#maxlength' => 2048, '#size' => 64, '#default_value' => $config->get('endpoint'), @@ -42,7 +42,7 @@ class JsonApiReferenceConfigForm extends ConfigFormBase { $form['username'] = [ '#type' => 'textfield', '#title' => $this->t('Username'), - '#description' => $this->t('Username for authenticating on the JSON:API endpoint'), + '#description' => $this->t('Username for authenticating on the JSON:API entrypoint'), '#maxlength' => 128, '#size' => 64, '#default_value' => $config->get('username'), @@ -50,7 +50,7 @@ class JsonApiReferenceConfigForm extends ConfigFormBase { $form['password'] = [ '#type' => 'password', '#title' => $this->t('Password'), - '#description' => $this->t('Password for authenticating on the JSON:API endpoint'), + '#description' => $this->t('Password for authenticating on the JSON:API entrypoint'), '#maxlength' => 128, '#size' => 64, '#default_value' => $config->get('password'), @@ -65,7 +65,7 @@ class JsonApiReferenceConfigForm extends ConfigFormBase { parent::submitForm($form, $form_state); $config = $this->config('jsonapi_reference.settings'); - $config->set('endpoint', $form_state->getValue('endpoint')) + $config->set('endpoint', $form_state->getValue('entrypoint')) ->set('username', $form_state->getValue('username')); if ($password = $form_state->getValue('password')) { $config->set('password', $password); diff --git a/src/JsonApiClient.php b/src/JsonApiClient.php index 884a9b7091dae1216d38f315c9f2ccba82c0a42b..7b8d6df30fbc0fafa1beae4fa1c93be1e7fc344e 100644 --- a/src/JsonApiClient.php +++ b/src/JsonApiClient.php @@ -16,28 +16,28 @@ use GuzzleHttp\RequestOptions; class JsonApiClient implements JsonApiClientInterface { /** - * Client for querying JSON:API endpoints. + * Client for querying the JSON:API entrypoint. * * @var \GuzzleHttp\ClientInterface */ protected $httpClient; /** - * Endpoint to call to retrieve JSONAPI objects. + * Entrypoint to call to retrieve JSONAPI objects. * * @var string */ - protected $endpoint; + protected $entrypoint; /** - * Username to use when authenticating to endpoint. + * Username to use when authenticating to the entrypoint. * * @var string */ protected $username; /** - * Password to use when authenticating to endpoint. + * Password to use when authenticating to the entrypoint. * * @var string */ @@ -54,7 +54,7 @@ class JsonApiClient implements JsonApiClientInterface { * JsonApiClient constructor. * * @param \GuzzleHttp\ClientInterface $httpClient - * Client for querying JSON:API endpoints. + * Client for querying the JSON:API entrypoint. * @param \Drupal\Core\Logger\LoggerChannelInterface $loggerChannel * Channel for logging. * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory @@ -62,7 +62,7 @@ class JsonApiClient implements JsonApiClientInterface { */ public function __construct(ClientInterface $httpClient, LoggerChannelInterface $loggerChannel, ConfigFactoryInterface $configFactory) { $this->httpClient = $httpClient; - $this->endpoint = $configFactory->get('jsonapi_reference.settings')->get('endpoint'); + $this->entrypoint = $configFactory->get('jsonapi_reference.settings')->get('endpoint'); $this->username = $configFactory->get('jsonapi_reference.settings')->get('username'); $this->password = $configFactory->get('jsonapi_reference.settings')->get('password'); $this->loggerChannel = $loggerChannel; @@ -76,16 +76,16 @@ class JsonApiClient implements JsonApiClientInterface { } /** - * Gets the resource object type information from the endpoint. + * Gets the resource object type information from the entrypoint. * * @return object[] * Array of objects, keyed by type name (EG node--article). - * Each object contains a href element pointing to the JSON:API endpoint + * Each object contains a href element pointing to the JSON:API entrypoint * for that specific type. */ protected function getResourceObjectTypes() { try { - $response = $this->httpClient->request('get', $this->endpoint, $this->getRequestOptions()); + $response = $this->httpClient->request('get', $this->entrypoint, $this->getRequestOptions()); } catch (GuzzleException $e) { $this->loggerChannel->error($e->getMessage()); @@ -93,7 +93,7 @@ class JsonApiClient implements JsonApiClientInterface { } $response = json_decode($response->getBody()->getContents()); if (!isset($response->links)) { - $this->loggerChannel->error('JSON:API endpoint @endpoint returned no type information.', ['@endpoint' => $this->endpoint]); + $this->loggerChannel->error('JSON:API entrypoint @entrypoint returned no type information.', ['@entrypoint' => $this->entrypoint]); return []; } return (array) $response->links; @@ -105,9 +105,9 @@ class JsonApiClient implements JsonApiClientInterface { public function search($resource_object_type, $search_attribute, $query) { $path = $this->getPathForResourceObjectType($resource_object_type); if (!$path) { - $this->loggerChannel->error('No path for resource object type @type found at JSON:API endpoint @endpoint.', [ + $this->loggerChannel->error('No path for resource object type @type found at JSON:API entrypoint @entrypoint.', [ '@type' => $resource_object_type, - '@endpoint' => $this->endpoint, + '@entrypoint' => $this->entrypoint, ]); return []; } @@ -136,8 +136,8 @@ class JsonApiClient implements JsonApiClientInterface { foreach ($response->data as $result) { $results[$result->attributes->$search_attribute] = $result->id; } - $this->loggerChannel->error('JSON:API endpoint @endpoint returned no data for path @path when searching for objects where the @search_attribute attribute matched "@query".', [ - '@endpoint' => $this->endpoint, + $this->loggerChannel->error('JSON:API entrypoint @entrypoint returned no data for path @path when searching for objects where the @search_attribute attribute matched "@query".', [ + '@entrypoint' => $this->entrypoint, '@path' => $path, '@search_attribute' => $search_attribute, '@query' => $query, diff --git a/src/JsonApiClientInterface.php b/src/JsonApiClientInterface.php index dc39243e896a54c427423f19f68295cd61c88b15..fb97fcd3a6b077947fdae5a160acb482d311d9f6 100644 --- a/src/JsonApiClientInterface.php +++ b/src/JsonApiClientInterface.php @@ -10,7 +10,7 @@ namespace Drupal\jsonapi_reference; interface JsonApiClientInterface { /** - * Gets a list of resource object types from the remote endpoint. + * Gets a list of resource object types from the remote entrypoint. * * @return string[] * Array of remote object types.src/JsonApiClient.php @@ -25,7 +25,7 @@ interface JsonApiClientInterface { public function listResourceObjectTypes(); /** - * Search the endpoint for a resource object of a given type. + * Search the entrypoint for a resource object of a given type. * * @param string $resource_object_type * Resource object type.