Skip to content

Commit

Permalink
modified setFileContext function
Browse files Browse the repository at this point in the history
  • Loading branch information
mastafit committed Aug 1, 2024
1 parent 2fdefda commit 42a1825
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 57 deletions.
58 changes: 45 additions & 13 deletions docs/api/acs/systems/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,71 @@ response includes all access control systems connected to your workspace.
<tbody>
<tr>
<td><code>acs_system_id</code></td>
<td>ID of the access control system</td>
<td>ID of the &#x60;acs_system&#x60;.</td>
</tr>
<tr>
<td><code>name</code></td>
<td>Name of the access control system</td>
<td><code>can_add_acs_users_to_acs_access_groups</code></td>
<td>Indicates whether the &#x60;acs_system&#x60; supports [adding users to access groups](https://docs.seam.co/latest/capability-guides/access-systems/assigning-users-to-access-groups#add-an-acs-user-to-an-access-group). See also [Access Group-based Access Control Systems](https://docs.seam.co/latest/capability-guides/access-systems/understanding-access-control-system-differences#access-group-based-access-control-systems).</td>
</tr>
<tr>
<td><code>workspace_id</code></td>
<td>ID of the workspace that contains the access control system</td>
<td><code>can_automate_enrollment</code></td>
<td>Indicates whether it is possible to [launch enrollment automations](https://docs.seam.co/latest/capability-guides/mobile-access-in-development/issuing-mobile-credentials-from-an-access-control-system#prepare-the-phones-for-a-user-identity-to-start-receiving-mobile-credentials-using-an-enrollment-aut) for the &#x60;acs_system&#x60;.</td>
</tr>
<tr>
<td><code>can_create_acs_access_groups</code></td>
<td>Indicates whether the &#x60;acs_system&#x60; supports creating [access groups](https://docs.seam.co/latest/capability-guides/access-systems/assigning-users-to-access-groups). See also [Access Group-based Access Control Systems](https://docs.seam.co/latest/capability-guides/access-systems/understanding-access-control-system-differences#access-group-based-access-control-systems).</td>
</tr>
<tr>
<td><code>can_remove_acs_users_from_acs_access_groups</code></td>
<td>Indicates whether the &#x60;acs_system&#x60; supports [removing users from access groups](https://docs.seam.co/latest/capability-guides/access-systems/assigning-users-to-access-groups#remove-an-acs-user-from-an-access-group). See also [Access Group-based Access Control Systems](https://docs.seam.co/latest/capability-guides/access-systems/understanding-access-control-system-differences#access-group-based-access-control-systems).</td>
</tr>
<tr>
<td><code>connected_account_ids</code></td>
<td>IDs of the [connected accounts](https://docs.seam.co/latest/core-concepts/connected-accounts) associated with the &#x60;acs_system&#x60;.</td>
</tr>
<tr>
<td><code>created_at</code></td>
<td>Date and time at which the access control system was created</td>
<td>Date and time at which the &#x60;acs_system&#x60; was created.</td>
</tr>
<tr>
<td><code>errors</code></td>
<td>Errors associated with the &#x60;acs_system&#x60;.</td>
</tr>
<tr>
<td><code>external_type</code></td>
<td>Brand-specific terminology for the access control system type</td>
<td>Brand-specific terminology for the &#x60;acs_system&#x60; type.</td>
</tr>
<tr>
<td><code>external_type_display_name</code></td>
<td>Display name that corresponds to the brand-specific terminology for the access control system type</td>
<td>Display name that corresponds to the brand-specific terminology for the &#x60;acs_system&#x60; type.</td>
</tr>
<tr>
<td><code>connected_account_ids</code></td>
<td>Array of connected account IDs associated with the access control system</td>
<td><code>image_alt_text</code></td>
<td>Alternative text for the &#x60;acs_system&#x60; image.</td>
</tr>
<tr>
<td><code>image_url</code></td>
<td>URL for the image that represents the access control system</td>
<td>URL for the image that represents the &#x60;acs_system&#x60;.</td>
</tr>
<tr>
<td><code>image_alt_text</code></td>
<td>Alternative text for the access control system image</td>
<td><code>name</code></td>
<td>Name of the &#x60;acs_system&#x60;.</td>
</tr>
<tr>
<td><code>system_type</code></td>
<td></td>
</tr>
<tr>
<td><code>system_type_display_name</code></td>
<td></td>
</tr>
<tr>
<td><code>warnings</code></td>
<td></td>
</tr>
<tr>
<td><code>workspace_id</code></td>
<td>ID of the [workspace](https://docs.seam.co/latest/core-concepts/workspaces) that contains the &#x60;acs_system&#x60;.</td>
</tr>
</tbody>
</table>
Expand Down
53 changes: 11 additions & 42 deletions src/lib/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ interface TemplateContext {
}>
}

export function setFileContext(file: Partial<TemplateContext>): void {
export function setFileContext(
file: Partial<TemplateContext>,
blueprint: any,
): void {
if (file.endpoint != null) {
file.description = file.endpoint.description ?? ''
file.title = file.endpoint.title ?? ''
Expand All @@ -51,51 +54,17 @@ export function setFileContext(file: Partial<TemplateContext>): void {
})) ?? [],
}

const defaultResponseProperties =
blueprint.resources?.acs_system?.properties.map((property: any) => ({
name: property.name,
description: property.description,
})) ?? []

file.response = {
description:
file.endpoint.response?.description ??
'Returns an `acs_systems` array, in which each returned `acs_system` contains the following properties:',
properties: [
{
name: 'acs_system_id',
description: 'ID of the access control system',
},
{ name: 'name', description: 'Name of the access control system' },
{
name: 'workspace_id',
description:
'ID of the workspace that contains the access control system',
},
{
name: 'created_at',
description:
'Date and time at which the access control system was created',
},
{
name: 'external_type',
description:
'Brand-specific terminology for the access control system type',
},
{
name: 'external_type_display_name',
description:
'Display name that corresponds to the brand-specific terminology for the access control system type',
},
{
name: 'connected_account_ids',
description:
'Array of connected account IDs associated with the access control system',
},
{
name: 'image_url',
description:
'URL for the image that represents the access control system',
},
{
name: 'image_alt_text',
description: 'Alternative text for the access control system image',
},
],
properties: defaultResponseProperties,
}

file.codeSamples =
Expand Down
33 changes: 31 additions & 2 deletions src/lib/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const reference = (
const file = files[k] as Partial<TemplateContext>
file.layout = 'api-reference.hbs'
file.endpoint = endpoint
setFileContext(file)
setFileContext(file, metadata)

for (const sdk of sdks) {
const k = `sdk/${sdk}${endpoint.path}.md`
Expand All @@ -30,7 +30,7 @@ export const reference = (
const file = files[k] as Partial<TemplateContext>
file.layout = 'sdk-reference.hbs'
file.endpoint = endpoint
setFileContext(file)
setFileContext(file, metadata)
}
}
}
Expand All @@ -40,4 +40,33 @@ interface TemplateContext {
layout: string
endpoint: Endpoint
endpointJson?: string
description?: string
title?: string
path?: string
request?: {
preferredMethod?: string
parameters?: Array<{
name: string
required?: boolean
description?: string
}>
}
response?: {
description: string
properties: Array<{
name: string
description: string
}>
}
codeSamples?: Array<{
title: string
description: string
code: Record<
string,
{
request: string
response: string
}
>
}>
}

0 comments on commit 42a1825

Please sign in to comment.