Skip to content

Commit 6722b5a

Browse files
razor-xseambot
andauthored
Add default title for all paths (#748)
* Rename codegen script to generate * Add default path title for all paths * ci: Generate docs * ci: Generate docs * Remove untitled namespaces and routes from report * Fix linter error * ci: Generate docs * Fix type error * ci: Generate docs --------- Co-authored-by: Seam Bot <[email protected]>
1 parent bbd8ab0 commit 6722b5a

File tree

13 files changed

+868
-106
lines changed

13 files changed

+868
-106
lines changed

.github/workflows/generate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
max_attempts: 3
5959
retry_wait_seconds: 1
6060
timeout_minutes: 2
61-
command: npm run codegen
61+
command: npm run generate
6262
- name: Commit
6363
uses: stefanzweifel/git-auto-commit-action@v5
6464
with:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ $ git clone https://github.com/seamapi/docs.git
6767
$ cd docs
6868
$ nvm install
6969
$ npm install
70-
$ npm run codegen
70+
$ npm run generate
7171
```
7272

7373
Primary development tasks are defined under `scripts` in `package.json`

codegen/data/paths.yaml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,12 @@
1818
3. Create `acs_credential`s, which are the digital means of granting access to users, such as PIN codes, mobile keys, and plastic (RFID) cards.
1919
If you are developing a mobile app to provide access for your users, you can also use [Seam's iOS and Android SDKs](https://docs.seam.co/latest/capability-guides/mobile-access/mobile-device-sdks) that pair with the Seam API to create and manage mobile keys.
2020
21-
/acs/systems:
22-
title: Systems
23-
2421
/acs/users:
2522
title: ACS Users
2623

27-
/acs/entrances:
28-
title: Entrances
29-
30-
/acs/access_groups:
31-
title: Access Groups
32-
33-
/acs/credentials:
34-
title: Credentials
35-
36-
/acs/encoders:
37-
title: Encoders
38-
3924
/acs/encoders/simulate:
4025
title: Encoder Simulations
4126

42-
/phones:
43-
title: Phones
44-
4527
/phones/simulate:
4628
title: Phone Simulations
4729

@@ -99,15 +81,9 @@
9981
10082
---
10183
102-
/noise_sensors/noise_thresholds:
103-
title: Noise Thresholds
104-
10584
/noise_sensors/simulate:
10685
title: Noise Sensor Simulations
10786

108-
/user_identities:
109-
title: User Identities
110-
11187
/access_codes:
11288
title: Access Codes
11389
include_groups:
@@ -135,28 +111,10 @@
135111
title: Spaces
136112
alpha: "**Early Access Preview.** The spaces API is currently in Alpha. We're actively developing it and seeking early feedback at [[email protected]](mailto:[email protected]). Expect breaking changes as we refine the design."
137113

138-
/connected_accounts:
139-
title: Connected Accounts
140-
141114
/customers:
142115
title: Customers
143116
alpha: "**Early Access Preview.** The customers API is currently in Alpha. We're actively developing it and seeking early feedback at [[email protected]](mailto:[email protected]). Expect breaking changes as we refine the design."
144117

145-
/client_sessions:
146-
title: Client Sessions
147-
148-
/connect_webviews:
149-
title: Connect Webviews
150-
151-
/webhooks:
152-
title: Webhooks
153-
154-
/workspaces:
155-
title: Workspaces
156-
157-
/devices:
158-
title: Devices
159-
160118
/devices/unmanaged:
161119
title: Unmanaged Devices
162120

@@ -200,6 +158,3 @@
200158
201159
/locks/simulate:
202160
title: Lock Simulations
203-
204-
/instant_keys:
205-
title: Instant Keys

codegen/layouts/report.hbs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,6 @@
22
{{#if (or noTitle.routes.length noTitle.endpoints.length noTitle.namespaces.length )}}
33

44
## Untitled
5-
{{#if noTitle.namespaces.length }}
6-
7-
### Namespaces
8-
9-
{{#each noTitle.namespaces}}
10-
- `{{name}}`
11-
{{/each}}
12-
{{/if}}
13-
{{#if noTitle.routes.length }}
14-
15-
### Routes
16-
17-
{{#each noTitle.routes}}
18-
- `{{name}}`
19-
{{/each}}
20-
{{/if}}
215
{{#if noTitle.endpoints.length }}
226

237
### Endpoints

codegen/lib/reference.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { Blueprint, Endpoint } from '@seamapi/blueprint'
22
import type Metalsmith from 'metalsmith'
33

4+
import { toCapitalCase } from 'lib/handlebars/helpers.js'
5+
46
import {
57
type ApiEndpointLayoutContext,
68
type ApiNamespaceLayoutContext,
@@ -42,6 +44,13 @@ export const reference = (
4244

4345
const { blueprint } = metadata
4446

47+
for (const { path, name } of [...blueprint.routes, ...blueprint.namespaces]) {
48+
if (path in pathMetadata) continue
49+
pathMetadata[path] = PathMetadataSchema.valueSchema.parse({
50+
title: toCapitalCase(name),
51+
})
52+
}
53+
4554
const { resources } = blueprint
4655

4756
const namespaces = blueprint.namespaces.filter(

codegen/lib/report.ts

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import type {
1212
import { openapi } from '@seamapi/types/connect'
1313
import type Metalsmith from 'metalsmith'
1414

15-
import { PathMetadataSchema } from './path-metadata.js'
16-
1715
const defaultDeprecatedMessage = 'No deprecated message provided'
1816
const defaultDraftMessage = 'No draft message provided'
1917
const defaultUndocumentedMessage = 'No undocumented message provided'
@@ -108,24 +106,12 @@ function generateReport(metadata: Metadata): Report {
108106
},
109107
}
110108

111-
const pathMetadata =
112-
'pathMetadata' in metadata
113-
? PathMetadataSchema.parse(metadata.pathMetadata)
114-
: {}
115-
116109
const routes = blueprint.routes ?? []
117110
for (const route of routes) {
118-
processRoute(route, report, metadata)
111+
processRoute(route, report)
119112
}
120113

121114
for (const namespace of blueprint.namespaces ?? []) {
122-
if (
123-
!namespace.isUndocumented &&
124-
pathMetadata[namespace.path]?.title == null
125-
) {
126-
addUntitledNamespaceToReport(namespace.path, report)
127-
}
128-
129115
processNamespace(namespace, report)
130116
}
131117

@@ -267,7 +253,7 @@ function processProperty(
267253
}
268254
}
269255

270-
function processRoute(route: Route, report: Report, metadata: Metadata): void {
256+
function processRoute(route: Route, report: Report): void {
271257
if (route.isUndocumented) {
272258
report.undocumented.routes.push({
273259
name: route.path,
@@ -289,30 +275,11 @@ function processRoute(route: Route, report: Report, metadata: Metadata): void {
289275
})
290276
}
291277

292-
const pathMetadata =
293-
'pathMetadata' in metadata
294-
? PathMetadataSchema.parse(metadata.pathMetadata)
295-
: {}
296-
297-
if (pathMetadata[route.path]?.title == null && !route.isUndocumented) {
298-
report.noTitle.routes.push({ name: route.path })
299-
}
300-
301-
// TODO: route description
302-
303278
for (const endpoint of route.endpoints) {
304279
processEndpoint(endpoint, report)
305280
}
306281
}
307282

308-
const addUntitledNamespaceToReport = (
309-
namespace: string,
310-
report: Report,
311-
): void => {
312-
if (report.noTitle.namespaces.some((n) => n.name === namespace)) return
313-
report.noTitle.namespaces.push({ name: namespace })
314-
}
315-
316283
function processNamespace(namespace: Namespace, report: Report): void {
317284
const addNamespace = (section: ReportItem[], reason: string): void => {
318285
if (section.some((item) => item.name === namespace.path)) return

docs/SUMMARY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@
326326
* [Set to Off Mode](api/thermostats/off.md)
327327
* [Update a Climate Preset](api/thermostats/update_climate_preset.md)
328328
* [Update the Thermostat Weekly Program](api/thermostats/update_weekly_program.md)
329+
* [Daily Programs](api/thermostats/daily_programs/README.md)
330+
* [Create a Thermostat Daily Program](api/thermostats/daily_programs/create.md)
331+
* [Delete a Thermostat Daily Program](api/thermostats/daily_programs/delete.md)
332+
* [Update a Thermostat Daily Program](api/thermostats/daily_programs/update.md)
329333
* [Thermostat Schedules](api/thermostats/schedules/README.md)
330334
* [Create a Thermostat Schedule](api/thermostats/schedules/create.md)
331335
* [Delete a Thermostat Schedule](api/thermostats/schedules/delete.md)

docs/api/_report.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# Documentation Report
22

3-
## Untitled
4-
5-
### Routes
6-
7-
- `/thermostats/daily_programs`
8-
93
## Undocumented
104

115
These items are intentionally undocumented.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Daily Programs
2+
3+
## The thermostat_daily_program Object
4+
5+
- [Properties](./#properties)
6+
- [Endpoints](./#endpoints)
7+
8+
9+
Represents a thermostat daily program, consisting of a set of periods, each of which has a starting time and the key that identifies the climate preset to apply at the starting time.
10+
11+
{% tabs %}
12+
{% tab title="Thermostat Daily Program" %}
13+
14+
A thermostat daily program resource.
15+
16+
```json
17+
{
18+
"created_at": "2025-06-14T16:54:17.946642Z",
19+
"device_id": "58437d45-47ac-4ee6-ab27-7b2d1f2947d1",
20+
"name": "Weekday Program",
21+
"periods": [
22+
{ "starts_at_time": "07:00:00", "climate_preset_key": "Home" },
23+
{ "starts_at_time": "09:00:00", "climate_preset_key": "Away" },
24+
{ "starts_at_time": "16:00:00", "climate_preset_key": "Home" },
25+
{ "starts_at_time": "22:30:00", "climate_preset_key": "Sleep" }
26+
],
27+
"thermostat_daily_program_id": "ab8ef74c-c7cd-4100-aa32-0ef960c0080d",
28+
"workspace_id": "8da8d923-e55b-45cd-84a3-6c96b3d3d454"
29+
}
30+
```
31+
{% endtab %}
32+
{% endtabs %}
33+
34+
---
35+
## Properties
36+
37+
**`created_at`** *Datetime*
38+
39+
Date and time at which the thermostat daily program was created.
40+
41+
42+
43+
44+
---
45+
46+
**`device_id`** *UUID*
47+
48+
ID of the thermostat device on which the thermostat daily program is configured.
49+
50+
51+
52+
53+
---
54+
55+
**`name`** *String*
56+
57+
User-friendly name to identify the thermostat daily program.
58+
59+
60+
61+
62+
---
63+
64+
**`periods`** *List* *of Objects*
65+
66+
Array of thermostat daily program periods.
67+
68+
69+
70+
<details>
71+
<summary>Child Object Properties</summary>
72+
<strong><code>climate_preset_key</code></strong> <i>String</i>
73+
74+
Key of the [climate preset](../../../capability-guides/thermostats/creating-and-managing-climate-presets/README.md) to activate at the `starts_at_time`.
75+
76+
<strong><code>starts_at_time</code></strong> <i>String</i>
77+
78+
Time at which the thermostat daily program period starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
79+
80+
</details>
81+
82+
---
83+
84+
**`thermostat_daily_program_id`** *UUID*
85+
86+
ID of the thermostat daily program.
87+
88+
89+
90+
91+
---
92+
93+
**`workspace_id`** *UUID*
94+
95+
ID of the [workspace](../../../core-concepts/workspaces/README.md) that contains the thermostat daily program.
96+
97+
98+
99+
100+
---
101+
102+
## Endpoints
103+
104+
105+
[**`/thermostats/daily_programs/create`**](./create.md)
106+
107+
Creates a new thermostat daily program. A daily program consists of a set of periods, where each period includes a start time and the key of a configured climate preset. Once you have defined a daily program, you can assign it to one or more days within a weekly program.
108+
109+
110+
[**`/thermostats/daily_programs/delete`**](./delete.md)
111+
112+
Deletes a thermostat daily program.
113+
114+
115+
[**`/thermostats/daily_programs/update`**](./update.md)
116+
117+
Updates a specified thermostat daily program. The periods that you specify overwrite any existing periods for the daily program.
118+
119+

0 commit comments

Comments
 (0)