Skip to content

Commit 38ff400

Browse files
committed
Generate int parameters using the blueprint isInt flag
Upgrade @seamapi/blueprint to 0.57.0 and map integer request parameters to the PHP int type instead of float. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H
1 parent 018733d commit 38ff400

5 files changed

Lines changed: 24 additions & 17 deletions

File tree

codegen/lib/map-php-type.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
// Maps a blueprint JSON type to the PHP type used in generated declarations.
22

3+
import type { Parameter } from '@seamapi/blueprint'
4+
5+
export const getParameterPhpType = (parameter: Parameter): string =>
6+
parameter.format === 'number' && parameter.isInt
7+
? 'int'
8+
: getPhpType(parameter.jsonType)
9+
310
export const getPhpType = (jsonType: string): string => {
411
switch (jsonType) {
512
case 'string':

codegen/lib/routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type Metalsmith from 'metalsmith'
1111
import type { PhpClient, PhpClientMethod } from './class-model.js'
1212
import { setObjectLayoutContext } from './layouts/object.js'
1313
import { setSeamClientLayoutContext } from './layouts/seam-client.js'
14-
import { getPhpType } from './map-php-type.js'
14+
import { getParameterPhpType } from './map-php-type.js'
1515
import { createResourceObjectModel } from './resource-model.js'
1616

1717
interface Metadata {
@@ -118,7 +118,7 @@ const createClientMethod = (endpoint: Endpoint): PhpClientMethod => {
118118
.filter((parameter) => !parameter.isUndocumented)
119119
.map((parameter) => ({
120120
name: parameter.name,
121-
type: getPhpType(parameter.jsonType),
121+
type: getParameterPhpType(parameter),
122122
required: parameter.isRequired,
123123
// The primary identifier of a get endpoint always sorts first in the
124124
// method signature.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"devDependencies": {
1818
"@prettier/plugin-php": "^0.24.0",
19-
"@seamapi/blueprint": "^0.56.0",
19+
"@seamapi/blueprint": "^0.57.0",
2020
"@seamapi/smith": "^0.5.2",
2121
"@seamapi/types": "1.964.0",
2222
"change-case": "^5.4.4",

src/SeamClient.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ public function pull_backup_access_code(string $access_code_id): AccessCode
490490

491491
public function report_device_constraints(
492492
string $device_id,
493-
?float $max_code_length = null,
494-
?float $min_code_length = null,
493+
?int $max_code_length = null,
494+
?int $min_code_length = null,
495495
?array $supported_code_lengths = null,
496496
): void {
497497
$request_payload = [];
@@ -2266,7 +2266,7 @@ public function list(
22662266
?string $acs_system_id = null,
22672267
?string $connected_account_id = null,
22682268
?string $customer_key = null,
2269-
?float $limit = null,
2269+
?int $limit = null,
22702270
?string $location_id = null,
22712271
?string $page_cursor = null,
22722272
?string $search = null,
@@ -2602,7 +2602,7 @@ public function get(
26022602
public function list(
26032603
?string $acs_system_id = null,
26042604
?string $created_before = null,
2605-
?float $limit = null,
2605+
?int $limit = null,
26062606
?string $page_cursor = null,
26072607
?string $search = null,
26082608
?string $user_identity_email_address = null,
@@ -2857,7 +2857,7 @@ public function get(string $action_attempt_id): ActionAttempt
28572857
public function list(
28582858
?array $action_attempt_ids = null,
28592859
?string $device_id = null,
2860-
?float $limit = null,
2860+
?int $limit = null,
28612861
?string $page_cursor = null,
28622862
?callable $on_response = null,
28632863
): array {
@@ -3338,7 +3338,7 @@ public function get(
33383338
public function list(
33393339
mixed $custom_metadata_has = null,
33403340
?string $customer_key = null,
3341-
?float $limit = null,
3341+
?int $limit = null,
33423342
?string $page_cursor = null,
33433343
?string $search = null,
33443344
?string $space_id = null,
@@ -6087,7 +6087,7 @@ public function create(
60876087
string $ends_at,
60886088
string $starts_at,
60896089
?bool $is_override_allowed = null,
6090-
?float $max_override_period_minutes = null,
6090+
?int $max_override_period_minutes = null,
60916091
?string $name = null,
60926092
): ThermostatSchedule {
60936093
$request_payload = [];
@@ -6191,7 +6191,7 @@ public function update(
61916191
?string $climate_preset_key = null,
61926192
?string $ends_at = null,
61936193
?bool $is_override_allowed = null,
6194-
?float $max_override_period_minutes = null,
6194+
?int $max_override_period_minutes = null,
61956195
?string $name = null,
61966196
?string $starts_at = null,
61976197
): void {
@@ -6467,7 +6467,7 @@ public function grant_access_to_device(
64676467
public function list(
64686468
?string $created_before = null,
64696469
?string $credential_manager_acs_system_id = null,
6470-
?float $limit = null,
6470+
?int $limit = null,
64716471
?string $page_cursor = null,
64726472
?string $search = null,
64736473
?array $user_identity_ids = null,
@@ -6682,7 +6682,7 @@ public function get(string $user_identity_id): void
66826682

66836683
public function list(
66846684
?string $created_before = null,
6685-
?float $limit = null,
6685+
?int $limit = null,
66866686
?string $page_cursor = null,
66876687
?string $search = null,
66886688
?callable $on_response = null,

0 commit comments

Comments
 (0)