diff --git a/codegen/lib/layout/summary.ts b/codegen/lib/layout/summary.ts index 956e02727..e5a422979 100644 --- a/codegen/lib/layout/summary.ts +++ b/codegen/lib/layout/summary.ts @@ -19,12 +19,38 @@ interface Context { pathMetadata: PathMetadata } +// Access Grants are the default and recommended way to grant access, so the +// granting resources are pinned to the top of the API reference nav. The +// low-level legacy granting resources sink to the bottom. Everything else +// stays alphabetical in between. +const firstResourcePaths = [ + '/access_grants', + '/access_methods', + '/spaces', + '/user_identities', + '/instant_keys', +] +const lastResourcePaths = ['/access_codes', '/acs'] + +const topLevelRank = (path: string): number => { + const firstIdx = firstResourcePaths.indexOf(path) + if (firstIdx !== -1) return firstIdx + const lastIdx = lastResourcePaths.indexOf(path) + if (lastIdx !== -1) return firstResourcePaths.length + 1 + lastIdx + return firstResourcePaths.length +} + export function setSummaryLayoutContext( file: Partial, context: Context, ): void { const paths = getPaths(null, context) - file.nodes = getNodes(paths, context) + const nodes = getNodes(paths, context) + file.nodes = nodes.sort( + (n1, n2) => + topLevelRank(`/${n1.path.replace(/\/README\.md$/, '')}`) - + topLevelRank(`/${n2.path.replace(/\/README\.md$/, '')}`), + ) } const getNodes = (paths: string[], context: Context): Node[] => { diff --git a/docs/api-reference/SUMMARY.md b/docs/api-reference/SUMMARY.md index 8f9fecd5d..2282699b6 100644 --- a/docs/api-reference/SUMMARY.md +++ b/docs/api-reference/SUMMARY.md @@ -6,76 +6,6 @@ * [Authentication](authentication.md) * [Pagination](pagination.md) * [Rate Limits and Guardrails](rate-limits-and-guardrails.md) -* [Access Codes](access_codes/README.md) - * [Create an Access Code](access_codes/create.md) - * [Create Multiple Linked Access Codes](access_codes/create_multiple.md) - * [Delete an Access Code](access_codes/delete.md) - * [Generate a Code](access_codes/generate_code.md) - * [Get an Access Code](access_codes/get.md) - * [List Access Codes](access_codes/list.md) - * [Pull a Backup Access Code](access_codes/pull_backup_access_code.md) - * [Report Device Access Code Constraints](access_codes/report_device_constraints.md) - * [Update an Access Code](access_codes/update.md) - * [Update Multiple Linked Access Codes](access_codes/update_multiple.md) - * [Access Code Simulations](access_codes/simulate/README.md) - * [Simulate Creating an Unmanaged Access Code](access_codes/simulate/create_unmanaged_access_code.md) - * [Unmanaged Access Codes](access_codes/unmanaged/README.md) - * [Convert an Unmanaged Access Code](access_codes/unmanaged/convert_to_managed.md) - * [Delete an Unmanaged Access Code](access_codes/unmanaged/delete.md) - * [Get an Unmanaged Access Code](access_codes/unmanaged/get.md) - * [List Unmanaged Access Codes](access_codes/unmanaged/list.md) - * [Update an Unmanaged Access Code](access_codes/unmanaged/update.md) -* [Access Control Systems (ACS)](acs/README.md) - * [Access Groups](acs/access_groups/README.md) - * [Add an ACS User to an Access Group](acs/access_groups/add_user.md) - * [Delete an Access Group](acs/access_groups/delete.md) - * [Get an Access Group](acs/access_groups/get.md) - * [List Access Groups](acs/access_groups/list.md) - * [List ACS Users in an Access Group](acs/access_groups/list_users.md) - * [List Entrances Accessible to an Access Group](acs/access_groups/list_accessible_entrances.md) - * [Remove an ACS User from an Access Group](acs/access_groups/remove_user.md) - * [ACS Users](acs/users/README.md) - * [Add an ACS User to an Access Group](acs/users/add_to_access_group.md) - * [Create an ACS User](acs/users/create.md) - * [Delete an ACS User](acs/users/delete.md) - * [Get an ACS User](acs/users/get.md) - * [List ACS User-Accessible Entrances](acs/users/list_accessible_entrances.md) - * [List ACS Users](acs/users/list.md) - * [Remove an ACS User from an Access Group](acs/users/remove_from_access_group.md) - * [Revoke ACS User Access to All Entrances](acs/users/revoke_access_to_all_entrances.md) - * [Suspend an ACS User](acs/users/suspend.md) - * [Unsuspend an ACS User](acs/users/unsuspend.md) - * [Update an ACS User](acs/users/update.md) - * [Credentials](acs/credentials/README.md) - * [Assign a Credential to an ACS User](acs/credentials/assign.md) - * [Create a Credential for an ACS User](acs/credentials/create.md) - * [Delete a Credential](acs/credentials/delete.md) - * [Get a Credential](acs/credentials/get.md) - * [List Accessible Entrances](acs/credentials/list_accessible_entrances.md) - * [List Credentials](acs/credentials/list.md) - * [Unassign a Credential from an ACS User](acs/credentials/unassign.md) - * [Update a Credential](acs/credentials/update.md) - * [Encoders](acs/encoders/README.md) - * [Encode a Credential](acs/encoders/encode_credential.md) - * [Get an Encoder](acs/encoders/get.md) - * [List Encoders](acs/encoders/list.md) - * [Scan a Credential](acs/encoders/scan_credential.md) - * [Encoder Simulations](acs/encoders/simulate/README.md) - * [Simulate that the Next Credential Encoding Will Fail](acs/encoders/simulate/next_credential_encode_will_fail.md) - * [Simulate that the Next Credential Encoding Will Succeed](acs/encoders/simulate/next_credential_encode_will_succeed.md) - * [Simulate that the Next Credential Scan Will Fail](acs/encoders/simulate/next_credential_scan_will_fail.md) - * [Simulate that the Next Credential Scan Will Succeed](acs/encoders/simulate/next_credential_scan_will_succeed.md) - * [Entrances](acs/entrances/README.md) - * [Get an Entrance](acs/entrances/get.md) - * [Grant an ACS User Access to an Entrance](acs/entrances/grant_access.md) - * [List Credentials with Access to an Entrance](acs/entrances/list_credentials_with_access.md) - * [List Entrances](acs/entrances/list.md) - * [Unlock an Entrance](acs/entrances/unlock.md) - * [Systems](acs/systems/README.md) - * [Get an ACS System](acs/systems/get.md) - * [List ACS Systems](acs/systems/list.md) - * [List Compatible Credential Manager ACS Systems](acs/systems/list_compatible_credential_manager_acs_systems.md) - * [Report Devices](acs/systems/report_devices.md) * [Access Grants](access_grants/README.md) * [Add Requested Access Methods to Access Grant](access_grants/request_access_methods.md) * [Create an Access Grant](access_grants/create.md) @@ -97,6 +27,40 @@ * [Unmanaged](access_methods/unmanaged/README.md) * [Get an Unmanaged Access Method](access_methods/unmanaged/get.md) * [List Unmanaged Access Methods](access_methods/unmanaged/list.md) +* [Spaces](spaces/README.md) + * [Add Devices to a Space](spaces/add_devices.md) + * [Add Entrances to a Space](spaces/add_acs_entrances.md) + * [Create a Space](spaces/create.md) + * [Delete a Space](spaces/delete.md) + * [Get a Space](spaces/get.md) + * [Get related Space resources](spaces/get_related.md) + * [List Spaces](spaces/list.md) + * [Remove Devices from a Space](spaces/remove_devices.md) + * [Remove Entrances from a Space](spaces/remove_acs_entrances.md) + * [Update a Space](spaces/update.md) +* [User Identities](user_identities/README.md) + * [Add an ACS User to a User Identity](user_identities/add_acs_user.md) + * [Create a User Identity](user_identities/create.md) + * [Delete a User Identity](user_identities/delete.md) + * [Generate an Instant Key](user_identities/generate_instant_key.md) + * [Get a User Identity](user_identities/get.md) + * [Grant a User Identity Access to a Device](user_identities/grant_access_to_device.md) + * [List Accessible Devices for a User Identity](user_identities/list_accessible_devices.md) + * [List Accessible Entrances for a User Identity](user_identities/list_accessible_entrances.md) + * [List ACS Systems Associated with a User Identity](user_identities/list_acs_systems.md) + * [List ACS Users Associated with a User Identity](user_identities/list_acs_users.md) + * [List User Identities](user_identities/list.md) + * [Remove an ACS User from a User Identity](user_identities/remove_acs_user.md) + * [Revoke Access to a Device from a User Identity](user_identities/revoke_access_to_device.md) + * [Update a User Identity](user_identities/update.md) + * [Unmanaged](user_identities/unmanaged/README.md) + * [Get an Unmanaged User Identity](user_identities/unmanaged/get.md) + * [List Unmanaged User Identities](user_identities/unmanaged/list.md) + * [Update an Unmanaged User Identity](user_identities/unmanaged/update.md) +* [Instant Keys](instant_keys/README.md) + * [Delete an Instant Key](instant_keys/delete.md) + * [Get an Instant Key](instant_keys/get.md) + * [List Instant Keys](instant_keys/list.md) * [Action Attempts](action_attempts/README.md) * [Get an Action Attempt](action_attempts/get.md) * [List Action Attempts](action_attempts/list.md) @@ -145,10 +109,6 @@ * [Events](events/README.md) * [Get an Event](events/get.md) * [List Events](events/list.md) -* [Instant Keys](instant_keys/README.md) - * [Delete an Instant Key](instant_keys/delete.md) - * [Get an Instant Key](instant_keys/get.md) - * [List Instant Keys](instant_keys/list.md) * [Locks](locks/README.md) * [Configure Auto-Lock](locks/configure_auto_lock.md) * [Get a Lock](locks/get.md) @@ -174,17 +134,6 @@ * [List Phones](phones/list.md) * [Phone Simulations](phones/simulate/README.md) * [Create a Sandbox Phone](phones/simulate/create_sandbox_phone.md) -* [Spaces](spaces/README.md) - * [Add Devices to a Space](spaces/add_devices.md) - * [Add Entrances to a Space](spaces/add_acs_entrances.md) - * [Create a Space](spaces/create.md) - * [Delete a Space](spaces/delete.md) - * [Get a Space](spaces/get.md) - * [Get related Space resources](spaces/get_related.md) - * [List Spaces](spaces/list.md) - * [Remove Devices from a Space](spaces/remove_devices.md) - * [Remove Entrances from a Space](spaces/remove_acs_entrances.md) - * [Update a Space](spaces/update.md) * [Thermostats](thermostats/README.md) * [Activate a Climate Preset](thermostats/activate_climate_preset.md) * [Create a Climate Preset](thermostats/create_climate_preset.md) @@ -213,25 +162,6 @@ * [Thermostat Simulations](thermostats/simulate/README.md) * [HVAC Mode Adjusted](thermostats/simulate/hvac_mode_adjusted.md) * [Temperature Reached](thermostats/simulate/temperature_reached.md) -* [User Identities](user_identities/README.md) - * [Add an ACS User to a User Identity](user_identities/add_acs_user.md) - * [Create a User Identity](user_identities/create.md) - * [Delete a User Identity](user_identities/delete.md) - * [Generate an Instant Key](user_identities/generate_instant_key.md) - * [Get a User Identity](user_identities/get.md) - * [Grant a User Identity Access to a Device](user_identities/grant_access_to_device.md) - * [List Accessible Devices for a User Identity](user_identities/list_accessible_devices.md) - * [List Accessible Entrances for a User Identity](user_identities/list_accessible_entrances.md) - * [List ACS Systems Associated with a User Identity](user_identities/list_acs_systems.md) - * [List ACS Users Associated with a User Identity](user_identities/list_acs_users.md) - * [List User Identities](user_identities/list.md) - * [Remove an ACS User from a User Identity](user_identities/remove_acs_user.md) - * [Revoke Access to a Device from a User Identity](user_identities/revoke_access_to_device.md) - * [Update a User Identity](user_identities/update.md) - * [Unmanaged](user_identities/unmanaged/README.md) - * [Get an Unmanaged User Identity](user_identities/unmanaged/get.md) - * [List Unmanaged User Identities](user_identities/unmanaged/list.md) - * [Update an Unmanaged User Identity](user_identities/unmanaged/update.md) * [Webhooks](webhooks/README.md) * [Create a Webhook](webhooks/create.md) * [Delete a Webhook](webhooks/delete.md) @@ -244,3 +174,73 @@ * [List Workspaces](workspaces/list.md) * [Reset a Sandbox Workspace](workspaces/reset_sandbox.md) * [Update a Workspace](workspaces/update.md) +* [Access Codes](access_codes/README.md) + * [Create an Access Code](access_codes/create.md) + * [Create Multiple Linked Access Codes](access_codes/create_multiple.md) + * [Delete an Access Code](access_codes/delete.md) + * [Generate a Code](access_codes/generate_code.md) + * [Get an Access Code](access_codes/get.md) + * [List Access Codes](access_codes/list.md) + * [Pull a Backup Access Code](access_codes/pull_backup_access_code.md) + * [Report Device Access Code Constraints](access_codes/report_device_constraints.md) + * [Update an Access Code](access_codes/update.md) + * [Update Multiple Linked Access Codes](access_codes/update_multiple.md) + * [Access Code Simulations](access_codes/simulate/README.md) + * [Simulate Creating an Unmanaged Access Code](access_codes/simulate/create_unmanaged_access_code.md) + * [Unmanaged Access Codes](access_codes/unmanaged/README.md) + * [Convert an Unmanaged Access Code](access_codes/unmanaged/convert_to_managed.md) + * [Delete an Unmanaged Access Code](access_codes/unmanaged/delete.md) + * [Get an Unmanaged Access Code](access_codes/unmanaged/get.md) + * [List Unmanaged Access Codes](access_codes/unmanaged/list.md) + * [Update an Unmanaged Access Code](access_codes/unmanaged/update.md) +* [Access Control Systems (ACS)](acs/README.md) + * [Access Groups](acs/access_groups/README.md) + * [Add an ACS User to an Access Group](acs/access_groups/add_user.md) + * [Delete an Access Group](acs/access_groups/delete.md) + * [Get an Access Group](acs/access_groups/get.md) + * [List Access Groups](acs/access_groups/list.md) + * [List ACS Users in an Access Group](acs/access_groups/list_users.md) + * [List Entrances Accessible to an Access Group](acs/access_groups/list_accessible_entrances.md) + * [Remove an ACS User from an Access Group](acs/access_groups/remove_user.md) + * [ACS Users](acs/users/README.md) + * [Add an ACS User to an Access Group](acs/users/add_to_access_group.md) + * [Create an ACS User](acs/users/create.md) + * [Delete an ACS User](acs/users/delete.md) + * [Get an ACS User](acs/users/get.md) + * [List ACS User-Accessible Entrances](acs/users/list_accessible_entrances.md) + * [List ACS Users](acs/users/list.md) + * [Remove an ACS User from an Access Group](acs/users/remove_from_access_group.md) + * [Revoke ACS User Access to All Entrances](acs/users/revoke_access_to_all_entrances.md) + * [Suspend an ACS User](acs/users/suspend.md) + * [Unsuspend an ACS User](acs/users/unsuspend.md) + * [Update an ACS User](acs/users/update.md) + * [Credentials](acs/credentials/README.md) + * [Assign a Credential to an ACS User](acs/credentials/assign.md) + * [Create a Credential for an ACS User](acs/credentials/create.md) + * [Delete a Credential](acs/credentials/delete.md) + * [Get a Credential](acs/credentials/get.md) + * [List Accessible Entrances](acs/credentials/list_accessible_entrances.md) + * [List Credentials](acs/credentials/list.md) + * [Unassign a Credential from an ACS User](acs/credentials/unassign.md) + * [Update a Credential](acs/credentials/update.md) + * [Encoders](acs/encoders/README.md) + * [Encode a Credential](acs/encoders/encode_credential.md) + * [Get an Encoder](acs/encoders/get.md) + * [List Encoders](acs/encoders/list.md) + * [Scan a Credential](acs/encoders/scan_credential.md) + * [Encoder Simulations](acs/encoders/simulate/README.md) + * [Simulate that the Next Credential Encoding Will Fail](acs/encoders/simulate/next_credential_encode_will_fail.md) + * [Simulate that the Next Credential Encoding Will Succeed](acs/encoders/simulate/next_credential_encode_will_succeed.md) + * [Simulate that the Next Credential Scan Will Fail](acs/encoders/simulate/next_credential_scan_will_fail.md) + * [Simulate that the Next Credential Scan Will Succeed](acs/encoders/simulate/next_credential_scan_will_succeed.md) + * [Entrances](acs/entrances/README.md) + * [Get an Entrance](acs/entrances/get.md) + * [Grant an ACS User Access to an Entrance](acs/entrances/grant_access.md) + * [List Credentials with Access to an Entrance](acs/entrances/list_credentials_with_access.md) + * [List Entrances](acs/entrances/list.md) + * [Unlock an Entrance](acs/entrances/unlock.md) + * [Systems](acs/systems/README.md) + * [Get an ACS System](acs/systems/get.md) + * [List ACS Systems](acs/systems/list.md) + * [List Compatible Credential Manager ACS Systems](acs/systems/list_compatible_credential_manager_acs_systems.md) + * [Report Devices](acs/systems/report_devices.md)