getMenu
Fetch a menu from Drupal.
⚠️
You need to install the JSON:API Menu Items module to use getMenu.
const resource = await drupal.getResource<T = DrupalMenuLinkContent>(  name,  options?: {    params,    withAuth,    deserialize,    locale,    defaultLocale,    withCache  }): Promise<{    items: T[]    tree: T[]}>name: string- Required
 - The name of the menu. Example: 
mainorfooter. 
options- Optional
 params: JsonApiParams: JSON:API params such asfilter,fields,includeorsort.withAuth: boolean | DrupalClientAuth:- Set the authentication method to use. See the authentication docs.
 - Set to 
trueto use the authentication method configured on the client. 
deserialize: boolean: Set to false to return the raw JSON:API response.locale: string: The locale to fetch the resource in.defaultLocale: string: The default locale of the site.withCache: boolean: SetwithCacheif you want to store and retrieve the menu from cache.cacheKey: string: The cache key to use.
Notes
getMenureturns:items: An array ofDrupalMenuLinkContent.tree: An array ofDrupalMenuLinkContentwith children nested to match the hierarchy from Drupal.
Examples
- Get the 
mainmenu. 
const { menu, items } = await drupal.getMenu("main")- Get the 
mainmenu using cache. 
const menu = await drupal.getMenu("main", {  withCache: true,  cacheKey: "menu--main",})