File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,29 @@ export class NextDrupalPages extends NextDrupal {
6464 }
6565
6666 /**
67- * Gets the entry point for a given resource type.
67+ * Get the JSON:API entry for a resource type.
6868 *
69- * @param {string } resourceType The resource type.
70- * @param {Locale } locale The locale.
69+ * @param {string } resourceType The resource type. Example: `node--article`.
70+ * @param {Locale } locale Optional. The locale to fetch the index. Example: `es` or `fr` .
7171 * @returns {Promise<string> } The entry point URL.
72+ * @remarks
73+ * By default, when retrieving resources in `getResource` or `getResourceCollection`,
74+ * the `DrupalClient` make a request to Drupal to fetch the JSON:API resource entry.
75+ *
76+ * Example: if you provide `node--article`, `DrupalClient` will make a request to
77+ * `http://example.com/jsonapi/node/article`.
78+ *
79+ * If you would like to infer the entry from the resource type, use the useDefaultResourceTypeEntry option:
80+ * ```ts
81+ * const drupal = new DrupalClient(process.env.NEXT_PUBLIC_DRUPAL_BASE_URL, {
82+ * useDefaultResourceTypeEntry: true,
83+ * })
84+ * ```
85+ * @example
86+ * ```ts
87+ * // https://example.com/jsonapi/node/article
88+ * const url = await drupal.getEntryForResourceType(`node--article`)
89+ * ```
7290 */
7391 async getEntryForResourceType (
7492 resourceType : string ,
You can’t perform that action at this time.
0 commit comments