From 914a6fe5757033a929dead59a9de832b03cd65b0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Jul 2026 14:53:47 +0000 Subject: [PATCH 1/5] Generate the PHP SDK from the blueprint only Remove all the temporary output-parity workarounds and their TODOs from the codegen. The generator no longer parses the OpenAPI spec: resource object classes, client classes, and methods are all derived from @seamapi/blueprint. Events, action attempts, and discriminated object lists are merged into single classes; nested namespaces are now wired to their parent clients; the parameter sort precedence bug is fixed; and integer parameters map to float instead of mixed. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H --- codegen/layouts/seam-client.hbs | 1 - codegen/lib/class-model.ts | 26 +- codegen/lib/endpoint-rules.ts | 13 - codegen/lib/layouts/object.ts | 130 +++------ codegen/lib/layouts/seam-client.ts | 7 +- codegen/lib/map-php-type.ts | 17 +- .../deep-extract-resource-object-schemas.ts | 193 ------------- .../deep-flatten-one-of-and-all-of-schema.ts | 138 ---------- codegen/lib/openapi/flatten-obj-schema.ts | 129 --------- codegen/lib/openapi/get-filtered-routes.ts | 23 -- .../get-parameter-and-response-schema.ts | 139 ---------- .../map-parent-to-children-resource.ts | 39 --- codegen/lib/openapi/types.ts | 74 ----- codegen/lib/resource-model.ts | 148 ++++++++++ codegen/lib/routes.ts | 257 +++++++----------- src/Objects/AccessCode.php | 90 +++--- src/Objects/AccessCodeErrors.php | 10 +- src/Objects/AccessCodeFrom.php | 4 + src/Objects/AccessCodeModifiedFields.php | 4 +- src/Objects/AccessCodePendingMutations.php | 12 +- src/Objects/AccessCodeTo.php | 4 + src/Objects/AccessCodeWarnings.php | 10 +- src/Objects/AccessGrant.php | 62 ++--- src/Objects/AccessGrantErrors.php | 12 +- src/Objects/AccessGrantFailedDevices.php | 12 +- src/Objects/AccessGrantFrom.php | 2 + src/Objects/AccessGrantPendingMutations.php | 22 +- .../AccessGrantRequestedAccessMethods.php | 18 +- src/Objects/AccessGrantTo.php | 4 + src/Objects/AccessGrantWarnings.php | 14 +- src/Objects/AccessMethod.php | 50 ++-- src/Objects/AccessMethodErrors.php | 12 +- src/Objects/AccessMethodFrom.php | 2 + src/Objects/AccessMethodPendingMutations.php | 22 +- src/Objects/AccessMethodTo.php | 2 + src/Objects/AccessMethodWarnings.php | 12 +- src/Objects/AcsAccessGroup.php | 62 +++-- src/Objects/AcsAccessGroupAccessSchedule.php | 4 +- src/Objects/AcsAccessGroupErrors.php | 12 +- src/Objects/AcsAccessGroupFrom.php | 16 +- .../AcsAccessGroupPendingMutations.php | 12 +- src/Objects/AcsAccessGroupTo.php | 16 +- src/Objects/AcsAccessGroupWarnings.php | 12 +- src/Objects/AcsCredential.php | 76 +++--- src/Objects/AcsCredentialErrors.php | 10 +- src/Objects/AcsCredentialPool.php | 29 +- .../AcsCredentialProvisioningAutomation.php | 22 +- src/Objects/AcsCredentialWarnings.php | 12 +- src/Objects/AcsEncoder.php | 24 +- src/Objects/AcsEncoderErrors.php | 12 +- src/Objects/AcsEntrance.php | 44 +-- src/Objects/AcsEntranceErrors.php | 10 +- src/Objects/AcsEntranceVisionlineMetadata.php | 2 +- src/Objects/AcsEntranceWarnings.php | 12 +- src/Objects/AcsSystem.php | 64 ++--- src/Objects/AcsSystemErrors.php | 12 +- src/Objects/AcsSystemWarnings.php | 12 +- src/Objects/AcsUser.php | 58 ++-- src/Objects/AcsUserAccessSchedule.php | 4 +- src/Objects/AcsUserErrors.php | 12 +- src/Objects/AcsUserFrom.php | 22 +- src/Objects/AcsUserPendingMutations.php | 16 +- src/Objects/AcsUserTo.php | 22 +- src/Objects/AcsUserWarnings.php | 12 +- src/Objects/ActionAttempt.php | 6 +- .../ActionAttemptAcsCredentialOnEncoder.php | 35 +++ .../ActionAttemptAcsCredentialOnSeam.php | 93 +++++++ .../ActionAttemptAssaAbloyVostioMetadata.php | 32 +++ src/Objects/ActionAttemptError.php | 10 +- src/Objects/ActionAttemptErrors.php | 22 ++ src/Objects/ActionAttemptFrom.php | 22 ++ src/Objects/ActionAttemptPendingMutations.php | 31 +++ src/Objects/ActionAttemptResult.php | 129 +++++++++ src/Objects/ActionAttemptTo.php | 22 ++ .../ActionAttemptVisionlineMetadata.php | 43 +++ src/Objects/ActionAttemptWarnings.php | 24 ++ src/Objects/Batch.php | 56 ++-- src/Objects/BridgeClientSession.php | 38 +-- src/Objects/BridgeClientSessionErrors.php | 12 +- src/Objects/BridgeConnectedSystems.php | 33 +-- src/Objects/ClientSession.php | 40 +-- src/Objects/ConnectWebview.php | 65 ++--- src/Objects/ConnectedAccount.php | 45 +-- src/Objects/ConnectedAccountErrors.php | 12 +- .../ConnectedAccountSaltoKsMetadata.php | 2 +- src/Objects/ConnectedAccountSites.php | 4 +- src/Objects/ConnectedAccountWarnings.php | 12 +- src/Objects/Customer.php | 12 +- src/Objects/CustomerPortal.php | 20 +- src/Objects/CustomizationProfile.php | 16 +- src/Objects/Device.php | 66 ++--- src/Objects/DeviceAccessoryKeypad.php | 4 +- .../DeviceActiveThermostatSchedule.php | 32 +-- src/Objects/DeviceAppearance.php | 4 +- ...viceAssaAbloyCredentialServiceMetadata.php | 2 +- src/Objects/DeviceAvailableClimatePresets.php | 25 +- src/Objects/DeviceBattery.php | 4 +- src/Objects/DeviceCodeConstraints.php | 4 +- src/Objects/DeviceDeviceManufacturer.php | 8 +- src/Objects/DeviceDeviceProvider.php | 12 +- .../DeviceDormakabaOracodeMetadata.php | 8 +- src/Objects/DeviceErrors.php | 12 +- src/Objects/DeviceKeynestMetadata.php | 40 +-- src/Objects/DeviceKeypadBattery.php | 4 +- src/Objects/DeviceKisiMetadata.php | 4 +- src/Objects/DeviceKorelockMetadata.php | 4 +- src/Objects/DeviceModel.php | 8 +- src/Objects/DeviceOfflineTimeFrameOptions.php | 6 +- src/Objects/DeviceOmnitecMetadata.php | 4 +- src/Objects/DeviceOnlineTimeFrameOptions.php | 6 +- src/Objects/DevicePeriods.php | 8 +- src/Objects/DeviceProperties.php | 42 +-- src/Objects/DeviceProvider.php | 16 +- src/Objects/DeviceSensiMetadata.php | 3 - src/Objects/DeviceThermostatDailyPrograms.php | 21 +- src/Objects/DeviceThermostatWeeklyProgram.php | 4 +- src/Objects/DeviceTimePairs.php | 12 +- src/Objects/DeviceTtlockMetadata.php | 4 +- src/Objects/DeviceWarnings.php | 16 +- src/Objects/EnrollmentAutomation.php | 21 +- src/Objects/Event.php | 40 +-- src/Objects/EventAccessCodeErrors.php | 12 +- src/Objects/EventAccessCodeWarnings.php | 12 +- src/Objects/EventAcsSystemErrors.php | 12 +- src/Objects/EventAcsSystemWarnings.php | 12 +- src/Objects/EventChangedProperties.php | 4 +- src/Objects/EventConnectedAccountErrors.php | 12 +- src/Objects/EventConnectedAccountWarnings.php | 12 +- src/Objects/EventDeviceErrors.php | 12 +- src/Objects/EventDeviceWarnings.php | 12 +- src/Objects/EventFrom.php | 4 + src/Objects/EventReason.php | 8 +- src/Objects/EventRequestedMutations.php | 4 +- src/Objects/EventTo.php | 4 + src/Objects/InstantKey.php | 28 +- src/Objects/MagicLink.php | 20 +- src/Objects/NoiseThreshold.php | 24 +- src/Objects/Pagination.php | 24 -- src/Objects/Phone.php | 32 ++- ...honeAssaAbloyCredentialServiceMetadata.php | 2 +- src/Objects/PhoneErrors.php | 10 +- src/Objects/PhoneRegistration.php | 26 -- src/Objects/PhoneSession.php | 16 +- src/Objects/PhoneSessionAcsCredentials.php | 80 +++--- src/Objects/PhoneSessionAcsEntrances.php | 44 +-- src/Objects/PhoneSessionErrors.php | 10 +- src/Objects/PhoneSessionPhoneRegistration.php | 10 +- src/Objects/PhoneSessionProviderSessions.php | 10 +- src/Objects/PhoneSessionUserIdentity.php | 32 +-- .../PhoneSessionVisionlineMetadata.php | 2 +- src/Objects/PhoneSessionWarnings.php | 12 +- src/Objects/PhoneWarnings.php | 10 +- src/Objects/Space.php | 36 +-- src/Objects/SpaceGeolocation.php | 9 +- src/Objects/StaffMember.php | 8 +- src/Objects/ThermostatDailyProgram.php | 21 +- src/Objects/ThermostatDailyProgramPeriods.php | 8 +- src/Objects/ThermostatSchedule.php | 32 +-- src/Objects/ThermostatScheduleErrors.php | 10 +- src/Objects/UnmanagedAccessCode.php | 52 ++-- src/Objects/UnmanagedAccessCodeErrors.php | 10 +- .../UnmanagedAccessCodeModifiedFields.php | 4 +- src/Objects/UnmanagedAccessCodeWarnings.php | 10 +- src/Objects/UnmanagedAcsAccessGroup.php | 62 +++-- .../UnmanagedAcsAccessGroupAccessSchedule.php | 4 +- src/Objects/UnmanagedAcsAccessGroupErrors.php | 12 +- src/Objects/UnmanagedAcsAccessGroupFrom.php | 16 +- ...nmanagedAcsAccessGroupPendingMutations.php | 12 +- src/Objects/UnmanagedAcsAccessGroupTo.php | 16 +- .../UnmanagedAcsAccessGroupWarnings.php | 12 +- src/Objects/UnmanagedAcsCredential.php | 76 +++--- src/Objects/UnmanagedAcsCredentialErrors.php | 10 +- .../UnmanagedAcsCredentialWarnings.php | 12 +- src/Objects/UnmanagedAcsUser.php | 58 ++-- .../UnmanagedAcsUserAccessSchedule.php | 4 +- src/Objects/UnmanagedAcsUserErrors.php | 12 +- src/Objects/UnmanagedAcsUserFrom.php | 22 +- .../UnmanagedAcsUserPendingMutations.php | 16 +- src/Objects/UnmanagedAcsUserTo.php | 22 +- src/Objects/UnmanagedAcsUserWarnings.php | 12 +- src/Objects/UnmanagedDevice.php | 58 ++-- .../UnmanagedDeviceAccessoryKeypad.php | 4 +- src/Objects/UnmanagedDeviceBattery.php | 4 +- src/Objects/UnmanagedDeviceErrors.php | 12 +- src/Objects/UnmanagedDeviceModel.php | 8 +- src/Objects/UnmanagedDeviceProperties.php | 14 +- src/Objects/UnmanagedDeviceWarnings.php | 16 +- src/Objects/UserIdentity.php | 32 +-- src/Objects/UserIdentityErrors.php | 20 +- src/Objects/UserIdentityWarnings.php | 12 +- src/Objects/Webhook.php | 8 +- src/Objects/Workspace.php | 41 +-- src/SeamClient.php | 82 ++++-- 193 files changed, 2450 insertions(+), 2566 deletions(-) delete mode 100644 codegen/lib/endpoint-rules.ts delete mode 100644 codegen/lib/openapi/deep-extract-resource-object-schemas.ts delete mode 100644 codegen/lib/openapi/deep-flatten-one-of-and-all-of-schema.ts delete mode 100644 codegen/lib/openapi/flatten-obj-schema.ts delete mode 100644 codegen/lib/openapi/get-filtered-routes.ts delete mode 100644 codegen/lib/openapi/get-parameter-and-response-schema.ts delete mode 100644 codegen/lib/openapi/map-parent-to-children-resource.ts delete mode 100644 codegen/lib/openapi/types.ts create mode 100644 codegen/lib/resource-model.ts create mode 100644 src/Objects/ActionAttemptAcsCredentialOnEncoder.php create mode 100644 src/Objects/ActionAttemptAcsCredentialOnSeam.php create mode 100644 src/Objects/ActionAttemptAssaAbloyVostioMetadata.php create mode 100644 src/Objects/ActionAttemptErrors.php create mode 100644 src/Objects/ActionAttemptFrom.php create mode 100644 src/Objects/ActionAttemptPendingMutations.php create mode 100644 src/Objects/ActionAttemptResult.php create mode 100644 src/Objects/ActionAttemptTo.php create mode 100644 src/Objects/ActionAttemptVisionlineMetadata.php create mode 100644 src/Objects/ActionAttemptWarnings.php delete mode 100644 src/Objects/Pagination.php delete mode 100644 src/Objects/PhoneRegistration.php diff --git a/codegen/layouts/seam-client.hbs b/codegen/layouts/seam-client.hbs index db4038bb..320a9b8f 100644 --- a/codegen/layouts/seam-client.hbs +++ b/codegen/layouts/seam-client.hbs @@ -63,7 +63,6 @@ class SeamClient ]; $options = array_filter($options, fn($option) => $option !== null); - // TODO handle request errors $response = $this->client->request($method, $path, $options); $status_code = $response->getStatusCode(); $request_id = $response->getHeaderLine("seam-request-id"); diff --git a/codegen/lib/class-model.ts b/codegen/lib/class-model.ts index d5ed5ed3..0cf63600 100644 --- a/codegen/lib/class-model.ts +++ b/codegen/lib/class-model.ts @@ -1,7 +1,5 @@ -// Ported from @seamapi/nextlove-sdk-generator -// lib/generate-php-sdk/utils/php-client.ts. Holds the data previously carried -// by the nextlove PhpClient; all string serialization moved to the Handlebars -// layouts and their context builders. +// Data model for the generated resource client classes. All string +// serialization lives in the Handlebars layouts and their context builders. export interface PhpClientMethodParameter { name: string @@ -32,20 +30,12 @@ export interface PhpClient { methods: PhpClientMethod[] } -// Verbatim port of the nextlove parameter comparator. The original expression -// `(a.position ?? a.required ? 1000 : 9999)` parses as -// `(a.position ?? a.required) ? 1000 : 9999`, so a parameter with position 0 -// is falsy and lands in the 9999 tier together with the optional parameters. -// Combined with a stable sort this yields: required parameters first (in -// schema order), then everything else (in schema order). -// TODO: Fix the operator precedence so position sorts a parameter first as -// originally intended, once generated output is allowed to change. Until then, -// do not "fix" it: the generated output must stay identical. +// Sorts parameters with an explicit position first, then required parameters, +// then everything else, keeping the schema order within each tier. export const sortPhpClientMethodParameters = ( parameters: PhpClientMethodParameter[], ): PhpClientMethodParameter[] => - [...parameters].sort( - (a, b) => - ((a.position ?? a.required) ? 1000 : 9999) - - ((b.position ?? b.required) ? 1000 : 9999), - ) + [...parameters].sort((a, b) => getParameterRank(a) - getParameterRank(b)) + +const getParameterRank = (parameter: PhpClientMethodParameter): number => + parameter.position ?? ((parameter.required ?? false) ? 1000 : 9999) diff --git a/codegen/lib/endpoint-rules.ts b/codegen/lib/endpoint-rules.ts deleted file mode 100644 index 28c45286..00000000 --- a/codegen/lib/endpoint-rules.ts +++ /dev/null @@ -1,13 +0,0 @@ -// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator -// lib/endpoint-rules.ts. This list only preserves legacy generated output: -// the ignored paths reproduce the previous endpoint filtering used when -// building the parent-to-child resource map. -// TODO: Delete this file once generated output is allowed to change; filter -// on blueprint undocumented flags instead. - -export const ignoredEndpointPaths = [ - '/health', - '/health/get_health', - '/health/get_service_health', - '/health/service/[service_name]', -] diff --git a/codegen/lib/layouts/object.ts b/codegen/lib/layouts/object.ts index a8c3d5db..85f03d9a 100644 --- a/codegen/lib/layouts/object.ts +++ b/codegen/lib/layouts/object.ts @@ -1,10 +1,14 @@ -// Builds the template context for resource object files (src/Objects/{Name}.php). -// Mirrors the nextlove generate-resource-object-class.ts serialization: the -// from_json body lines and the constructor parameter lines, each already -// sorted with the nextlove property comparator. - -import { getPhpType } from '../map-php-type.js' -import type { ExtractedResourceObjectSchema ,PropertySchemaWithReferenceObject } from '../openapi/deep-extract-resource-object-schemas.js' +// Builds the template context for resource object files (src/Objects/{Name}.php): +// the from_json body lines and the constructor parameter lines. +// +// The blueprint does not track which resource properties are required, so +// every property is optional: from_json falls back to null for missing values +// and the constructor parameters are nullable. + +import type { + ResourceObjectProperty, + ResourceObjectSchema, +} from '../resource-model.js' export interface ObjectLayoutContext { className: string @@ -12,103 +16,49 @@ export interface ObjectLayoutContext { constructorParams: string[] } -const compareProperties = ( - [propA, schemaA]: [string, PropertySchemaWithReferenceObject], - [propB, schemaB]: [string, PropertySchemaWithReferenceObject], - requiredPropertyNames: string[], -): number => { - const aRequired = requiredPropertyNames.includes(propA) - const bRequired = requiredPropertyNames.includes(propB) - const aNullable = 'nullable' in schemaA && schemaA.nullable === true - const bNullable = 'nullable' in schemaB && schemaB.nullable === true - - if (!aNullable !== !bNullable) return !aNullable ? -1 : 1 - if (aRequired !== bRequired) return aRequired ? -1 : 1 - return propA.localeCompare(propB) -} - -const isObjectReferencingResource = ( - schema: PropertySchemaWithReferenceObject, -): boolean => - 'type' in schema && - schema.type === 'object' && - 'referenceObjectTypeName' in schema +const generateFromJsonProp = (property: ResourceObjectProperty): string => { + const { name } = property -const isArrayReferencingResource = ( - schema: PropertySchemaWithReferenceObject, -): boolean => - 'type' in schema && - schema.type === 'array' && - 'referenceObjectTypeName' in schema - -const isPropertyRequired = ( - propName: string, - schema: PropertySchemaWithReferenceObject, - requiredPropertyNames: string[], -): boolean => - 'nullable' in schema - ? !(schema.nullable ?? false) - : requiredPropertyNames.includes(propName) - -const generateFromJsonProp = ( - propName: string, - schema: PropertySchemaWithReferenceObject, - requiredPropertyNames: string[], -): string => { - const required = isPropertyRequired(propName, schema, requiredPropertyNames) - const refName = - 'referenceObjectTypeName' in schema ? schema.referenceObjectTypeName : '' + switch (property.kind) { + case 'objectReference': + return `${name}: isset($json->${name}) ? ${property.referenceName}::from_json($json->${name}) : null,` - if (isObjectReferencingResource(schema)) { - return `${propName}: ${required ? '' : `isset($json->${propName}) ? `}${refName}::from_json($json->${propName})${required ? ',' : ' : null,'}` - } + case 'listReference': + return `${name}: array_map(fn ($${name[0]}) => ${property.referenceName}::from_json($${name[0]}), $json->${name} ?? []),` - if (isArrayReferencingResource(schema)) { - return `${propName}: array_map(fn ($${propName[0]}) => ${refName}::from_json($${propName[0]}), $json->${propName} ?? []),` + case 'value': + return `${name}: $json->${name} ?? null,` } - - return `${propName}: $json->${propName}${required ? ',' : ' ?? null,'}` } const generateConstructorParam = ( - propName: string, - schema: PropertySchemaWithReferenceObject, - requiredPropertyNames: string[], + property: ResourceObjectProperty, ): string => { - const phpType = isObjectReferencingResource(schema) - ? ((schema as { referenceObjectTypeName?: string }) - .referenceObjectTypeName ?? 'mixed') - : getPhpType('type' in schema ? schema.type : 'mixed') - const required = isPropertyRequired(propName, schema, requiredPropertyNames) - const nullSuffix = phpType === 'mixed' ? '' : required ? '' : ' | null' - - return `public ${phpType}${nullSuffix} $${propName},` + switch (property.kind) { + case 'objectReference': + return `public ${property.referenceName}|null $${property.name},` + + case 'listReference': + return `public array $${property.name},` + + case 'value': { + const { phpType } = property + const nullSuffix = phpType === 'mixed' ? '' : '|null' + return `public ${phpType}${nullSuffix} $${property.name},` + } + } } export const setObjectLayoutContext = ( - schema: ExtractedResourceObjectSchema, + schema: ResourceObjectSchema, ): ObjectLayoutContext => { - const { name, requiredPropertyNames } = schema - const properties = { ...schema.properties } - - // TODO: Remove this created_at injection once seam-connect is patched and - // generated output is allowed to change. The nextlove generator added a - // created_at string property to every Errors and Warnings resource class. - if (name.endsWith('Errors') || name.endsWith('Warnings')) { - properties['created_at'] = { type: 'string' } - } - - const sorted = Object.entries(properties).sort((a, b) => - compareProperties(a, b, requiredPropertyNames), + const sorted = [...schema.properties].sort((a, b) => + a.name.localeCompare(b.name), ) return { - className: name, - fromJsonProps: sorted.map(([propName, propSchema]) => - generateFromJsonProp(propName, propSchema, requiredPropertyNames), - ), - constructorParams: sorted.map(([propName, propSchema]) => - generateConstructorParam(propName, propSchema, requiredPropertyNames), - ), + className: schema.name, + fromJsonProps: sorted.map(generateFromJsonProp), + constructorParams: sorted.map(generateConstructorParam), } } diff --git a/codegen/lib/layouts/seam-client.ts b/codegen/lib/layouts/seam-client.ts index 6be84ca4..03514c41 100644 --- a/codegen/lib/layouts/seam-client.ts +++ b/codegen/lib/layouts/seam-client.ts @@ -1,7 +1,6 @@ -// Builds the template context for src/SeamClient.php. -// Mirrors the nextlove generate-seam-client.ts plus PhpClient#serialize: the -// SeamClient class with its parent client properties, and every resource -// client class with its methods. +// Builds the template context for src/SeamClient.php: the SeamClient class +// with its parent client properties, and every resource client class with its +// methods. import { type PhpClient, diff --git a/codegen/lib/map-php-type.ts b/codegen/lib/map-php-type.ts index 1cd8c280..3edf20d5 100644 --- a/codegen/lib/map-php-type.ts +++ b/codegen/lib/map-php-type.ts @@ -1,15 +1,7 @@ -// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator -// lib/generate-php-sdk/utils/get-php-type.ts. This is a frozen output-parity -// workaround: it exists only so the generated output stays byte-identical to -// the previous generator. Do not review, refactor, or improve it. Note the -// integer case is intentionally absent: it falls through to the default and -// maps to mixed, matching the previous generator (blueprint would collapse -// integer to number and produce float instead). -// TODO: Delete this file and derive types from @seamapi/blueprint parameter -// and resource properties once generated output is allowed to change. +// Maps a blueprint JSON type to the PHP type used in generated declarations. -export const getPhpType = (zodType: string | undefined): string => { - switch (zodType) { +export const getPhpType = (jsonType: string): string => { + switch (jsonType) { case 'string': return 'string' @@ -19,9 +11,6 @@ export const getPhpType = (zodType: string | undefined): string => { case 'boolean': return 'bool' - case 'object': - return 'mixed' - case 'array': return 'array' diff --git a/codegen/lib/openapi/deep-extract-resource-object-schemas.ts b/codegen/lib/openapi/deep-extract-resource-object-schemas.ts deleted file mode 100644 index 6d8de223..00000000 --- a/codegen/lib/openapi/deep-extract-resource-object-schemas.ts +++ /dev/null @@ -1,193 +0,0 @@ -// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator -// lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.ts. This is -// a frozen output-parity workaround: it exists only so the generated output -// stays byte-identical to the previous generator. Do not review, refactor, or -// improve it. Local identifiers were camelCased to satisfy lint, but the -// logic, including which nested object and array schemas are split into their -// own resource classes, is unchanged. -// TODO: Delete this file and use blueprint.resources (plus its nested -// property schemas) once generated output is allowed to change. - -import { pascalCase } from 'change-case' - -import { deepFlattenOneOfAndAllOfSchema } from './deep-flatten-one-of-and-all-of-schema.js' -import type { PropertySchema } from './types.js' - -export type PropertySchemaWithReferenceObject = - | PropertySchema - | { - type: 'object' | 'array' - referenceObjectTypeName?: string - nullable?: boolean - } - -export interface ExtractedResourceObjectSchema { - name: string - properties: Record - requiredPropertyNames: string[] -} - -interface DeepExtractParams { - schemaName: string - schemaBody: PropertySchema -} - -export function deepExtractResourceObjectSchemas({ - schemaName, - schemaBody, -}: DeepExtractParams): Record { - const extractedResourceObjectSchemas: Record< - string, - ExtractedResourceObjectSchema - > = {} - - const createResourceSchema = ({ - name, - properties, - requiredPropertyNames = [], - }: { - name: string - properties: Record - requiredPropertyNames?: string[] - }): void => { - if (extractedResourceObjectSchemas[name] == null) { - extractedResourceObjectSchemas[name] = { - name: pascalCase(name), - properties: processPropertySchemas(properties), - requiredPropertyNames, - } - } - } - - const processPropertySchemas = ( - propertySchemas: Record, - ): Record => { - const propertySchemasWithTypeReferences: Record< - string, - PropertySchemaWithReferenceObject - > = {} - - for (const propertyName in propertySchemas) { - const propertySchema = propertySchemas[propertyName] as any - const referenceObjectTypeName = pascalCase( - `${schemaName}_${propertyName}`, - ) - if ('$ref' in propertySchema) { - // eslint-disable-next-line no-console - console.error('$ref not currently supported when extracting schemas') - continue - } - - const isAllOfOrOneOfSchema = - 'allOf' in propertySchema || 'oneOf' in propertySchema - const isObjectSchema = - !isAllOfOrOneOfSchema && - propertySchema.type === 'object' && - 'properties' in propertySchema - const isArrayNonPrimitiveSchema = - !isAllOfOrOneOfSchema && - propertySchema.type === 'array' && - 'items' in propertySchema && - ('properties' in propertySchema.items || - 'allOf' in propertySchema.items || - 'oneOf' in propertySchema.items) - const isNullableSet = 'nullable' in propertySchema - - if (isObjectSchema) { - propertySchemasWithTypeReferences[propertyName] = { - type: 'object', - referenceObjectTypeName, - ...(isNullableSet && { nullable: propertySchema.nullable }), - } - - createResourceSchema({ - name: referenceObjectTypeName, - properties: propertySchema.properties, - requiredPropertyNames: propertySchema.required, - }) - } else if (isArrayNonPrimitiveSchema) { - propertySchemasWithTypeReferences[propertyName] = { - type: 'array', - referenceObjectTypeName, - ...(isNullableSet && { nullable: propertySchema.nullable }), - } - - let schemaProperties = propertySchema.items?.properties - let requiredSchemaPropertyNames = propertySchema.items?.required - - if ( - 'allOf' in propertySchema.items || - 'oneOf' in propertySchema.items - ) { - const flattenedSchema = deepFlattenOneOfAndAllOfSchema( - propertySchema.items, - ) as any - - schemaProperties = - 'properties' in flattenedSchema - ? flattenedSchema.properties - : flattenedSchema - requiredSchemaPropertyNames = - 'required' in flattenedSchema ? flattenedSchema.required : [] - } - - createResourceSchema({ - name: referenceObjectTypeName, - properties: schemaProperties, - requiredPropertyNames: requiredSchemaPropertyNames, - }) - } else if (isAllOfOrOneOfSchema) { - const flattenedSchema = deepFlattenOneOfAndAllOfSchema( - propertySchema, - ) as any - - if ('properties' in flattenedSchema) { - propertySchemasWithTypeReferences[propertyName] = { - type: flattenedSchema.type, - referenceObjectTypeName, - } - - createResourceSchema({ - name: referenceObjectTypeName, - properties: flattenedSchema.properties, - requiredPropertyNames: flattenedSchema.required, - }) - } else { - propertySchemasWithTypeReferences[propertyName] = flattenedSchema - } - continue - } else { - propertySchemasWithTypeReferences[propertyName] = { - type: propertySchema.type, - ...(isNullableSet && { nullable: propertySchema.nullable }), - } - } - } - - return propertySchemasWithTypeReferences - } - - const body = schemaBody as any - let baseResourceProperties: Record | undefined - - if ('allOf' in body || 'oneOf' in body) { - const flattenedBaseResourceSchema = deepFlattenOneOfAndAllOfSchema( - body, - ) as any - - baseResourceProperties = - 'properties' in flattenedBaseResourceSchema - ? flattenedBaseResourceSchema.properties - : {} - } - - baseResourceProperties ??= 'properties' in body ? body.properties : {} - - createResourceSchema({ - name: pascalCase(schemaName), - properties: baseResourceProperties ?? {}, - requiredPropertyNames: 'required' in body ? body.required : [], - }) - - return extractedResourceObjectSchemas -} diff --git a/codegen/lib/openapi/deep-flatten-one-of-and-all-of-schema.ts b/codegen/lib/openapi/deep-flatten-one-of-and-all-of-schema.ts deleted file mode 100644 index 3e585947..00000000 --- a/codegen/lib/openapi/deep-flatten-one-of-and-all-of-schema.ts +++ /dev/null @@ -1,138 +0,0 @@ -// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator -// lib/openapi/deep-flatten-one-of-and-all-of-schema.ts. This OpenAPI parsing -// is a frozen output-parity workaround: it exists only so the generated -// output stays byte-identical to the previous generator. Do not review, -// refactor, or improve it. -// TODO: Delete this file and use parameter formats from @seamapi/blueprint -// once generated output is allowed to change. - -import type { - AllOfSchema, - ArraySchema, - ObjSchema, - OneOfSchema, - PrimitiveSchema, - PropertySchema, -} from './types.js' - -export function deepFlattenOneOfAndAllOfSchema( - schema: PropertySchema, -): PropertySchema { - if ('oneOf' in schema) { - return flattenOneOf(schema) - } else if ('allOf' in schema) { - return flattenAllOf(schema) - } else if ( - 'type' in schema && - schema.type === 'object' && - schema.properties != null - ) { - return flattenObject(schema) - } else if ( - 'type' in schema && - schema.type === 'array' && - schema.items != null - ) { - return flattenArray(schema) - } else { - // For primitive types, return the schema as is - return schema - } -} - -function flattenOneOf(oneOfSchema: OneOfSchema): ObjSchema | PrimitiveSchema { - const flattenedSchema: ObjSchema = { - type: 'object', - properties: {}, - required: [], - } - - for (const subSchema of oneOfSchema.oneOf) { - const flattenedSubSchema = deepFlattenOneOfAndAllOfSchema(subSchema) - - // Check if the sub-schema is a primitive schema - if ('type' in flattenedSubSchema && !('properties' in flattenedSubSchema)) { - return { type: flattenedSubSchema.type } as PrimitiveSchema - } - - if ('$ref' in flattenedSubSchema) { - // eslint-disable-next-line no-console - console.error('$ref not currently supported when flattening oneOf') - continue - } - - const subObj = flattenedSubSchema as ObjSchema - - // Merge properties - Object.assign(flattenedSchema.properties, subObj.properties) - - // Update required array with common properties - flattenedSchema.required = - flattenedSchema.required.length === 0 - ? subObj.required - : flattenedSchema.required.filter((prop) => - subObj.required.includes(prop), - ) - } - - return flattenedSchema -} - -function flattenAllOf(allOfSchema: AllOfSchema): ObjSchema | PrimitiveSchema { - const flattenedSchema: ObjSchema = { - type: 'object', - properties: {}, - required: [], - } - - for (const subSchema of allOfSchema.allOf) { - const flattenedSubSchema = deepFlattenOneOfAndAllOfSchema(subSchema) - - // Check if the sub-schema is a primitive schema - if ('type' in flattenedSubSchema && !('properties' in flattenedSubSchema)) { - return { type: flattenedSubSchema.type } as PrimitiveSchema - } - - if ('$ref' in flattenedSubSchema) { - // eslint-disable-next-line no-console - console.error('$ref not currently supported when flattening allOf') - continue - } - - const subObj = flattenedSubSchema as ObjSchema - - // Merge properties - Object.assign(flattenedSchema.properties, subObj.properties) - - // Merge required array - flattenedSchema.required = [ - ...new Set([...flattenedSchema.required, ...subObj.required]), - ] - } - - return flattenedSchema -} - -function flattenObject(objSchema: ObjSchema): ObjSchema { - const flattenedSchema: ObjSchema = { - type: 'object', - properties: {}, - required: objSchema.required ?? [], - } - - for (const prop in objSchema.properties) { - const propSchema = objSchema.properties[prop] - if (propSchema == null) continue - flattenedSchema.properties[prop] = - deepFlattenOneOfAndAllOfSchema(propSchema) - } - - return flattenedSchema -} - -function flattenArray(arraySchema: ArraySchema): ArraySchema { - return { - type: 'array', - items: deepFlattenOneOfAndAllOfSchema(arraySchema.items), - } -} diff --git a/codegen/lib/openapi/flatten-obj-schema.ts b/codegen/lib/openapi/flatten-obj-schema.ts deleted file mode 100644 index 7e2eb809..00000000 --- a/codegen/lib/openapi/flatten-obj-schema.ts +++ /dev/null @@ -1,129 +0,0 @@ -// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator -// lib/openapi/flatten-obj-schema.ts (with the lodash intersectionWith(isEqual) -// call replaced by a plain string-array intersection; required arrays only -// ever contain strings, so the semantics are identical). This is a frozen -// output-parity workaround: it exists only so the generated output stays -// byte-identical to the previous generator. Do not review, refactor, or -// improve it. -// TODO: Delete this file and use resource properties from @seamapi/blueprint -// once generated output is allowed to change. - -import type { - AllOfSchema, - ArraySchema, - ObjSchema, - PrimitiveSchema, - PropertySchema, -} from './types.js' - -const intersection = (a: string[], b: string[]): string[] => - a.filter((x) => b.includes(x)) - -export const flattenObjSchema = ( - s: ObjSchema | { oneOf: ObjSchema[] } | { allOf: ObjSchema[] }, -): ObjSchema => { - if ('type' in s && s.type === 'object') return s - - if ('oneOf' in s) { - if (s.oneOf[0] == null) { - throw new Error('oneOf must have at least one element') - } - - const superObj: ObjSchema = { - type: 'object', - properties: {}, - required: [...s.oneOf[0].required], - } - for (const obj of s.oneOf) { - for (const [k, v] of Object.entries(obj.properties)) { - superObj.properties[k] = v - } - superObj.required = intersection(superObj.required, obj.required) - } - return superObj - } - - if ('allOf' in s) { - return deepFlattenAllOfSchema(s) as ObjSchema - } - - throw new Error(`Unknown schema type "${(s as { type: string }).type}"`) -} - -export const deepFlattenAllOfSchema = ( - s: AllOfSchema, -): Exclude | undefined => { - if (s.allOf.length === 1 && s.allOf[0] != null) { - const recursive = s.allOf[0] - - if ('allOf' in recursive) { - return deepFlattenAllOfSchema(recursive) - } - - return recursive as Exclude - } - - const properties: Record = {} - const required = new Set() - const primitives: Array = [] - - for (let subschema of s.allOf) { - if ('allOf' in subschema) { - const recursive = deepFlattenAllOfSchema(subschema as AllOfSchema) - if (recursive == null) continue - - subschema = recursive - } - - if ('oneOf' in subschema) { - subschema = flattenObjSchema(subschema as { oneOf: ObjSchema[] }) - } - - if ('$ref' in subschema) { - // eslint-disable-next-line no-console - console.error('$ref not currently supported when flattening allOf') - continue - } - - if (subschema.type === 'object') { - const objSchema = subschema as ObjSchema - for (const [k, v] of Object.entries(objSchema.properties)) { - if (properties[k] == null) properties[k] = [] - properties[k]?.push(v) - - if (objSchema.required?.includes(k) ?? false) required.add(k) - } - - continue - } - - primitives.push(subschema as PrimitiveSchema | ArraySchema) - } - - if (Object.keys(properties).length > 0 && primitives.length > 0) { - // eslint-disable-next-line no-console - console.error( - 'Found invalid allOf schema with both properties and primitives', - new Error(JSON.stringify(s, null, 2)), - ) - } - - if (primitives.length > 0) { - // TODO: check that all primitives are the same, then merge nullability/unions - return primitives[0] - } - - if (Object.keys(properties).length > 0) { - return { - type: 'object', - required: [...required], - properties: Object.fromEntries( - Object.entries(properties) - .map(([k, v]) => [k, deepFlattenAllOfSchema({ allOf: v })]) - .filter(([, v]) => v != null), - ), - } - } - - return undefined -} diff --git a/codegen/lib/openapi/get-filtered-routes.ts b/codegen/lib/openapi/get-filtered-routes.ts deleted file mode 100644 index 289a06af..00000000 --- a/codegen/lib/openapi/get-filtered-routes.ts +++ /dev/null @@ -1,23 +0,0 @@ -// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator -// lib/openapi/get-filtered-routes.ts. This is a frozen output-parity -// workaround: it exists only so the generated output stays byte-identical to -// the previous generator. Do not review, refactor, or improve it. -// TODO: Delete this file and use route.isUndocumented from @seamapi/blueprint -// once generated output is allowed to change. - -import type { OpenapiSchema, Route } from './types.js' - -export function getFilteredRoutes(openapi: OpenapiSchema): Route[] { - return Object.entries(openapi.paths) - .filter(([, pathSchema]) => { - const post = pathSchema.post - if (post == null) return false - const summary = post.summary ?? '' - - const isDocumented = post['x-undocumented'] == null - const isSeamInternalRoute = summary.startsWith('/seam/') - - return isDocumented && !isSeamInternalRoute - }) - .map(([path, route]) => ({ path, ...route }) as Route) -} diff --git a/codegen/lib/openapi/get-parameter-and-response-schema.ts b/codegen/lib/openapi/get-parameter-and-response-schema.ts deleted file mode 100644 index cf3cd546..00000000 --- a/codegen/lib/openapi/get-parameter-and-response-schema.ts +++ /dev/null @@ -1,139 +0,0 @@ -// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator -// lib/openapi/get-parameter-and-response-schema.ts. This OpenAPI parsing is a -// frozen output-parity workaround: it exists only so the generated output -// stays byte-identical to the previous generator. Do not review, refactor, or -// improve it. -// TODO: Delete this file and use endpoint.request.parameters and -// endpoint.response from @seamapi/blueprint once generated output is allowed -// to change. - -import { deepFlattenOneOfAndAllOfSchema } from './deep-flatten-one-of-and-all-of-schema.js' -import { flattenObjSchema } from './flatten-obj-schema.js' -import type { ObjSchema, Route } from './types.js' - -export const getParameterAndResponseSchema = ( - route: Route, -): { - parameterSchema?: ObjSchema - responseObjType?: string | undefined - responseArrType?: string | undefined -} => { - const responseSchema = - route.post.responses['200']?.content?.['application/json']?.schema - - if (responseSchema == null) { - return {} - } - - if (route.post.requestBody == null) { - route.post.requestBody = { - content: { - 'application/json': { schema: { type: 'object', properties: {} } }, - }, - } - } - - if (route.post.requestBody.content?.['application/json'] == null) { - return {} - } - - const parameterSchema = processParameterSchema( - route.post.requestBody.content['application/json'].schema, - ) - - const resReturnSchema = - responseSchema.properties?.[route.post['x-response-key'] ?? ''] - - const responseObjRef = resReturnSchema?.$ref - const responseArrRef = resReturnSchema?.items?.$ref - - if (route.post['x-response-key'] === 'batch') { - return { - responseObjType: route.post['x-response-key'], - responseArrType: undefined, - parameterSchema, - } - } else if (responseObjRef == null && responseArrRef == null) { - return { - responseObjType: undefined, - responseArrType: undefined, - parameterSchema, - } - } else { - return { - responseObjType: responseObjRef?.split('/')?.pop(), - responseArrType: responseArrRef?.split('/')?.pop(), - parameterSchema, - } - } -} - -function processParameterSchema( - schema: ObjSchema | { oneOf: ObjSchema[] } | { allOf: ObjSchema[] }, -): ObjSchema { - const parameterSchema = flattenObjSchema(schema) - - for (const [paramName, paramValue] of Object.entries( - parameterSchema.properties, - )) { - if ('oneOf' in paramValue || 'allOf' in paramValue) { - parameterSchema.properties[paramName] = - deepFlattenOneOfAndAllOfSchema(paramValue) - } - } - - return stripUndocumentedProperties(parameterSchema) -} - -function stripUndocumentedProperties(schema: ObjSchema): ObjSchema { - const properties = Object.fromEntries( - Object.entries(schema.properties).flatMap(([name, propertySchema]) => { - const filteredProperty = stripUndocumentedPropertySchema(propertySchema) - - return filteredProperty != null ? [[name, filteredProperty]] : [] - }), - ) - - return { - ...schema, - properties, - required: (schema.required ?? []).filter((name) => name in properties), - } -} - -function stripUndocumentedPropertySchema(propertySchema: any): any { - if (propertySchema?.['x-undocumented'] != null) { - return undefined - } - - if (propertySchema?.type === 'object' && propertySchema.properties != null) { - const properties = Object.fromEntries( - Object.entries(propertySchema.properties).flatMap( - ([name, nestedSchema]) => { - const filteredProperty = stripUndocumentedPropertySchema(nestedSchema) - - return filteredProperty != null ? [[name, filteredProperty]] : [] - }, - ), - ) - - return { - ...propertySchema, - properties, - required: (propertySchema.required ?? []).filter( - (name: string) => name in properties, - ), - } - } - - if (propertySchema?.type === 'array' && propertySchema.items != null) { - const items = stripUndocumentedPropertySchema(propertySchema.items) - - return { - ...propertySchema, - items: items ?? propertySchema.items, - } - } - - return propertySchema -} diff --git a/codegen/lib/openapi/map-parent-to-children-resource.ts b/codegen/lib/openapi/map-parent-to-children-resource.ts deleted file mode 100644 index 167a48e6..00000000 --- a/codegen/lib/openapi/map-parent-to-children-resource.ts +++ /dev/null @@ -1,39 +0,0 @@ -// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator -// lib/openapi/map-parent-to-children-resource.ts. This is a frozen -// output-parity workaround: it exists only so the generated output stays -// byte-identical to the previous generator. Do not review, refactor, or -// improve it. Only the first two segments of x-fern-sdk-group-name are -// considered, so deeply nested namespaces are generated as standalone client -// classes but never wired to a parent property. -// TODO: Delete this file and use blueprint.namespaces parent/child -// relationships once generated output is allowed to change, wiring deeply -// nested namespaces to a property on their parent class at the same time. - -import { ignoredEndpointPaths } from '../endpoint-rules.js' -import type { Route } from './types.js' - -export const mapParentToChildResources = ( - routes: Route[], -): Record => - routes.reduce((acc: Record, route) => { - if (route.post?.['x-fern-sdk-group-name'] == null) return acc - if (ignoredEndpointPaths.includes(route.path)) return acc - - const [parentResourceName, childResourceName] = - route.post['x-fern-sdk-group-name'] - - if (parentResourceName == null) return acc - - if (acc[parentResourceName] == null) { - acc[parentResourceName] = [] - } - - if ( - childResourceName != null && - !(acc[parentResourceName]?.includes(childResourceName) ?? false) - ) { - acc[parentResourceName]?.push(childResourceName) - } - - return acc - }, {}) diff --git a/codegen/lib/openapi/types.ts b/codegen/lib/openapi/types.ts deleted file mode 100644 index b032a472..00000000 --- a/codegen/lib/openapi/types.ts +++ /dev/null @@ -1,74 +0,0 @@ -// TEMPORARY: Minimal OpenAPI types ported from @seamapi/nextlove-sdk-generator -// lib/types.ts. These only support the frozen output-parity workarounds in -// this directory. Do not review, refactor, or improve them. -// TODO: Delete this file and use @seamapi/blueprint types once generated -// output is allowed to change. - -export interface PrimitiveSchema { - type: 'string' | 'integer' | 'boolean' | 'number' - enum?: unknown[] - format?: string - nullable?: boolean -} - -export interface ArraySchema { - type: 'array' - items: PropertySchema - nullable?: boolean -} - -export interface ObjSchema { - type: 'object' - properties: Record - required: string[] - nullable?: boolean -} - -export interface OneOfSchema { - oneOf: PropertySchema[] - nullable?: boolean -} - -export interface AllOfSchema { - allOf: PropertySchema[] - nullable?: boolean -} - -export interface RefSchema { - $ref: string - nullable?: boolean -} - -export type PropertySchema = - | PrimitiveSchema - | ArraySchema - | ObjSchema - | OneOfSchema - | AllOfSchema - | RefSchema - -export interface RoutePost { - summary?: string - requestBody?: { - content?: Record - } - responses: Record }> - 'x-fern-sdk-group-name'?: string[] - 'x-fern-sdk-method-name'?: string - 'x-fern-sdk-return-value'?: string - 'x-response-key'?: string | null - 'x-undocumented'?: string - [key: string]: any -} - -export interface Route { - path: string - post: RoutePost - [key: string]: any -} - -export interface OpenapiSchema { - info?: { title: string } - paths: Record - components: { schemas: Record } -} diff --git a/codegen/lib/resource-model.ts b/codegen/lib/resource-model.ts new file mode 100644 index 00000000..b16e636b --- /dev/null +++ b/codegen/lib/resource-model.ts @@ -0,0 +1,148 @@ +// Builds the resource object class model for src/Objects from the blueprint. +// +// Each blueprint resource becomes a PHP class. Nested object properties and +// lists of objects are split into their own classes named after the base +// resource and the property, e.g. the device battery property becomes +// DeviceBattery. Discriminated unions (events, action attempts, and +// discriminated object lists) are flattened into a single class with the +// union of the variant properties. + +import type { Blueprint, Property } from '@seamapi/blueprint' +import { pascalCase } from 'change-case' + +import { getPhpType } from './map-php-type.js' + +export type ResourceObjectProperty = + | { name: string; kind: 'value'; phpType: string } + | { name: string; kind: 'objectReference'; referenceName: string } + | { name: string; kind: 'listReference'; referenceName: string } + +export interface ResourceObjectSchema { + name: string + properties: ResourceObjectProperty[] +} + +export interface ResourceObjectModel { + baseResourceNames: string[] + schemas: ResourceObjectSchema[] +} + +export const createResourceObjectModel = ( + blueprint: Blueprint, +): ResourceObjectModel => { + const baseResources = new Map() + + for (const resource of blueprint.resources) { + baseResources.set(resource.resourceType, resource.properties) + } + + // The blueprint models events and action attempts as one resource per + // variant. The PHP SDK has a single class for each, so the variants are + // merged into one schema. + if (blueprint.events.length > 0) { + baseResources.set( + 'event', + mergeProperties(blueprint.events.map((event) => event.properties)), + ) + } + + if (blueprint.actionAttempts.length > 0) { + baseResources.set( + 'action_attempt', + mergeProperties( + blueprint.actionAttempts.map((actionAttempt) => actionAttempt.properties), + ), + ) + } + + const schemas = new Map() + + const addSchema = ( + name: string, + properties: Property[], + baseName: string, + ): void => { + if (schemas.has(name)) return + const schema: ResourceObjectSchema = { name, properties: [] } + schemas.set(name, schema) + schema.properties = properties.map((property) => + createResourceObjectProperty(property, baseName, addSchema), + ) + } + + const baseResourceTypes = [...baseResources.keys()].sort() + for (const resourceType of baseResourceTypes) { + addSchema( + pascalCase(resourceType), + baseResources.get(resourceType) ?? [], + resourceType, + ) + } + + return { + baseResourceNames: baseResourceTypes.map((resourceType) => + pascalCase(resourceType), + ), + schemas: [...schemas.values()], + } +} + +const createResourceObjectProperty = ( + property: Property, + baseName: string, + addSchema: (name: string, properties: Property[], baseName: string) => void, +): ResourceObjectProperty => { + const referenceName = pascalCase(`${baseName}_${property.name}`) + + if (property.format === 'object' && property.properties.length > 0) { + addSchema(referenceName, property.properties, baseName) + return { name: property.name, kind: 'objectReference', referenceName } + } + + if (property.format === 'list') { + const itemProperties = + property.itemFormat === 'object' + ? property.itemProperties + : property.itemFormat === 'discriminated_object' + ? mergeProperties(property.variants.map((variant) => variant.properties)) + : [] + + if (itemProperties.length > 0) { + addSchema(referenceName, itemProperties, baseName) + return { name: property.name, kind: 'listReference', referenceName } + } + } + + return { + name: property.name, + kind: 'value', + phpType: getPhpType(property.jsonType), + } +} + +const mergeProperties = (propertyLists: Property[][]): Property[] => { + const merged = new Map() + + for (const properties of propertyLists) { + for (const property of properties) { + const existing = merged.get(property.name) + + if (existing == null) { + merged.set(property.name, property) + continue + } + + if (existing.format === 'object' && property.format === 'object') { + merged.set(property.name, { + ...existing, + properties: mergeProperties([ + existing.properties, + property.properties, + ]), + }) + } + } + } + + return [...merged.values()] +} diff --git a/codegen/lib/routes.ts b/codegen/lib/routes.ts index 068fe08f..a084b645 100644 --- a/codegen/lib/routes.ts +++ b/codegen/lib/routes.ts @@ -1,30 +1,18 @@ -// The Metalsmith plugin that generates the PHP SDK route files. -// Ported from @seamapi/nextlove-sdk-generator -// lib/generate-php-sdk/generate-php-sdk.ts, restructured to mirror the -// javascript-http codegen plugin (lib/connect.ts). +// The Metalsmith plugin that generates the PHP SDK source files. // -// The blueprint from @seamapi/blueprint drives the iteration order and the -// route, endpoint, and namespace structure. The raw OpenAPI spec is still -// consulted wherever the previous nextlove generator derived output from data -// the blueprint normalizes differently; each of those spots is marked with a -// TODO so they can migrate to the blueprint once output is allowed to change, -// and the supporting code lives in files marked TEMPORARY that will be deleted -// with them. - -import type { Blueprint } from '@seamapi/blueprint' -import * as types from '@seamapi/types/connect' +// The blueprint from @seamapi/blueprint is the only input: it drives the +// resource object classes written to src/Objects, and the resource client +// classes serialized into src/SeamClient.php. + +import type { Blueprint, Endpoint } from '@seamapi/blueprint' import { pascalCase } from 'change-case' import type Metalsmith from 'metalsmith' -import type { PhpClient, PhpClientMethodParameter } from './class-model.js' +import type { PhpClient, PhpClientMethod } from './class-model.js' import { setObjectLayoutContext } from './layouts/object.js' import { setSeamClientLayoutContext } from './layouts/seam-client.js' import { getPhpType } from './map-php-type.js' -import { deepExtractResourceObjectSchemas } from './openapi/deep-extract-resource-object-schemas.js' -import { getFilteredRoutes } from './openapi/get-filtered-routes.js' -import { getParameterAndResponseSchema } from './openapi/get-parameter-and-response-schema.js' -import { mapParentToChildResources } from './openapi/map-parent-to-children-resource.js' -import type { OpenapiSchema } from './openapi/types.js' +import { createResourceObjectModel } from './resource-model.js' interface Metadata { blueprint: Blueprint @@ -33,8 +21,6 @@ interface Metadata { const objectsPath = 'src/Objects' const seamClientPath = 'src/SeamClient.php' -const openapi = types.openapi as unknown as OpenapiSchema - export const routes = ( files: Metalsmith.Files, metalsmith: Metalsmith, @@ -42,159 +28,108 @@ export const routes = ( const metadata = metalsmith.metadata() as Metadata const { blueprint } = metadata - // TODO: Derive the parent to child resource map from blueprint.namespaces - // once generated output is allowed to change. - const rawRoutes = getFilteredRoutes(openapi) - const parentToChildResourcesMap = mapParentToChildResources(rawRoutes) - - // Resource object classes, one file per (deeply extracted) schema. The order - // of base resource names drives the SeamClient use statements. - const baseResourceObjectNames: string[] = [] - for (const [schemaName, schema] of Object.entries( - openapi.components.schemas, - )) { - baseResourceObjectNames.push(pascalCase(schemaName)) - - const extracted = deepExtractResourceObjectSchemas({ - schemaName, - schemaBody: schema, - }) - - for (const extractedSchema of Object.values(extracted)) { - // TODO: Remove this ActionAttempt result widening once the nextlove - // OpenAPI generator is fixed and generated output is allowed to change. - const schemaForContext = - extractedSchema.name === 'ActionAttempt' - ? { - ...extractedSchema, - properties: { - ...extractedSchema.properties, - result: { type: 'object' as const, nullable: true }, - }, - } - : extractedSchema - - files[`${objectsPath}/${extractedSchema.name}.php`] = { - contents: Buffer.from('\n'), - layout: 'object.hbs', - ...setObjectLayoutContext(schemaForContext), - } + // Resource object classes, one file per (deeply extracted) schema. The base + // resource names drive the SeamClient use statements. + const { baseResourceNames, schemas } = createResourceObjectModel(blueprint) + + for (const schema of schemas) { + files[`${objectsPath}/${schema.name}.php`] = { + contents: Buffer.from('\n'), + layout: 'object.hbs', + ...setObjectLayoutContext(schema), } } - // Resource client classes, all serialized into SeamClient.php. + // Resource client classes, all serialized into SeamClient.php. Each route + // path maps to a client class, e.g. /acs/users to AcsUsersClient, wired to + // a property on its parent client (AcsClient) or, for top-level routes, on + // the SeamClient itself. const classMap = new Map() - const processClient = (resourceName: string): void => { - const childClientIdentifiers = ( - parentToChildResourcesMap[resourceName] ?? [] - ).map((childResource) => ({ - clientName: pascalCase(`${resourceName} ${childResource}`), - namespace: childResource, - })) - const isParentClient = Object.keys(parentToChildResourcesMap).includes( - resourceName, - ) - const pascalResourceName = pascalCase(resourceName) - - classMap.set(pascalResourceName, { - clientName: pascalResourceName, - namespace: resourceName, - isParentClient, - childClientIdentifiers, + const ensureClient = (namespaceSegments: string[]): PhpClient => { + const clientName = pascalCase(namespaceSegments.join('_')) + const existingClient = classMap.get(clientName) + if (existingClient != null) return existingClient + + const namespace = namespaceSegments.at(-1) ?? '' + const client: PhpClient = { + clientName, + namespace, + isParentClient: namespaceSegments.length === 1, + childClientIdentifiers: [], methods: [], - }) + } + classMap.set(clientName, client) + + if (namespaceSegments.length > 1) { + const parentClient = ensureClient(namespaceSegments.slice(0, -1)) + parentClient.childClientIdentifiers.push({ clientName, namespace }) + } + + return client } for (const route of blueprint.routes) { - for (const endpoint of route.endpoints) { - const post = openapi.paths[endpoint.path]?.post - if (post == null) continue - - // TODO: Filter on endpoint.isUndocumented and route.isUndocumented from - // the blueprint once generated output is allowed to change. The raw - // OpenAPI extensions are used here to include exactly the same route set - // as the previous nextlove getFilteredRoutes plus its group-name guard. - if (post['x-undocumented'] != null) continue - if ((post.summary ?? '').startsWith('/seam/')) continue - if (post['x-fern-sdk-group-name'] == null) continue - - const groupNames = [...post['x-fern-sdk-group-name']] - const [baseResource] = groupNames - const namespace = groupNames.join('_') - const clientName = pascalCase(namespace) - - if (!classMap.has(clientName)) { - processClient(namespace) - } - - /* - Special case when we don't have routes for a base resource - and thus a respective x-fern-sdk-group-name for ex. /noise_sensors - */ - if (baseResource != null && !classMap.has(pascalCase(baseResource))) { - processClient(baseResource) - } - - const client = classMap.get(clientName) - - if (client == null) { - // eslint-disable-next-line no-console - console.warn(`No client for "${clientName}", skipping`) - continue - } - - const { parameterSchema, responseObjType, responseArrType } = - getParameterAndResponseSchema({ path: endpoint.path, post }) - - if (parameterSchema == null) { - // eslint-disable-next-line no-console - console.warn(`No parameter schema for "${endpoint.path}", skipping`) - continue - } - - const returnResource = responseObjType ?? responseArrType ?? '' - - client.methods.push({ - methodName: post['x-fern-sdk-method-name'] ?? '', - path: endpoint.path, - // TODO: Use endpoint.request.parameters from the blueprint once - // generated output is allowed to change. The blueprint collapses - // integer to number and flattens unions differently, so parameters are - // derived from the raw OpenAPI schema for identical output. - parameters: Object.entries(parameterSchema.properties) - .filter( - ([, paramVal]) => - 'type' in paramVal || - ('oneOf' in paramVal && - 'type' in ((paramVal as any).oneOf[0] ?? {})), - ) - .map(([paramName, paramVal]): PhpClientMethodParameter => { - const raw = paramVal as any - return { - name: paramName, - type: getPhpType(raw?.type ?? raw.oneOf[0].type), - required: parameterSchema.required?.includes(paramName), - position: - post['x-fern-sdk-method-name'] === 'get' && - paramName === `${post['x-fern-sdk-return-value']}_id` - ? 0 - : undefined, - } - }), - returnPath: post['x-fern-sdk-return-value'] ?? '', - returnResource: pascalCase(returnResource), - isArrayResponse: Boolean(responseArrType), - }) + if (route.isUndocumented) continue + + const endpoints = route.endpoints.filter( + (endpoint) => !endpoint.isUndocumented, + ) + if (endpoints.length === 0) continue + + const namespaceSegments = route.path.split('/').filter((s) => s.length > 0) + const client = ensureClient(namespaceSegments) + + for (const endpoint of endpoints) { + client.methods.push(createClientMethod(endpoint)) } } files[seamClientPath] = { contents: Buffer.from('\n'), layout: 'seam-client.hbs', - ...setSeamClientLayoutContext( - [...classMap.values()], - baseResourceObjectNames, - ), + ...setSeamClientLayoutContext([...classMap.values()], baseResourceNames), + } +} + +const createClientMethod = (endpoint: Endpoint): PhpClientMethod => { + const { response } = endpoint + + const responseKey = response.responseType === 'void' ? '' : response.responseKey + + // Batch responses have no single resource type; they deserialize into the + // Batch resource object. A response whose resource type the blueprint + // cannot resolve ('unknown') has no resource object class to deserialize + // into, so the method is generated as returning void. + const resourceType = + response.responseType === 'void' + ? '' + : response.responseType === 'resource' && + response.batchResourceTypes != null + ? 'batch' + : response.resourceType === 'unknown' + ? '' + : response.resourceType + + return { + methodName: endpoint.name, + path: endpoint.path, + parameters: endpoint.request.parameters + .filter((parameter) => !parameter.isUndocumented) + .map((parameter) => ({ + name: parameter.name, + type: getPhpType(parameter.jsonType), + required: parameter.isRequired, + // The primary identifier of a get endpoint always sorts first in the + // method signature. + position: + endpoint.name === 'get' && parameter.name === `${responseKey}_id` + ? 0 + : undefined, + })), + returnPath: responseKey, + returnResource: resourceType === '' ? '' : pascalCase(resourceType), + isArrayResponse: + response.responseType === 'resource_list' && resourceType !== '', } } diff --git a/src/Objects/AccessCode.php b/src/Objects/AccessCode.php index bbab9b90..cd129b37 100644 --- a/src/Objects/AccessCode.php +++ b/src/Objects/AccessCode.php @@ -10,72 +10,74 @@ public static function from_json(mixed $json): AccessCode|null return null; } return new self( - access_code_id: $json->access_code_id, - created_at: $json->created_at, - device_id: $json->device_id, + access_code_id: $json->access_code_id ?? null, + code: $json->code ?? null, + common_code_key: $json->common_code_key ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) + ? AccessCodeDormakabaOracodeMetadata::from_json( + $json->dormakaba_oracode_metadata, + ) + : null, + ends_at: $json->ends_at ?? null, errors: array_map( fn($e) => AccessCodeErrors::from_json($e), $json->errors ?? [], ), - is_backup_access_code_available: $json->is_backup_access_code_available, - is_external_modification_allowed: $json->is_external_modification_allowed, - is_managed: $json->is_managed, - is_offline_access_code: $json->is_offline_access_code, - is_one_time_use: $json->is_one_time_use, - pending_mutations: array_map( - fn($p) => AccessCodePendingMutations::from_json($p), - $json->pending_mutations ?? [], - ), - status: $json->status, - type: $json->type, - warnings: array_map( - fn($w) => AccessCodeWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, is_backup: $json->is_backup ?? null, + is_backup_access_code_available: $json->is_backup_access_code_available ?? + null, + is_external_modification_allowed: $json->is_external_modification_allowed ?? + null, + is_managed: $json->is_managed ?? null, + is_offline_access_code: $json->is_offline_access_code ?? null, + is_one_time_use: $json->is_one_time_use ?? null, is_scheduled_on_device: $json->is_scheduled_on_device ?? null, is_waiting_for_code_assignment: $json->is_waiting_for_code_assignment ?? null, - code: $json->code ?? null, - common_code_key: $json->common_code_key ?? null, name: $json->name ?? null, - dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) - ? AccessCodeDormakabaOracodeMetadata::from_json( - $json->dormakaba_oracode_metadata, - ) - : null, - ends_at: $json->ends_at ?? null, + pending_mutations: array_map( + fn($p) => AccessCodePendingMutations::from_json($p), + $json->pending_mutations ?? [], + ), pulled_backup_access_code_id: $json->pulled_backup_access_code_id ?? null, starts_at: $json->starts_at ?? null, + status: $json->status ?? null, + type: $json->type ?? null, + warnings: array_map( + fn($w) => AccessCodeWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_code_id, - public string $created_at, - public string $device_id, + public string|null $access_code_id, + public string|null $code, + public string|null $common_code_key, + public string|null $created_at, + public string|null $device_id, + public AccessCodeDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, + public string|null $ends_at, public array $errors, - public bool $is_backup_access_code_available, - public bool $is_external_modification_allowed, - public bool $is_managed, - public bool $is_offline_access_code, - public bool $is_one_time_use, - public array $pending_mutations, - public string $status, - public string $type, - public array $warnings, - public string $workspace_id, public bool|null $is_backup, + public bool|null $is_backup_access_code_available, + public bool|null $is_external_modification_allowed, + public bool|null $is_managed, + public bool|null $is_offline_access_code, + public bool|null $is_one_time_use, public bool|null $is_scheduled_on_device, public bool|null $is_waiting_for_code_assignment, - public string|null $code, - public string|null $common_code_key, public string|null $name, - public AccessCodeDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, - public string|null $ends_at, + public array $pending_mutations, public string|null $pulled_backup_access_code_id, public string|null $starts_at, + public string|null $status, + public string|null $type, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AccessCodeErrors.php b/src/Objects/AccessCodeErrors.php index 948768cf..eb11d921 100644 --- a/src/Objects/AccessCodeErrors.php +++ b/src/Objects/AccessCodeErrors.php @@ -10,16 +10,16 @@ public static function from_json(mixed $json): AccessCodeErrors|null return null; } return new self( - error_code: $json->error_code, - message: $json->message, change_type: $json->change_type ?? null, created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, managed_access_code_id: $json->managed_access_code_id ?? null, + message: $json->message ?? null, modified_fields: array_map( fn($m) => AccessCodeModifiedFields::from_json($m), $json->modified_fields ?? [], @@ -29,16 +29,16 @@ public static function from_json(mixed $json): AccessCodeErrors|null } public function __construct( - public string $error_code, - public string $message, public string|null $change_type, public string|null $created_at, + public string|null $error_code, public bool|null $is_access_code_error, public bool|null $is_bridge_error, public bool|null $is_connected_account_error, public bool|null $is_device_error, public string|null $managed_access_code_id, - public array|null $modified_fields, + public string|null $message, + public array $modified_fields, public string|null $unmanaged_access_code_id, ) {} } diff --git a/src/Objects/AccessCodeFrom.php b/src/Objects/AccessCodeFrom.php index aa37b155..05eb0844 100644 --- a/src/Objects/AccessCodeFrom.php +++ b/src/Objects/AccessCodeFrom.php @@ -10,13 +10,17 @@ public static function from_json(mixed $json): AccessCodeFrom|null return null; } return new self( + code: $json->code ?? null, ends_at: $json->ends_at ?? null, + name: $json->name ?? null, starts_at: $json->starts_at ?? null, ); } public function __construct( + public string|null $code, public string|null $ends_at, + public string|null $name, public string|null $starts_at, ) {} } diff --git a/src/Objects/AccessCodeModifiedFields.php b/src/Objects/AccessCodeModifiedFields.php index 91b5520d..4e6cb14c 100644 --- a/src/Objects/AccessCodeModifiedFields.php +++ b/src/Objects/AccessCodeModifiedFields.php @@ -10,14 +10,14 @@ public static function from_json(mixed $json): AccessCodeModifiedFields|null return null; } return new self( - field: $json->field, + field: $json->field ?? null, from: $json->from ?? null, to: $json->to ?? null, ); } public function __construct( - public string $field, + public string|null $field, public string|null $from, public string|null $to, ) {} diff --git a/src/Objects/AccessCodePendingMutations.php b/src/Objects/AccessCodePendingMutations.php index d75bf241..e12cadde 100644 --- a/src/Objects/AccessCodePendingMutations.php +++ b/src/Objects/AccessCodePendingMutations.php @@ -11,22 +11,22 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - message: $json->message, - mutation_code: $json->mutation_code, + created_at: $json->created_at ?? null, from: isset($json->from) ? AccessCodeFrom::from_json($json->from) : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, scheduled_at: $json->scheduled_at ?? null, to: isset($json->to) ? AccessCodeTo::from_json($json->to) : null, ); } public function __construct( - public string $created_at, - public string $message, - public string $mutation_code, + public string|null $created_at, public AccessCodeFrom|null $from, + public string|null $message, + public string|null $mutation_code, public string|null $scheduled_at, public AccessCodeTo|null $to, ) {} diff --git a/src/Objects/AccessCodeTo.php b/src/Objects/AccessCodeTo.php index 16d7af0e..6d860fac 100644 --- a/src/Objects/AccessCodeTo.php +++ b/src/Objects/AccessCodeTo.php @@ -10,13 +10,17 @@ public static function from_json(mixed $json): AccessCodeTo|null return null; } return new self( + code: $json->code ?? null, ends_at: $json->ends_at ?? null, + name: $json->name ?? null, starts_at: $json->starts_at ?? null, ); } public function __construct( + public string|null $code, public string|null $ends_at, + public string|null $name, public string|null $starts_at, ) {} } diff --git a/src/Objects/AccessCodeWarnings.php b/src/Objects/AccessCodeWarnings.php index 0b20f857..83d249e3 100644 --- a/src/Objects/AccessCodeWarnings.php +++ b/src/Objects/AccessCodeWarnings.php @@ -10,22 +10,22 @@ public static function from_json(mixed $json): AccessCodeWarnings|null return null; } return new self( - message: $json->message, - warning_code: $json->warning_code, change_type: $json->change_type ?? null, created_at: $json->created_at ?? null, + message: $json->message ?? null, modified_fields: array_map( fn($m) => AccessCodeModifiedFields::from_json($m), $json->modified_fields ?? [], ), + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $message, - public string $warning_code, public string|null $change_type, public string|null $created_at, - public array|null $modified_fields, + public string|null $message, + public array $modified_fields, + public string|null $warning_code, ) {} } diff --git a/src/Objects/AccessGrant.php b/src/Objects/AccessGrant.php index e793240b..18937da2 100644 --- a/src/Objects/AccessGrant.php +++ b/src/Objects/AccessGrant.php @@ -10,15 +10,21 @@ public static function from_json(mixed $json): AccessGrant|null return null; } return new self( - access_grant_id: $json->access_grant_id, - access_method_ids: $json->access_method_ids, - created_at: $json->created_at, - display_name: $json->display_name, + access_grant_id: $json->access_grant_id ?? null, + access_grant_key: $json->access_grant_key ?? null, + access_method_ids: $json->access_method_ids ?? null, + client_session_token: $json->client_session_token ?? null, + created_at: $json->created_at ?? null, + customization_profile_id: $json->customization_profile_id ?? null, + display_name: $json->display_name ?? null, + ends_at: $json->ends_at ?? null, errors: array_map( fn($e) => AccessGrantErrors::from_json($e), $json->errors ?? [], ), - location_ids: $json->location_ids, + instant_key_url: $json->instant_key_url ?? null, + location_ids: $json->location_ids ?? null, + name: $json->name ?? null, pending_mutations: array_map( fn($p) => AccessGrantPendingMutations::from_json($p), $json->pending_mutations ?? [], @@ -27,44 +33,38 @@ public static function from_json(mixed $json): AccessGrant|null fn($r) => AccessGrantRequestedAccessMethods::from_json($r), $json->requested_access_methods ?? [], ), - space_ids: $json->space_ids, - starts_at: $json->starts_at, - user_identity_id: $json->user_identity_id, + reservation_key: $json->reservation_key ?? null, + space_ids: $json->space_ids ?? null, + starts_at: $json->starts_at ?? null, + user_identity_id: $json->user_identity_id ?? null, warnings: array_map( fn($w) => AccessGrantWarnings::from_json($w), $json->warnings ?? [], ), - workspace_id: $json->workspace_id, - access_grant_key: $json->access_grant_key ?? null, - client_session_token: $json->client_session_token ?? null, - customization_profile_id: $json->customization_profile_id ?? null, - instant_key_url: $json->instant_key_url ?? null, - reservation_key: $json->reservation_key ?? null, - ends_at: $json->ends_at ?? null, - name: $json->name ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_grant_id, - public array $access_method_ids, - public string $created_at, - public string $display_name, - public array $errors, - public array $location_ids, - public array $pending_mutations, - public array $requested_access_methods, - public array $space_ids, - public string $starts_at, - public string $user_identity_id, - public array $warnings, - public string $workspace_id, + public string|null $access_grant_id, public string|null $access_grant_key, + public array|null $access_method_ids, public string|null $client_session_token, + public string|null $created_at, public string|null $customization_profile_id, - public string|null $instant_key_url, - public string|null $reservation_key, + public string|null $display_name, public string|null $ends_at, + public array $errors, + public string|null $instant_key_url, + public array|null $location_ids, public string|null $name, + public array $pending_mutations, + public array $requested_access_methods, + public string|null $reservation_key, + public array|null $space_ids, + public string|null $starts_at, + public string|null $user_identity_id, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AccessGrantErrors.php b/src/Objects/AccessGrantErrors.php index 5ae9d809..3cd4362a 100644 --- a/src/Objects/AccessGrantErrors.php +++ b/src/Objects/AccessGrantErrors.php @@ -10,17 +10,17 @@ public static function from_json(mixed $json): AccessGrantErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, missing_device_ids: $json->missing_device_ids ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, public array|null $missing_device_ids, ) {} } diff --git a/src/Objects/AccessGrantFailedDevices.php b/src/Objects/AccessGrantFailedDevices.php index 954ce053..92362630 100644 --- a/src/Objects/AccessGrantFailedDevices.php +++ b/src/Objects/AccessGrantFailedDevices.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AccessGrantFailedDevices|null return null; } return new self( - device_id: $json->device_id, - error_code: $json->error_code, - message: $json->message, + device_id: $json->device_id ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $device_id, - public string $error_code, - public string $message, + public string|null $device_id, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/AccessGrantFrom.php b/src/Objects/AccessGrantFrom.php index cff87b3a..4eade595 100644 --- a/src/Objects/AccessGrantFrom.php +++ b/src/Objects/AccessGrantFrom.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): AccessGrantFrom|null return null; } return new self( + device_ids: $json->device_ids ?? null, ends_at: $json->ends_at ?? null, starts_at: $json->starts_at ?? null, ); } public function __construct( + public array|null $device_ids, public string|null $ends_at, public string|null $starts_at, ) {} diff --git a/src/Objects/AccessGrantPendingMutations.php b/src/Objects/AccessGrantPendingMutations.php index dd545823..a05eb302 100644 --- a/src/Objects/AccessGrantPendingMutations.php +++ b/src/Objects/AccessGrantPendingMutations.php @@ -11,21 +11,23 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - from: AccessGrantFrom::from_json($json->from), - message: $json->message, - mutation_code: $json->mutation_code, - to: AccessGrantTo::from_json($json->to), access_method_ids: $json->access_method_ids ?? null, + created_at: $json->created_at ?? null, + from: isset($json->from) + ? AccessGrantFrom::from_json($json->from) + : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, + to: isset($json->to) ? AccessGrantTo::from_json($json->to) : null, ); } public function __construct( - public string $created_at, - public AccessGrantFrom $from, - public string $message, - public string $mutation_code, - public AccessGrantTo $to, public array|null $access_method_ids, + public string|null $created_at, + public AccessGrantFrom|null $from, + public string|null $message, + public string|null $mutation_code, + public AccessGrantTo|null $to, ) {} } diff --git a/src/Objects/AccessGrantRequestedAccessMethods.php b/src/Objects/AccessGrantRequestedAccessMethods.php index 362d6c93..384f0d60 100644 --- a/src/Objects/AccessGrantRequestedAccessMethods.php +++ b/src/Objects/AccessGrantRequestedAccessMethods.php @@ -11,21 +11,21 @@ public static function from_json( return null; } return new self( - created_access_method_ids: $json->created_access_method_ids, - created_at: $json->created_at, - display_name: $json->display_name, - mode: $json->mode, code: $json->code ?? null, + created_access_method_ids: $json->created_access_method_ids ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, instant_key_max_use_count: $json->instant_key_max_use_count ?? null, + mode: $json->mode ?? null, ); } public function __construct( - public array $created_access_method_ids, - public string $created_at, - public string $display_name, - public string $mode, public string|null $code, - public mixed $instant_key_max_use_count, + public array|null $created_access_method_ids, + public string|null $created_at, + public string|null $display_name, + public float|null $instant_key_max_use_count, + public string|null $mode, ) {} } diff --git a/src/Objects/AccessGrantTo.php b/src/Objects/AccessGrantTo.php index 4c4d1c61..bbcd4078 100644 --- a/src/Objects/AccessGrantTo.php +++ b/src/Objects/AccessGrantTo.php @@ -10,12 +10,16 @@ public static function from_json(mixed $json): AccessGrantTo|null return null; } return new self( + common_code_key: $json->common_code_key ?? null, + device_ids: $json->device_ids ?? null, ends_at: $json->ends_at ?? null, starts_at: $json->starts_at ?? null, ); } public function __construct( + public string|null $common_code_key, + public array|null $device_ids, public string|null $ends_at, public string|null $starts_at, ) {} diff --git a/src/Objects/AccessGrantWarnings.php b/src/Objects/AccessGrantWarnings.php index 19ee3a57..92cceafa 100644 --- a/src/Objects/AccessGrantWarnings.php +++ b/src/Objects/AccessGrantWarnings.php @@ -10,30 +10,30 @@ public static function from_json(mixed $json): AccessGrantWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, access_method_ids: $json->access_method_ids ?? null, + created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, failed_devices: array_map( fn($f) => AccessGrantFailedDevices::from_json($f), $json->failed_devices ?? [], ), + message: $json->message ?? null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, reason: $json->reason ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, public array|null $access_method_ids, + public string|null $created_at, public string|null $device_id, - public array|null $failed_devices, + public array $failed_devices, + public string|null $message, public string|null $new_code, public string|null $original_code, public string|null $reason, + public string|null $warning_code, ) {} } diff --git a/src/Objects/AccessMethod.php b/src/Objects/AccessMethod.php index 230a9d15..da472bf8 100644 --- a/src/Objects/AccessMethod.php +++ b/src/Objects/AccessMethod.php @@ -10,15 +10,24 @@ public static function from_json(mixed $json): AccessMethod|null return null; } return new self( - access_method_id: $json->access_method_id, - created_at: $json->created_at, - display_name: $json->display_name, + access_method_id: $json->access_method_id ?? null, + client_session_token: $json->client_session_token ?? null, + code: $json->code ?? null, + created_at: $json->created_at ?? null, + customization_profile_id: $json->customization_profile_id ?? null, + display_name: $json->display_name ?? null, errors: array_map( fn($e) => AccessMethodErrors::from_json($e), $json->errors ?? [], ), - is_issued: $json->is_issued, - mode: $json->mode, + instant_key_url: $json->instant_key_url ?? null, + is_assignment_required: $json->is_assignment_required ?? null, + is_encoding_required: $json->is_encoding_required ?? null, + is_issued: $json->is_issued ?? null, + is_ready_for_assignment: $json->is_ready_for_assignment ?? null, + is_ready_for_encoding: $json->is_ready_for_encoding ?? null, + issued_at: $json->issued_at ?? null, + mode: $json->mode ?? null, pending_mutations: array_map( fn($p) => AccessMethodPendingMutations::from_json($p), $json->pending_mutations ?? [], @@ -27,37 +36,28 @@ public static function from_json(mixed $json): AccessMethod|null fn($w) => AccessMethodWarnings::from_json($w), $json->warnings ?? [], ), - workspace_id: $json->workspace_id, - client_session_token: $json->client_session_token ?? null, - customization_profile_id: $json->customization_profile_id ?? null, - instant_key_url: $json->instant_key_url ?? null, - is_assignment_required: $json->is_assignment_required ?? null, - is_encoding_required: $json->is_encoding_required ?? null, - is_ready_for_assignment: $json->is_ready_for_assignment ?? null, - is_ready_for_encoding: $json->is_ready_for_encoding ?? null, - issued_at: $json->issued_at ?? null, - code: $json->code ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_method_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_issued, - public string $mode, - public array $pending_mutations, - public array $warnings, - public string $workspace_id, + public string|null $access_method_id, public string|null $client_session_token, + public string|null $code, + public string|null $created_at, public string|null $customization_profile_id, + public string|null $display_name, + public array $errors, public string|null $instant_key_url, public bool|null $is_assignment_required, public bool|null $is_encoding_required, + public bool|null $is_issued, public bool|null $is_ready_for_assignment, public bool|null $is_ready_for_encoding, public string|null $issued_at, - public string|null $code, + public string|null $mode, + public array $pending_mutations, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AccessMethodErrors.php b/src/Objects/AccessMethodErrors.php index 25e1c7e8..394453c0 100644 --- a/src/Objects/AccessMethodErrors.php +++ b/src/Objects/AccessMethodErrors.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AccessMethodErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/AccessMethodFrom.php b/src/Objects/AccessMethodFrom.php index 5183f565..7111d3a8 100644 --- a/src/Objects/AccessMethodFrom.php +++ b/src/Objects/AccessMethodFrom.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): AccessMethodFrom|null return null; } return new self( + device_ids: $json->device_ids ?? null, ends_at: $json->ends_at ?? null, starts_at: $json->starts_at ?? null, ); } public function __construct( + public array|null $device_ids, public string|null $ends_at, public string|null $starts_at, ) {} diff --git a/src/Objects/AccessMethodPendingMutations.php b/src/Objects/AccessMethodPendingMutations.php index 8e754406..117d9dbb 100644 --- a/src/Objects/AccessMethodPendingMutations.php +++ b/src/Objects/AccessMethodPendingMutations.php @@ -11,19 +11,21 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - from: AccessMethodFrom::from_json($json->from), - message: $json->message, - mutation_code: $json->mutation_code, - to: AccessMethodTo::from_json($json->to), + created_at: $json->created_at ?? null, + from: isset($json->from) + ? AccessMethodFrom::from_json($json->from) + : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, + to: isset($json->to) ? AccessMethodTo::from_json($json->to) : null, ); } public function __construct( - public string $created_at, - public AccessMethodFrom $from, - public string $message, - public string $mutation_code, - public AccessMethodTo $to, + public string|null $created_at, + public AccessMethodFrom|null $from, + public string|null $message, + public string|null $mutation_code, + public AccessMethodTo|null $to, ) {} } diff --git a/src/Objects/AccessMethodTo.php b/src/Objects/AccessMethodTo.php index 07939470..a1ca5f23 100644 --- a/src/Objects/AccessMethodTo.php +++ b/src/Objects/AccessMethodTo.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): AccessMethodTo|null return null; } return new self( + device_ids: $json->device_ids ?? null, ends_at: $json->ends_at ?? null, starts_at: $json->starts_at ?? null, ); } public function __construct( + public array|null $device_ids, public string|null $ends_at, public string|null $starts_at, ) {} diff --git a/src/Objects/AccessMethodWarnings.php b/src/Objects/AccessMethodWarnings.php index bed8a32a..114cac67 100644 --- a/src/Objects/AccessMethodWarnings.php +++ b/src/Objects/AccessMethodWarnings.php @@ -10,17 +10,17 @@ public static function from_json(mixed $json): AccessMethodWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, original_access_method_id: $json->original_access_method_id ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, public string|null $original_access_method_id, + public string|null $warning_code, ) {} } diff --git a/src/Objects/AcsAccessGroup.php b/src/Objects/AcsAccessGroup.php index 59e11b96..76c0658b 100644 --- a/src/Objects/AcsAccessGroup.php +++ b/src/Objects/AcsAccessGroup.php @@ -10,21 +10,28 @@ public static function from_json(mixed $json): AcsAccessGroup|null return null; } return new self( - access_group_type: $json->access_group_type, - access_group_type_display_name: $json->access_group_type_display_name, - acs_access_group_id: $json->acs_access_group_id, - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, + access_group_type: $json->access_group_type ?? null, + access_group_type_display_name: $json->access_group_type_display_name ?? + null, + access_schedule: isset($json->access_schedule) + ? AcsAccessGroupAccessSchedule::from_json( + $json->access_schedule, + ) + : null, + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, errors: array_map( fn($e) => AcsAccessGroupErrors::from_json($e), $json->errors ?? [], ), - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - is_managed: $json->is_managed, - name: $json->name, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + is_managed: $json->is_managed ?? null, + name: $json->name ?? null, pending_mutations: array_map( fn($p) => AcsAccessGroupPendingMutations::from_json($p), $json->pending_mutations ?? [], @@ -33,31 +40,26 @@ public static function from_json(mixed $json): AcsAccessGroup|null fn($w) => AcsAccessGroupWarnings::from_json($w), $json->warnings ?? [], ), - workspace_id: $json->workspace_id, - access_schedule: isset($json->access_schedule) - ? AcsAccessGroupAccessSchedule::from_json( - $json->access_schedule, - ) - : null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_group_type, - public string $access_group_type_display_name, - public string $acs_access_group_id, - public string $acs_system_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, + public string|null $access_group_type, + public string|null $access_group_type_display_name, + public AcsAccessGroupAccessSchedule|null $access_schedule, + public string|null $acs_access_group_id, + public string|null $acs_system_id, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public array $errors, - public string $external_type, - public string $external_type_display_name, - public bool $is_managed, - public string $name, + public string|null $external_type, + public string|null $external_type_display_name, + public bool|null $is_managed, + public string|null $name, public array $pending_mutations, public array $warnings, - public string $workspace_id, - public AcsAccessGroupAccessSchedule|null $access_schedule, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AcsAccessGroupAccessSchedule.php b/src/Objects/AcsAccessGroupAccessSchedule.php index 06aa160e..78633da8 100644 --- a/src/Objects/AcsAccessGroupAccessSchedule.php +++ b/src/Objects/AcsAccessGroupAccessSchedule.php @@ -11,13 +11,13 @@ public static function from_json( return null; } return new self( - starts_at: $json->starts_at, ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, ); } public function __construct( - public string $starts_at, public string|null $ends_at, + public string|null $starts_at, ) {} } diff --git a/src/Objects/AcsAccessGroupErrors.php b/src/Objects/AcsAccessGroupErrors.php index 16044e89..494e48e8 100644 --- a/src/Objects/AcsAccessGroupErrors.php +++ b/src/Objects/AcsAccessGroupErrors.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AcsAccessGroupErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/AcsAccessGroupFrom.php b/src/Objects/AcsAccessGroupFrom.php index 6a1d278c..7d077ba6 100644 --- a/src/Objects/AcsAccessGroupFrom.php +++ b/src/Objects/AcsAccessGroupFrom.php @@ -9,8 +9,20 @@ public static function from_json(mixed $json): AcsAccessGroupFrom|null if (!$json) { return null; } - return new self(acs_entrance_id: $json->acs_entrance_id ?? null); + return new self( + acs_entrance_id: $json->acs_entrance_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + ends_at: $json->ends_at ?? null, + name: $json->name ?? null, + starts_at: $json->starts_at ?? null, + ); } - public function __construct(public string|null $acs_entrance_id) {} + public function __construct( + public string|null $acs_entrance_id, + public string|null $acs_user_id, + public string|null $ends_at, + public string|null $name, + public string|null $starts_at, + ) {} } diff --git a/src/Objects/AcsAccessGroupPendingMutations.php b/src/Objects/AcsAccessGroupPendingMutations.php index 7b4d7b5a..9c3ffa9d 100644 --- a/src/Objects/AcsAccessGroupPendingMutations.php +++ b/src/Objects/AcsAccessGroupPendingMutations.php @@ -11,13 +11,13 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - message: $json->message, - mutation_code: $json->mutation_code, acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, from: isset($json->from) ? AcsAccessGroupFrom::from_json($json->from) : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? AcsAccessGroupTo::from_json($json->to) : null, @@ -26,11 +26,11 @@ public static function from_json( } public function __construct( - public string $created_at, - public string $message, - public string $mutation_code, public string|null $acs_user_id, + public string|null $created_at, public AcsAccessGroupFrom|null $from, + public string|null $message, + public string|null $mutation_code, public AcsAccessGroupTo|null $to, public string|null $variant, ) {} diff --git a/src/Objects/AcsAccessGroupTo.php b/src/Objects/AcsAccessGroupTo.php index 6f69a0b9..2f7982ae 100644 --- a/src/Objects/AcsAccessGroupTo.php +++ b/src/Objects/AcsAccessGroupTo.php @@ -9,8 +9,20 @@ public static function from_json(mixed $json): AcsAccessGroupTo|null if (!$json) { return null; } - return new self(acs_entrance_id: $json->acs_entrance_id ?? null); + return new self( + acs_entrance_id: $json->acs_entrance_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + ends_at: $json->ends_at ?? null, + name: $json->name ?? null, + starts_at: $json->starts_at ?? null, + ); } - public function __construct(public string|null $acs_entrance_id) {} + public function __construct( + public string|null $acs_entrance_id, + public string|null $acs_user_id, + public string|null $ends_at, + public string|null $name, + public string|null $starts_at, + ) {} } diff --git a/src/Objects/AcsAccessGroupWarnings.php b/src/Objects/AcsAccessGroupWarnings.php index 1d8d77d3..d3bbd407 100644 --- a/src/Objects/AcsAccessGroupWarnings.php +++ b/src/Objects/AcsAccessGroupWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AcsAccessGroupWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/AcsCredential.php b/src/Objects/AcsCredential.php index cb48f2d8..0bb6fb5c 100644 --- a/src/Objects/AcsCredential.php +++ b/src/Objects/AcsCredential.php @@ -10,37 +10,39 @@ public static function from_json(mixed $json): AcsCredential|null return null; } return new self( - access_method: $json->access_method, - acs_credential_id: $json->acs_credential_id, - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsCredentialErrors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => AcsCredentialWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, + access_method: $json->access_method ?? null, + acs_credential_id: $json->acs_credential_id ?? null, acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_system_id: $json->acs_system_id ?? null, acs_user_id: $json->acs_user_id ?? null, assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) ? AcsCredentialAssaAbloyVostioMetadata::from_json( $json->assa_abloy_vostio_metadata, ) : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, ends_at: $json->ends_at ?? null, + errors: array_map( + fn($e) => AcsCredentialErrors::from_json($e), + $json->errors ?? [], + ), external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, is_issued: $json->is_issued ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + is_managed: $json->is_managed ?? null, is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? null, is_one_time_use: $json->is_one_time_use ?? null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, parent_acs_credential_id: $json->parent_acs_credential_id ?? null, starts_at: $json->starts_at ?? null, user_identity_id: $json->user_identity_id ?? null, @@ -49,44 +51,42 @@ public static function from_json(mixed $json): AcsCredential|null $json->visionline_metadata, ) : null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, + warnings: array_map( + fn($w) => AcsCredentialWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_method, - public string $acs_credential_id, - public string $acs_system_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, + public string|null $access_method, + public string|null $acs_credential_id, public string|null $acs_credential_pool_id, + public string|null $acs_system_id, public string|null $acs_user_id, public AcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $card_number, + public string|null $code, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public string|null $ends_at, + public array $errors, public string|null $external_type, public string|null $external_type_display_name, public bool|null $is_issued, + public bool|null $is_latest_desired_state_synced_with_provider, + public bool|null $is_managed, public bool|null $is_multi_phone_sync_credential, public bool|null $is_one_time_use, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at, public string|null $parent_acs_credential_id, public string|null $starts_at, public string|null $user_identity_id, public AcsCredentialVisionlineMetadata|null $visionline_metadata, - public string|null $card_number, - public string|null $code, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AcsCredentialErrors.php b/src/Objects/AcsCredentialErrors.php index 6efaa605..414c19da 100644 --- a/src/Objects/AcsCredentialErrors.php +++ b/src/Objects/AcsCredentialErrors.php @@ -10,15 +10,13 @@ public static function from_json(mixed $json): AcsCredentialErrors|null return null; } return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/AcsCredentialPool.php b/src/Objects/AcsCredentialPool.php index bcf96757..687f33d7 100644 --- a/src/Objects/AcsCredentialPool.php +++ b/src/Objects/AcsCredentialPool.php @@ -10,23 +10,24 @@ public static function from_json(mixed $json): AcsCredentialPool|null return null; } return new self( - acs_credential_pool_id: $json->acs_credential_pool_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - workspace_id: $json->workspace_id, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $acs_credential_pool_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public string $external_type, - public string $external_type_display_name, - public string $workspace_id, + public string|null $acs_credential_pool_id, + public string|null $acs_system_id, + public string|null $created_at, + public string|null $display_name, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AcsCredentialProvisioningAutomation.php b/src/Objects/AcsCredentialProvisioningAutomation.php index b32ff5d5..cd0e0d72 100644 --- a/src/Objects/AcsCredentialProvisioningAutomation.php +++ b/src/Objects/AcsCredentialProvisioningAutomation.php @@ -11,19 +11,21 @@ public static function from_json( return null; } return new self( - acs_credential_provisioning_automation_id: $json->acs_credential_provisioning_automation_id, - created_at: $json->created_at, - credential_manager_acs_system_id: $json->credential_manager_acs_system_id, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id, + acs_credential_provisioning_automation_id: $json->acs_credential_provisioning_automation_id ?? + null, + created_at: $json->created_at ?? null, + credential_manager_acs_system_id: $json->credential_manager_acs_system_id ?? + null, + user_identity_id: $json->user_identity_id ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $acs_credential_provisioning_automation_id, - public string $created_at, - public string $credential_manager_acs_system_id, - public string $user_identity_id, - public string $workspace_id, + public string|null $acs_credential_provisioning_automation_id, + public string|null $created_at, + public string|null $credential_manager_acs_system_id, + public string|null $user_identity_id, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AcsCredentialWarnings.php b/src/Objects/AcsCredentialWarnings.php index 42e6ee6b..4d910aff 100644 --- a/src/Objects/AcsCredentialWarnings.php +++ b/src/Objects/AcsCredentialWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AcsCredentialWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/AcsEncoder.php b/src/Objects/AcsEncoder.php index aac8061a..58974825 100644 --- a/src/Objects/AcsEncoder.php +++ b/src/Objects/AcsEncoder.php @@ -10,26 +10,26 @@ public static function from_json(mixed $json): AcsEncoder|null return null; } return new self( - acs_encoder_id: $json->acs_encoder_id, - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, + acs_encoder_id: $json->acs_encoder_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, errors: array_map( fn($e) => AcsEncoderErrors::from_json($e), $json->errors ?? [], ), - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $acs_encoder_id, - public string $acs_system_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, + public string|null $acs_encoder_id, + public string|null $acs_system_id, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public array $errors, - public string $workspace_id, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AcsEncoderErrors.php b/src/Objects/AcsEncoderErrors.php index 60f4522c..eabeb59d 100644 --- a/src/Objects/AcsEncoderErrors.php +++ b/src/Objects/AcsEncoderErrors.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AcsEncoderErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/AcsEntrance.php b/src/Objects/AcsEntrance.php index e60e5102..4b352dcf 100644 --- a/src/Objects/AcsEntrance.php +++ b/src/Objects/AcsEntrance.php @@ -10,20 +10,8 @@ public static function from_json(mixed $json): AcsEntrance|null return null; } return new self( - acs_entrance_id: $json->acs_entrance_id, - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsEntranceErrors::from_json($e), - $json->errors ?? [], - ), - space_ids: $json->space_ids, - warnings: array_map( - fn($w) => AcsEntranceWarnings::from_json($w), - $json->warnings ?? [], - ), + acs_entrance_id: $json->acs_entrance_id ?? null, + acs_system_id: $json->acs_system_id ?? null, assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) ? AcsEntranceAssaAbloyVostioMetadata::from_json( $json->assa_abloy_vostio_metadata, @@ -43,6 +31,9 @@ public static function from_json(mixed $json): AcsEntrance|null can_unlock_with_code: $json->can_unlock_with_code ?? null, can_unlock_with_mobile_key: $json->can_unlock_with_mobile_key ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, dormakaba_ambiance_metadata: isset( $json->dormakaba_ambiance_metadata, ) @@ -57,6 +48,10 @@ public static function from_json(mixed $json): AcsEntrance|null $json->dormakaba_community_metadata, ) : null, + errors: array_map( + fn($e) => AcsEntranceErrors::from_json($e), + $json->errors ?? [], + ), hotek_metadata: isset($json->hotek_metadata) ? AcsEntranceHotekMetadata::from_json($json->hotek_metadata) : null, @@ -74,23 +69,22 @@ public static function from_json(mixed $json): AcsEntrance|null $json->salto_space_metadata, ) : null, + space_ids: $json->space_ids ?? null, visionline_metadata: isset($json->visionline_metadata) ? AcsEntranceVisionlineMetadata::from_json( $json->visionline_metadata, ) : null, + warnings: array_map( + fn($w) => AcsEntranceWarnings::from_json($w), + $json->warnings ?? [], + ), ); } public function __construct( - public string $acs_entrance_id, - public string $acs_system_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, - public array $errors, - public array $space_ids, - public array $warnings, + public string|null $acs_entrance_id, + public string|null $acs_system_id, public AcsEntranceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, public AcsEntranceAvigilonAltaMetadata|null $avigilon_alta_metadata, public AcsEntranceBrivoMetadata|null $brivo_metadata, @@ -99,13 +93,19 @@ public function __construct( public bool|null $can_unlock_with_cloud_key, public bool|null $can_unlock_with_code, public bool|null $can_unlock_with_mobile_key, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public AcsEntranceDormakabaAmbianceMetadata|null $dormakaba_ambiance_metadata, public AcsEntranceDormakabaCommunityMetadata|null $dormakaba_community_metadata, + public array $errors, public AcsEntranceHotekMetadata|null $hotek_metadata, public bool|null $is_locked, public AcsEntranceLatchMetadata|null $latch_metadata, public AcsEntranceSaltoKsMetadata|null $salto_ks_metadata, public AcsEntranceSaltoSpaceMetadata|null $salto_space_metadata, + public array|null $space_ids, public AcsEntranceVisionlineMetadata|null $visionline_metadata, + public array $warnings, ) {} } diff --git a/src/Objects/AcsEntranceErrors.php b/src/Objects/AcsEntranceErrors.php index 3b7d2a22..eae7219d 100644 --- a/src/Objects/AcsEntranceErrors.php +++ b/src/Objects/AcsEntranceErrors.php @@ -10,15 +10,13 @@ public static function from_json(mixed $json): AcsEntranceErrors|null return null; } return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/AcsEntranceVisionlineMetadata.php b/src/Objects/AcsEntranceVisionlineMetadata.php index 12bae9e5..fc4c2cb1 100644 --- a/src/Objects/AcsEntranceVisionlineMetadata.php +++ b/src/Objects/AcsEntranceVisionlineMetadata.php @@ -23,6 +23,6 @@ public static function from_json( public function __construct( public string|null $door_category, public string|null $door_name, - public array|null $profiles, + public array $profiles, ) {} } diff --git a/src/Objects/AcsEntranceWarnings.php b/src/Objects/AcsEntranceWarnings.php index 03ab9ab3..3d29d169 100644 --- a/src/Objects/AcsEntranceWarnings.php +++ b/src/Objects/AcsEntranceWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AcsEntranceWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/AcsSystem.php b/src/Objects/AcsSystem.php index 7977c41a..d3c47822 100644 --- a/src/Objects/AcsSystem.php +++ b/src/Objects/AcsSystem.php @@ -10,29 +10,28 @@ public static function from_json(mixed $json): AcsSystem|null return null; } return new self( - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - connected_account_ids: $json->connected_account_ids, - created_at: $json->created_at, + acs_access_group_count: $json->acs_access_group_count ?? null, + acs_system_id: $json->acs_system_id ?? null, + acs_user_count: $json->acs_user_count ?? null, + connected_account_id: $json->connected_account_id ?? null, + connected_account_ids: $json->connected_account_ids ?? null, + created_at: $json->created_at ?? null, + default_credential_manager_acs_system_id: $json->default_credential_manager_acs_system_id ?? + null, errors: array_map( fn($e) => AcsSystemErrors::from_json($e), $json->errors ?? [], ), - image_alt_text: $json->image_alt_text, - image_url: $json->image_url, - is_credential_manager: $json->is_credential_manager, - location: AcsSystemLocation::from_json($json->location), - name: $json->name, - warnings: array_map( - fn($w) => AcsSystemWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, - acs_access_group_count: $json->acs_access_group_count ?? null, - acs_user_count: $json->acs_user_count ?? null, external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, + image_alt_text: $json->image_alt_text ?? null, + image_url: $json->image_url ?? null, + is_credential_manager: $json->is_credential_manager ?? null, + location: isset($json->location) + ? AcsSystemLocation::from_json($json->location) + : null, + name: $json->name ?? null, system_type: $json->system_type ?? null, system_type_display_name: $json->system_type_display_name ?? null, visionline_metadata: isset($json->visionline_metadata) @@ -40,31 +39,34 @@ public static function from_json(mixed $json): AcsSystem|null $json->visionline_metadata, ) : null, - default_credential_manager_acs_system_id: $json->default_credential_manager_acs_system_id ?? - null, + warnings: array_map( + fn($w) => AcsSystemWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $acs_system_id, - public string $connected_account_id, - public array $connected_account_ids, - public string $created_at, - public array $errors, - public string $image_alt_text, - public string $image_url, - public bool $is_credential_manager, - public AcsSystemLocation $location, - public string $name, - public array $warnings, - public string $workspace_id, public float|null $acs_access_group_count, + public string|null $acs_system_id, public float|null $acs_user_count, + public string|null $connected_account_id, + public array|null $connected_account_ids, + public string|null $created_at, + public string|null $default_credential_manager_acs_system_id, + public array $errors, public string|null $external_type, public string|null $external_type_display_name, + public string|null $image_alt_text, + public string|null $image_url, + public bool|null $is_credential_manager, + public AcsSystemLocation|null $location, + public string|null $name, public string|null $system_type, public string|null $system_type_display_name, public AcsSystemVisionlineMetadata|null $visionline_metadata, - public string|null $default_credential_manager_acs_system_id, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AcsSystemErrors.php b/src/Objects/AcsSystemErrors.php index 692d9a0b..84f4140d 100644 --- a/src/Objects/AcsSystemErrors.php +++ b/src/Objects/AcsSystemErrors.php @@ -10,17 +10,17 @@ public static function from_json(mixed $json): AcsSystemErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, is_bridge_error: $json->is_bridge_error ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, public bool|null $is_bridge_error, + public string|null $message, ) {} } diff --git a/src/Objects/AcsSystemWarnings.php b/src/Objects/AcsSystemWarnings.php index 003bf2d8..d5c44335 100644 --- a/src/Objects/AcsSystemWarnings.php +++ b/src/Objects/AcsSystemWarnings.php @@ -10,18 +10,18 @@ public static function from_json(mixed $json): AcsSystemWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, misconfigured_acs_entrance_ids: $json->misconfigured_acs_entrance_ids ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, public array|null $misconfigured_acs_entrance_ids, + public string|null $warning_code, ) {} } diff --git a/src/Objects/AcsUser.php b/src/Objects/AcsUser.php index c92b2ca8..ff5645f2 100644 --- a/src/Objects/AcsUser.php +++ b/src/Objects/AcsUser.php @@ -10,32 +10,28 @@ public static function from_json(mixed $json): AcsUser|null return null; } return new self( - acs_system_id: $json->acs_system_id, - acs_user_id: $json->acs_user_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsUserErrors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => AcsUserWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, access_schedule: isset($json->access_schedule) ? AcsUserAccessSchedule::from_json($json->access_schedule) : null, + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, email: $json->email ?? null, email_address: $json->email_address ?? null, + errors: array_map( + fn($e) => AcsUserErrors::from_json($e), + $json->errors ?? [], + ), external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, full_name: $json->full_name ?? null, hid_acs_system_id: $json->hid_acs_system_id ?? null, + is_managed: $json->is_managed ?? null, is_suspended: $json->is_suspended ?? null, + last_successful_sync_at: $json->last_successful_sync_at ?? null, pending_mutations: array_map( fn($p) => AcsUserPendingMutations::from_json($p), $json->pending_mutations ?? [], @@ -46,41 +42,45 @@ public static function from_json(mixed $json): AcsUser|null $json->salto_space_metadata, ) : null, - user_identity_id: $json->user_identity_id ?? null, - last_successful_sync_at: $json->last_successful_sync_at ?? null, user_identity_email_address: $json->user_identity_email_address ?? null, user_identity_full_name: $json->user_identity_full_name ?? null, + user_identity_id: $json->user_identity_id ?? null, user_identity_phone_number: $json->user_identity_phone_number ?? null, + warnings: array_map( + fn($w) => AcsUserWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $acs_system_id, - public string $acs_user_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, public AcsUserAccessSchedule|null $access_schedule, + public string|null $acs_system_id, + public string|null $acs_user_id, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public string|null $email, public string|null $email_address, + public array $errors, public string|null $external_type, public string|null $external_type_display_name, public string|null $full_name, public string|null $hid_acs_system_id, + public bool|null $is_managed, public bool|null $is_suspended, - public array|null $pending_mutations, + public string|null $last_successful_sync_at, + public array $pending_mutations, public string|null $phone_number, public AcsUserSaltoSpaceMetadata|null $salto_space_metadata, - public string|null $user_identity_id, - public string|null $last_successful_sync_at, public string|null $user_identity_email_address, public string|null $user_identity_full_name, + public string|null $user_identity_id, public string|null $user_identity_phone_number, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/AcsUserAccessSchedule.php b/src/Objects/AcsUserAccessSchedule.php index f4de74ae..34298ecb 100644 --- a/src/Objects/AcsUserAccessSchedule.php +++ b/src/Objects/AcsUserAccessSchedule.php @@ -10,13 +10,13 @@ public static function from_json(mixed $json): AcsUserAccessSchedule|null return null; } return new self( - starts_at: $json->starts_at, ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, ); } public function __construct( - public string $starts_at, public string|null $ends_at, + public string|null $starts_at, ) {} } diff --git a/src/Objects/AcsUserErrors.php b/src/Objects/AcsUserErrors.php index ed996f29..aca6a44f 100644 --- a/src/Objects/AcsUserErrors.php +++ b/src/Objects/AcsUserErrors.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AcsUserErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/AcsUserFrom.php b/src/Objects/AcsUserFrom.php index b0c23f63..4e2b6cd0 100644 --- a/src/Objects/AcsUserFrom.php +++ b/src/Objects/AcsUserFrom.php @@ -9,8 +9,26 @@ public static function from_json(mixed $json): AcsUserFrom|null if (!$json) { return null; } - return new self(acs_credential_id: $json->acs_credential_id ?? null); + return new self( + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + email_address: $json->email_address ?? null, + ends_at: $json->ends_at ?? null, + full_name: $json->full_name ?? null, + is_suspended: $json->is_suspended ?? null, + phone_number: $json->phone_number ?? null, + starts_at: $json->starts_at ?? null, + ); } - public function __construct(public string|null $acs_credential_id) {} + public function __construct( + public string|null $acs_access_group_id, + public string|null $acs_credential_id, + public string|null $email_address, + public string|null $ends_at, + public string|null $full_name, + public bool|null $is_suspended, + public string|null $phone_number, + public string|null $starts_at, + ) {} } diff --git a/src/Objects/AcsUserPendingMutations.php b/src/Objects/AcsUserPendingMutations.php index c061bc4d..f6a1f5e3 100644 --- a/src/Objects/AcsUserPendingMutations.php +++ b/src/Objects/AcsUserPendingMutations.php @@ -10,27 +10,27 @@ public static function from_json(mixed $json): AcsUserPendingMutations|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - mutation_code: $json->mutation_code, acs_access_group_id: $json->acs_access_group_id ?? null, + created_at: $json->created_at ?? null, from: isset($json->from) ? AcsUserFrom::from_json($json->from) : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, + scheduled_at: $json->scheduled_at ?? null, to: isset($json->to) ? AcsUserTo::from_json($json->to) : null, variant: $json->variant ?? null, - scheduled_at: $json->scheduled_at ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $mutation_code, public string|null $acs_access_group_id, + public string|null $created_at, public AcsUserFrom|null $from, + public string|null $message, + public string|null $mutation_code, + public string|null $scheduled_at, public AcsUserTo|null $to, public string|null $variant, - public string|null $scheduled_at, ) {} } diff --git a/src/Objects/AcsUserTo.php b/src/Objects/AcsUserTo.php index fe315fcf..9e59e4e2 100644 --- a/src/Objects/AcsUserTo.php +++ b/src/Objects/AcsUserTo.php @@ -9,8 +9,26 @@ public static function from_json(mixed $json): AcsUserTo|null if (!$json) { return null; } - return new self(acs_credential_id: $json->acs_credential_id ?? null); + return new self( + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + email_address: $json->email_address ?? null, + ends_at: $json->ends_at ?? null, + full_name: $json->full_name ?? null, + is_suspended: $json->is_suspended ?? null, + phone_number: $json->phone_number ?? null, + starts_at: $json->starts_at ?? null, + ); } - public function __construct(public string|null $acs_credential_id) {} + public function __construct( + public string|null $acs_access_group_id, + public string|null $acs_credential_id, + public string|null $email_address, + public string|null $ends_at, + public string|null $full_name, + public bool|null $is_suspended, + public string|null $phone_number, + public string|null $starts_at, + ) {} } diff --git a/src/Objects/AcsUserWarnings.php b/src/Objects/AcsUserWarnings.php index 683619ca..ef105786 100644 --- a/src/Objects/AcsUserWarnings.php +++ b/src/Objects/AcsUserWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): AcsUserWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/ActionAttempt.php b/src/Objects/ActionAttempt.php index e6c6e23e..27081525 100644 --- a/src/Objects/ActionAttempt.php +++ b/src/Objects/ActionAttempt.php @@ -15,8 +15,10 @@ public static function from_json(mixed $json): ActionAttempt|null error: isset($json->error) ? ActionAttemptError::from_json($json->error) : null, + result: isset($json->result) + ? ActionAttemptResult::from_json($json->result) + : null, status: $json->status ?? null, - result: $json->result ?? null, ); } @@ -24,7 +26,7 @@ public function __construct( public string|null $action_attempt_id, public string|null $action_type, public ActionAttemptError|null $error, + public ActionAttemptResult|null $result, public string|null $status, - public mixed $result, ) {} } diff --git a/src/Objects/ActionAttemptAcsCredentialOnEncoder.php b/src/Objects/ActionAttemptAcsCredentialOnEncoder.php new file mode 100644 index 00000000..8d5d6ae1 --- /dev/null +++ b/src/Objects/ActionAttemptAcsCredentialOnEncoder.php @@ -0,0 +1,35 @@ +card_number ?? null, + created_at: $json->created_at ?? null, + ends_at: $json->ends_at ?? null, + is_issued: $json->is_issued ?? null, + starts_at: $json->starts_at ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? ActionAttemptVisionlineMetadata::from_json( + $json->visionline_metadata, + ) + : null, + ); + } + + public function __construct( + public string|null $card_number, + public string|null $created_at, + public string|null $ends_at, + public bool|null $is_issued, + public string|null $starts_at, + public ActionAttemptVisionlineMetadata|null $visionline_metadata, + ) {} +} diff --git a/src/Objects/ActionAttemptAcsCredentialOnSeam.php b/src/Objects/ActionAttemptAcsCredentialOnSeam.php new file mode 100644 index 00000000..8baa1192 --- /dev/null +++ b/src/Objects/ActionAttemptAcsCredentialOnSeam.php @@ -0,0 +1,93 @@ +access_method ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? ActionAttemptAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata, + ) + : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, + ends_at: $json->ends_at ?? null, + errors: array_map( + fn($e) => ActionAttemptErrors::from_json($e), + $json->errors ?? [], + ), + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + is_issued: $json->is_issued ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + is_managed: $json->is_managed ?? null, + is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? + null, + is_one_time_use: $json->is_one_time_use ?? null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, + parent_acs_credential_id: $json->parent_acs_credential_id ?? null, + starts_at: $json->starts_at ?? null, + user_identity_id: $json->user_identity_id ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? ActionAttemptVisionlineMetadata::from_json( + $json->visionline_metadata, + ) + : null, + warnings: array_map( + fn($w) => ActionAttemptWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, + ); + } + + public function __construct( + public string|null $access_method, + public string|null $acs_credential_id, + public string|null $acs_credential_pool_id, + public string|null $acs_system_id, + public string|null $acs_user_id, + public ActionAttemptAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $card_number, + public string|null $code, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, + public string|null $ends_at, + public array $errors, + public string|null $external_type, + public string|null $external_type_display_name, + public bool|null $is_issued, + public bool|null $is_latest_desired_state_synced_with_provider, + public bool|null $is_managed, + public bool|null $is_multi_phone_sync_credential, + public bool|null $is_one_time_use, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at, + public string|null $parent_acs_credential_id, + public string|null $starts_at, + public string|null $user_identity_id, + public ActionAttemptVisionlineMetadata|null $visionline_metadata, + public array $warnings, + public string|null $workspace_id, + ) {} +} diff --git a/src/Objects/ActionAttemptAssaAbloyVostioMetadata.php b/src/Objects/ActionAttemptAssaAbloyVostioMetadata.php new file mode 100644 index 00000000..9bc57b26 --- /dev/null +++ b/src/Objects/ActionAttemptAssaAbloyVostioMetadata.php @@ -0,0 +1,32 @@ +auto_join ?? null, + door_names: $json->door_names ?? null, + endpoint_id: $json->endpoint_id ?? null, + key_id: $json->key_id ?? null, + key_issuing_request_id: $json->key_issuing_request_id ?? null, + override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? + null, + ); + } + + public function __construct( + public bool|null $auto_join, + public array|null $door_names, + public string|null $endpoint_id, + public string|null $key_id, + public string|null $key_issuing_request_id, + public array|null $override_guest_acs_entrance_ids, + ) {} +} diff --git a/src/Objects/ActionAttemptError.php b/src/Objects/ActionAttemptError.php index d756a57a..9b2d4239 100644 --- a/src/Objects/ActionAttemptError.php +++ b/src/Objects/ActionAttemptError.php @@ -9,8 +9,14 @@ public static function from_json(mixed $json): ActionAttemptError|null if (!$json) { return null; } - return new self(message: $json->message, type: $json->type); + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); } - public function __construct(public string $message, public string $type) {} + public function __construct( + public string|null $message, + public string|null $type, + ) {} } diff --git a/src/Objects/ActionAttemptErrors.php b/src/Objects/ActionAttemptErrors.php new file mode 100644 index 00000000..9fd0a67b --- /dev/null +++ b/src/Objects/ActionAttemptErrors.php @@ -0,0 +1,22 @@ +error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + public string|null $error_code, + public string|null $message, + ) {} +} diff --git a/src/Objects/ActionAttemptFrom.php b/src/Objects/ActionAttemptFrom.php new file mode 100644 index 00000000..c59cfd89 --- /dev/null +++ b/src/Objects/ActionAttemptFrom.php @@ -0,0 +1,22 @@ +ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + public string|null $ends_at, + public string|null $starts_at, + ) {} +} diff --git a/src/Objects/ActionAttemptPendingMutations.php b/src/Objects/ActionAttemptPendingMutations.php new file mode 100644 index 00000000..0536a889 --- /dev/null +++ b/src/Objects/ActionAttemptPendingMutations.php @@ -0,0 +1,31 @@ +created_at ?? null, + from: isset($json->from) + ? ActionAttemptFrom::from_json($json->from) + : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, + to: isset($json->to) ? ActionAttemptTo::from_json($json->to) : null, + ); + } + + public function __construct( + public string|null $created_at, + public ActionAttemptFrom|null $from, + public string|null $message, + public string|null $mutation_code, + public ActionAttemptTo|null $to, + ) {} +} diff --git a/src/Objects/ActionAttemptResult.php b/src/Objects/ActionAttemptResult.php new file mode 100644 index 00000000..f5d9b06d --- /dev/null +++ b/src/Objects/ActionAttemptResult.php @@ -0,0 +1,129 @@ +access_method ?? null, + access_method_id: $json->access_method_id ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + acs_credential_on_encoder: isset($json->acs_credential_on_encoder) + ? ActionAttemptAcsCredentialOnEncoder::from_json( + $json->acs_credential_on_encoder, + ) + : null, + acs_credential_on_seam: isset($json->acs_credential_on_seam) + ? ActionAttemptAcsCredentialOnSeam::from_json( + $json->acs_credential_on_seam, + ) + : null, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? ActionAttemptAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata, + ) + : null, + card_number: $json->card_number ?? null, + client_session_token: $json->client_session_token ?? null, + code: $json->code ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + customization_profile_id: $json->customization_profile_id ?? null, + display_name: $json->display_name ?? null, + ends_at: $json->ends_at ?? null, + errors: array_map( + fn($e) => ActionAttemptErrors::from_json($e), + $json->errors ?? [], + ), + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + instant_key_url: $json->instant_key_url ?? null, + is_assignment_required: $json->is_assignment_required ?? null, + is_encoding_required: $json->is_encoding_required ?? null, + is_issued: $json->is_issued ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + is_managed: $json->is_managed ?? null, + is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? + null, + is_one_time_use: $json->is_one_time_use ?? null, + is_ready_for_assignment: $json->is_ready_for_assignment ?? null, + is_ready_for_encoding: $json->is_ready_for_encoding ?? null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, + mode: $json->mode ?? null, + parent_acs_credential_id: $json->parent_acs_credential_id ?? null, + pending_mutations: array_map( + fn($p) => ActionAttemptPendingMutations::from_json($p), + $json->pending_mutations ?? [], + ), + starts_at: $json->starts_at ?? null, + user_identity_id: $json->user_identity_id ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? ActionAttemptVisionlineMetadata::from_json( + $json->visionline_metadata, + ) + : null, + warnings: array_map( + fn($w) => ActionAttemptWarnings::from_json($w), + $json->warnings ?? [], + ), + was_confirmed_by_device: $json->was_confirmed_by_device ?? null, + workspace_id: $json->workspace_id ?? null, + ); + } + + public function __construct( + public string|null $access_method, + public string|null $access_method_id, + public string|null $acs_credential_id, + public ActionAttemptAcsCredentialOnEncoder|null $acs_credential_on_encoder, + public ActionAttemptAcsCredentialOnSeam|null $acs_credential_on_seam, + public string|null $acs_credential_pool_id, + public string|null $acs_system_id, + public string|null $acs_user_id, + public ActionAttemptAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $card_number, + public string|null $client_session_token, + public string|null $code, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $customization_profile_id, + public string|null $display_name, + public string|null $ends_at, + public array $errors, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $instant_key_url, + public bool|null $is_assignment_required, + public bool|null $is_encoding_required, + public bool|null $is_issued, + public bool|null $is_latest_desired_state_synced_with_provider, + public bool|null $is_managed, + public bool|null $is_multi_phone_sync_credential, + public bool|null $is_one_time_use, + public bool|null $is_ready_for_assignment, + public bool|null $is_ready_for_encoding, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at, + public string|null $mode, + public string|null $parent_acs_credential_id, + public array $pending_mutations, + public string|null $starts_at, + public string|null $user_identity_id, + public ActionAttemptVisionlineMetadata|null $visionline_metadata, + public array $warnings, + public bool|null $was_confirmed_by_device, + public string|null $workspace_id, + ) {} +} diff --git a/src/Objects/ActionAttemptTo.php b/src/Objects/ActionAttemptTo.php new file mode 100644 index 00000000..52d14277 --- /dev/null +++ b/src/Objects/ActionAttemptTo.php @@ -0,0 +1,22 @@ +ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + public string|null $ends_at, + public string|null $starts_at, + ) {} +} diff --git a/src/Objects/ActionAttemptVisionlineMetadata.php b/src/Objects/ActionAttemptVisionlineMetadata.php new file mode 100644 index 00000000..a06c3e13 --- /dev/null +++ b/src/Objects/ActionAttemptVisionlineMetadata.php @@ -0,0 +1,43 @@ +cancelled ?? null, + card_format: $json->card_format ?? null, + card_holder: $json->card_holder ?? null, + card_id: $json->card_id ?? null, + common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, + discarded: $json->discarded ?? null, + expired: $json->expired ?? null, + guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, + number_of_issued_cards: $json->number_of_issued_cards ?? null, + overridden: $json->overridden ?? null, + overwritten: $json->overwritten ?? null, + pending_auto_update: $json->pending_auto_update ?? null, + ); + } + + public function __construct( + public bool|null $cancelled, + public string|null $card_format, + public string|null $card_holder, + public string|null $card_id, + public array|null $common_acs_entrance_ids, + public bool|null $discarded, + public bool|null $expired, + public array|null $guest_acs_entrance_ids, + public float|null $number_of_issued_cards, + public bool|null $overridden, + public bool|null $overwritten, + public bool|null $pending_auto_update, + ) {} +} diff --git a/src/Objects/ActionAttemptWarnings.php b/src/Objects/ActionAttemptWarnings.php new file mode 100644 index 00000000..114f1a57 --- /dev/null +++ b/src/Objects/ActionAttemptWarnings.php @@ -0,0 +1,24 @@ +created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + public string|null $created_at, + public string|null $message, + public string|null $warning_code, + ) {} +} diff --git a/src/Objects/Batch.php b/src/Objects/Batch.php index f4208a43..dab4cf24 100644 --- a/src/Objects/Batch.php +++ b/src/Objects/Batch.php @@ -43,33 +43,33 @@ public static function from_json(mixed $json): Batch|null } public function __construct( - public array|null $access_codes, - public array|null $access_grants, - public array|null $access_methods, - public array|null $acs_access_groups, - public array|null $acs_credentials, - public array|null $acs_encoders, - public array|null $acs_entrances, - public array|null $acs_systems, - public array|null $acs_users, - public array|null $action_attempts, - public array|null $client_sessions, - public array|null $connect_webviews, - public array|null $connected_accounts, - public array|null $customization_profiles, - public array|null $devices, - public array|null $events, - public array|null $instant_keys, - public array|null $noise_thresholds, - public array|null $spaces, - public array|null $thermostat_daily_programs, - public array|null $thermostat_schedules, - public array|null $unmanaged_access_codes, - public array|null $unmanaged_acs_access_groups, - public array|null $unmanaged_acs_credentials, - public array|null $unmanaged_acs_users, - public array|null $unmanaged_devices, - public array|null $user_identities, - public array|null $workspaces, + public mixed $access_codes, + public mixed $access_grants, + public mixed $access_methods, + public mixed $acs_access_groups, + public mixed $acs_credentials, + public mixed $acs_encoders, + public mixed $acs_entrances, + public mixed $acs_systems, + public mixed $acs_users, + public mixed $action_attempts, + public mixed $client_sessions, + public mixed $connect_webviews, + public mixed $connected_accounts, + public mixed $customization_profiles, + public mixed $devices, + public mixed $events, + public mixed $instant_keys, + public mixed $noise_thresholds, + public mixed $spaces, + public mixed $thermostat_daily_programs, + public mixed $thermostat_schedules, + public mixed $unmanaged_access_codes, + public mixed $unmanaged_acs_access_groups, + public mixed $unmanaged_acs_credentials, + public mixed $unmanaged_acs_users, + public mixed $unmanaged_devices, + public mixed $user_identities, + public mixed $workspaces, ) {} } diff --git a/src/Objects/BridgeClientSession.php b/src/Objects/BridgeClientSession.php index d4a06b14..51322b40 100644 --- a/src/Objects/BridgeClientSession.php +++ b/src/Objects/BridgeClientSession.php @@ -10,20 +10,22 @@ public static function from_json(mixed $json): BridgeClientSession|null return null; } return new self( - bridge_client_machine_identifier_key: $json->bridge_client_machine_identifier_key, - bridge_client_name: $json->bridge_client_name, - bridge_client_session_id: $json->bridge_client_session_id, - bridge_client_session_token: $json->bridge_client_session_token, - bridge_client_time_zone: $json->bridge_client_time_zone, - created_at: $json->created_at, + bridge_client_machine_identifier_key: $json->bridge_client_machine_identifier_key ?? + null, + bridge_client_name: $json->bridge_client_name ?? null, + bridge_client_session_id: $json->bridge_client_session_id ?? null, + bridge_client_session_token: $json->bridge_client_session_token ?? + null, + bridge_client_time_zone: $json->bridge_client_time_zone ?? null, + created_at: $json->created_at ?? null, errors: array_map( fn($e) => BridgeClientSessionErrors::from_json($e), $json->errors ?? [], ), - pairing_code: $json->pairing_code, - pairing_code_expires_at: $json->pairing_code_expires_at, - tailscale_hostname: $json->tailscale_hostname, + pairing_code: $json->pairing_code ?? null, + pairing_code_expires_at: $json->pairing_code_expires_at ?? null, tailscale_auth_key: $json->tailscale_auth_key ?? null, + tailscale_hostname: $json->tailscale_hostname ?? null, telemetry_token: $json->telemetry_token ?? null, telemetry_token_expires_at: $json->telemetry_token_expires_at ?? null, @@ -32,17 +34,17 @@ public static function from_json(mixed $json): BridgeClientSession|null } public function __construct( - public string $bridge_client_machine_identifier_key, - public string $bridge_client_name, - public string $bridge_client_session_id, - public string $bridge_client_session_token, - public string $bridge_client_time_zone, - public string $created_at, + public string|null $bridge_client_machine_identifier_key, + public string|null $bridge_client_name, + public string|null $bridge_client_session_id, + public string|null $bridge_client_session_token, + public string|null $bridge_client_time_zone, + public string|null $created_at, public array $errors, - public string $pairing_code, - public string $pairing_code_expires_at, - public string $tailscale_hostname, + public string|null $pairing_code, + public string|null $pairing_code_expires_at, public string|null $tailscale_auth_key, + public string|null $tailscale_hostname, public string|null $telemetry_token, public string|null $telemetry_token_expires_at, public string|null $telemetry_url, diff --git a/src/Objects/BridgeClientSessionErrors.php b/src/Objects/BridgeClientSessionErrors.php index 9d7e738f..49715616 100644 --- a/src/Objects/BridgeClientSessionErrors.php +++ b/src/Objects/BridgeClientSessionErrors.php @@ -11,30 +11,30 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, can_tailscale_proxy_reach_bridge: $json->can_tailscale_proxy_reach_bridge ?? null, can_tailscale_proxy_reach_tailscale_network: $json->can_tailscale_proxy_reach_tailscale_network ?? null, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, is_bridge_socks_server_healthy: $json->is_bridge_socks_server_healthy ?? null, is_tailscale_proxy_reachable: $json->is_tailscale_proxy_reachable ?? null, is_tailscale_proxy_socks_server_healthy: $json->is_tailscale_proxy_socks_server_healthy ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, public bool|null $can_tailscale_proxy_reach_bridge, public bool|null $can_tailscale_proxy_reach_tailscale_network, + public string|null $created_at, + public string|null $error_code, public bool|null $is_bridge_socks_server_healthy, public bool|null $is_tailscale_proxy_reachable, public bool|null $is_tailscale_proxy_socks_server_healthy, + public string|null $message, ) {} } diff --git a/src/Objects/BridgeConnectedSystems.php b/src/Objects/BridgeConnectedSystems.php index 07d70195..bcc0bb4d 100644 --- a/src/Objects/BridgeConnectedSystems.php +++ b/src/Objects/BridgeConnectedSystems.php @@ -10,25 +10,26 @@ public static function from_json(mixed $json): BridgeConnectedSystems|null return null; } return new self( - acs_system_display_name: $json->acs_system_display_name, - acs_system_id: $json->acs_system_id, - bridge_created_at: $json->bridge_created_at, - bridge_id: $json->bridge_id, - connected_account_created_at: $json->connected_account_created_at, - connected_account_id: $json->connected_account_id, - workspace_display_name: $json->workspace_display_name, - workspace_id: $json->workspace_id, + acs_system_display_name: $json->acs_system_display_name ?? null, + acs_system_id: $json->acs_system_id ?? null, + bridge_created_at: $json->bridge_created_at ?? null, + bridge_id: $json->bridge_id ?? null, + connected_account_created_at: $json->connected_account_created_at ?? + null, + connected_account_id: $json->connected_account_id ?? null, + workspace_display_name: $json->workspace_display_name ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $acs_system_display_name, - public string $acs_system_id, - public string $bridge_created_at, - public string $bridge_id, - public string $connected_account_created_at, - public string $connected_account_id, - public string $workspace_display_name, - public string $workspace_id, + public string|null $acs_system_display_name, + public string|null $acs_system_id, + public string|null $bridge_created_at, + public string|null $bridge_id, + public string|null $connected_account_created_at, + public string|null $connected_account_id, + public string|null $workspace_display_name, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/ClientSession.php b/src/Objects/ClientSession.php index 4c7b8a8c..57ea99e1 100644 --- a/src/Objects/ClientSession.php +++ b/src/Objects/ClientSession.php @@ -10,33 +10,33 @@ public static function from_json(mixed $json): ClientSession|null return null; } return new self( - client_session_id: $json->client_session_id, - connect_webview_ids: $json->connect_webview_ids, - connected_account_ids: $json->connected_account_ids, - created_at: $json->created_at, - device_count: $json->device_count, - expires_at: $json->expires_at, - token: $json->token, - user_identity_ids: $json->user_identity_ids, - workspace_id: $json->workspace_id, + client_session_id: $json->client_session_id ?? null, + connect_webview_ids: $json->connect_webview_ids ?? null, + connected_account_ids: $json->connected_account_ids ?? null, + created_at: $json->created_at ?? null, customer_key: $json->customer_key ?? null, - user_identity_id: $json->user_identity_id ?? null, + device_count: $json->device_count ?? null, + expires_at: $json->expires_at ?? null, + token: $json->token ?? null, user_identifier_key: $json->user_identifier_key ?? null, + user_identity_id: $json->user_identity_id ?? null, + user_identity_ids: $json->user_identity_ids ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $client_session_id, - public array $connect_webview_ids, - public array $connected_account_ids, - public string $created_at, - public float $device_count, - public string $expires_at, - public string $token, - public array $user_identity_ids, - public string $workspace_id, + public string|null $client_session_id, + public array|null $connect_webview_ids, + public array|null $connected_account_ids, + public string|null $created_at, public string|null $customer_key, - public string|null $user_identity_id, + public float|null $device_count, + public string|null $expires_at, + public string|null $token, public string|null $user_identifier_key, + public string|null $user_identity_id, + public array|null $user_identity_ids, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/ConnectWebview.php b/src/Objects/ConnectWebview.php index a64d5b88..370cd71b 100644 --- a/src/Objects/ConnectWebview.php +++ b/src/Objects/ConnectWebview.php @@ -10,52 +10,53 @@ public static function from_json(mixed $json): ConnectWebview|null return null; } return new self( - accepted_capabilities: $json->accepted_capabilities, - accepted_devices: $json->accepted_devices, - accepted_providers: $json->accepted_providers, - any_device_allowed: $json->any_device_allowed, - any_provider_allowed: $json->any_provider_allowed, - automatically_manage_new_devices: $json->automatically_manage_new_devices, - connect_webview_id: $json->connect_webview_id, - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_selection_mode: $json->device_selection_mode, - login_successful: $json->login_successful, - status: $json->status, - url: $json->url, - wait_for_device_creation: $json->wait_for_device_creation, - workspace_id: $json->workspace_id, - customer_key: $json->customer_key ?? null, + accepted_capabilities: $json->accepted_capabilities ?? null, + accepted_devices: $json->accepted_devices ?? null, + accepted_providers: $json->accepted_providers ?? null, + any_device_allowed: $json->any_device_allowed ?? null, + any_provider_allowed: $json->any_provider_allowed ?? null, authorized_at: $json->authorized_at ?? null, + automatically_manage_new_devices: $json->automatically_manage_new_devices ?? + null, + connect_webview_id: $json->connect_webview_id ?? null, connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + custom_metadata: $json->custom_metadata ?? null, custom_redirect_failure_url: $json->custom_redirect_failure_url ?? null, custom_redirect_url: $json->custom_redirect_url ?? null, + customer_key: $json->customer_key ?? null, + device_selection_mode: $json->device_selection_mode ?? null, + login_successful: $json->login_successful ?? null, selected_provider: $json->selected_provider ?? null, + status: $json->status ?? null, + url: $json->url ?? null, + wait_for_device_creation: $json->wait_for_device_creation ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public array $accepted_capabilities, - public array $accepted_devices, - public array $accepted_providers, - public bool $any_device_allowed, - public bool $any_provider_allowed, - public bool $automatically_manage_new_devices, - public string $connect_webview_id, - public string $created_at, - public mixed $custom_metadata, - public string $device_selection_mode, - public bool $login_successful, - public string $status, - public string $url, - public bool $wait_for_device_creation, - public string $workspace_id, - public string|null $customer_key, + public array|null $accepted_capabilities, + public array|null $accepted_devices, + public array|null $accepted_providers, + public bool|null $any_device_allowed, + public bool|null $any_provider_allowed, public string|null $authorized_at, + public bool|null $automatically_manage_new_devices, + public string|null $connect_webview_id, public string|null $connected_account_id, + public string|null $created_at, + public mixed $custom_metadata, public string|null $custom_redirect_failure_url, public string|null $custom_redirect_url, + public string|null $customer_key, + public string|null $device_selection_mode, + public bool|null $login_successful, public string|null $selected_provider, + public string|null $status, + public string|null $url, + public bool|null $wait_for_device_creation, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/ConnectedAccount.php b/src/Objects/ConnectedAccount.php index 4e52b742..8def7b43 100644 --- a/src/Objects/ConnectedAccount.php +++ b/src/Objects/ConnectedAccount.php @@ -10,25 +10,22 @@ public static function from_json(mixed $json): ConnectedAccount|null return null; } return new self( - accepted_capabilities: $json->accepted_capabilities, - account_type_display_name: $json->account_type_display_name, - automatically_manage_new_devices: $json->automatically_manage_new_devices, - connected_account_id: $json->connected_account_id, - custom_metadata: $json->custom_metadata, - display_name: $json->display_name, - errors: array_map( - fn($e) => ConnectedAccountErrors::from_json($e), - $json->errors ?? [], - ), - warnings: array_map( - fn($w) => ConnectedAccountWarnings::from_json($w), - $json->warnings ?? [], - ), + accepted_capabilities: $json->accepted_capabilities ?? null, account_type: $json->account_type ?? null, + account_type_display_name: $json->account_type_display_name ?? null, + automatically_manage_new_devices: $json->automatically_manage_new_devices ?? + null, + connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, + custom_metadata: $json->custom_metadata ?? null, customer_key: $json->customer_key ?? null, default_checkin_time: $json->default_checkin_time ?? null, default_checkout_time: $json->default_checkout_time ?? null, + display_name: $json->display_name ?? null, + errors: array_map( + fn($e) => ConnectedAccountErrors::from_json($e), + $json->errors ?? [], + ), ical_feed_origin: $json->ical_feed_origin ?? null, ical_url: $json->ical_url ?? null, image_url: $json->image_url ?? null, @@ -38,27 +35,31 @@ public static function from_json(mixed $json): ConnectedAccount|null $json->user_identifier, ) : null, + warnings: array_map( + fn($w) => ConnectedAccountWarnings::from_json($w), + $json->warnings ?? [], + ), ); } public function __construct( - public array $accepted_capabilities, - public string $account_type_display_name, - public bool $automatically_manage_new_devices, - public string $connected_account_id, - public mixed $custom_metadata, - public string $display_name, - public array $errors, - public array $warnings, + public array|null $accepted_capabilities, public string|null $account_type, + public string|null $account_type_display_name, + public bool|null $automatically_manage_new_devices, + public string|null $connected_account_id, public string|null $created_at, + public mixed $custom_metadata, public string|null $customer_key, public string|null $default_checkin_time, public string|null $default_checkout_time, + public string|null $display_name, + public array $errors, public string|null $ical_feed_origin, public string|null $ical_url, public string|null $image_url, public string|null $time_zone, public ConnectedAccountUserIdentifier|null $user_identifier, + public array $warnings, ) {} } diff --git a/src/Objects/ConnectedAccountErrors.php b/src/Objects/ConnectedAccountErrors.php index b40febb7..454e6726 100644 --- a/src/Objects/ConnectedAccountErrors.php +++ b/src/Objects/ConnectedAccountErrors.php @@ -10,12 +10,12 @@ public static function from_json(mixed $json): ConnectedAccountErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, + message: $json->message ?? null, salto_ks_metadata: isset($json->salto_ks_metadata) ? ConnectedAccountSaltoKsMetadata::from_json( $json->salto_ks_metadata, @@ -25,11 +25,11 @@ public static function from_json(mixed $json): ConnectedAccountErrors|null } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, public bool|null $is_bridge_error, public bool|null $is_connected_account_error, + public string|null $message, public ConnectedAccountSaltoKsMetadata|null $salto_ks_metadata, ) {} } diff --git a/src/Objects/ConnectedAccountSaltoKsMetadata.php b/src/Objects/ConnectedAccountSaltoKsMetadata.php index ee31de99..3e9b0de2 100644 --- a/src/Objects/ConnectedAccountSaltoKsMetadata.php +++ b/src/Objects/ConnectedAccountSaltoKsMetadata.php @@ -18,5 +18,5 @@ public static function from_json( ); } - public function __construct(public array|null $sites) {} + public function __construct(public array $sites) {} } diff --git a/src/Objects/ConnectedAccountSites.php b/src/Objects/ConnectedAccountSites.php index 237ee98d..1dbbdb1a 100644 --- a/src/Objects/ConnectedAccountSites.php +++ b/src/Objects/ConnectedAccountSites.php @@ -22,7 +22,7 @@ public static function from_json(mixed $json): ConnectedAccountSites|null public function __construct( public string|null $site_id, public string|null $site_name, - public mixed $site_user_subscription_limit, - public mixed $subscribed_site_user_count, + public float|null $site_user_subscription_limit, + public float|null $subscribed_site_user_count, ) {} } diff --git a/src/Objects/ConnectedAccountWarnings.php b/src/Objects/ConnectedAccountWarnings.php index aae2c132..609ccf18 100644 --- a/src/Objects/ConnectedAccountWarnings.php +++ b/src/Objects/ConnectedAccountWarnings.php @@ -10,21 +10,21 @@ public static function from_json(mixed $json): ConnectedAccountWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, salto_ks_metadata: isset($json->salto_ks_metadata) ? ConnectedAccountSaltoKsMetadata::from_json( $json->salto_ks_metadata, ) : null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, public ConnectedAccountSaltoKsMetadata|null $salto_ks_metadata, + public string|null $warning_code, ) {} } diff --git a/src/Objects/Customer.php b/src/Objects/Customer.php index 017ceb6b..04786519 100644 --- a/src/Objects/Customer.php +++ b/src/Objects/Customer.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): Customer|null return null; } return new self( - created_at: $json->created_at, - customer_key: $json->customer_key, - workspace_id: $json->workspace_id, + created_at: $json->created_at ?? null, + customer_key: $json->customer_key ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $created_at, - public string $customer_key, - public string $workspace_id, + public string|null $created_at, + public string|null $customer_key, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/CustomerPortal.php b/src/Objects/CustomerPortal.php index 11ea580d..86247dbf 100644 --- a/src/Objects/CustomerPortal.php +++ b/src/Objects/CustomerPortal.php @@ -10,19 +10,19 @@ public static function from_json(mixed $json): CustomerPortal|null return null; } return new self( - created_at: $json->created_at, - customer_key: $json->customer_key, - expires_at: $json->expires_at, - url: $json->url, - workspace_id: $json->workspace_id, + created_at: $json->created_at ?? null, + customer_key: $json->customer_key ?? null, + expires_at: $json->expires_at ?? null, + url: $json->url ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $created_at, - public string $customer_key, - public string $expires_at, - public string $url, - public string $workspace_id, + public string|null $created_at, + public string|null $customer_key, + public string|null $expires_at, + public string|null $url, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/CustomizationProfile.php b/src/Objects/CustomizationProfile.php index d1b202d4..cd7058e2 100644 --- a/src/Objects/CustomizationProfile.php +++ b/src/Objects/CustomizationProfile.php @@ -10,31 +10,31 @@ public static function from_json(mixed $json): CustomizationProfile|null return null; } return new self( - created_at: $json->created_at, - customization_profile_id: $json->customization_profile_id, - workspace_id: $json->workspace_id, + created_at: $json->created_at ?? null, customer_portal_theme: isset($json->customer_portal_theme) ? CustomizationProfileCustomerPortalTheme::from_json( $json->customer_portal_theme, ) : null, + customization_profile_id: $json->customization_profile_id ?? null, logo_url: $json->logo_url ?? null, message_overrides: $json->message_overrides ?? null, + name: $json->name ?? null, primary_color: $json->primary_color ?? null, secondary_color: $json->secondary_color ?? null, - name: $json->name ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $created_at, - public string $customization_profile_id, - public string $workspace_id, + public string|null $created_at, public CustomizationProfileCustomerPortalTheme|null $customer_portal_theme, + public string|null $customization_profile_id, public string|null $logo_url, public mixed $message_overrides, + public string|null $name, public string|null $primary_color, public string|null $secondary_color, - public string|null $name, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/Device.php b/src/Objects/Device.php index 944568b8..d75a50d7 100644 --- a/src/Objects/Device.php +++ b/src/Objects/Device.php @@ -10,25 +10,6 @@ public static function from_json(mixed $json): Device|null return null; } return new self( - capabilities_supported: $json->capabilities_supported, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_id: $json->device_id, - device_type: $json->device_type, - display_name: $json->display_name, - errors: array_map( - fn($e) => DeviceErrors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed, - properties: DeviceProperties::from_json($json->properties), - space_ids: $json->space_ids, - warnings: array_map( - fn($w) => DeviceWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, can_configure_auto_lock: $json->can_configure_auto_lock ?? null, can_hvac_cool: $json->can_hvac_cool ?? null, can_hvac_heat: $json->can_hvac_heat ?? null, @@ -59,6 +40,11 @@ public static function from_json(mixed $json): Device|null can_simulate_removal: $json->can_simulate_removal ?? null, can_turn_off_hvac: $json->can_turn_off_hvac ?? null, can_unlock_with_code: $json->can_unlock_with_code ?? null, + capabilities_supported: $json->capabilities_supported ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + custom_metadata: $json->custom_metadata ?? null, + device_id: $json->device_id ?? null, device_manufacturer: isset($json->device_manufacturer) ? DeviceDeviceManufacturer::from_json( $json->device_manufacturer, @@ -67,27 +53,30 @@ public static function from_json(mixed $json): Device|null device_provider: isset($json->device_provider) ? DeviceDeviceProvider::from_json($json->device_provider) : null, + device_type: $json->device_type ?? null, + display_name: $json->display_name ?? null, + errors: array_map( + fn($e) => DeviceErrors::from_json($e), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, location: isset($json->location) ? DeviceLocation::from_json($json->location) : null, nickname: $json->nickname ?? null, + properties: isset($json->properties) + ? DeviceProperties::from_json($json->properties) + : null, + space_ids: $json->space_ids ?? null, + warnings: array_map( + fn($w) => DeviceWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public array $capabilities_supported, - public string $connected_account_id, - public string $created_at, - public mixed $custom_metadata, - public string $device_id, - public string $device_type, - public string $display_name, - public array $errors, - public bool $is_managed, - public DeviceProperties $properties, - public array $space_ids, - public array $warnings, - public string $workspace_id, public bool|null $can_configure_auto_lock, public bool|null $can_hvac_cool, public bool|null $can_hvac_heat, @@ -108,9 +97,22 @@ public function __construct( public bool|null $can_simulate_removal, public bool|null $can_turn_off_hvac, public bool|null $can_unlock_with_code, + public array|null $capabilities_supported, + public string|null $connected_account_id, + public string|null $created_at, + public mixed $custom_metadata, + public string|null $device_id, public DeviceDeviceManufacturer|null $device_manufacturer, public DeviceDeviceProvider|null $device_provider, + public string|null $device_type, + public string|null $display_name, + public array $errors, + public bool|null $is_managed, public DeviceLocation|null $location, public string|null $nickname, + public DeviceProperties|null $properties, + public array|null $space_ids, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/DeviceAccessoryKeypad.php b/src/Objects/DeviceAccessoryKeypad.php index df794458..7503c437 100644 --- a/src/Objects/DeviceAccessoryKeypad.php +++ b/src/Objects/DeviceAccessoryKeypad.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): DeviceAccessoryKeypad|null return null; } return new self( - is_connected: $json->is_connected, battery: isset($json->battery) ? DeviceBattery::from_json($json->battery) : null, + is_connected: $json->is_connected ?? null, ); } public function __construct( - public bool $is_connected, public DeviceBattery|null $battery, + public bool|null $is_connected, ) {} } diff --git a/src/Objects/DeviceActiveThermostatSchedule.php b/src/Objects/DeviceActiveThermostatSchedule.php index 9b1f9828..4c12afbb 100644 --- a/src/Objects/DeviceActiveThermostatSchedule.php +++ b/src/Objects/DeviceActiveThermostatSchedule.php @@ -11,35 +11,35 @@ public static function from_json( return null; } return new self( - climate_preset_key: $json->climate_preset_key, - created_at: $json->created_at, - device_id: $json->device_id, - ends_at: $json->ends_at, + climate_preset_key: $json->climate_preset_key ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + ends_at: $json->ends_at ?? null, errors: array_map( fn($e) => DeviceErrors::from_json($e), $json->errors ?? [], ), - starts_at: $json->starts_at, - thermostat_schedule_id: $json->thermostat_schedule_id, - workspace_id: $json->workspace_id, is_override_allowed: $json->is_override_allowed ?? null, - name: $json->name ?? null, max_override_period_minutes: $json->max_override_period_minutes ?? null, + name: $json->name ?? null, + starts_at: $json->starts_at ?? null, + thermostat_schedule_id: $json->thermostat_schedule_id ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $climate_preset_key, - public string $created_at, - public string $device_id, - public string $ends_at, + public string|null $climate_preset_key, + public string|null $created_at, + public string|null $device_id, + public string|null $ends_at, public array $errors, - public string $starts_at, - public string $thermostat_schedule_id, - public string $workspace_id, public bool|null $is_override_allowed, + public float|null $max_override_period_minutes, public string|null $name, - public mixed $max_override_period_minutes, + public string|null $starts_at, + public string|null $thermostat_schedule_id, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/DeviceAppearance.php b/src/Objects/DeviceAppearance.php index a46d17d3..d4eebc6a 100644 --- a/src/Objects/DeviceAppearance.php +++ b/src/Objects/DeviceAppearance.php @@ -9,8 +9,8 @@ public static function from_json(mixed $json): DeviceAppearance|null if (!$json) { return null; } - return new self(name: $json->name); + return new self(name: $json->name ?? null); } - public function __construct(public string $name) {} + public function __construct(public string|null $name) {} } diff --git a/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php b/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php index dd2e51e8..4f9a816b 100644 --- a/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php +++ b/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php @@ -20,7 +20,7 @@ public static function from_json( } public function __construct( - public array|null $endpoints, + public array $endpoints, public bool|null $has_active_endpoint, ) {} } diff --git a/src/Objects/DeviceAvailableClimatePresets.php b/src/Objects/DeviceAvailableClimatePresets.php index b0217082..fa114afb 100644 --- a/src/Objects/DeviceAvailableClimatePresets.php +++ b/src/Objects/DeviceAvailableClimatePresets.php @@ -11,16 +11,16 @@ public static function from_json( return null; } return new self( - can_delete: $json->can_delete, - can_edit: $json->can_edit, - can_use_with_thermostat_daily_programs: $json->can_use_with_thermostat_daily_programs, - climate_preset_key: $json->climate_preset_key, - display_name: $json->display_name, - manual_override_allowed: $json->manual_override_allowed, + can_delete: $json->can_delete ?? null, + can_edit: $json->can_edit ?? null, + can_use_with_thermostat_daily_programs: $json->can_use_with_thermostat_daily_programs ?? + null, + climate_preset_key: $json->climate_preset_key ?? null, climate_preset_mode: $json->climate_preset_mode ?? null, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? null, + display_name: $json->display_name ?? null, ecobee_metadata: isset($json->ecobee_metadata) ? DeviceEcobeeMetadata::from_json($json->ecobee_metadata) : null, @@ -29,25 +29,26 @@ public static function from_json( heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, hvac_mode_setting: $json->hvac_mode_setting ?? null, + manual_override_allowed: $json->manual_override_allowed ?? null, name: $json->name ?? null, ); } public function __construct( - public bool $can_delete, - public bool $can_edit, - public bool $can_use_with_thermostat_daily_programs, - public string $climate_preset_key, - public string $display_name, - public bool $manual_override_allowed, + public bool|null $can_delete, + public bool|null $can_edit, + public bool|null $can_use_with_thermostat_daily_programs, + public string|null $climate_preset_key, public string|null $climate_preset_mode, public float|null $cooling_set_point_celsius, public float|null $cooling_set_point_fahrenheit, + public string|null $display_name, public DeviceEcobeeMetadata|null $ecobee_metadata, public string|null $fan_mode_setting, public float|null $heating_set_point_celsius, public float|null $heating_set_point_fahrenheit, public string|null $hvac_mode_setting, + public bool|null $manual_override_allowed, public string|null $name, ) {} } diff --git a/src/Objects/DeviceBattery.php b/src/Objects/DeviceBattery.php index b7c11f93..bfc9bb39 100644 --- a/src/Objects/DeviceBattery.php +++ b/src/Objects/DeviceBattery.php @@ -9,8 +9,8 @@ public static function from_json(mixed $json): DeviceBattery|null if (!$json) { return null; } - return new self(level: $json->level); + return new self(level: $json->level ?? null); } - public function __construct(public float $level) {} + public function __construct(public float|null $level) {} } diff --git a/src/Objects/DeviceCodeConstraints.php b/src/Objects/DeviceCodeConstraints.php index b1ef1c1d..dbb52b65 100644 --- a/src/Objects/DeviceCodeConstraints.php +++ b/src/Objects/DeviceCodeConstraints.php @@ -10,14 +10,14 @@ public static function from_json(mixed $json): DeviceCodeConstraints|null return null; } return new self( - constraint_type: $json->constraint_type, + constraint_type: $json->constraint_type ?? null, max_length: $json->max_length ?? null, min_length: $json->min_length ?? null, ); } public function __construct( - public string $constraint_type, + public string|null $constraint_type, public float|null $max_length, public float|null $min_length, ) {} diff --git a/src/Objects/DeviceDeviceManufacturer.php b/src/Objects/DeviceDeviceManufacturer.php index 809de0d0..cc5bc1eb 100644 --- a/src/Objects/DeviceDeviceManufacturer.php +++ b/src/Objects/DeviceDeviceManufacturer.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): DeviceDeviceManufacturer|null return null; } return new self( - display_name: $json->display_name, - manufacturer: $json->manufacturer, + display_name: $json->display_name ?? null, image_url: $json->image_url ?? null, + manufacturer: $json->manufacturer ?? null, ); } public function __construct( - public string $display_name, - public string $manufacturer, + public string|null $display_name, public string|null $image_url, + public string|null $manufacturer, ) {} } diff --git a/src/Objects/DeviceDeviceProvider.php b/src/Objects/DeviceDeviceProvider.php index 45430975..f27bc4f1 100644 --- a/src/Objects/DeviceDeviceProvider.php +++ b/src/Objects/DeviceDeviceProvider.php @@ -10,17 +10,17 @@ public static function from_json(mixed $json): DeviceDeviceProvider|null return null; } return new self( - device_provider_name: $json->device_provider_name, - display_name: $json->display_name, - provider_category: $json->provider_category, + device_provider_name: $json->device_provider_name ?? null, + display_name: $json->display_name ?? null, image_url: $json->image_url ?? null, + provider_category: $json->provider_category ?? null, ); } public function __construct( - public string $device_provider_name, - public string $display_name, - public string $provider_category, + public string|null $device_provider_name, + public string|null $display_name, public string|null $image_url, + public string|null $provider_category, ) {} } diff --git a/src/Objects/DeviceDormakabaOracodeMetadata.php b/src/Objects/DeviceDormakabaOracodeMetadata.php index 67b4c626..36abe8bc 100644 --- a/src/Objects/DeviceDormakabaOracodeMetadata.php +++ b/src/Objects/DeviceDormakabaOracodeMetadata.php @@ -20,19 +20,19 @@ public static function from_json( fn($p) => DevicePredefinedTimeSlots::from_json($p), $json->predefined_time_slots ?? [], ), - site_name: $json->site_name ?? null, site_id: $json->site_id ?? null, + site_name: $json->site_name ?? null, ); } public function __construct( - public float|null $device_id, + public mixed $device_id, public float|null $door_id, public bool|null $door_is_wireless, public string|null $door_name, public string|null $iana_timezone, - public array|null $predefined_time_slots, - public string|null $site_name, + public array $predefined_time_slots, public float|null $site_id, + public string|null $site_name, ) {} } diff --git a/src/Objects/DeviceErrors.php b/src/Objects/DeviceErrors.php index b1440f4a..6a6b66d1 100644 --- a/src/Objects/DeviceErrors.php +++ b/src/Objects/DeviceErrors.php @@ -10,22 +10,22 @@ public static function from_json(mixed $json): DeviceErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, public bool|null $is_bridge_error, public bool|null $is_connected_account_error, public bool|null $is_device_error, + public string|null $message, ) {} } diff --git a/src/Objects/DeviceKeynestMetadata.php b/src/Objects/DeviceKeynestMetadata.php index 5867b94a..072485f0 100644 --- a/src/Objects/DeviceKeynestMetadata.php +++ b/src/Objects/DeviceKeynestMetadata.php @@ -10,51 +10,51 @@ public static function from_json(mixed $json): DeviceKeynestMetadata|null return null; } return new self( - current_or_last_store_id: $json->current_or_last_store_id ?? null, - default_office_id: $json->default_office_id ?? null, - device_name: $json->device_name ?? null, - fob_id: $json->fob_id ?? null, - has_photo: $json->has_photo ?? null, - is_quadient_locker: $json->is_quadient_locker ?? null, - key_id: $json->key_id ?? null, - last_movement: $json->last_movement ?? null, - status_type: $json->status_type ?? null, - subscription_plan: $json->subscription_plan ?? null, address: $json->address ?? null, + current_or_last_store_id: $json->current_or_last_store_id ?? null, current_status: $json->current_status ?? null, current_user_company: $json->current_user_company ?? null, current_user_email: $json->current_user_email ?? null, current_user_name: $json->current_user_name ?? null, current_user_phone_number: $json->current_user_phone_number ?? null, + default_office_id: $json->default_office_id ?? null, + device_name: $json->device_name ?? null, + fob_id: $json->fob_id ?? null, handover_method: $json->handover_method ?? null, + has_photo: $json->has_photo ?? null, + is_quadient_locker: $json->is_quadient_locker ?? null, + key_id: $json->key_id ?? null, key_notes: $json->key_notes ?? null, keynest_app_user: $json->keynest_app_user ?? null, + last_movement: $json->last_movement ?? null, property_id: $json->property_id ?? null, property_postcode: $json->property_postcode ?? null, + status_type: $json->status_type ?? null, + subscription_plan: $json->subscription_plan ?? null, ); } public function __construct( - public float|null $current_or_last_store_id, - public float|null $default_office_id, - public string|null $device_name, - public float|null $fob_id, - public bool|null $has_photo, - public bool|null $is_quadient_locker, - public string|null $key_id, - public string|null $last_movement, - public string|null $status_type, - public string|null $subscription_plan, public string|null $address, + public float|null $current_or_last_store_id, public string|null $current_status, public string|null $current_user_company, public string|null $current_user_email, public string|null $current_user_name, public string|null $current_user_phone_number, + public float|null $default_office_id, + public string|null $device_name, + public float|null $fob_id, public string|null $handover_method, + public bool|null $has_photo, + public bool|null $is_quadient_locker, + public string|null $key_id, public string|null $key_notes, public string|null $keynest_app_user, + public string|null $last_movement, public string|null $property_id, public string|null $property_postcode, + public string|null $status_type, + public string|null $subscription_plan, ) {} } diff --git a/src/Objects/DeviceKeypadBattery.php b/src/Objects/DeviceKeypadBattery.php index 29394a2f..cdfe474d 100644 --- a/src/Objects/DeviceKeypadBattery.php +++ b/src/Objects/DeviceKeypadBattery.php @@ -9,8 +9,8 @@ public static function from_json(mixed $json): DeviceKeypadBattery|null if (!$json) { return null; } - return new self(level: $json->level); + return new self(level: $json->level ?? null); } - public function __construct(public float $level) {} + public function __construct(public float|null $level) {} } diff --git a/src/Objects/DeviceKisiMetadata.php b/src/Objects/DeviceKisiMetadata.php index d129b56e..81ac7207 100644 --- a/src/Objects/DeviceKisiMetadata.php +++ b/src/Objects/DeviceKisiMetadata.php @@ -10,17 +10,17 @@ public static function from_json(mixed $json): DeviceKisiMetadata|null return null; } return new self( + description: $json->description ?? null, lock_id: $json->lock_id ?? null, lock_name: $json->lock_name ?? null, - description: $json->description ?? null, place_name: $json->place_name ?? null, ); } public function __construct( + public string|null $description, public float|null $lock_id, public string|null $lock_name, - public string|null $description, public string|null $place_name, ) {} } diff --git a/src/Objects/DeviceKorelockMetadata.php b/src/Objects/DeviceKorelockMetadata.php index c795a658..17e4043b 100644 --- a/src/Objects/DeviceKorelockMetadata.php +++ b/src/Objects/DeviceKorelockMetadata.php @@ -13,10 +13,10 @@ public static function from_json(mixed $json): DeviceKorelockMetadata|null device_id: $json->device_id ?? null, device_name: $json->device_name ?? null, firmware_version: $json->firmware_version ?? null, + location_id: $json->location_id ?? null, model_code: $json->model_code ?? null, serial_number: $json->serial_number ?? null, wifi_signal_strength: $json->wifi_signal_strength ?? null, - location_id: $json->location_id ?? null, ); } @@ -24,9 +24,9 @@ public function __construct( public string|null $device_id, public string|null $device_name, public string|null $firmware_version, + public string|null $location_id, public string|null $model_code, public string|null $serial_number, public float|null $wifi_signal_strength, - public string|null $location_id, ) {} } diff --git a/src/Objects/DeviceModel.php b/src/Objects/DeviceModel.php index 384a31e4..248fb31b 100644 --- a/src/Objects/DeviceModel.php +++ b/src/Objects/DeviceModel.php @@ -10,13 +10,13 @@ public static function from_json(mixed $json): DeviceModel|null return null; } return new self( - display_name: $json->display_name, - manufacturer_display_name: $json->manufacturer_display_name, accessory_keypad_supported: $json->accessory_keypad_supported ?? null, can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? null, + display_name: $json->display_name ?? null, has_built_in_keypad: $json->has_built_in_keypad ?? null, + manufacturer_display_name: $json->manufacturer_display_name ?? null, offline_access_codes_supported: $json->offline_access_codes_supported ?? null, online_access_codes_supported: $json->online_access_codes_supported ?? @@ -25,11 +25,11 @@ public static function from_json(mixed $json): DeviceModel|null } public function __construct( - public string $display_name, - public string $manufacturer_display_name, public bool|null $accessory_keypad_supported, public bool|null $can_connect_accessory_keypad, + public string|null $display_name, public bool|null $has_built_in_keypad, + public string|null $manufacturer_display_name, public bool|null $offline_access_codes_supported, public bool|null $online_access_codes_supported, ) {} diff --git a/src/Objects/DeviceOfflineTimeFrameOptions.php b/src/Objects/DeviceOfflineTimeFrameOptions.php index 1f9eb8fb..4c38466d 100644 --- a/src/Objects/DeviceOfflineTimeFrameOptions.php +++ b/src/Objects/DeviceOfflineTimeFrameOptions.php @@ -11,7 +11,7 @@ public static function from_json( return null; } return new self( - display_name: $json->display_name, + display_name: $json->display_name ?? null, end_date_recurrence_rule: $json->end_date_recurrence_rule ?? null, matching_start_end_time: $json->matching_start_end_time ?? null, max_duration: $json->max_duration ?? null, @@ -27,13 +27,13 @@ public static function from_json( } public function __construct( - public string $display_name, + public string|null $display_name, public string|null $end_date_recurrence_rule, public bool|null $matching_start_end_time, public string|null $max_duration, public string|null $min_duration, public string|null $start_date_recurrence_rule, - public array|null $time_pairs, + public array $time_pairs, public string|null $time_zone, ) {} } diff --git a/src/Objects/DeviceOmnitecMetadata.php b/src/Objects/DeviceOmnitecMetadata.php index d3d3a532..aec1ac4e 100644 --- a/src/Objects/DeviceOmnitecMetadata.php +++ b/src/Objects/DeviceOmnitecMetadata.php @@ -15,8 +15,8 @@ public static function from_json(mixed $json): DeviceOmnitecMetadata|null lock_id: $json->lock_id ?? null, lock_mac: $json->lock_mac ?? null, lock_name: $json->lock_name ?? null, - timezone_raw_offset_ms: $json->timezone_raw_offset_ms ?? null, time_zone: $json->time_zone ?? null, + timezone_raw_offset_ms: $json->timezone_raw_offset_ms ?? null, ); } @@ -26,7 +26,7 @@ public function __construct( public float|null $lock_id, public string|null $lock_mac, public string|null $lock_name, - public float|null $timezone_raw_offset_ms, public string|null $time_zone, + public float|null $timezone_raw_offset_ms, ) {} } diff --git a/src/Objects/DeviceOnlineTimeFrameOptions.php b/src/Objects/DeviceOnlineTimeFrameOptions.php index 6e4a904c..85435485 100644 --- a/src/Objects/DeviceOnlineTimeFrameOptions.php +++ b/src/Objects/DeviceOnlineTimeFrameOptions.php @@ -11,7 +11,7 @@ public static function from_json( return null; } return new self( - display_name: $json->display_name, + display_name: $json->display_name ?? null, end_date_recurrence_rule: $json->end_date_recurrence_rule ?? null, matching_start_end_time: $json->matching_start_end_time ?? null, max_duration: $json->max_duration ?? null, @@ -27,13 +27,13 @@ public static function from_json( } public function __construct( - public string $display_name, + public string|null $display_name, public string|null $end_date_recurrence_rule, public bool|null $matching_start_end_time, public string|null $max_duration, public string|null $min_duration, public string|null $start_date_recurrence_rule, - public array|null $time_pairs, + public array $time_pairs, public string|null $time_zone, ) {} } diff --git a/src/Objects/DevicePeriods.php b/src/Objects/DevicePeriods.php index 57f253b6..b65cfe65 100644 --- a/src/Objects/DevicePeriods.php +++ b/src/Objects/DevicePeriods.php @@ -10,13 +10,13 @@ public static function from_json(mixed $json): DevicePeriods|null return null; } return new self( - climate_preset_key: $json->climate_preset_key, - starts_at_time: $json->starts_at_time, + climate_preset_key: $json->climate_preset_key ?? null, + starts_at_time: $json->starts_at_time ?? null, ); } public function __construct( - public string $climate_preset_key, - public string $starts_at_time, + public string|null $climate_preset_key, + public string|null $starts_at_time, ) {} } diff --git a/src/Objects/DeviceProperties.php b/src/Objects/DeviceProperties.php index 6f0bf1a4..70917bdc 100644 --- a/src/Objects/DeviceProperties.php +++ b/src/Objects/DeviceProperties.php @@ -10,10 +10,6 @@ public static function from_json(mixed $json): DeviceProperties|null return null; } return new self( - appearance: DeviceAppearance::from_json($json->appearance), - model: DeviceModel::from_json($json->model), - name: $json->name, - online: $json->online, _experimental_supported_code_from_access_codes_lengths: $json->_experimental_supported_code_from_access_codes_lengths ?? null, accessory_keypad: isset($json->accessory_keypad) @@ -24,9 +20,14 @@ public static function from_json(mixed $json): DeviceProperties|null $json->active_thermostat_schedule, ) : null, + active_thermostat_schedule_id: $json->active_thermostat_schedule_id ?? + null, akiles_metadata: isset($json->akiles_metadata) ? DeviceAkilesMetadata::from_json($json->akiles_metadata) : null, + appearance: isset($json->appearance) + ? DeviceAppearance::from_json($json->appearance) + : null, assa_abloy_credential_service_metadata: isset( $json->assa_abloy_credential_service_metadata, ) @@ -98,6 +99,8 @@ public static function from_json(mixed $json): DeviceProperties|null ecobee_metadata: isset($json->ecobee_metadata) ? DeviceEcobeeMetadata::from_json($json->ecobee_metadata) : null, + fallback_climate_preset_key: $json->fallback_climate_preset_key ?? + null, fan_mode_setting: $json->fan_mode_setting ?? null, four_suites_metadata: isset($json->four_suites_metadata) ? DeviceFourSuitesMetadata::from_json( @@ -176,6 +179,10 @@ public static function from_json(mixed $json): DeviceProperties|null minut_metadata: isset($json->minut_metadata) ? DeviceMinutMetadata::from_json($json->minut_metadata) : null, + model: isset($json->model) + ? DeviceModel::from_json($json->model) + : null, + name: $json->name ?? null, nest_metadata: isset($json->nest_metadata) ? DeviceNestMetadata::from_json($json->nest_metadata) : null, @@ -197,6 +204,7 @@ public static function from_json(mixed $json): DeviceProperties|null omnitec_metadata: isset($json->omnitec_metadata) ? DeviceOmnitecMetadata::from_json($json->omnitec_metadata) : null, + online: $json->online ?? null, online_access_codes_enabled: $json->online_access_codes_enabled ?? null, online_time_frame_options: array_map( @@ -284,29 +292,23 @@ public static function from_json(mixed $json): DeviceProperties|null wyze_metadata: isset($json->wyze_metadata) ? DeviceWyzeMetadata::from_json($json->wyze_metadata) : null, - active_thermostat_schedule_id: $json->active_thermostat_schedule_id ?? - null, - fallback_climate_preset_key: $json->fallback_climate_preset_key ?? - null, ); } public function __construct( - public DeviceAppearance $appearance, - public DeviceModel $model, - public string $name, - public bool $online, public array|null $_experimental_supported_code_from_access_codes_lengths, public DeviceAccessoryKeypad|null $accessory_keypad, public DeviceActiveThermostatSchedule|null $active_thermostat_schedule, + public string|null $active_thermostat_schedule_id, public DeviceAkilesMetadata|null $akiles_metadata, + public DeviceAppearance|null $appearance, public DeviceAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, public DeviceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, public DeviceAugustMetadata|null $august_metadata, public float|null $auto_lock_delay_seconds, public bool|null $auto_lock_enabled, public array|null $available_climate_preset_modes, - public array|null $available_climate_presets, + public array $available_climate_presets, public array|null $available_fan_mode_settings, public array|null $available_hvac_mode_settings, public DeviceAvigilonAltaMetadata|null $avigilon_alta_metadata, @@ -314,7 +316,7 @@ public function __construct( public DeviceBattery|null $battery, public float|null $battery_level, public DeviceBrivoMetadata|null $brivo_metadata, - public array|null $code_constraints, + public array $code_constraints, public DeviceControlbywebMetadata|null $controlbyweb_metadata, public DeviceCurrentClimateSetting|null $current_climate_setting, public array|null $currently_triggering_noise_threshold_ids, @@ -322,6 +324,7 @@ public function __construct( public bool|null $door_open, public DeviceDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, public DeviceEcobeeMetadata|null $ecobee_metadata, + public string|null $fallback_climate_preset_key, public string|null $fan_mode_setting, public DeviceFourSuitesMetadata|null $four_suites_metadata, public DeviceGenieMetadata|null $genie_metadata, @@ -358,15 +361,18 @@ public function __construct( public float|null $min_heating_set_point_celsius, public float|null $min_heating_set_point_fahrenheit, public DeviceMinutMetadata|null $minut_metadata, + public DeviceModel|null $model, + public string|null $name, public DeviceNestMetadata|null $nest_metadata, public float|null $noise_level_decibels, public DeviceNoiseawareMetadata|null $noiseaware_metadata, public DeviceNukiMetadata|null $nuki_metadata, public bool|null $offline_access_codes_enabled, - public array|null $offline_time_frame_options, + public array $offline_time_frame_options, public DeviceOmnitecMetadata|null $omnitec_metadata, + public bool|null $online, public bool|null $online_access_codes_enabled, - public array|null $online_time_frame_options, + public array $online_time_frame_options, public float|null $relative_humidity, public DeviceRingMetadata|null $ring_metadata, public DeviceSaltoKsMetadata|null $salto_ks_metadata, @@ -387,14 +393,12 @@ public function __construct( public float|null $temperature_fahrenheit, public DeviceTemperatureThreshold|null $temperature_threshold, public float|null $thermostat_daily_program_period_precision_minutes, - public array|null $thermostat_daily_programs, + public array $thermostat_daily_programs, public DeviceThermostatWeeklyProgram|null $thermostat_weekly_program, public DeviceTtlockMetadata|null $ttlock_metadata, public DeviceTwoNMetadata|null $two_n_metadata, public DeviceUltraloqMetadata|null $ultraloq_metadata, public DeviceVisionlineMetadata|null $visionline_metadata, public DeviceWyzeMetadata|null $wyze_metadata, - public string|null $active_thermostat_schedule_id, - public string|null $fallback_climate_preset_key, ) {} } diff --git a/src/Objects/DeviceProvider.php b/src/Objects/DeviceProvider.php index 5fa63bd2..f875e79b 100644 --- a/src/Objects/DeviceProvider.php +++ b/src/Objects/DeviceProvider.php @@ -10,10 +10,6 @@ public static function from_json(mixed $json): DeviceProvider|null return null; } return new self( - device_provider_name: $json->device_provider_name, - display_name: $json->display_name, - image_url: $json->image_url, - provider_categories: $json->provider_categories, can_configure_auto_lock: $json->can_configure_auto_lock ?? null, can_hvac_cool: $json->can_hvac_cool ?? null, can_hvac_heat: $json->can_hvac_heat ?? null, @@ -44,14 +40,14 @@ public static function from_json(mixed $json): DeviceProvider|null can_simulate_removal: $json->can_simulate_removal ?? null, can_turn_off_hvac: $json->can_turn_off_hvac ?? null, can_unlock_with_code: $json->can_unlock_with_code ?? null, + device_provider_name: $json->device_provider_name ?? null, + display_name: $json->display_name ?? null, + image_url: $json->image_url ?? null, + provider_categories: $json->provider_categories ?? null, ); } public function __construct( - public string $device_provider_name, - public string $display_name, - public string $image_url, - public array $provider_categories, public bool|null $can_configure_auto_lock, public bool|null $can_hvac_cool, public bool|null $can_hvac_heat, @@ -72,5 +68,9 @@ public function __construct( public bool|null $can_simulate_removal, public bool|null $can_turn_off_hvac, public bool|null $can_unlock_with_code, + public string|null $device_provider_name, + public string|null $display_name, + public string|null $image_url, + public array|null $provider_categories, ) {} } diff --git a/src/Objects/DeviceSensiMetadata.php b/src/Objects/DeviceSensiMetadata.php index b4574548..090bcd2c 100644 --- a/src/Objects/DeviceSensiMetadata.php +++ b/src/Objects/DeviceSensiMetadata.php @@ -14,8 +14,6 @@ public static function from_json(mixed $json): DeviceSensiMetadata|null device_name: $json->device_name ?? null, dual_setpoints_not_supported: $json->dual_setpoints_not_supported ?? null, - enforced_setpoint_range_celsius: $json->enforced_setpoint_range_celsius ?? - null, product_type: $json->product_type ?? null, ); } @@ -24,7 +22,6 @@ public function __construct( public string|null $device_id, public string|null $device_name, public bool|null $dual_setpoints_not_supported, - public mixed $enforced_setpoint_range_celsius, public string|null $product_type, ) {} } diff --git a/src/Objects/DeviceThermostatDailyPrograms.php b/src/Objects/DeviceThermostatDailyPrograms.php index e24fba6c..dcfd3ab8 100644 --- a/src/Objects/DeviceThermostatDailyPrograms.php +++ b/src/Objects/DeviceThermostatDailyPrograms.php @@ -11,24 +11,25 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - device_id: $json->device_id, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + name: $json->name ?? null, periods: array_map( fn($p) => DevicePeriods::from_json($p), $json->periods ?? [], ), - thermostat_daily_program_id: $json->thermostat_daily_program_id, - workspace_id: $json->workspace_id, - name: $json->name ?? null, + thermostat_daily_program_id: $json->thermostat_daily_program_id ?? + null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $created_at, - public string $device_id, - public array $periods, - public string $thermostat_daily_program_id, - public string $workspace_id, + public string|null $created_at, + public string|null $device_id, public string|null $name, + public array $periods, + public string|null $thermostat_daily_program_id, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/DeviceThermostatWeeklyProgram.php b/src/Objects/DeviceThermostatWeeklyProgram.php index eb1d9071..fd87a1b3 100644 --- a/src/Objects/DeviceThermostatWeeklyProgram.php +++ b/src/Objects/DeviceThermostatWeeklyProgram.php @@ -11,7 +11,7 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, + created_at: $json->created_at ?? null, friday_program_id: $json->friday_program_id ?? null, monday_program_id: $json->monday_program_id ?? null, saturday_program_id: $json->saturday_program_id ?? null, @@ -23,7 +23,7 @@ public static function from_json( } public function __construct( - public string $created_at, + public string|null $created_at, public string|null $friday_program_id, public string|null $monday_program_id, public string|null $saturday_program_id, diff --git a/src/Objects/DeviceTimePairs.php b/src/Objects/DeviceTimePairs.php index f378eea1..b85f66a2 100644 --- a/src/Objects/DeviceTimePairs.php +++ b/src/Objects/DeviceTimePairs.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): DeviceTimePairs|null return null; } return new self( - display_name: $json->display_name, - end_time: $json->end_time, - start_time: $json->start_time, + display_name: $json->display_name ?? null, + end_time: $json->end_time ?? null, + start_time: $json->start_time ?? null, ); } public function __construct( - public string $display_name, - public string $end_time, - public string $start_time, + public string|null $display_name, + public string|null $end_time, + public string|null $start_time, ) {} } diff --git a/src/Objects/DeviceTtlockMetadata.php b/src/Objects/DeviceTtlockMetadata.php index bc37f5cb..4f993252 100644 --- a/src/Objects/DeviceTtlockMetadata.php +++ b/src/Objects/DeviceTtlockMetadata.php @@ -17,11 +17,11 @@ public static function from_json(mixed $json): DeviceTtlockMetadata|null has_gateway: $json->has_gateway ?? null, lock_alias: $json->lock_alias ?? null, lock_id: $json->lock_id ?? null, + timezone_raw_offset_ms: $json->timezone_raw_offset_ms ?? null, wireless_keypads: array_map( fn($w) => DeviceWirelessKeypads::from_json($w), $json->wireless_keypads ?? [], ), - timezone_raw_offset_ms: $json->timezone_raw_offset_ms ?? null, ); } @@ -31,7 +31,7 @@ public function __construct( public bool|null $has_gateway, public string|null $lock_alias, public float|null $lock_id, - public array|null $wireless_keypads, public float|null $timezone_raw_offset_ms, + public array $wireless_keypads, ) {} } diff --git a/src/Objects/DeviceWarnings.php b/src/Objects/DeviceWarnings.php index 54d92992..f9fa718f 100644 --- a/src/Objects/DeviceWarnings.php +++ b/src/Objects/DeviceWarnings.php @@ -10,20 +10,20 @@ public static function from_json(mixed $json): DeviceWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, active_access_code_count: $json->active_access_code_count ?? null, + created_at: $json->created_at ?? null, max_active_access_code_count: $json->max_active_access_code_count ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, - public mixed $active_access_code_count, - public mixed $max_active_access_code_count, + public float|null $active_access_code_count, + public string|null $created_at, + public float|null $max_active_access_code_count, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/EnrollmentAutomation.php b/src/Objects/EnrollmentAutomation.php index 2a5a1cb3..236c6533 100644 --- a/src/Objects/EnrollmentAutomation.php +++ b/src/Objects/EnrollmentAutomation.php @@ -10,19 +10,20 @@ public static function from_json(mixed $json): EnrollmentAutomation|null return null; } return new self( - created_at: $json->created_at, - credential_manager_acs_system_id: $json->credential_manager_acs_system_id, - enrollment_automation_id: $json->enrollment_automation_id, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id, + created_at: $json->created_at ?? null, + credential_manager_acs_system_id: $json->credential_manager_acs_system_id ?? + null, + enrollment_automation_id: $json->enrollment_automation_id ?? null, + user_identity_id: $json->user_identity_id ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $created_at, - public string $credential_manager_acs_system_id, - public string $enrollment_automation_id, - public string $user_identity_id, - public string $workspace_id, + public string|null $created_at, + public string|null $credential_manager_acs_system_id, + public string|null $enrollment_automation_id, + public string|null $user_identity_id, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/Event.php b/src/Objects/Event.php index 2e2bff0e..f9c3784b 100644 --- a/src/Objects/Event.php +++ b/src/Objects/Event.php @@ -108,6 +108,8 @@ public static function from_json(mixed $json): Event|null null, is_via_bluetooth: $json->is_via_bluetooth ?? null, is_via_nfc: $json->is_via_nfc ?? null, + lower_limit_celsius: $json->lower_limit_celsius ?? null, + lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, method: $json->method ?? null, minut_metadata: $json->minut_metadata ?? null, missing_device_ids: $json->missing_device_ids ?? null, @@ -131,23 +133,21 @@ public static function from_json(mixed $json): Event|null status: $json->status ?? null, temperature_celsius: $json->temperature_celsius ?? null, temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + thermostat_schedule_id: $json->thermostat_schedule_id ?? null, to: isset($json->to) ? EventTo::from_json($json->to) : null, + upper_limit_celsius: $json->upper_limit_celsius ?? null, + upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null, user_identity_id: $json->user_identity_id ?? null, video_url: $json->video_url ?? null, workspace_id: $json->workspace_id ?? null, - lower_limit_celsius: $json->lower_limit_celsius ?? null, - lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, - thermostat_schedule_id: $json->thermostat_schedule_id ?? null, - upper_limit_celsius: $json->upper_limit_celsius ?? null, - upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null, ); } public function __construct( - public array|null $access_code_errors, + public array $access_code_errors, public string|null $access_code_id, public bool|null $access_code_is_managed, - public array|null $access_code_warnings, + public array $access_code_warnings, public string|null $access_grant_id, public array|null $access_grant_ids, public string|null $access_grant_key, @@ -158,9 +158,9 @@ public function __construct( public string|null $acs_encoder_id, public string|null $acs_entrance_id, public array|null $acs_entrance_ids, - public array|null $acs_system_errors, + public array $acs_system_errors, public string|null $acs_system_id, - public array|null $acs_system_warnings, + public array $acs_system_warnings, public string|null $acs_user_id, public string|null $action_attempt_id, public string|null $action_type, @@ -169,16 +169,16 @@ public function __construct( public float|null $battery_level, public string|null $battery_status, public string|null $change_reason, - public array|null $changed_properties, + public array $changed_properties, public string|null $client_session_id, public string|null $climate_preset_key, public string|null $code, public string|null $connect_webview_id, public mixed $connected_account_custom_metadata, - public array|null $connected_account_errors, + public array $connected_account_errors, public string|null $connected_account_id, public string|null $connected_account_type, - public array|null $connected_account_warnings, + public array $connected_account_warnings, public float|null $cooling_set_point_celsius, public float|null $cooling_set_point_fahrenheit, public string|null $created_at, @@ -187,11 +187,11 @@ public function __construct( public float|null $desired_temperature_celsius, public float|null $desired_temperature_fahrenheit, public mixed $device_custom_metadata, - public array|null $device_errors, + public array $device_errors, public string|null $device_id, public array|null $device_ids, public string|null $device_name, - public array|null $device_warnings, + public array $device_warnings, public string|null $ends_at, public string|null $enrollment_automation_id, public string|null $error_code, @@ -209,6 +209,8 @@ public function __construct( public bool|null $is_fallback_climate_preset, public bool|null $is_via_bluetooth, public bool|null $is_via_nfc, + public float|null $lower_limit_celsius, + public float|null $lower_limit_fahrenheit, public string|null $method, public mixed $minut_metadata, public array|null $missing_device_ids, @@ -220,21 +222,19 @@ public function __construct( public mixed $noiseaware_metadata, public string|null $occurred_at, public EventReason|null $reason, - public array|null $requested_mutations, + public array $requested_mutations, public string|null $space_id, public string|null $space_key, public string|null $starts_at, public string|null $status, public float|null $temperature_celsius, public float|null $temperature_fahrenheit, + public string|null $thermostat_schedule_id, public EventTo|null $to, + public float|null $upper_limit_celsius, + public float|null $upper_limit_fahrenheit, public string|null $user_identity_id, public string|null $video_url, public string|null $workspace_id, - public float|null $lower_limit_celsius, - public float|null $lower_limit_fahrenheit, - public string|null $thermostat_schedule_id, - public float|null $upper_limit_celsius, - public float|null $upper_limit_fahrenheit, ) {} } diff --git a/src/Objects/EventAccessCodeErrors.php b/src/Objects/EventAccessCodeErrors.php index 6941858e..a4892226 100644 --- a/src/Objects/EventAccessCodeErrors.php +++ b/src/Objects/EventAccessCodeErrors.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): EventAccessCodeErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/EventAccessCodeWarnings.php b/src/Objects/EventAccessCodeWarnings.php index f4a8ee60..ef20dd3a 100644 --- a/src/Objects/EventAccessCodeWarnings.php +++ b/src/Objects/EventAccessCodeWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): EventAccessCodeWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/EventAcsSystemErrors.php b/src/Objects/EventAcsSystemErrors.php index a2c663ff..11a5dd9b 100644 --- a/src/Objects/EventAcsSystemErrors.php +++ b/src/Objects/EventAcsSystemErrors.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): EventAcsSystemErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/EventAcsSystemWarnings.php b/src/Objects/EventAcsSystemWarnings.php index 00657449..76dd75c6 100644 --- a/src/Objects/EventAcsSystemWarnings.php +++ b/src/Objects/EventAcsSystemWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): EventAcsSystemWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/EventChangedProperties.php b/src/Objects/EventChangedProperties.php index 9aadc265..8a1299f2 100644 --- a/src/Objects/EventChangedProperties.php +++ b/src/Objects/EventChangedProperties.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): EventChangedProperties|null return null; } return new self( - property: $json->property, from: $json->from ?? null, + property: $json->property ?? null, to: $json->to ?? null, ); } public function __construct( - public string $property, public string|null $from, + public string|null $property, public string|null $to, ) {} } diff --git a/src/Objects/EventConnectedAccountErrors.php b/src/Objects/EventConnectedAccountErrors.php index 8cf665ee..432a664c 100644 --- a/src/Objects/EventConnectedAccountErrors.php +++ b/src/Objects/EventConnectedAccountErrors.php @@ -11,15 +11,15 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/EventConnectedAccountWarnings.php b/src/Objects/EventConnectedAccountWarnings.php index 7d8dcb97..533fe5a6 100644 --- a/src/Objects/EventConnectedAccountWarnings.php +++ b/src/Objects/EventConnectedAccountWarnings.php @@ -11,15 +11,15 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/EventDeviceErrors.php b/src/Objects/EventDeviceErrors.php index 3945af50..a7561dc2 100644 --- a/src/Objects/EventDeviceErrors.php +++ b/src/Objects/EventDeviceErrors.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): EventDeviceErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/EventDeviceWarnings.php b/src/Objects/EventDeviceWarnings.php index 9c7873f2..c28203af 100644 --- a/src/Objects/EventDeviceWarnings.php +++ b/src/Objects/EventDeviceWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): EventDeviceWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/EventFrom.php b/src/Objects/EventFrom.php index e1fc68b8..e0dfbe63 100644 --- a/src/Objects/EventFrom.php +++ b/src/Objects/EventFrom.php @@ -10,13 +10,17 @@ public static function from_json(mixed $json): EventFrom|null return null; } return new self( + code: $json->code ?? null, ends_at: $json->ends_at ?? null, + name: $json->name ?? null, starts_at: $json->starts_at ?? null, ); } public function __construct( + public string|null $code, public string|null $ends_at, + public string|null $name, public string|null $starts_at, ) {} } diff --git a/src/Objects/EventReason.php b/src/Objects/EventReason.php index 6dc5596a..c1812a53 100644 --- a/src/Objects/EventReason.php +++ b/src/Objects/EventReason.php @@ -10,13 +10,13 @@ public static function from_json(mixed $json): EventReason|null return null; } return new self( - message: $json->message, - reason_code: $json->reason_code, + message: $json->message ?? null, + reason_code: $json->reason_code ?? null, ); } public function __construct( - public string $message, - public string $reason_code, + public string|null $message, + public string|null $reason_code, ) {} } diff --git a/src/Objects/EventRequestedMutations.php b/src/Objects/EventRequestedMutations.php index ca778747..71f2b32a 100644 --- a/src/Objects/EventRequestedMutations.php +++ b/src/Objects/EventRequestedMutations.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): EventRequestedMutations|null return null; } return new self( - mutation_code: $json->mutation_code, from: $json->from ?? null, + mutation_code: $json->mutation_code ?? null, to: $json->to ?? null, ); } public function __construct( - public string $mutation_code, public mixed $from, + public string|null $mutation_code, public mixed $to, ) {} } diff --git a/src/Objects/EventTo.php b/src/Objects/EventTo.php index e0eae822..0cbeaac3 100644 --- a/src/Objects/EventTo.php +++ b/src/Objects/EventTo.php @@ -10,13 +10,17 @@ public static function from_json(mixed $json): EventTo|null return null; } return new self( + code: $json->code ?? null, ends_at: $json->ends_at ?? null, + name: $json->name ?? null, starts_at: $json->starts_at ?? null, ); } public function __construct( + public string|null $code, public string|null $ends_at, + public string|null $name, public string|null $starts_at, ) {} } diff --git a/src/Objects/InstantKey.php b/src/Objects/InstantKey.php index f1ef0e9c..eeb7c2d8 100644 --- a/src/Objects/InstantKey.php +++ b/src/Objects/InstantKey.php @@ -10,29 +10,29 @@ public static function from_json(mixed $json): InstantKey|null return null; } return new self( - client_session_id: $json->client_session_id, - created_at: $json->created_at, - expires_at: $json->expires_at, - instant_key_id: $json->instant_key_id, - instant_key_url: $json->instant_key_url, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id, + client_session_id: $json->client_session_id ?? null, + created_at: $json->created_at ?? null, customization: isset($json->customization) ? InstantKeyCustomization::from_json($json->customization) : null, customization_profile_id: $json->customization_profile_id ?? null, + expires_at: $json->expires_at ?? null, + instant_key_id: $json->instant_key_id ?? null, + instant_key_url: $json->instant_key_url ?? null, + user_identity_id: $json->user_identity_id ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $client_session_id, - public string $created_at, - public string $expires_at, - public string $instant_key_id, - public string $instant_key_url, - public string $user_identity_id, - public string $workspace_id, + public string|null $client_session_id, + public string|null $created_at, public InstantKeyCustomization|null $customization, public string|null $customization_profile_id, + public string|null $expires_at, + public string|null $instant_key_id, + public string|null $instant_key_url, + public string|null $user_identity_id, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/MagicLink.php b/src/Objects/MagicLink.php index 87230ead..0aa4ac3b 100644 --- a/src/Objects/MagicLink.php +++ b/src/Objects/MagicLink.php @@ -10,19 +10,19 @@ public static function from_json(mixed $json): MagicLink|null return null; } return new self( - created_at: $json->created_at, - customer_key: $json->customer_key, - expires_at: $json->expires_at, - url: $json->url, - workspace_id: $json->workspace_id, + created_at: $json->created_at ?? null, + customer_key: $json->customer_key ?? null, + expires_at: $json->expires_at ?? null, + url: $json->url ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $created_at, - public string $customer_key, - public string $expires_at, - public string $url, - public string $workspace_id, + public string|null $created_at, + public string|null $customer_key, + public string|null $expires_at, + public string|null $url, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/NoiseThreshold.php b/src/Objects/NoiseThreshold.php index b27176ed..73d97c82 100644 --- a/src/Objects/NoiseThreshold.php +++ b/src/Objects/NoiseThreshold.php @@ -10,23 +10,23 @@ public static function from_json(mixed $json): NoiseThreshold|null return null; } return new self( - device_id: $json->device_id, - ends_daily_at: $json->ends_daily_at, - name: $json->name, - noise_threshold_decibels: $json->noise_threshold_decibels, - noise_threshold_id: $json->noise_threshold_id, - starts_daily_at: $json->starts_daily_at, + device_id: $json->device_id ?? null, + ends_daily_at: $json->ends_daily_at ?? null, + name: $json->name ?? null, + noise_threshold_decibels: $json->noise_threshold_decibels ?? null, + noise_threshold_id: $json->noise_threshold_id ?? null, noise_threshold_nrs: $json->noise_threshold_nrs ?? null, + starts_daily_at: $json->starts_daily_at ?? null, ); } public function __construct( - public string $device_id, - public string $ends_daily_at, - public string $name, - public float $noise_threshold_decibels, - public string $noise_threshold_id, - public string $starts_daily_at, + public string|null $device_id, + public string|null $ends_daily_at, + public string|null $name, + public float|null $noise_threshold_decibels, + public string|null $noise_threshold_id, public float|null $noise_threshold_nrs, + public string|null $starts_daily_at, ) {} } diff --git a/src/Objects/Pagination.php b/src/Objects/Pagination.php deleted file mode 100644 index 580020ad..00000000 --- a/src/Objects/Pagination.php +++ /dev/null @@ -1,24 +0,0 @@ -has_next_page, - next_page_cursor: $json->next_page_cursor ?? null, - next_page_url: $json->next_page_url ?? null, - ); - } - - public function __construct( - public bool $has_next_page, - public string|null $next_page_cursor, - public string|null $next_page_url, - ) {} -} diff --git a/src/Objects/Phone.php b/src/Objects/Phone.php index 0f6e050e..40d363ed 100644 --- a/src/Objects/Phone.php +++ b/src/Objects/Phone.php @@ -10,35 +10,37 @@ public static function from_json(mixed $json): Phone|null return null; } return new self( - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_id: $json->device_id, - device_type: $json->device_type, - display_name: $json->display_name, + created_at: $json->created_at ?? null, + custom_metadata: $json->custom_metadata ?? null, + device_id: $json->device_id ?? null, + device_type: $json->device_type ?? null, + display_name: $json->display_name ?? null, errors: array_map( fn($e) => PhoneErrors::from_json($e), $json->errors ?? [], ), - properties: PhoneProperties::from_json($json->properties), + nickname: $json->nickname ?? null, + properties: isset($json->properties) + ? PhoneProperties::from_json($json->properties) + : null, warnings: array_map( fn($w) => PhoneWarnings::from_json($w), $json->warnings ?? [], ), - workspace_id: $json->workspace_id, - nickname: $json->nickname ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $created_at, + public string|null $created_at, public mixed $custom_metadata, - public string $device_id, - public string $device_type, - public string $display_name, + public string|null $device_id, + public string|null $device_type, + public string|null $display_name, public array $errors, - public PhoneProperties $properties, - public array $warnings, - public string $workspace_id, public string|null $nickname, + public PhoneProperties|null $properties, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php b/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php index 06dcb063..86b397c4 100644 --- a/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php +++ b/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php @@ -20,7 +20,7 @@ public static function from_json( } public function __construct( - public array|null $endpoints, + public array $endpoints, public bool|null $has_active_endpoint, ) {} } diff --git a/src/Objects/PhoneErrors.php b/src/Objects/PhoneErrors.php index 7c9ea9b2..aff9abd1 100644 --- a/src/Objects/PhoneErrors.php +++ b/src/Objects/PhoneErrors.php @@ -10,15 +10,13 @@ public static function from_json(mixed $json): PhoneErrors|null return null; } return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/PhoneRegistration.php b/src/Objects/PhoneRegistration.php deleted file mode 100644 index 7774f2f6..00000000 --- a/src/Objects/PhoneRegistration.php +++ /dev/null @@ -1,26 +0,0 @@ -is_being_activated, - phone_registration_id: $json->phone_registration_id, - provider_state: $json->provider_state ?? null, - provider_name: $json->provider_name ?? null, - ); - } - - public function __construct( - public bool $is_being_activated, - public string $phone_registration_id, - public mixed $provider_state, - public string|null $provider_name, - ) {} -} diff --git a/src/Objects/PhoneSession.php b/src/Objects/PhoneSession.php index b392b592..852866f8 100644 --- a/src/Objects/PhoneSession.php +++ b/src/Objects/PhoneSession.php @@ -10,22 +10,22 @@ public static function from_json(mixed $json): PhoneSession|null return null; } return new self( - is_sandbox_workspace: $json->is_sandbox_workspace, + is_sandbox_workspace: $json->is_sandbox_workspace ?? null, provider_sessions: array_map( fn($p) => PhoneSessionProviderSessions::from_json($p), $json->provider_sessions ?? [], ), - user_identity: PhoneSessionUserIdentity::from_json( - $json->user_identity, - ), - workspace_id: $json->workspace_id, + user_identity: isset($json->user_identity) + ? PhoneSessionUserIdentity::from_json($json->user_identity) + : null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public bool $is_sandbox_workspace, + public bool|null $is_sandbox_workspace, public array $provider_sessions, - public PhoneSessionUserIdentity $user_identity, - public string $workspace_id, + public PhoneSessionUserIdentity|null $user_identity, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/PhoneSessionAcsCredentials.php b/src/Objects/PhoneSessionAcsCredentials.php index b48290ed..a73a18da 100644 --- a/src/Objects/PhoneSessionAcsCredentials.php +++ b/src/Objects/PhoneSessionAcsCredentials.php @@ -11,40 +11,43 @@ public static function from_json( return null; } return new self( - access_method: $json->access_method, + access_method: $json->access_method ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, acs_entrances: array_map( fn($a) => PhoneSessionAcsEntrances::from_json($a), $json->acs_entrances ?? [], ), - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => PhoneSessionErrors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => PhoneSessionWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, - acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_system_id: $json->acs_system_id ?? null, acs_user_id: $json->acs_user_id ?? null, assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) ? PhoneSessionAssaAbloyVostioMetadata::from_json( $json->assa_abloy_vostio_metadata, ) : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, ends_at: $json->ends_at ?? null, + errors: array_map( + fn($e) => PhoneSessionErrors::from_json($e), + $json->errors ?? [], + ), external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, is_issued: $json->is_issued ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + is_managed: $json->is_managed ?? null, is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? null, is_one_time_use: $json->is_one_time_use ?? null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, parent_acs_credential_id: $json->parent_acs_credential_id ?? null, starts_at: $json->starts_at ?? null, user_identity_id: $json->user_identity_id ?? null, @@ -53,46 +56,43 @@ public static function from_json( $json->visionline_metadata, ) : null, - acs_credential_id: $json->acs_credential_id ?? null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, + warnings: array_map( + fn($w) => PhoneSessionWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_method, - public array $acs_entrances, - public string $acs_system_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, + public string|null $access_method, + public string|null $acs_credential_id, public string|null $acs_credential_pool_id, + public array $acs_entrances, + public string|null $acs_system_id, public string|null $acs_user_id, public PhoneSessionAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $card_number, + public string|null $code, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public string|null $ends_at, + public array $errors, public string|null $external_type, public string|null $external_type_display_name, public bool|null $is_issued, + public bool|null $is_latest_desired_state_synced_with_provider, + public bool|null $is_managed, public bool|null $is_multi_phone_sync_credential, public bool|null $is_one_time_use, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at, public string|null $parent_acs_credential_id, public string|null $starts_at, public string|null $user_identity_id, public PhoneSessionVisionlineMetadata|null $visionline_metadata, - public string|null $acs_credential_id, - public string|null $card_number, - public string|null $code, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/PhoneSessionAcsEntrances.php b/src/Objects/PhoneSessionAcsEntrances.php index b511d046..59b9875a 100644 --- a/src/Objects/PhoneSessionAcsEntrances.php +++ b/src/Objects/PhoneSessionAcsEntrances.php @@ -10,20 +10,8 @@ public static function from_json(mixed $json): PhoneSessionAcsEntrances|null return null; } return new self( - acs_entrance_id: $json->acs_entrance_id, - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => PhoneSessionErrors::from_json($e), - $json->errors ?? [], - ), - space_ids: $json->space_ids, - warnings: array_map( - fn($w) => PhoneSessionWarnings::from_json($w), - $json->warnings ?? [], - ), + acs_entrance_id: $json->acs_entrance_id ?? null, + acs_system_id: $json->acs_system_id ?? null, assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) ? PhoneSessionAssaAbloyVostioMetadata::from_json( $json->assa_abloy_vostio_metadata, @@ -43,6 +31,9 @@ public static function from_json(mixed $json): PhoneSessionAcsEntrances|null can_unlock_with_code: $json->can_unlock_with_code ?? null, can_unlock_with_mobile_key: $json->can_unlock_with_mobile_key ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, dormakaba_ambiance_metadata: isset( $json->dormakaba_ambiance_metadata, ) @@ -57,6 +48,10 @@ public static function from_json(mixed $json): PhoneSessionAcsEntrances|null $json->dormakaba_community_metadata, ) : null, + errors: array_map( + fn($e) => PhoneSessionErrors::from_json($e), + $json->errors ?? [], + ), hotek_metadata: isset($json->hotek_metadata) ? PhoneSessionHotekMetadata::from_json($json->hotek_metadata) : null, @@ -74,23 +69,22 @@ public static function from_json(mixed $json): PhoneSessionAcsEntrances|null $json->salto_space_metadata, ) : null, + space_ids: $json->space_ids ?? null, visionline_metadata: isset($json->visionline_metadata) ? PhoneSessionVisionlineMetadata::from_json( $json->visionline_metadata, ) : null, + warnings: array_map( + fn($w) => PhoneSessionWarnings::from_json($w), + $json->warnings ?? [], + ), ); } public function __construct( - public string $acs_entrance_id, - public string $acs_system_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, - public array $errors, - public array $space_ids, - public array $warnings, + public string|null $acs_entrance_id, + public string|null $acs_system_id, public PhoneSessionAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, public PhoneSessionAvigilonAltaMetadata|null $avigilon_alta_metadata, public PhoneSessionBrivoMetadata|null $brivo_metadata, @@ -99,13 +93,19 @@ public function __construct( public bool|null $can_unlock_with_cloud_key, public bool|null $can_unlock_with_code, public bool|null $can_unlock_with_mobile_key, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public PhoneSessionDormakabaAmbianceMetadata|null $dormakaba_ambiance_metadata, public PhoneSessionDormakabaCommunityMetadata|null $dormakaba_community_metadata, + public array $errors, public PhoneSessionHotekMetadata|null $hotek_metadata, public bool|null $is_locked, public PhoneSessionLatchMetadata|null $latch_metadata, public PhoneSessionSaltoKsMetadata|null $salto_ks_metadata, public PhoneSessionSaltoSpaceMetadata|null $salto_space_metadata, + public array|null $space_ids, public PhoneSessionVisionlineMetadata|null $visionline_metadata, + public array $warnings, ) {} } diff --git a/src/Objects/PhoneSessionErrors.php b/src/Objects/PhoneSessionErrors.php index ba0adebf..4239d317 100644 --- a/src/Objects/PhoneSessionErrors.php +++ b/src/Objects/PhoneSessionErrors.php @@ -10,15 +10,13 @@ public static function from_json(mixed $json): PhoneSessionErrors|null return null; } return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/PhoneSessionPhoneRegistration.php b/src/Objects/PhoneSessionPhoneRegistration.php index 8e565542..43092d34 100644 --- a/src/Objects/PhoneSessionPhoneRegistration.php +++ b/src/Objects/PhoneSessionPhoneRegistration.php @@ -11,17 +11,15 @@ public static function from_json( return null; } return new self( - is_being_activated: $json->is_being_activated, - phone_registration_id: $json->phone_registration_id, - provider_state: $json->provider_state ?? null, + is_being_activated: $json->is_being_activated ?? null, + phone_registration_id: $json->phone_registration_id ?? null, provider_name: $json->provider_name ?? null, ); } public function __construct( - public bool $is_being_activated, - public string $phone_registration_id, - public mixed $provider_state, + public bool|null $is_being_activated, + public string|null $phone_registration_id, public string|null $provider_name, ) {} } diff --git a/src/Objects/PhoneSessionProviderSessions.php b/src/Objects/PhoneSessionProviderSessions.php index 0cc2dfec..84314956 100644 --- a/src/Objects/PhoneSessionProviderSessions.php +++ b/src/Objects/PhoneSessionProviderSessions.php @@ -15,14 +15,16 @@ public static function from_json( fn($a) => PhoneSessionAcsCredentials::from_json($a), $json->acs_credentials ?? [], ), - phone_registration: PhoneSessionPhoneRegistration::from_json( - $json->phone_registration, - ), + phone_registration: isset($json->phone_registration) + ? PhoneSessionPhoneRegistration::from_json( + $json->phone_registration, + ) + : null, ); } public function __construct( public array $acs_credentials, - public PhoneSessionPhoneRegistration $phone_registration, + public PhoneSessionPhoneRegistration|null $phone_registration, ) {} } diff --git a/src/Objects/PhoneSessionUserIdentity.php b/src/Objects/PhoneSessionUserIdentity.php index a382890e..19f9e715 100644 --- a/src/Objects/PhoneSessionUserIdentity.php +++ b/src/Objects/PhoneSessionUserIdentity.php @@ -10,37 +10,37 @@ public static function from_json(mixed $json): PhoneSessionUserIdentity|null return null; } return new self( - acs_user_ids: $json->acs_user_ids, - created_at: $json->created_at, - display_name: $json->display_name, + acs_user_ids: $json->acs_user_ids ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, + email_address: $json->email_address ?? null, errors: array_map( fn($e) => PhoneSessionErrors::from_json($e), $json->errors ?? [], ), - user_identity_id: $json->user_identity_id, + full_name: $json->full_name ?? null, + phone_number: $json->phone_number ?? null, + user_identity_id: $json->user_identity_id ?? null, + user_identity_key: $json->user_identity_key ?? null, warnings: array_map( fn($w) => PhoneSessionWarnings::from_json($w), $json->warnings ?? [], ), - workspace_id: $json->workspace_id, - email_address: $json->email_address ?? null, - full_name: $json->full_name ?? null, - phone_number: $json->phone_number ?? null, - user_identity_key: $json->user_identity_key ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public array $acs_user_ids, - public string $created_at, - public string $display_name, - public array $errors, - public string $user_identity_id, - public array $warnings, - public string $workspace_id, + public array|null $acs_user_ids, + public string|null $created_at, + public string|null $display_name, public string|null $email_address, + public array $errors, public string|null $full_name, public string|null $phone_number, + public string|null $user_identity_id, public string|null $user_identity_key, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/PhoneSessionVisionlineMetadata.php b/src/Objects/PhoneSessionVisionlineMetadata.php index 6d95bd87..5703322a 100644 --- a/src/Objects/PhoneSessionVisionlineMetadata.php +++ b/src/Objects/PhoneSessionVisionlineMetadata.php @@ -23,6 +23,6 @@ public static function from_json( public function __construct( public string|null $door_category, public string|null $door_name, - public array|null $profiles, + public array $profiles, ) {} } diff --git a/src/Objects/PhoneSessionWarnings.php b/src/Objects/PhoneSessionWarnings.php index 4f996b14..9350d2d3 100644 --- a/src/Objects/PhoneSessionWarnings.php +++ b/src/Objects/PhoneSessionWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): PhoneSessionWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/PhoneWarnings.php b/src/Objects/PhoneWarnings.php index cd1c273d..1a20f80a 100644 --- a/src/Objects/PhoneWarnings.php +++ b/src/Objects/PhoneWarnings.php @@ -10,15 +10,13 @@ public static function from_json(mixed $json): PhoneWarnings|null return null; } return new self( - message: $json->message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/Space.php b/src/Objects/Space.php index 3c68ca13..9783cef7 100644 --- a/src/Objects/Space.php +++ b/src/Objects/Space.php @@ -10,39 +10,39 @@ public static function from_json(mixed $json): Space|null return null; } return new self( - acs_entrance_count: $json->acs_entrance_count, - created_at: $json->created_at, - device_count: $json->device_count, - display_name: $json->display_name, - name: $json->name, - space_id: $json->space_id, - workspace_id: $json->workspace_id, + acs_entrance_count: $json->acs_entrance_count ?? null, + created_at: $json->created_at ?? null, customer_data: isset($json->customer_data) ? SpaceCustomerData::from_json($json->customer_data) : null, customer_key: $json->customer_key ?? null, - parent_space_id: $json->parent_space_id ?? null, - parent_space_key: $json->parent_space_key ?? null, - space_key: $json->space_key ?? null, + device_count: $json->device_count ?? null, + display_name: $json->display_name ?? null, geolocation: isset($json->geolocation) ? SpaceGeolocation::from_json($json->geolocation) : null, + name: $json->name ?? null, + parent_space_id: $json->parent_space_id ?? null, + parent_space_key: $json->parent_space_key ?? null, + space_id: $json->space_id ?? null, + space_key: $json->space_key ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public float $acs_entrance_count, - public string $created_at, - public float $device_count, - public string $display_name, - public string $name, - public string $space_id, - public string $workspace_id, + public float|null $acs_entrance_count, + public string|null $created_at, public SpaceCustomerData|null $customer_data, public string|null $customer_key, + public float|null $device_count, + public string|null $display_name, + public SpaceGeolocation|null $geolocation, + public string|null $name, public string|null $parent_space_id, public string|null $parent_space_key, + public string|null $space_id, public string|null $space_key, - public SpaceGeolocation|null $geolocation, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/SpaceGeolocation.php b/src/Objects/SpaceGeolocation.php index 3fd35246..e7a52e08 100644 --- a/src/Objects/SpaceGeolocation.php +++ b/src/Objects/SpaceGeolocation.php @@ -9,11 +9,14 @@ public static function from_json(mixed $json): SpaceGeolocation|null if (!$json) { return null; } - return new self(latitude: $json->latitude, longitude: $json->longitude); + return new self( + latitude: $json->latitude ?? null, + longitude: $json->longitude ?? null, + ); } public function __construct( - public float $latitude, - public float $longitude, + public float|null $latitude, + public float|null $longitude, ) {} } diff --git a/src/Objects/StaffMember.php b/src/Objects/StaffMember.php index e8ff2779..6c9c7a56 100644 --- a/src/Objects/StaffMember.php +++ b/src/Objects/StaffMember.php @@ -10,37 +10,37 @@ public static function from_json(mixed $json): StaffMember|null return null; } return new self( - name: $json->name, - staff_member_key: $json->staff_member_key, building_keys: $json->building_keys ?? null, common_area_keys: $json->common_area_keys ?? null, email_address: $json->email_address ?? null, facility_keys: $json->facility_keys ?? null, listing_keys: $json->listing_keys ?? null, + name: $json->name ?? null, phone_number: $json->phone_number ?? null, property_keys: $json->property_keys ?? null, property_listing_keys: $json->property_listing_keys ?? null, room_keys: $json->room_keys ?? null, site_keys: $json->site_keys ?? null, space_keys: $json->space_keys ?? null, + staff_member_key: $json->staff_member_key ?? null, unit_keys: $json->unit_keys ?? null, ); } public function __construct( - public string $name, - public string $staff_member_key, public array|null $building_keys, public array|null $common_area_keys, public string|null $email_address, public array|null $facility_keys, public array|null $listing_keys, + public string|null $name, public string|null $phone_number, public array|null $property_keys, public array|null $property_listing_keys, public array|null $room_keys, public array|null $site_keys, public array|null $space_keys, + public string|null $staff_member_key, public array|null $unit_keys, ) {} } diff --git a/src/Objects/ThermostatDailyProgram.php b/src/Objects/ThermostatDailyProgram.php index e7035db5..0fef3434 100644 --- a/src/Objects/ThermostatDailyProgram.php +++ b/src/Objects/ThermostatDailyProgram.php @@ -10,24 +10,25 @@ public static function from_json(mixed $json): ThermostatDailyProgram|null return null; } return new self( - created_at: $json->created_at, - device_id: $json->device_id, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + name: $json->name ?? null, periods: array_map( fn($p) => ThermostatDailyProgramPeriods::from_json($p), $json->periods ?? [], ), - thermostat_daily_program_id: $json->thermostat_daily_program_id, - workspace_id: $json->workspace_id, - name: $json->name ?? null, + thermostat_daily_program_id: $json->thermostat_daily_program_id ?? + null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $created_at, - public string $device_id, - public array $periods, - public string $thermostat_daily_program_id, - public string $workspace_id, + public string|null $created_at, + public string|null $device_id, public string|null $name, + public array $periods, + public string|null $thermostat_daily_program_id, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/ThermostatDailyProgramPeriods.php b/src/Objects/ThermostatDailyProgramPeriods.php index a3ed0a18..580586db 100644 --- a/src/Objects/ThermostatDailyProgramPeriods.php +++ b/src/Objects/ThermostatDailyProgramPeriods.php @@ -11,13 +11,13 @@ public static function from_json( return null; } return new self( - climate_preset_key: $json->climate_preset_key, - starts_at_time: $json->starts_at_time, + climate_preset_key: $json->climate_preset_key ?? null, + starts_at_time: $json->starts_at_time ?? null, ); } public function __construct( - public string $climate_preset_key, - public string $starts_at_time, + public string|null $climate_preset_key, + public string|null $starts_at_time, ) {} } diff --git a/src/Objects/ThermostatSchedule.php b/src/Objects/ThermostatSchedule.php index 4835df62..02a77b7f 100644 --- a/src/Objects/ThermostatSchedule.php +++ b/src/Objects/ThermostatSchedule.php @@ -10,35 +10,35 @@ public static function from_json(mixed $json): ThermostatSchedule|null return null; } return new self( - climate_preset_key: $json->climate_preset_key, - created_at: $json->created_at, - device_id: $json->device_id, - ends_at: $json->ends_at, + climate_preset_key: $json->climate_preset_key ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + ends_at: $json->ends_at ?? null, errors: array_map( fn($e) => ThermostatScheduleErrors::from_json($e), $json->errors ?? [], ), - starts_at: $json->starts_at, - thermostat_schedule_id: $json->thermostat_schedule_id, - workspace_id: $json->workspace_id, is_override_allowed: $json->is_override_allowed ?? null, - name: $json->name ?? null, max_override_period_minutes: $json->max_override_period_minutes ?? null, + name: $json->name ?? null, + starts_at: $json->starts_at ?? null, + thermostat_schedule_id: $json->thermostat_schedule_id ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $climate_preset_key, - public string $created_at, - public string $device_id, - public string $ends_at, + public string|null $climate_preset_key, + public string|null $created_at, + public string|null $device_id, + public string|null $ends_at, public array $errors, - public string $starts_at, - public string $thermostat_schedule_id, - public string $workspace_id, public bool|null $is_override_allowed, + public float|null $max_override_period_minutes, public string|null $name, - public mixed $max_override_period_minutes, + public string|null $starts_at, + public string|null $thermostat_schedule_id, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/ThermostatScheduleErrors.php b/src/Objects/ThermostatScheduleErrors.php index de098f3f..857b6817 100644 --- a/src/Objects/ThermostatScheduleErrors.php +++ b/src/Objects/ThermostatScheduleErrors.php @@ -10,15 +10,13 @@ public static function from_json(mixed $json): ThermostatScheduleErrors|null return null; } return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/UnmanagedAccessCode.php b/src/Objects/UnmanagedAccessCode.php index 5d950139..ba5b57df 100644 --- a/src/Objects/UnmanagedAccessCode.php +++ b/src/Objects/UnmanagedAccessCode.php @@ -10,52 +10,52 @@ public static function from_json(mixed $json): UnmanagedAccessCode|null return null; } return new self( - access_code_id: $json->access_code_id, - created_at: $json->created_at, - device_id: $json->device_id, - errors: array_map( - fn($e) => UnmanagedAccessCodeErrors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed, - status: $json->status, - type: $json->type, - warnings: array_map( - fn($w) => UnmanagedAccessCodeWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, + access_code_id: $json->access_code_id ?? null, cannot_be_managed: $json->cannot_be_managed ?? null, cannot_delete_unmanaged_access_code: $json->cannot_delete_unmanaged_access_code ?? null, code: $json->code ?? null, - name: $json->name ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) ? UnmanagedAccessCodeDormakabaOracodeMetadata::from_json( $json->dormakaba_oracode_metadata, ) : null, ends_at: $json->ends_at ?? null, + errors: array_map( + fn($e) => UnmanagedAccessCodeErrors::from_json($e), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + name: $json->name ?? null, starts_at: $json->starts_at ?? null, + status: $json->status ?? null, + type: $json->type ?? null, + warnings: array_map( + fn($w) => UnmanagedAccessCodeWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_code_id, - public string $created_at, - public string $device_id, - public array $errors, - public bool $is_managed, - public string $status, - public string $type, - public array $warnings, - public string $workspace_id, + public string|null $access_code_id, public bool|null $cannot_be_managed, public bool|null $cannot_delete_unmanaged_access_code, public string|null $code, - public string|null $name, + public string|null $created_at, + public string|null $device_id, public UnmanagedAccessCodeDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, public string|null $ends_at, + public array $errors, + public bool|null $is_managed, + public string|null $name, public string|null $starts_at, + public string|null $status, + public string|null $type, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/UnmanagedAccessCodeErrors.php b/src/Objects/UnmanagedAccessCodeErrors.php index 35b2cd62..6d8e4502 100644 --- a/src/Objects/UnmanagedAccessCodeErrors.php +++ b/src/Objects/UnmanagedAccessCodeErrors.php @@ -11,16 +11,16 @@ public static function from_json( return null; } return new self( - error_code: $json->error_code, - message: $json->message, change_type: $json->change_type ?? null, created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, managed_access_code_id: $json->managed_access_code_id ?? null, + message: $json->message ?? null, modified_fields: array_map( fn($m) => UnmanagedAccessCodeModifiedFields::from_json($m), $json->modified_fields ?? [], @@ -30,16 +30,16 @@ public static function from_json( } public function __construct( - public string $error_code, - public string $message, public string|null $change_type, public string|null $created_at, + public string|null $error_code, public bool|null $is_access_code_error, public bool|null $is_bridge_error, public bool|null $is_connected_account_error, public bool|null $is_device_error, public string|null $managed_access_code_id, - public array|null $modified_fields, + public string|null $message, + public array $modified_fields, public string|null $unmanaged_access_code_id, ) {} } diff --git a/src/Objects/UnmanagedAccessCodeModifiedFields.php b/src/Objects/UnmanagedAccessCodeModifiedFields.php index 72f1e29b..87949ef8 100644 --- a/src/Objects/UnmanagedAccessCodeModifiedFields.php +++ b/src/Objects/UnmanagedAccessCodeModifiedFields.php @@ -11,14 +11,14 @@ public static function from_json( return null; } return new self( - field: $json->field, + field: $json->field ?? null, from: $json->from ?? null, to: $json->to ?? null, ); } public function __construct( - public string $field, + public string|null $field, public string|null $from, public string|null $to, ) {} diff --git a/src/Objects/UnmanagedAccessCodeWarnings.php b/src/Objects/UnmanagedAccessCodeWarnings.php index d96854c4..daf28e62 100644 --- a/src/Objects/UnmanagedAccessCodeWarnings.php +++ b/src/Objects/UnmanagedAccessCodeWarnings.php @@ -11,22 +11,22 @@ public static function from_json( return null; } return new self( - message: $json->message, - warning_code: $json->warning_code, change_type: $json->change_type ?? null, created_at: $json->created_at ?? null, + message: $json->message ?? null, modified_fields: array_map( fn($m) => UnmanagedAccessCodeModifiedFields::from_json($m), $json->modified_fields ?? [], ), + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $message, - public string $warning_code, public string|null $change_type, public string|null $created_at, - public array|null $modified_fields, + public string|null $message, + public array $modified_fields, + public string|null $warning_code, ) {} } diff --git a/src/Objects/UnmanagedAcsAccessGroup.php b/src/Objects/UnmanagedAcsAccessGroup.php index 3b0da740..cfa31891 100644 --- a/src/Objects/UnmanagedAcsAccessGroup.php +++ b/src/Objects/UnmanagedAcsAccessGroup.php @@ -10,21 +10,28 @@ public static function from_json(mixed $json): UnmanagedAcsAccessGroup|null return null; } return new self( - access_group_type: $json->access_group_type, - access_group_type_display_name: $json->access_group_type_display_name, - acs_access_group_id: $json->acs_access_group_id, - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, + access_group_type: $json->access_group_type ?? null, + access_group_type_display_name: $json->access_group_type_display_name ?? + null, + access_schedule: isset($json->access_schedule) + ? UnmanagedAcsAccessGroupAccessSchedule::from_json( + $json->access_schedule, + ) + : null, + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, errors: array_map( fn($e) => UnmanagedAcsAccessGroupErrors::from_json($e), $json->errors ?? [], ), - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - is_managed: $json->is_managed, - name: $json->name, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + is_managed: $json->is_managed ?? null, + name: $json->name ?? null, pending_mutations: array_map( fn($p) => UnmanagedAcsAccessGroupPendingMutations::from_json( $p, @@ -35,31 +42,26 @@ public static function from_json(mixed $json): UnmanagedAcsAccessGroup|null fn($w) => UnmanagedAcsAccessGroupWarnings::from_json($w), $json->warnings ?? [], ), - workspace_id: $json->workspace_id, - access_schedule: isset($json->access_schedule) - ? UnmanagedAcsAccessGroupAccessSchedule::from_json( - $json->access_schedule, - ) - : null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_group_type, - public string $access_group_type_display_name, - public string $acs_access_group_id, - public string $acs_system_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, + public string|null $access_group_type, + public string|null $access_group_type_display_name, + public UnmanagedAcsAccessGroupAccessSchedule|null $access_schedule, + public string|null $acs_access_group_id, + public string|null $acs_system_id, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public array $errors, - public string $external_type, - public string $external_type_display_name, - public bool $is_managed, - public string $name, + public string|null $external_type, + public string|null $external_type_display_name, + public bool|null $is_managed, + public string|null $name, public array $pending_mutations, public array $warnings, - public string $workspace_id, - public UnmanagedAcsAccessGroupAccessSchedule|null $access_schedule, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/UnmanagedAcsAccessGroupAccessSchedule.php b/src/Objects/UnmanagedAcsAccessGroupAccessSchedule.php index 71b23ec6..993137ac 100644 --- a/src/Objects/UnmanagedAcsAccessGroupAccessSchedule.php +++ b/src/Objects/UnmanagedAcsAccessGroupAccessSchedule.php @@ -11,13 +11,13 @@ public static function from_json( return null; } return new self( - starts_at: $json->starts_at, ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, ); } public function __construct( - public string $starts_at, public string|null $ends_at, + public string|null $starts_at, ) {} } diff --git a/src/Objects/UnmanagedAcsAccessGroupErrors.php b/src/Objects/UnmanagedAcsAccessGroupErrors.php index b057c450..6a0630f5 100644 --- a/src/Objects/UnmanagedAcsAccessGroupErrors.php +++ b/src/Objects/UnmanagedAcsAccessGroupErrors.php @@ -11,15 +11,15 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/UnmanagedAcsAccessGroupFrom.php b/src/Objects/UnmanagedAcsAccessGroupFrom.php index 8a6661dd..c0c56569 100644 --- a/src/Objects/UnmanagedAcsAccessGroupFrom.php +++ b/src/Objects/UnmanagedAcsAccessGroupFrom.php @@ -10,8 +10,20 @@ public static function from_json( if (!$json) { return null; } - return new self(acs_entrance_id: $json->acs_entrance_id ?? null); + return new self( + acs_entrance_id: $json->acs_entrance_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + ends_at: $json->ends_at ?? null, + name: $json->name ?? null, + starts_at: $json->starts_at ?? null, + ); } - public function __construct(public string|null $acs_entrance_id) {} + public function __construct( + public string|null $acs_entrance_id, + public string|null $acs_user_id, + public string|null $ends_at, + public string|null $name, + public string|null $starts_at, + ) {} } diff --git a/src/Objects/UnmanagedAcsAccessGroupPendingMutations.php b/src/Objects/UnmanagedAcsAccessGroupPendingMutations.php index 3d89dd40..df804b8a 100644 --- a/src/Objects/UnmanagedAcsAccessGroupPendingMutations.php +++ b/src/Objects/UnmanagedAcsAccessGroupPendingMutations.php @@ -11,13 +11,13 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - message: $json->message, - mutation_code: $json->mutation_code, acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, from: isset($json->from) ? UnmanagedAcsAccessGroupFrom::from_json($json->from) : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? UnmanagedAcsAccessGroupTo::from_json($json->to) : null, @@ -26,11 +26,11 @@ public static function from_json( } public function __construct( - public string $created_at, - public string $message, - public string $mutation_code, public string|null $acs_user_id, + public string|null $created_at, public UnmanagedAcsAccessGroupFrom|null $from, + public string|null $message, + public string|null $mutation_code, public UnmanagedAcsAccessGroupTo|null $to, public string|null $variant, ) {} diff --git a/src/Objects/UnmanagedAcsAccessGroupTo.php b/src/Objects/UnmanagedAcsAccessGroupTo.php index 708a4ebb..f1a5ac19 100644 --- a/src/Objects/UnmanagedAcsAccessGroupTo.php +++ b/src/Objects/UnmanagedAcsAccessGroupTo.php @@ -10,8 +10,20 @@ public static function from_json( if (!$json) { return null; } - return new self(acs_entrance_id: $json->acs_entrance_id ?? null); + return new self( + acs_entrance_id: $json->acs_entrance_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + ends_at: $json->ends_at ?? null, + name: $json->name ?? null, + starts_at: $json->starts_at ?? null, + ); } - public function __construct(public string|null $acs_entrance_id) {} + public function __construct( + public string|null $acs_entrance_id, + public string|null $acs_user_id, + public string|null $ends_at, + public string|null $name, + public string|null $starts_at, + ) {} } diff --git a/src/Objects/UnmanagedAcsAccessGroupWarnings.php b/src/Objects/UnmanagedAcsAccessGroupWarnings.php index 3b846ee2..699b128e 100644 --- a/src/Objects/UnmanagedAcsAccessGroupWarnings.php +++ b/src/Objects/UnmanagedAcsAccessGroupWarnings.php @@ -11,15 +11,15 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/UnmanagedAcsCredential.php b/src/Objects/UnmanagedAcsCredential.php index 6430ec59..75321df2 100644 --- a/src/Objects/UnmanagedAcsCredential.php +++ b/src/Objects/UnmanagedAcsCredential.php @@ -10,37 +10,39 @@ public static function from_json(mixed $json): UnmanagedAcsCredential|null return null; } return new self( - access_method: $json->access_method, - acs_credential_id: $json->acs_credential_id, - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => UnmanagedAcsCredentialErrors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => UnmanagedAcsCredentialWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, + access_method: $json->access_method ?? null, + acs_credential_id: $json->acs_credential_id ?? null, acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_system_id: $json->acs_system_id ?? null, acs_user_id: $json->acs_user_id ?? null, assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) ? UnmanagedAcsCredentialAssaAbloyVostioMetadata::from_json( $json->assa_abloy_vostio_metadata, ) : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, ends_at: $json->ends_at ?? null, + errors: array_map( + fn($e) => UnmanagedAcsCredentialErrors::from_json($e), + $json->errors ?? [], + ), external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, is_issued: $json->is_issued ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + is_managed: $json->is_managed ?? null, is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? null, is_one_time_use: $json->is_one_time_use ?? null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, parent_acs_credential_id: $json->parent_acs_credential_id ?? null, starts_at: $json->starts_at ?? null, user_identity_id: $json->user_identity_id ?? null, @@ -49,44 +51,42 @@ public static function from_json(mixed $json): UnmanagedAcsCredential|null $json->visionline_metadata, ) : null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, + warnings: array_map( + fn($w) => UnmanagedAcsCredentialWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $access_method, - public string $acs_credential_id, - public string $acs_system_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, + public string|null $access_method, + public string|null $acs_credential_id, public string|null $acs_credential_pool_id, + public string|null $acs_system_id, public string|null $acs_user_id, public UnmanagedAcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $card_number, + public string|null $code, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public string|null $ends_at, + public array $errors, public string|null $external_type, public string|null $external_type_display_name, public bool|null $is_issued, + public bool|null $is_latest_desired_state_synced_with_provider, + public bool|null $is_managed, public bool|null $is_multi_phone_sync_credential, public bool|null $is_one_time_use, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at, public string|null $parent_acs_credential_id, public string|null $starts_at, public string|null $user_identity_id, public UnmanagedAcsCredentialVisionlineMetadata|null $visionline_metadata, - public string|null $card_number, - public string|null $code, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/UnmanagedAcsCredentialErrors.php b/src/Objects/UnmanagedAcsCredentialErrors.php index 9e4d04d8..82df3410 100644 --- a/src/Objects/UnmanagedAcsCredentialErrors.php +++ b/src/Objects/UnmanagedAcsCredentialErrors.php @@ -11,15 +11,13 @@ public static function from_json( return null; } return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/UnmanagedAcsCredentialWarnings.php b/src/Objects/UnmanagedAcsCredentialWarnings.php index 4619a5db..98a73528 100644 --- a/src/Objects/UnmanagedAcsCredentialWarnings.php +++ b/src/Objects/UnmanagedAcsCredentialWarnings.php @@ -11,15 +11,15 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/UnmanagedAcsUser.php b/src/Objects/UnmanagedAcsUser.php index fd8bcc10..a840929e 100644 --- a/src/Objects/UnmanagedAcsUser.php +++ b/src/Objects/UnmanagedAcsUser.php @@ -10,34 +10,30 @@ public static function from_json(mixed $json): UnmanagedAcsUser|null return null; } return new self( - acs_system_id: $json->acs_system_id, - acs_user_id: $json->acs_user_id, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => UnmanagedAcsUserErrors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => UnmanagedAcsUserWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, access_schedule: isset($json->access_schedule) ? UnmanagedAcsUserAccessSchedule::from_json( $json->access_schedule, ) : null, + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, email: $json->email ?? null, email_address: $json->email_address ?? null, + errors: array_map( + fn($e) => UnmanagedAcsUserErrors::from_json($e), + $json->errors ?? [], + ), external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, full_name: $json->full_name ?? null, hid_acs_system_id: $json->hid_acs_system_id ?? null, + is_managed: $json->is_managed ?? null, is_suspended: $json->is_suspended ?? null, + last_successful_sync_at: $json->last_successful_sync_at ?? null, pending_mutations: array_map( fn($p) => UnmanagedAcsUserPendingMutations::from_json($p), $json->pending_mutations ?? [], @@ -48,41 +44,45 @@ public static function from_json(mixed $json): UnmanagedAcsUser|null $json->salto_space_metadata, ) : null, - user_identity_id: $json->user_identity_id ?? null, - last_successful_sync_at: $json->last_successful_sync_at ?? null, user_identity_email_address: $json->user_identity_email_address ?? null, user_identity_full_name: $json->user_identity_full_name ?? null, + user_identity_id: $json->user_identity_id ?? null, user_identity_phone_number: $json->user_identity_phone_number ?? null, + warnings: array_map( + fn($w) => UnmanagedAcsUserWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $acs_system_id, - public string $acs_user_id, - public string $connected_account_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, public UnmanagedAcsUserAccessSchedule|null $access_schedule, + public string|null $acs_system_id, + public string|null $acs_user_id, + public string|null $connected_account_id, + public string|null $created_at, + public string|null $display_name, public string|null $email, public string|null $email_address, + public array $errors, public string|null $external_type, public string|null $external_type_display_name, public string|null $full_name, public string|null $hid_acs_system_id, + public bool|null $is_managed, public bool|null $is_suspended, - public array|null $pending_mutations, + public string|null $last_successful_sync_at, + public array $pending_mutations, public string|null $phone_number, public UnmanagedAcsUserSaltoSpaceMetadata|null $salto_space_metadata, - public string|null $user_identity_id, - public string|null $last_successful_sync_at, public string|null $user_identity_email_address, public string|null $user_identity_full_name, + public string|null $user_identity_id, public string|null $user_identity_phone_number, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/UnmanagedAcsUserAccessSchedule.php b/src/Objects/UnmanagedAcsUserAccessSchedule.php index 808967eb..63d5ef48 100644 --- a/src/Objects/UnmanagedAcsUserAccessSchedule.php +++ b/src/Objects/UnmanagedAcsUserAccessSchedule.php @@ -11,13 +11,13 @@ public static function from_json( return null; } return new self( - starts_at: $json->starts_at, ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, ); } public function __construct( - public string $starts_at, public string|null $ends_at, + public string|null $starts_at, ) {} } diff --git a/src/Objects/UnmanagedAcsUserErrors.php b/src/Objects/UnmanagedAcsUserErrors.php index 73df443a..4fdbdd2f 100644 --- a/src/Objects/UnmanagedAcsUserErrors.php +++ b/src/Objects/UnmanagedAcsUserErrors.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): UnmanagedAcsUserErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/UnmanagedAcsUserFrom.php b/src/Objects/UnmanagedAcsUserFrom.php index c0b8559e..d1ea2519 100644 --- a/src/Objects/UnmanagedAcsUserFrom.php +++ b/src/Objects/UnmanagedAcsUserFrom.php @@ -9,8 +9,26 @@ public static function from_json(mixed $json): UnmanagedAcsUserFrom|null if (!$json) { return null; } - return new self(acs_credential_id: $json->acs_credential_id ?? null); + return new self( + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + email_address: $json->email_address ?? null, + ends_at: $json->ends_at ?? null, + full_name: $json->full_name ?? null, + is_suspended: $json->is_suspended ?? null, + phone_number: $json->phone_number ?? null, + starts_at: $json->starts_at ?? null, + ); } - public function __construct(public string|null $acs_credential_id) {} + public function __construct( + public string|null $acs_access_group_id, + public string|null $acs_credential_id, + public string|null $email_address, + public string|null $ends_at, + public string|null $full_name, + public bool|null $is_suspended, + public string|null $phone_number, + public string|null $starts_at, + ) {} } diff --git a/src/Objects/UnmanagedAcsUserPendingMutations.php b/src/Objects/UnmanagedAcsUserPendingMutations.php index e1318ba6..82281844 100644 --- a/src/Objects/UnmanagedAcsUserPendingMutations.php +++ b/src/Objects/UnmanagedAcsUserPendingMutations.php @@ -11,29 +11,29 @@ public static function from_json( return null; } return new self( - created_at: $json->created_at, - message: $json->message, - mutation_code: $json->mutation_code, acs_access_group_id: $json->acs_access_group_id ?? null, + created_at: $json->created_at ?? null, from: isset($json->from) ? UnmanagedAcsUserFrom::from_json($json->from) : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, + scheduled_at: $json->scheduled_at ?? null, to: isset($json->to) ? UnmanagedAcsUserTo::from_json($json->to) : null, variant: $json->variant ?? null, - scheduled_at: $json->scheduled_at ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $mutation_code, public string|null $acs_access_group_id, + public string|null $created_at, public UnmanagedAcsUserFrom|null $from, + public string|null $message, + public string|null $mutation_code, + public string|null $scheduled_at, public UnmanagedAcsUserTo|null $to, public string|null $variant, - public string|null $scheduled_at, ) {} } diff --git a/src/Objects/UnmanagedAcsUserTo.php b/src/Objects/UnmanagedAcsUserTo.php index a4f7b337..b2c793ed 100644 --- a/src/Objects/UnmanagedAcsUserTo.php +++ b/src/Objects/UnmanagedAcsUserTo.php @@ -9,8 +9,26 @@ public static function from_json(mixed $json): UnmanagedAcsUserTo|null if (!$json) { return null; } - return new self(acs_credential_id: $json->acs_credential_id ?? null); + return new self( + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + email_address: $json->email_address ?? null, + ends_at: $json->ends_at ?? null, + full_name: $json->full_name ?? null, + is_suspended: $json->is_suspended ?? null, + phone_number: $json->phone_number ?? null, + starts_at: $json->starts_at ?? null, + ); } - public function __construct(public string|null $acs_credential_id) {} + public function __construct( + public string|null $acs_access_group_id, + public string|null $acs_credential_id, + public string|null $email_address, + public string|null $ends_at, + public string|null $full_name, + public bool|null $is_suspended, + public string|null $phone_number, + public string|null $starts_at, + ) {} } diff --git a/src/Objects/UnmanagedAcsUserWarnings.php b/src/Objects/UnmanagedAcsUserWarnings.php index de88b87c..17f9cfc9 100644 --- a/src/Objects/UnmanagedAcsUserWarnings.php +++ b/src/Objects/UnmanagedAcsUserWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): UnmanagedAcsUserWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/UnmanagedDevice.php b/src/Objects/UnmanagedDevice.php index 77fb8322..38cc60a0 100644 --- a/src/Objects/UnmanagedDevice.php +++ b/src/Objects/UnmanagedDevice.php @@ -10,23 +10,6 @@ public static function from_json(mixed $json): UnmanagedDevice|null return null; } return new self( - capabilities_supported: $json->capabilities_supported, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_id: $json->device_id, - device_type: $json->device_type, - errors: array_map( - fn($e) => UnmanagedDeviceErrors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed, - properties: UnmanagedDeviceProperties::from_json($json->properties), - warnings: array_map( - fn($w) => UnmanagedDeviceWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id, can_configure_auto_lock: $json->can_configure_auto_lock ?? null, can_hvac_cool: $json->can_hvac_cool ?? null, can_hvac_heat: $json->can_hvac_heat ?? null, @@ -57,24 +40,32 @@ public static function from_json(mixed $json): UnmanagedDevice|null can_simulate_removal: $json->can_simulate_removal ?? null, can_turn_off_hvac: $json->can_turn_off_hvac ?? null, can_unlock_with_code: $json->can_unlock_with_code ?? null, + capabilities_supported: $json->capabilities_supported ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + custom_metadata: $json->custom_metadata ?? null, + device_id: $json->device_id ?? null, + device_type: $json->device_type ?? null, + errors: array_map( + fn($e) => UnmanagedDeviceErrors::from_json($e), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, location: isset($json->location) ? UnmanagedDeviceLocation::from_json($json->location) : null, + properties: isset($json->properties) + ? UnmanagedDeviceProperties::from_json($json->properties) + : null, + warnings: array_map( + fn($w) => UnmanagedDeviceWarnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public array $capabilities_supported, - public string $connected_account_id, - public string $created_at, - public mixed $custom_metadata, - public string $device_id, - public string $device_type, - public array $errors, - public bool $is_managed, - public UnmanagedDeviceProperties $properties, - public array $warnings, - public string $workspace_id, public bool|null $can_configure_auto_lock, public bool|null $can_hvac_cool, public bool|null $can_hvac_heat, @@ -95,6 +86,17 @@ public function __construct( public bool|null $can_simulate_removal, public bool|null $can_turn_off_hvac, public bool|null $can_unlock_with_code, + public array|null $capabilities_supported, + public string|null $connected_account_id, + public string|null $created_at, + public mixed $custom_metadata, + public string|null $device_id, + public string|null $device_type, + public array $errors, + public bool|null $is_managed, public UnmanagedDeviceLocation|null $location, + public UnmanagedDeviceProperties|null $properties, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/UnmanagedDeviceAccessoryKeypad.php b/src/Objects/UnmanagedDeviceAccessoryKeypad.php index 8498077b..2500dc3d 100644 --- a/src/Objects/UnmanagedDeviceAccessoryKeypad.php +++ b/src/Objects/UnmanagedDeviceAccessoryKeypad.php @@ -11,15 +11,15 @@ public static function from_json( return null; } return new self( - is_connected: $json->is_connected, battery: isset($json->battery) ? UnmanagedDeviceBattery::from_json($json->battery) : null, + is_connected: $json->is_connected ?? null, ); } public function __construct( - public bool $is_connected, public UnmanagedDeviceBattery|null $battery, + public bool|null $is_connected, ) {} } diff --git a/src/Objects/UnmanagedDeviceBattery.php b/src/Objects/UnmanagedDeviceBattery.php index f9769228..2663b5b8 100644 --- a/src/Objects/UnmanagedDeviceBattery.php +++ b/src/Objects/UnmanagedDeviceBattery.php @@ -9,8 +9,8 @@ public static function from_json(mixed $json): UnmanagedDeviceBattery|null if (!$json) { return null; } - return new self(level: $json->level); + return new self(level: $json->level ?? null); } - public function __construct(public float $level) {} + public function __construct(public float|null $level) {} } diff --git a/src/Objects/UnmanagedDeviceErrors.php b/src/Objects/UnmanagedDeviceErrors.php index 8d5f9de5..a2b2806b 100644 --- a/src/Objects/UnmanagedDeviceErrors.php +++ b/src/Objects/UnmanagedDeviceErrors.php @@ -10,22 +10,22 @@ public static function from_json(mixed $json): UnmanagedDeviceErrors|null return null; } return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $created_at, - public string $error_code, - public string $message, + public string|null $created_at, + public string|null $error_code, public bool|null $is_bridge_error, public bool|null $is_connected_account_error, public bool|null $is_device_error, + public string|null $message, ) {} } diff --git a/src/Objects/UnmanagedDeviceModel.php b/src/Objects/UnmanagedDeviceModel.php index 7ee800cd..a1c67310 100644 --- a/src/Objects/UnmanagedDeviceModel.php +++ b/src/Objects/UnmanagedDeviceModel.php @@ -10,13 +10,13 @@ public static function from_json(mixed $json): UnmanagedDeviceModel|null return null; } return new self( - display_name: $json->display_name, - manufacturer_display_name: $json->manufacturer_display_name, accessory_keypad_supported: $json->accessory_keypad_supported ?? null, can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? null, + display_name: $json->display_name ?? null, has_built_in_keypad: $json->has_built_in_keypad ?? null, + manufacturer_display_name: $json->manufacturer_display_name ?? null, offline_access_codes_supported: $json->offline_access_codes_supported ?? null, online_access_codes_supported: $json->online_access_codes_supported ?? @@ -25,11 +25,11 @@ public static function from_json(mixed $json): UnmanagedDeviceModel|null } public function __construct( - public string $display_name, - public string $manufacturer_display_name, public bool|null $accessory_keypad_supported, public bool|null $can_connect_accessory_keypad, + public string|null $display_name, public bool|null $has_built_in_keypad, + public string|null $manufacturer_display_name, public bool|null $offline_access_codes_supported, public bool|null $online_access_codes_supported, ) {} diff --git a/src/Objects/UnmanagedDeviceProperties.php b/src/Objects/UnmanagedDeviceProperties.php index 0b46bd8a..40f13def 100644 --- a/src/Objects/UnmanagedDeviceProperties.php +++ b/src/Objects/UnmanagedDeviceProperties.php @@ -11,9 +11,6 @@ public static function from_json( return null; } return new self( - model: UnmanagedDeviceModel::from_json($json->model), - name: $json->name, - online: $json->online, accessory_keypad: isset($json->accessory_keypad) ? UnmanagedDeviceAccessoryKeypad::from_json( $json->accessory_keypad, @@ -26,24 +23,29 @@ public static function from_json( image_alt_text: $json->image_alt_text ?? null, image_url: $json->image_url ?? null, manufacturer: $json->manufacturer ?? null, + model: isset($json->model) + ? UnmanagedDeviceModel::from_json($json->model) + : null, + name: $json->name ?? null, offline_access_codes_enabled: $json->offline_access_codes_enabled ?? null, + online: $json->online ?? null, online_access_codes_enabled: $json->online_access_codes_enabled ?? null, ); } public function __construct( - public UnmanagedDeviceModel $model, - public string $name, - public bool $online, public UnmanagedDeviceAccessoryKeypad|null $accessory_keypad, public UnmanagedDeviceBattery|null $battery, public float|null $battery_level, public string|null $image_alt_text, public string|null $image_url, public string|null $manufacturer, + public UnmanagedDeviceModel|null $model, + public string|null $name, public bool|null $offline_access_codes_enabled, + public bool|null $online, public bool|null $online_access_codes_enabled, ) {} } diff --git a/src/Objects/UnmanagedDeviceWarnings.php b/src/Objects/UnmanagedDeviceWarnings.php index 55d3f4af..41db733f 100644 --- a/src/Objects/UnmanagedDeviceWarnings.php +++ b/src/Objects/UnmanagedDeviceWarnings.php @@ -10,20 +10,20 @@ public static function from_json(mixed $json): UnmanagedDeviceWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, active_access_code_count: $json->active_access_code_count ?? null, + created_at: $json->created_at ?? null, max_active_access_code_count: $json->max_active_access_code_count ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, - public mixed $active_access_code_count, - public mixed $max_active_access_code_count, + public float|null $active_access_code_count, + public string|null $created_at, + public float|null $max_active_access_code_count, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/UserIdentity.php b/src/Objects/UserIdentity.php index 5a912173..a5054791 100644 --- a/src/Objects/UserIdentity.php +++ b/src/Objects/UserIdentity.php @@ -10,37 +10,37 @@ public static function from_json(mixed $json): UserIdentity|null return null; } return new self( - acs_user_ids: $json->acs_user_ids, - created_at: $json->created_at, - display_name: $json->display_name, + acs_user_ids: $json->acs_user_ids ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, + email_address: $json->email_address ?? null, errors: array_map( fn($e) => UserIdentityErrors::from_json($e), $json->errors ?? [], ), - user_identity_id: $json->user_identity_id, + full_name: $json->full_name ?? null, + phone_number: $json->phone_number ?? null, + user_identity_id: $json->user_identity_id ?? null, + user_identity_key: $json->user_identity_key ?? null, warnings: array_map( fn($w) => UserIdentityWarnings::from_json($w), $json->warnings ?? [], ), - workspace_id: $json->workspace_id, - email_address: $json->email_address ?? null, - full_name: $json->full_name ?? null, - phone_number: $json->phone_number ?? null, - user_identity_key: $json->user_identity_key ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public array $acs_user_ids, - public string $created_at, - public string $display_name, - public array $errors, - public string $user_identity_id, - public array $warnings, - public string $workspace_id, + public array|null $acs_user_ids, + public string|null $created_at, + public string|null $display_name, public string|null $email_address, + public array $errors, public string|null $full_name, public string|null $phone_number, + public string|null $user_identity_id, public string|null $user_identity_key, + public array $warnings, + public string|null $workspace_id, ) {} } diff --git a/src/Objects/UserIdentityErrors.php b/src/Objects/UserIdentityErrors.php index 46221ba5..baeaf0f3 100644 --- a/src/Objects/UserIdentityErrors.php +++ b/src/Objects/UserIdentityErrors.php @@ -10,19 +10,19 @@ public static function from_json(mixed $json): UserIdentityErrors|null return null; } return new self( - acs_system_id: $json->acs_system_id, - acs_user_id: $json->acs_user_id, - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message, + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( - public string $acs_system_id, - public string $acs_user_id, - public string $created_at, - public string $error_code, - public string $message, + public string|null $acs_system_id, + public string|null $acs_user_id, + public string|null $created_at, + public string|null $error_code, + public string|null $message, ) {} } diff --git a/src/Objects/UserIdentityWarnings.php b/src/Objects/UserIdentityWarnings.php index 8ed3fa89..dd16a01b 100644 --- a/src/Objects/UserIdentityWarnings.php +++ b/src/Objects/UserIdentityWarnings.php @@ -10,15 +10,15 @@ public static function from_json(mixed $json): UserIdentityWarnings|null return null; } return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( - public string $created_at, - public string $message, - public string $warning_code, + public string|null $created_at, + public string|null $message, + public string|null $warning_code, ) {} } diff --git a/src/Objects/Webhook.php b/src/Objects/Webhook.php index 484e7432..247aeaac 100644 --- a/src/Objects/Webhook.php +++ b/src/Objects/Webhook.php @@ -10,17 +10,17 @@ public static function from_json(mixed $json): Webhook|null return null; } return new self( - url: $json->url, - webhook_id: $json->webhook_id, event_types: $json->event_types ?? null, secret: $json->secret ?? null, + url: $json->url ?? null, + webhook_id: $json->webhook_id ?? null, ); } public function __construct( - public string $url, - public string $webhook_id, public array|null $event_types, public string|null $secret, + public string|null $url, + public string|null $webhook_id, ) {} } diff --git a/src/Objects/Workspace.php b/src/Objects/Workspace.php index 1abcf533..44431bbb 100644 --- a/src/Objects/Workspace.php +++ b/src/Objects/Workspace.php @@ -10,31 +10,36 @@ public static function from_json(mixed $json): Workspace|null return null; } return new self( - company_name: $json->company_name, - connect_webview_customization: WorkspaceConnectWebviewCustomization::from_json( - $json->connect_webview_customization, - ), - is_publishable_key_auth_enabled: $json->is_publishable_key_auth_enabled, - is_sandbox: $json->is_sandbox, - is_suspended: $json->is_suspended, - name: $json->name, - workspace_id: $json->workspace_id, - publishable_key: $json->publishable_key ?? null, + company_name: $json->company_name ?? null, connect_partner_name: $json->connect_partner_name ?? null, + connect_webview_customization: isset( + $json->connect_webview_customization, + ) + ? WorkspaceConnectWebviewCustomization::from_json( + $json->connect_webview_customization, + ) + : null, + is_publishable_key_auth_enabled: $json->is_publishable_key_auth_enabled ?? + null, + is_sandbox: $json->is_sandbox ?? null, + is_suspended: $json->is_suspended ?? null, + name: $json->name ?? null, organization_id: $json->organization_id ?? null, + publishable_key: $json->publishable_key ?? null, + workspace_id: $json->workspace_id ?? null, ); } public function __construct( - public string $company_name, - public WorkspaceConnectWebviewCustomization $connect_webview_customization, - public bool $is_publishable_key_auth_enabled, - public bool $is_sandbox, - public bool $is_suspended, - public string $name, - public string $workspace_id, - public string|null $publishable_key, + public string|null $company_name, public string|null $connect_partner_name, + public WorkspaceConnectWebviewCustomization|null $connect_webview_customization, + public bool|null $is_publishable_key_auth_enabled, + public bool|null $is_sandbox, + public bool|null $is_suspended, + public string|null $name, public string|null $organization_id, + public string|null $publishable_key, + public string|null $workspace_id, ) {} } diff --git a/src/SeamClient.php b/src/SeamClient.php index 8a7f1899..171493c9 100644 --- a/src/SeamClient.php +++ b/src/SeamClient.php @@ -30,9 +30,7 @@ use Seam\Objects\InstantKey; use Seam\Objects\MagicLink; use Seam\Objects\NoiseThreshold; -use Seam\Objects\Pagination; use Seam\Objects\Phone; -use Seam\Objects\PhoneRegistration; use Seam\Objects\PhoneSession; use Seam\Objects\Space; use Seam\Objects\StaffMember; @@ -134,7 +132,6 @@ public function request($method, $path, $json = null, $query = null) ]; $options = array_filter($options, fn($option) => $option !== null); - // TODO handle request errors $response = $this->client->request($method, $path, $options); $status_code = $response->getStatusCode(); $request_id = $response->getHeaderLine("seam-request-id"); @@ -506,8 +503,8 @@ public function pull_backup_access_code(string $access_code_id): AccessCode public function report_device_constraints( string $device_id, - mixed $max_code_length = null, - mixed $min_code_length = null, + ?float $max_code_length = null, + ?float $min_code_length = null, ?array $supported_code_lengths = null, ): void { $request_payload = []; @@ -1948,10 +1945,11 @@ public function update( class AcsEncodersClient { private SeamClient $seam; - + public AcsEncodersSimulateClient $simulate; public function __construct(SeamClient $seam) { $this->seam = $seam; + $this->simulate = new AcsEncodersSimulateClient($seam); } public function encode_credential( @@ -2281,7 +2279,7 @@ public function list( ?string $acs_system_id = null, ?string $connected_account_id = null, ?string $customer_key = null, - mixed $limit = null, + ?float $limit = null, ?string $location_id = null, ?string $page_cursor = null, ?string $search = null, @@ -2589,18 +2587,18 @@ public function delete( } public function get( - ?string $acs_system_id = null, ?string $acs_user_id = null, + ?string $acs_system_id = null, ?string $user_identity_id = null, ): AcsUser { $request_payload = []; - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } if ($acs_user_id !== null) { $request_payload["acs_user_id"] = $acs_user_id; } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } if ($user_identity_id !== null) { $request_payload["user_identity_id"] = $user_identity_id; } @@ -2617,7 +2615,7 @@ public function get( public function list( ?string $acs_system_id = null, ?string $created_before = null, - mixed $limit = null, + ?float $limit = null, ?string $page_cursor = null, ?string $search = null, ?string $user_identity_email_address = null, @@ -2872,7 +2870,7 @@ public function get(string $action_attempt_id): ActionAttempt public function list( ?array $action_attempt_ids = null, ?string $device_id = null, - mixed $limit = null, + ?float $limit = null, ?string $page_cursor = null, ?callable $on_response = null, ): array { @@ -3353,7 +3351,7 @@ public function get( public function list( mixed $custom_metadata_has = null, ?string $customer_key = null, - mixed $limit = null, + ?float $limit = null, ?string $page_cursor = null, ?string $search = null, ?string $space_id = null, @@ -4168,18 +4166,18 @@ public function __construct(SeamClient $seam) } public function get( - ?string $device_id = null, ?string $event_id = null, + ?string $device_id = null, ?string $event_type = null, ): Event { $request_payload = []; - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } if ($event_id !== null) { $request_payload["event_id"] = $event_id; } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } if ($event_type !== null) { $request_payload["event_type"] = $event_type; } @@ -6102,7 +6100,7 @@ public function create( string $ends_at, string $starts_at, ?bool $is_override_allowed = null, - mixed $max_override_period_minutes = null, + ?float $max_override_period_minutes = null, ?string $name = null, ): ThermostatSchedule { $request_payload = []; @@ -6206,7 +6204,7 @@ public function update( ?string $climate_preset_key = null, ?string $ends_at = null, ?bool $is_override_allowed = null, - mixed $max_override_period_minutes = null, + ?float $max_override_period_minutes = null, ?string $name = null, ?string $starts_at = null, ): void { @@ -6482,7 +6480,7 @@ public function grant_access_to_device( public function list( ?string $created_before = null, ?string $credential_manager_acs_system_id = null, - mixed $limit = null, + ?float $limit = null, ?string $page_cursor = null, ?string $search = null, ?array $user_identity_ids = null, @@ -6697,7 +6695,7 @@ public function get(string $user_identity_id): void public function list( ?string $created_before = null, - mixed $limit = null, + ?float $limit = null, ?string $page_cursor = null, ?string $search = null, ?callable $on_response = null, @@ -6940,4 +6938,44 @@ public function reset_sandbox( return $action_attempt; } + + public function update( + ?string $connect_partner_name = null, + mixed $connect_webview_customization = null, + ?bool $is_publishable_key_auth_enabled = null, + ?bool $is_suspended = null, + ?string $name = null, + ?string $organization_id = null, + ): void { + $request_payload = []; + + if ($connect_partner_name !== null) { + $request_payload["connect_partner_name"] = $connect_partner_name; + } + if ($connect_webview_customization !== null) { + $request_payload[ + "connect_webview_customization" + ] = $connect_webview_customization; + } + if ($is_publishable_key_auth_enabled !== null) { + $request_payload[ + "is_publishable_key_auth_enabled" + ] = $is_publishable_key_auth_enabled; + } + if ($is_suspended !== null) { + $request_payload["is_suspended"] = $is_suspended; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($organization_id !== null) { + $request_payload["organization_id"] = $organization_id; + } + + $this->seam->request( + "POST", + "/workspaces/update", + json: (object) $request_payload, + ); + } } From 018733de625324d36c53a811b999c3440a8b3376 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Jul 2026 15:11:51 +0000 Subject: [PATCH 2/5] Exclude undocumented resources and properties from the generated SDK Filter blueprint resources, events, action attempts, and their properties on isUndocumented, dropping resource object classes such as PhoneSession and BridgeClientSession that are not part of the public SDK. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H --- codegen/lib/resource-model.ts | 43 +++++-- src/Objects/AcsCredentialPool.php | 33 ------ .../AcsCredentialProvisioningAutomation.php | 31 ----- src/Objects/AcsUser.php | 2 - src/Objects/Batch.php | 9 -- src/Objects/BridgeClientSession.php | 52 -------- src/Objects/BridgeClientSessionErrors.php | 40 ------- src/Objects/BridgeConnectedSystems.php | 35 ------ src/Objects/ConnectWebview.php | 4 - src/Objects/Customer.php | 24 ---- src/Objects/CustomizationProfile.php | 40 ------- ...ustomizationProfileCustomerPortalTheme.php | 32 ----- src/Objects/DeviceProperties.php | 3 - src/Objects/EnrollmentAutomation.php | 29 ----- src/Objects/MagicLink.php | 28 ----- src/Objects/PhoneSession.php | 31 ----- src/Objects/PhoneSessionAcsCredentials.php | 98 ---------------- src/Objects/PhoneSessionAcsEntrances.php | 111 ------------------ .../PhoneSessionAssaAbloyVostioMetadata.php | 29 ----- .../PhoneSessionAvigilonAltaMetadata.php | 33 ------ src/Objects/PhoneSessionBrivoMetadata.php | 25 ---- .../PhoneSessionDormakabaAmbianceMetadata.php | 17 --- ...PhoneSessionDormakabaCommunityMetadata.php | 19 --- src/Objects/PhoneSessionErrors.php | 22 ---- src/Objects/PhoneSessionHotekMetadata.php | 25 ---- src/Objects/PhoneSessionLatchMetadata.php | 27 ----- src/Objects/PhoneSessionPhoneRegistration.php | 25 ---- src/Objects/PhoneSessionProfiles.php | 24 ---- src/Objects/PhoneSessionProviderSessions.php | 30 ----- src/Objects/PhoneSessionSaltoKsMetadata.php | 35 ------ .../PhoneSessionSaltoSpaceMetadata.php | 31 ----- src/Objects/PhoneSessionUserIdentity.php | 46 -------- .../PhoneSessionVisionlineMetadata.php | 28 ----- src/Objects/PhoneSessionWarnings.php | 24 ---- src/Objects/Space.php | 4 - src/Objects/StaffMember.php | 46 -------- src/Objects/UnmanagedAcsAccessGroup.php | 67 ----------- .../UnmanagedAcsAccessGroupAccessSchedule.php | 23 ---- src/Objects/UnmanagedAcsAccessGroupErrors.php | 25 ---- src/Objects/UnmanagedAcsAccessGroupFrom.php | 29 ----- ...nmanagedAcsAccessGroupPendingMutations.php | 37 ------ src/Objects/UnmanagedAcsAccessGroupTo.php | 29 ----- .../UnmanagedAcsAccessGroupWarnings.php | 25 ---- src/Objects/UnmanagedAcsCredential.php | 92 --------------- ...edAcsCredentialAssaAbloyVostioMetadata.php | 32 ----- src/Objects/UnmanagedAcsCredentialErrors.php | 23 ---- ...managedAcsCredentialVisionlineMetadata.php | 35 ------ .../UnmanagedAcsCredentialWarnings.php | 25 ---- src/Objects/UnmanagedAcsUser.php | 88 -------------- .../UnmanagedAcsUserAccessSchedule.php | 23 ---- src/Objects/UnmanagedAcsUserErrors.php | 24 ---- src/Objects/UnmanagedAcsUserFrom.php | 34 ------ .../UnmanagedAcsUserPendingMutations.php | 39 ------ .../UnmanagedAcsUserSaltoSpaceMetadata.php | 23 ---- src/Objects/UnmanagedAcsUserTo.php | 34 ------ src/Objects/UnmanagedAcsUserWarnings.php | 24 ---- src/SeamClient.php | 13 -- 57 files changed, 33 insertions(+), 1846 deletions(-) delete mode 100644 src/Objects/AcsCredentialPool.php delete mode 100644 src/Objects/AcsCredentialProvisioningAutomation.php delete mode 100644 src/Objects/BridgeClientSession.php delete mode 100644 src/Objects/BridgeClientSessionErrors.php delete mode 100644 src/Objects/BridgeConnectedSystems.php delete mode 100644 src/Objects/Customer.php delete mode 100644 src/Objects/CustomizationProfile.php delete mode 100644 src/Objects/CustomizationProfileCustomerPortalTheme.php delete mode 100644 src/Objects/EnrollmentAutomation.php delete mode 100644 src/Objects/MagicLink.php delete mode 100644 src/Objects/PhoneSession.php delete mode 100644 src/Objects/PhoneSessionAcsCredentials.php delete mode 100644 src/Objects/PhoneSessionAcsEntrances.php delete mode 100644 src/Objects/PhoneSessionAssaAbloyVostioMetadata.php delete mode 100644 src/Objects/PhoneSessionAvigilonAltaMetadata.php delete mode 100644 src/Objects/PhoneSessionBrivoMetadata.php delete mode 100644 src/Objects/PhoneSessionDormakabaAmbianceMetadata.php delete mode 100644 src/Objects/PhoneSessionDormakabaCommunityMetadata.php delete mode 100644 src/Objects/PhoneSessionErrors.php delete mode 100644 src/Objects/PhoneSessionHotekMetadata.php delete mode 100644 src/Objects/PhoneSessionLatchMetadata.php delete mode 100644 src/Objects/PhoneSessionPhoneRegistration.php delete mode 100644 src/Objects/PhoneSessionProfiles.php delete mode 100644 src/Objects/PhoneSessionProviderSessions.php delete mode 100644 src/Objects/PhoneSessionSaltoKsMetadata.php delete mode 100644 src/Objects/PhoneSessionSaltoSpaceMetadata.php delete mode 100644 src/Objects/PhoneSessionUserIdentity.php delete mode 100644 src/Objects/PhoneSessionVisionlineMetadata.php delete mode 100644 src/Objects/PhoneSessionWarnings.php delete mode 100644 src/Objects/StaffMember.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroup.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroupAccessSchedule.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroupErrors.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroupFrom.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroupPendingMutations.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroupTo.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroupWarnings.php delete mode 100644 src/Objects/UnmanagedAcsCredential.php delete mode 100644 src/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php delete mode 100644 src/Objects/UnmanagedAcsCredentialErrors.php delete mode 100644 src/Objects/UnmanagedAcsCredentialVisionlineMetadata.php delete mode 100644 src/Objects/UnmanagedAcsCredentialWarnings.php delete mode 100644 src/Objects/UnmanagedAcsUser.php delete mode 100644 src/Objects/UnmanagedAcsUserAccessSchedule.php delete mode 100644 src/Objects/UnmanagedAcsUserErrors.php delete mode 100644 src/Objects/UnmanagedAcsUserFrom.php delete mode 100644 src/Objects/UnmanagedAcsUserPendingMutations.php delete mode 100644 src/Objects/UnmanagedAcsUserSaltoSpaceMetadata.php delete mode 100644 src/Objects/UnmanagedAcsUserTo.php delete mode 100644 src/Objects/UnmanagedAcsUserWarnings.php diff --git a/codegen/lib/resource-model.ts b/codegen/lib/resource-model.ts index b16e636b..3c9effa4 100644 --- a/codegen/lib/resource-model.ts +++ b/codegen/lib/resource-model.ts @@ -33,24 +33,36 @@ export const createResourceObjectModel = ( const baseResources = new Map() for (const resource of blueprint.resources) { - baseResources.set(resource.resourceType, resource.properties) + if (resource.isUndocumented) continue + baseResources.set( + resource.resourceType, + documentedProperties(resource.properties), + ) } // The blueprint models events and action attempts as one resource per // variant. The PHP SDK has a single class for each, so the variants are // merged into one schema. - if (blueprint.events.length > 0) { + const events = blueprint.events.filter((event) => !event.isUndocumented) + if (events.length > 0) { baseResources.set( 'event', - mergeProperties(blueprint.events.map((event) => event.properties)), + mergeProperties( + events.map((event) => documentedProperties(event.properties)), + ), ) } - if (blueprint.actionAttempts.length > 0) { + const actionAttempts = blueprint.actionAttempts.filter( + (actionAttempt) => !actionAttempt.isUndocumented, + ) + if (actionAttempts.length > 0) { baseResources.set( 'action_attempt', mergeProperties( - blueprint.actionAttempts.map((actionAttempt) => actionAttempt.properties), + actionAttempts.map((actionAttempt) => + documentedProperties(actionAttempt.properties), + ), ), ) } @@ -94,17 +106,25 @@ const createResourceObjectProperty = ( ): ResourceObjectProperty => { const referenceName = pascalCase(`${baseName}_${property.name}`) - if (property.format === 'object' && property.properties.length > 0) { - addSchema(referenceName, property.properties, baseName) - return { name: property.name, kind: 'objectReference', referenceName } + if (property.format === 'object') { + const properties = documentedProperties(property.properties) + + if (properties.length > 0) { + addSchema(referenceName, properties, baseName) + return { name: property.name, kind: 'objectReference', referenceName } + } } if (property.format === 'list') { const itemProperties = property.itemFormat === 'object' - ? property.itemProperties + ? documentedProperties(property.itemProperties) : property.itemFormat === 'discriminated_object' - ? mergeProperties(property.variants.map((variant) => variant.properties)) + ? mergeProperties( + property.variants.map((variant) => + documentedProperties(variant.properties), + ), + ) : [] if (itemProperties.length > 0) { @@ -120,6 +140,9 @@ const createResourceObjectProperty = ( } } +const documentedProperties = (properties: Property[]): Property[] => + properties.filter((property) => !property.isUndocumented) + const mergeProperties = (propertyLists: Property[][]): Property[] => { const merged = new Map() diff --git a/src/Objects/AcsCredentialPool.php b/src/Objects/AcsCredentialPool.php deleted file mode 100644 index 687f33d7..00000000 --- a/src/Objects/AcsCredentialPool.php +++ /dev/null @@ -1,33 +0,0 @@ -acs_credential_pool_id ?? null, - acs_system_id: $json->acs_system_id ?? null, - created_at: $json->created_at ?? null, - display_name: $json->display_name ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $acs_credential_pool_id, - public string|null $acs_system_id, - public string|null $created_at, - public string|null $display_name, - public string|null $external_type, - public string|null $external_type_display_name, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/AcsCredentialProvisioningAutomation.php b/src/Objects/AcsCredentialProvisioningAutomation.php deleted file mode 100644 index cd0e0d72..00000000 --- a/src/Objects/AcsCredentialProvisioningAutomation.php +++ /dev/null @@ -1,31 +0,0 @@ -acs_credential_provisioning_automation_id ?? - null, - created_at: $json->created_at ?? null, - credential_manager_acs_system_id: $json->credential_manager_acs_system_id ?? - null, - user_identity_id: $json->user_identity_id ?? null, - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $acs_credential_provisioning_automation_id, - public string|null $created_at, - public string|null $credential_manager_acs_system_id, - public string|null $user_identity_id, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/AcsUser.php b/src/Objects/AcsUser.php index ff5645f2..1c8b824c 100644 --- a/src/Objects/AcsUser.php +++ b/src/Objects/AcsUser.php @@ -31,7 +31,6 @@ public static function from_json(mixed $json): AcsUser|null hid_acs_system_id: $json->hid_acs_system_id ?? null, is_managed: $json->is_managed ?? null, is_suspended: $json->is_suspended ?? null, - last_successful_sync_at: $json->last_successful_sync_at ?? null, pending_mutations: array_map( fn($p) => AcsUserPendingMutations::from_json($p), $json->pending_mutations ?? [], @@ -72,7 +71,6 @@ public function __construct( public string|null $hid_acs_system_id, public bool|null $is_managed, public bool|null $is_suspended, - public string|null $last_successful_sync_at, public array $pending_mutations, public string|null $phone_number, public AcsUserSaltoSpaceMetadata|null $salto_space_metadata, diff --git a/src/Objects/Batch.php b/src/Objects/Batch.php index dab4cf24..46fb69ca 100644 --- a/src/Objects/Batch.php +++ b/src/Objects/Batch.php @@ -23,7 +23,6 @@ public static function from_json(mixed $json): Batch|null client_sessions: $json->client_sessions ?? null, connect_webviews: $json->connect_webviews ?? null, connected_accounts: $json->connected_accounts ?? null, - customization_profiles: $json->customization_profiles ?? null, devices: $json->devices ?? null, events: $json->events ?? null, instant_keys: $json->instant_keys ?? null, @@ -32,10 +31,6 @@ public static function from_json(mixed $json): Batch|null thermostat_daily_programs: $json->thermostat_daily_programs ?? null, thermostat_schedules: $json->thermostat_schedules ?? null, unmanaged_access_codes: $json->unmanaged_access_codes ?? null, - unmanaged_acs_access_groups: $json->unmanaged_acs_access_groups ?? - null, - unmanaged_acs_credentials: $json->unmanaged_acs_credentials ?? null, - unmanaged_acs_users: $json->unmanaged_acs_users ?? null, unmanaged_devices: $json->unmanaged_devices ?? null, user_identities: $json->user_identities ?? null, workspaces: $json->workspaces ?? null, @@ -56,7 +51,6 @@ public function __construct( public mixed $client_sessions, public mixed $connect_webviews, public mixed $connected_accounts, - public mixed $customization_profiles, public mixed $devices, public mixed $events, public mixed $instant_keys, @@ -65,9 +59,6 @@ public function __construct( public mixed $thermostat_daily_programs, public mixed $thermostat_schedules, public mixed $unmanaged_access_codes, - public mixed $unmanaged_acs_access_groups, - public mixed $unmanaged_acs_credentials, - public mixed $unmanaged_acs_users, public mixed $unmanaged_devices, public mixed $user_identities, public mixed $workspaces, diff --git a/src/Objects/BridgeClientSession.php b/src/Objects/BridgeClientSession.php deleted file mode 100644 index 51322b40..00000000 --- a/src/Objects/BridgeClientSession.php +++ /dev/null @@ -1,52 +0,0 @@ -bridge_client_machine_identifier_key ?? - null, - bridge_client_name: $json->bridge_client_name ?? null, - bridge_client_session_id: $json->bridge_client_session_id ?? null, - bridge_client_session_token: $json->bridge_client_session_token ?? - null, - bridge_client_time_zone: $json->bridge_client_time_zone ?? null, - created_at: $json->created_at ?? null, - errors: array_map( - fn($e) => BridgeClientSessionErrors::from_json($e), - $json->errors ?? [], - ), - pairing_code: $json->pairing_code ?? null, - pairing_code_expires_at: $json->pairing_code_expires_at ?? null, - tailscale_auth_key: $json->tailscale_auth_key ?? null, - tailscale_hostname: $json->tailscale_hostname ?? null, - telemetry_token: $json->telemetry_token ?? null, - telemetry_token_expires_at: $json->telemetry_token_expires_at ?? - null, - telemetry_url: $json->telemetry_url ?? null, - ); - } - - public function __construct( - public string|null $bridge_client_machine_identifier_key, - public string|null $bridge_client_name, - public string|null $bridge_client_session_id, - public string|null $bridge_client_session_token, - public string|null $bridge_client_time_zone, - public string|null $created_at, - public array $errors, - public string|null $pairing_code, - public string|null $pairing_code_expires_at, - public string|null $tailscale_auth_key, - public string|null $tailscale_hostname, - public string|null $telemetry_token, - public string|null $telemetry_token_expires_at, - public string|null $telemetry_url, - ) {} -} diff --git a/src/Objects/BridgeClientSessionErrors.php b/src/Objects/BridgeClientSessionErrors.php deleted file mode 100644 index 49715616..00000000 --- a/src/Objects/BridgeClientSessionErrors.php +++ /dev/null @@ -1,40 +0,0 @@ -can_tailscale_proxy_reach_bridge ?? - null, - can_tailscale_proxy_reach_tailscale_network: $json->can_tailscale_proxy_reach_tailscale_network ?? - null, - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - is_bridge_socks_server_healthy: $json->is_bridge_socks_server_healthy ?? - null, - is_tailscale_proxy_reachable: $json->is_tailscale_proxy_reachable ?? - null, - is_tailscale_proxy_socks_server_healthy: $json->is_tailscale_proxy_socks_server_healthy ?? - null, - message: $json->message ?? null, - ); - } - - public function __construct( - public bool|null $can_tailscale_proxy_reach_bridge, - public bool|null $can_tailscale_proxy_reach_tailscale_network, - public string|null $created_at, - public string|null $error_code, - public bool|null $is_bridge_socks_server_healthy, - public bool|null $is_tailscale_proxy_reachable, - public bool|null $is_tailscale_proxy_socks_server_healthy, - public string|null $message, - ) {} -} diff --git a/src/Objects/BridgeConnectedSystems.php b/src/Objects/BridgeConnectedSystems.php deleted file mode 100644 index bcc0bb4d..00000000 --- a/src/Objects/BridgeConnectedSystems.php +++ /dev/null @@ -1,35 +0,0 @@ -acs_system_display_name ?? null, - acs_system_id: $json->acs_system_id ?? null, - bridge_created_at: $json->bridge_created_at ?? null, - bridge_id: $json->bridge_id ?? null, - connected_account_created_at: $json->connected_account_created_at ?? - null, - connected_account_id: $json->connected_account_id ?? null, - workspace_display_name: $json->workspace_display_name ?? null, - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $acs_system_display_name, - public string|null $acs_system_id, - public string|null $bridge_created_at, - public string|null $bridge_id, - public string|null $connected_account_created_at, - public string|null $connected_account_id, - public string|null $workspace_display_name, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/ConnectWebview.php b/src/Objects/ConnectWebview.php index 370cd71b..a8e225ea 100644 --- a/src/Objects/ConnectWebview.php +++ b/src/Objects/ConnectWebview.php @@ -11,9 +11,7 @@ public static function from_json(mixed $json): ConnectWebview|null } return new self( accepted_capabilities: $json->accepted_capabilities ?? null, - accepted_devices: $json->accepted_devices ?? null, accepted_providers: $json->accepted_providers ?? null, - any_device_allowed: $json->any_device_allowed ?? null, any_provider_allowed: $json->any_provider_allowed ?? null, authorized_at: $json->authorized_at ?? null, automatically_manage_new_devices: $json->automatically_manage_new_devices ?? @@ -38,9 +36,7 @@ public static function from_json(mixed $json): ConnectWebview|null public function __construct( public array|null $accepted_capabilities, - public array|null $accepted_devices, public array|null $accepted_providers, - public bool|null $any_device_allowed, public bool|null $any_provider_allowed, public string|null $authorized_at, public bool|null $automatically_manage_new_devices, diff --git a/src/Objects/Customer.php b/src/Objects/Customer.php deleted file mode 100644 index 04786519..00000000 --- a/src/Objects/Customer.php +++ /dev/null @@ -1,24 +0,0 @@ -created_at ?? null, - customer_key: $json->customer_key ?? null, - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $customer_key, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/CustomizationProfile.php b/src/Objects/CustomizationProfile.php deleted file mode 100644 index cd7058e2..00000000 --- a/src/Objects/CustomizationProfile.php +++ /dev/null @@ -1,40 +0,0 @@ -created_at ?? null, - customer_portal_theme: isset($json->customer_portal_theme) - ? CustomizationProfileCustomerPortalTheme::from_json( - $json->customer_portal_theme, - ) - : null, - customization_profile_id: $json->customization_profile_id ?? null, - logo_url: $json->logo_url ?? null, - message_overrides: $json->message_overrides ?? null, - name: $json->name ?? null, - primary_color: $json->primary_color ?? null, - secondary_color: $json->secondary_color ?? null, - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public CustomizationProfileCustomerPortalTheme|null $customer_portal_theme, - public string|null $customization_profile_id, - public string|null $logo_url, - public mixed $message_overrides, - public string|null $name, - public string|null $primary_color, - public string|null $secondary_color, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/CustomizationProfileCustomerPortalTheme.php b/src/Objects/CustomizationProfileCustomerPortalTheme.php deleted file mode 100644 index d210e9ac..00000000 --- a/src/Objects/CustomizationProfileCustomerPortalTheme.php +++ /dev/null @@ -1,32 +0,0 @@ -font_family ?? null, - mono_font_family: $json->mono_font_family ?? null, - primary_color: $json->primary_color ?? null, - primary_foreground_color: $json->primary_foreground_color ?? null, - secondary_color: $json->secondary_color ?? null, - secondary_foreground_color: $json->secondary_foreground_color ?? - null, - ); - } - - public function __construct( - public string|null $font_family, - public string|null $mono_font_family, - public string|null $primary_color, - public string|null $primary_foreground_color, - public string|null $secondary_color, - public string|null $secondary_foreground_color, - ) {} -} diff --git a/src/Objects/DeviceProperties.php b/src/Objects/DeviceProperties.php index 70917bdc..c8b76ab1 100644 --- a/src/Objects/DeviceProperties.php +++ b/src/Objects/DeviceProperties.php @@ -10,8 +10,6 @@ public static function from_json(mixed $json): DeviceProperties|null return null; } return new self( - _experimental_supported_code_from_access_codes_lengths: $json->_experimental_supported_code_from_access_codes_lengths ?? - null, accessory_keypad: isset($json->accessory_keypad) ? DeviceAccessoryKeypad::from_json($json->accessory_keypad) : null, @@ -296,7 +294,6 @@ public static function from_json(mixed $json): DeviceProperties|null } public function __construct( - public array|null $_experimental_supported_code_from_access_codes_lengths, public DeviceAccessoryKeypad|null $accessory_keypad, public DeviceActiveThermostatSchedule|null $active_thermostat_schedule, public string|null $active_thermostat_schedule_id, diff --git a/src/Objects/EnrollmentAutomation.php b/src/Objects/EnrollmentAutomation.php deleted file mode 100644 index 236c6533..00000000 --- a/src/Objects/EnrollmentAutomation.php +++ /dev/null @@ -1,29 +0,0 @@ -created_at ?? null, - credential_manager_acs_system_id: $json->credential_manager_acs_system_id ?? - null, - enrollment_automation_id: $json->enrollment_automation_id ?? null, - user_identity_id: $json->user_identity_id ?? null, - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $credential_manager_acs_system_id, - public string|null $enrollment_automation_id, - public string|null $user_identity_id, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/MagicLink.php b/src/Objects/MagicLink.php deleted file mode 100644 index 0aa4ac3b..00000000 --- a/src/Objects/MagicLink.php +++ /dev/null @@ -1,28 +0,0 @@ -created_at ?? null, - customer_key: $json->customer_key ?? null, - expires_at: $json->expires_at ?? null, - url: $json->url ?? null, - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $customer_key, - public string|null $expires_at, - public string|null $url, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/PhoneSession.php b/src/Objects/PhoneSession.php deleted file mode 100644 index 852866f8..00000000 --- a/src/Objects/PhoneSession.php +++ /dev/null @@ -1,31 +0,0 @@ -is_sandbox_workspace ?? null, - provider_sessions: array_map( - fn($p) => PhoneSessionProviderSessions::from_json($p), - $json->provider_sessions ?? [], - ), - user_identity: isset($json->user_identity) - ? PhoneSessionUserIdentity::from_json($json->user_identity) - : null, - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public bool|null $is_sandbox_workspace, - public array $provider_sessions, - public PhoneSessionUserIdentity|null $user_identity, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/PhoneSessionAcsCredentials.php b/src/Objects/PhoneSessionAcsCredentials.php deleted file mode 100644 index a73a18da..00000000 --- a/src/Objects/PhoneSessionAcsCredentials.php +++ /dev/null @@ -1,98 +0,0 @@ -access_method ?? null, - acs_credential_id: $json->acs_credential_id ?? null, - acs_credential_pool_id: $json->acs_credential_pool_id ?? null, - acs_entrances: array_map( - fn($a) => PhoneSessionAcsEntrances::from_json($a), - $json->acs_entrances ?? [], - ), - acs_system_id: $json->acs_system_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? PhoneSessionAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata, - ) - : null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - connected_account_id: $json->connected_account_id ?? null, - created_at: $json->created_at ?? null, - display_name: $json->display_name ?? null, - ends_at: $json->ends_at ?? null, - errors: array_map( - fn($e) => PhoneSessionErrors::from_json($e), - $json->errors ?? [], - ), - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - is_issued: $json->is_issued ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - is_managed: $json->is_managed ?? null, - is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? - null, - is_one_time_use: $json->is_one_time_use ?? null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, - parent_acs_credential_id: $json->parent_acs_credential_id ?? null, - starts_at: $json->starts_at ?? null, - user_identity_id: $json->user_identity_id ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? PhoneSessionVisionlineMetadata::from_json( - $json->visionline_metadata, - ) - : null, - warnings: array_map( - fn($w) => PhoneSessionWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $access_method, - public string|null $acs_credential_id, - public string|null $acs_credential_pool_id, - public array $acs_entrances, - public string|null $acs_system_id, - public string|null $acs_user_id, - public PhoneSessionAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public string|null $card_number, - public string|null $code, - public string|null $connected_account_id, - public string|null $created_at, - public string|null $display_name, - public string|null $ends_at, - public array $errors, - public string|null $external_type, - public string|null $external_type_display_name, - public bool|null $is_issued, - public bool|null $is_latest_desired_state_synced_with_provider, - public bool|null $is_managed, - public bool|null $is_multi_phone_sync_credential, - public bool|null $is_one_time_use, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at, - public string|null $parent_acs_credential_id, - public string|null $starts_at, - public string|null $user_identity_id, - public PhoneSessionVisionlineMetadata|null $visionline_metadata, - public array $warnings, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/PhoneSessionAcsEntrances.php b/src/Objects/PhoneSessionAcsEntrances.php deleted file mode 100644 index 59b9875a..00000000 --- a/src/Objects/PhoneSessionAcsEntrances.php +++ /dev/null @@ -1,111 +0,0 @@ -acs_entrance_id ?? null, - acs_system_id: $json->acs_system_id ?? null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? PhoneSessionAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata, - ) - : null, - avigilon_alta_metadata: isset($json->avigilon_alta_metadata) - ? PhoneSessionAvigilonAltaMetadata::from_json( - $json->avigilon_alta_metadata, - ) - : null, - brivo_metadata: isset($json->brivo_metadata) - ? PhoneSessionBrivoMetadata::from_json($json->brivo_metadata) - : null, - can_belong_to_reservation: $json->can_belong_to_reservation ?? null, - can_unlock_with_card: $json->can_unlock_with_card ?? null, - can_unlock_with_cloud_key: $json->can_unlock_with_cloud_key ?? null, - can_unlock_with_code: $json->can_unlock_with_code ?? null, - can_unlock_with_mobile_key: $json->can_unlock_with_mobile_key ?? - null, - connected_account_id: $json->connected_account_id ?? null, - created_at: $json->created_at ?? null, - display_name: $json->display_name ?? null, - dormakaba_ambiance_metadata: isset( - $json->dormakaba_ambiance_metadata, - ) - ? PhoneSessionDormakabaAmbianceMetadata::from_json( - $json->dormakaba_ambiance_metadata, - ) - : null, - dormakaba_community_metadata: isset( - $json->dormakaba_community_metadata, - ) - ? PhoneSessionDormakabaCommunityMetadata::from_json( - $json->dormakaba_community_metadata, - ) - : null, - errors: array_map( - fn($e) => PhoneSessionErrors::from_json($e), - $json->errors ?? [], - ), - hotek_metadata: isset($json->hotek_metadata) - ? PhoneSessionHotekMetadata::from_json($json->hotek_metadata) - : null, - is_locked: $json->is_locked ?? null, - latch_metadata: isset($json->latch_metadata) - ? PhoneSessionLatchMetadata::from_json($json->latch_metadata) - : null, - salto_ks_metadata: isset($json->salto_ks_metadata) - ? PhoneSessionSaltoKsMetadata::from_json( - $json->salto_ks_metadata, - ) - : null, - salto_space_metadata: isset($json->salto_space_metadata) - ? PhoneSessionSaltoSpaceMetadata::from_json( - $json->salto_space_metadata, - ) - : null, - space_ids: $json->space_ids ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? PhoneSessionVisionlineMetadata::from_json( - $json->visionline_metadata, - ) - : null, - warnings: array_map( - fn($w) => PhoneSessionWarnings::from_json($w), - $json->warnings ?? [], - ), - ); - } - - public function __construct( - public string|null $acs_entrance_id, - public string|null $acs_system_id, - public PhoneSessionAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public PhoneSessionAvigilonAltaMetadata|null $avigilon_alta_metadata, - public PhoneSessionBrivoMetadata|null $brivo_metadata, - public bool|null $can_belong_to_reservation, - public bool|null $can_unlock_with_card, - public bool|null $can_unlock_with_cloud_key, - public bool|null $can_unlock_with_code, - public bool|null $can_unlock_with_mobile_key, - public string|null $connected_account_id, - public string|null $created_at, - public string|null $display_name, - public PhoneSessionDormakabaAmbianceMetadata|null $dormakaba_ambiance_metadata, - public PhoneSessionDormakabaCommunityMetadata|null $dormakaba_community_metadata, - public array $errors, - public PhoneSessionHotekMetadata|null $hotek_metadata, - public bool|null $is_locked, - public PhoneSessionLatchMetadata|null $latch_metadata, - public PhoneSessionSaltoKsMetadata|null $salto_ks_metadata, - public PhoneSessionSaltoSpaceMetadata|null $salto_space_metadata, - public array|null $space_ids, - public PhoneSessionVisionlineMetadata|null $visionline_metadata, - public array $warnings, - ) {} -} diff --git a/src/Objects/PhoneSessionAssaAbloyVostioMetadata.php b/src/Objects/PhoneSessionAssaAbloyVostioMetadata.php deleted file mode 100644 index 758888f1..00000000 --- a/src/Objects/PhoneSessionAssaAbloyVostioMetadata.php +++ /dev/null @@ -1,29 +0,0 @@ -door_name ?? null, - door_number: $json->door_number ?? null, - door_type: $json->door_type ?? null, - pms_id: $json->pms_id ?? null, - stand_open: $json->stand_open ?? null, - ); - } - - public function __construct( - public string|null $door_name, - public float|null $door_number, - public string|null $door_type, - public string|null $pms_id, - public bool|null $stand_open, - ) {} -} diff --git a/src/Objects/PhoneSessionAvigilonAltaMetadata.php b/src/Objects/PhoneSessionAvigilonAltaMetadata.php deleted file mode 100644 index a15b2efb..00000000 --- a/src/Objects/PhoneSessionAvigilonAltaMetadata.php +++ /dev/null @@ -1,33 +0,0 @@ -entry_name ?? null, - entry_relays_total_count: $json->entry_relays_total_count ?? null, - org_name: $json->org_name ?? null, - site_id: $json->site_id ?? null, - site_name: $json->site_name ?? null, - zone_id: $json->zone_id ?? null, - zone_name: $json->zone_name ?? null, - ); - } - - public function __construct( - public string|null $entry_name, - public float|null $entry_relays_total_count, - public string|null $org_name, - public float|null $site_id, - public string|null $site_name, - public float|null $zone_id, - public string|null $zone_name, - ) {} -} diff --git a/src/Objects/PhoneSessionBrivoMetadata.php b/src/Objects/PhoneSessionBrivoMetadata.php deleted file mode 100644 index 18f79ad5..00000000 --- a/src/Objects/PhoneSessionBrivoMetadata.php +++ /dev/null @@ -1,25 +0,0 @@ -access_point_id ?? null, - site_id: $json->site_id ?? null, - site_name: $json->site_name ?? null, - ); - } - - public function __construct( - public string|null $access_point_id, - public float|null $site_id, - public string|null $site_name, - ) {} -} diff --git a/src/Objects/PhoneSessionDormakabaAmbianceMetadata.php b/src/Objects/PhoneSessionDormakabaAmbianceMetadata.php deleted file mode 100644 index 6451f193..00000000 --- a/src/Objects/PhoneSessionDormakabaAmbianceMetadata.php +++ /dev/null @@ -1,17 +0,0 @@ -access_point_name ?? null); - } - - public function __construct(public string|null $access_point_name) {} -} diff --git a/src/Objects/PhoneSessionDormakabaCommunityMetadata.php b/src/Objects/PhoneSessionDormakabaCommunityMetadata.php deleted file mode 100644 index 1dfd8522..00000000 --- a/src/Objects/PhoneSessionDormakabaCommunityMetadata.php +++ /dev/null @@ -1,19 +0,0 @@ -access_point_profile ?? null, - ); - } - - public function __construct(public string|null $access_point_profile) {} -} diff --git a/src/Objects/PhoneSessionErrors.php b/src/Objects/PhoneSessionErrors.php deleted file mode 100644 index 4239d317..00000000 --- a/src/Objects/PhoneSessionErrors.php +++ /dev/null @@ -1,22 +0,0 @@ -error_code ?? null, - message: $json->message ?? null, - ); - } - - public function __construct( - public string|null $error_code, - public string|null $message, - ) {} -} diff --git a/src/Objects/PhoneSessionHotekMetadata.php b/src/Objects/PhoneSessionHotekMetadata.php deleted file mode 100644 index c836d114..00000000 --- a/src/Objects/PhoneSessionHotekMetadata.php +++ /dev/null @@ -1,25 +0,0 @@ -common_area_name ?? null, - common_area_number: $json->common_area_number ?? null, - room_number: $json->room_number ?? null, - ); - } - - public function __construct( - public string|null $common_area_name, - public string|null $common_area_number, - public string|null $room_number, - ) {} -} diff --git a/src/Objects/PhoneSessionLatchMetadata.php b/src/Objects/PhoneSessionLatchMetadata.php deleted file mode 100644 index 5c18338e..00000000 --- a/src/Objects/PhoneSessionLatchMetadata.php +++ /dev/null @@ -1,27 +0,0 @@ -accessibility_type ?? null, - door_name: $json->door_name ?? null, - door_type: $json->door_type ?? null, - is_connected: $json->is_connected ?? null, - ); - } - - public function __construct( - public string|null $accessibility_type, - public string|null $door_name, - public string|null $door_type, - public bool|null $is_connected, - ) {} -} diff --git a/src/Objects/PhoneSessionPhoneRegistration.php b/src/Objects/PhoneSessionPhoneRegistration.php deleted file mode 100644 index 43092d34..00000000 --- a/src/Objects/PhoneSessionPhoneRegistration.php +++ /dev/null @@ -1,25 +0,0 @@ -is_being_activated ?? null, - phone_registration_id: $json->phone_registration_id ?? null, - provider_name: $json->provider_name ?? null, - ); - } - - public function __construct( - public bool|null $is_being_activated, - public string|null $phone_registration_id, - public string|null $provider_name, - ) {} -} diff --git a/src/Objects/PhoneSessionProfiles.php b/src/Objects/PhoneSessionProfiles.php deleted file mode 100644 index b8beaba3..00000000 --- a/src/Objects/PhoneSessionProfiles.php +++ /dev/null @@ -1,24 +0,0 @@ -visionline_door_profile_id ?? - null, - visionline_door_profile_type: $json->visionline_door_profile_type ?? - null, - ); - } - - public function __construct( - public string|null $visionline_door_profile_id, - public string|null $visionline_door_profile_type, - ) {} -} diff --git a/src/Objects/PhoneSessionProviderSessions.php b/src/Objects/PhoneSessionProviderSessions.php deleted file mode 100644 index 84314956..00000000 --- a/src/Objects/PhoneSessionProviderSessions.php +++ /dev/null @@ -1,30 +0,0 @@ - PhoneSessionAcsCredentials::from_json($a), - $json->acs_credentials ?? [], - ), - phone_registration: isset($json->phone_registration) - ? PhoneSessionPhoneRegistration::from_json( - $json->phone_registration, - ) - : null, - ); - } - - public function __construct( - public array $acs_credentials, - public PhoneSessionPhoneRegistration|null $phone_registration, - ) {} -} diff --git a/src/Objects/PhoneSessionSaltoKsMetadata.php b/src/Objects/PhoneSessionSaltoKsMetadata.php deleted file mode 100644 index e4bc738a..00000000 --- a/src/Objects/PhoneSessionSaltoKsMetadata.php +++ /dev/null @@ -1,35 +0,0 @@ -battery_level ?? null, - door_name: $json->door_name ?? null, - intrusion_alarm: $json->intrusion_alarm ?? null, - left_open_alarm: $json->left_open_alarm ?? null, - lock_type: $json->lock_type ?? null, - locked_state: $json->locked_state ?? null, - online: $json->online ?? null, - privacy_mode: $json->privacy_mode ?? null, - ); - } - - public function __construct( - public string|null $battery_level, - public string|null $door_name, - public bool|null $intrusion_alarm, - public bool|null $left_open_alarm, - public string|null $lock_type, - public string|null $locked_state, - public bool|null $online, - public bool|null $privacy_mode, - ) {} -} diff --git a/src/Objects/PhoneSessionSaltoSpaceMetadata.php b/src/Objects/PhoneSessionSaltoSpaceMetadata.php deleted file mode 100644 index ed32a92a..00000000 --- a/src/Objects/PhoneSessionSaltoSpaceMetadata.php +++ /dev/null @@ -1,31 +0,0 @@ -audit_on_keys ?? null, - door_description: $json->door_description ?? null, - door_id: $json->door_id ?? null, - door_name: $json->door_name ?? null, - room_description: $json->room_description ?? null, - room_name: $json->room_name ?? null, - ); - } - - public function __construct( - public bool|null $audit_on_keys, - public string|null $door_description, - public string|null $door_id, - public string|null $door_name, - public string|null $room_description, - public string|null $room_name, - ) {} -} diff --git a/src/Objects/PhoneSessionUserIdentity.php b/src/Objects/PhoneSessionUserIdentity.php deleted file mode 100644 index 19f9e715..00000000 --- a/src/Objects/PhoneSessionUserIdentity.php +++ /dev/null @@ -1,46 +0,0 @@ -acs_user_ids ?? null, - created_at: $json->created_at ?? null, - display_name: $json->display_name ?? null, - email_address: $json->email_address ?? null, - errors: array_map( - fn($e) => PhoneSessionErrors::from_json($e), - $json->errors ?? [], - ), - full_name: $json->full_name ?? null, - phone_number: $json->phone_number ?? null, - user_identity_id: $json->user_identity_id ?? null, - user_identity_key: $json->user_identity_key ?? null, - warnings: array_map( - fn($w) => PhoneSessionWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public array|null $acs_user_ids, - public string|null $created_at, - public string|null $display_name, - public string|null $email_address, - public array $errors, - public string|null $full_name, - public string|null $phone_number, - public string|null $user_identity_id, - public string|null $user_identity_key, - public array $warnings, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/PhoneSessionVisionlineMetadata.php b/src/Objects/PhoneSessionVisionlineMetadata.php deleted file mode 100644 index 5703322a..00000000 --- a/src/Objects/PhoneSessionVisionlineMetadata.php +++ /dev/null @@ -1,28 +0,0 @@ -door_category ?? null, - door_name: $json->door_name ?? null, - profiles: array_map( - fn($p) => PhoneSessionProfiles::from_json($p), - $json->profiles ?? [], - ), - ); - } - - public function __construct( - public string|null $door_category, - public string|null $door_name, - public array $profiles, - ) {} -} diff --git a/src/Objects/PhoneSessionWarnings.php b/src/Objects/PhoneSessionWarnings.php deleted file mode 100644 index 9350d2d3..00000000 --- a/src/Objects/PhoneSessionWarnings.php +++ /dev/null @@ -1,24 +0,0 @@ -created_at ?? null, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $message, - public string|null $warning_code, - ) {} -} diff --git a/src/Objects/Space.php b/src/Objects/Space.php index 9783cef7..11165522 100644 --- a/src/Objects/Space.php +++ b/src/Objects/Space.php @@ -22,8 +22,6 @@ public static function from_json(mixed $json): Space|null ? SpaceGeolocation::from_json($json->geolocation) : null, name: $json->name ?? null, - parent_space_id: $json->parent_space_id ?? null, - parent_space_key: $json->parent_space_key ?? null, space_id: $json->space_id ?? null, space_key: $json->space_key ?? null, workspace_id: $json->workspace_id ?? null, @@ -39,8 +37,6 @@ public function __construct( public string|null $display_name, public SpaceGeolocation|null $geolocation, public string|null $name, - public string|null $parent_space_id, - public string|null $parent_space_key, public string|null $space_id, public string|null $space_key, public string|null $workspace_id, diff --git a/src/Objects/StaffMember.php b/src/Objects/StaffMember.php deleted file mode 100644 index 6c9c7a56..00000000 --- a/src/Objects/StaffMember.php +++ /dev/null @@ -1,46 +0,0 @@ -building_keys ?? null, - common_area_keys: $json->common_area_keys ?? null, - email_address: $json->email_address ?? null, - facility_keys: $json->facility_keys ?? null, - listing_keys: $json->listing_keys ?? null, - name: $json->name ?? null, - phone_number: $json->phone_number ?? null, - property_keys: $json->property_keys ?? null, - property_listing_keys: $json->property_listing_keys ?? null, - room_keys: $json->room_keys ?? null, - site_keys: $json->site_keys ?? null, - space_keys: $json->space_keys ?? null, - staff_member_key: $json->staff_member_key ?? null, - unit_keys: $json->unit_keys ?? null, - ); - } - - public function __construct( - public array|null $building_keys, - public array|null $common_area_keys, - public string|null $email_address, - public array|null $facility_keys, - public array|null $listing_keys, - public string|null $name, - public string|null $phone_number, - public array|null $property_keys, - public array|null $property_listing_keys, - public array|null $room_keys, - public array|null $site_keys, - public array|null $space_keys, - public string|null $staff_member_key, - public array|null $unit_keys, - ) {} -} diff --git a/src/Objects/UnmanagedAcsAccessGroup.php b/src/Objects/UnmanagedAcsAccessGroup.php deleted file mode 100644 index cfa31891..00000000 --- a/src/Objects/UnmanagedAcsAccessGroup.php +++ /dev/null @@ -1,67 +0,0 @@ -access_group_type ?? null, - access_group_type_display_name: $json->access_group_type_display_name ?? - null, - access_schedule: isset($json->access_schedule) - ? UnmanagedAcsAccessGroupAccessSchedule::from_json( - $json->access_schedule, - ) - : null, - acs_access_group_id: $json->acs_access_group_id ?? null, - acs_system_id: $json->acs_system_id ?? null, - connected_account_id: $json->connected_account_id ?? null, - created_at: $json->created_at ?? null, - display_name: $json->display_name ?? null, - errors: array_map( - fn($e) => UnmanagedAcsAccessGroupErrors::from_json($e), - $json->errors ?? [], - ), - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - is_managed: $json->is_managed ?? null, - name: $json->name ?? null, - pending_mutations: array_map( - fn($p) => UnmanagedAcsAccessGroupPendingMutations::from_json( - $p, - ), - $json->pending_mutations ?? [], - ), - warnings: array_map( - fn($w) => UnmanagedAcsAccessGroupWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $access_group_type, - public string|null $access_group_type_display_name, - public UnmanagedAcsAccessGroupAccessSchedule|null $access_schedule, - public string|null $acs_access_group_id, - public string|null $acs_system_id, - public string|null $connected_account_id, - public string|null $created_at, - public string|null $display_name, - public array $errors, - public string|null $external_type, - public string|null $external_type_display_name, - public bool|null $is_managed, - public string|null $name, - public array $pending_mutations, - public array $warnings, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/UnmanagedAcsAccessGroupAccessSchedule.php b/src/Objects/UnmanagedAcsAccessGroupAccessSchedule.php deleted file mode 100644 index 993137ac..00000000 --- a/src/Objects/UnmanagedAcsAccessGroupAccessSchedule.php +++ /dev/null @@ -1,23 +0,0 @@ -ends_at ?? null, - starts_at: $json->starts_at ?? null, - ); - } - - public function __construct( - public string|null $ends_at, - public string|null $starts_at, - ) {} -} diff --git a/src/Objects/UnmanagedAcsAccessGroupErrors.php b/src/Objects/UnmanagedAcsAccessGroupErrors.php deleted file mode 100644 index 6a0630f5..00000000 --- a/src/Objects/UnmanagedAcsAccessGroupErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $error_code, - public string|null $message, - ) {} -} diff --git a/src/Objects/UnmanagedAcsAccessGroupFrom.php b/src/Objects/UnmanagedAcsAccessGroupFrom.php deleted file mode 100644 index c0c56569..00000000 --- a/src/Objects/UnmanagedAcsAccessGroupFrom.php +++ /dev/null @@ -1,29 +0,0 @@ -acs_entrance_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - ends_at: $json->ends_at ?? null, - name: $json->name ?? null, - starts_at: $json->starts_at ?? null, - ); - } - - public function __construct( - public string|null $acs_entrance_id, - public string|null $acs_user_id, - public string|null $ends_at, - public string|null $name, - public string|null $starts_at, - ) {} -} diff --git a/src/Objects/UnmanagedAcsAccessGroupPendingMutations.php b/src/Objects/UnmanagedAcsAccessGroupPendingMutations.php deleted file mode 100644 index df804b8a..00000000 --- a/src/Objects/UnmanagedAcsAccessGroupPendingMutations.php +++ /dev/null @@ -1,37 +0,0 @@ -acs_user_id ?? null, - created_at: $json->created_at ?? null, - from: isset($json->from) - ? UnmanagedAcsAccessGroupFrom::from_json($json->from) - : null, - message: $json->message ?? null, - mutation_code: $json->mutation_code ?? null, - to: isset($json->to) - ? UnmanagedAcsAccessGroupTo::from_json($json->to) - : null, - variant: $json->variant ?? null, - ); - } - - public function __construct( - public string|null $acs_user_id, - public string|null $created_at, - public UnmanagedAcsAccessGroupFrom|null $from, - public string|null $message, - public string|null $mutation_code, - public UnmanagedAcsAccessGroupTo|null $to, - public string|null $variant, - ) {} -} diff --git a/src/Objects/UnmanagedAcsAccessGroupTo.php b/src/Objects/UnmanagedAcsAccessGroupTo.php deleted file mode 100644 index f1a5ac19..00000000 --- a/src/Objects/UnmanagedAcsAccessGroupTo.php +++ /dev/null @@ -1,29 +0,0 @@ -acs_entrance_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - ends_at: $json->ends_at ?? null, - name: $json->name ?? null, - starts_at: $json->starts_at ?? null, - ); - } - - public function __construct( - public string|null $acs_entrance_id, - public string|null $acs_user_id, - public string|null $ends_at, - public string|null $name, - public string|null $starts_at, - ) {} -} diff --git a/src/Objects/UnmanagedAcsAccessGroupWarnings.php b/src/Objects/UnmanagedAcsAccessGroupWarnings.php deleted file mode 100644 index 699b128e..00000000 --- a/src/Objects/UnmanagedAcsAccessGroupWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at ?? null, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $message, - public string|null $warning_code, - ) {} -} diff --git a/src/Objects/UnmanagedAcsCredential.php b/src/Objects/UnmanagedAcsCredential.php deleted file mode 100644 index 75321df2..00000000 --- a/src/Objects/UnmanagedAcsCredential.php +++ /dev/null @@ -1,92 +0,0 @@ -access_method ?? null, - acs_credential_id: $json->acs_credential_id ?? null, - acs_credential_pool_id: $json->acs_credential_pool_id ?? null, - acs_system_id: $json->acs_system_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? UnmanagedAcsCredentialAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata, - ) - : null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - connected_account_id: $json->connected_account_id ?? null, - created_at: $json->created_at ?? null, - display_name: $json->display_name ?? null, - ends_at: $json->ends_at ?? null, - errors: array_map( - fn($e) => UnmanagedAcsCredentialErrors::from_json($e), - $json->errors ?? [], - ), - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - is_issued: $json->is_issued ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - is_managed: $json->is_managed ?? null, - is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? - null, - is_one_time_use: $json->is_one_time_use ?? null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, - parent_acs_credential_id: $json->parent_acs_credential_id ?? null, - starts_at: $json->starts_at ?? null, - user_identity_id: $json->user_identity_id ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? UnmanagedAcsCredentialVisionlineMetadata::from_json( - $json->visionline_metadata, - ) - : null, - warnings: array_map( - fn($w) => UnmanagedAcsCredentialWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public string|null $access_method, - public string|null $acs_credential_id, - public string|null $acs_credential_pool_id, - public string|null $acs_system_id, - public string|null $acs_user_id, - public UnmanagedAcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public string|null $card_number, - public string|null $code, - public string|null $connected_account_id, - public string|null $created_at, - public string|null $display_name, - public string|null $ends_at, - public array $errors, - public string|null $external_type, - public string|null $external_type_display_name, - public bool|null $is_issued, - public bool|null $is_latest_desired_state_synced_with_provider, - public bool|null $is_managed, - public bool|null $is_multi_phone_sync_credential, - public bool|null $is_one_time_use, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at, - public string|null $parent_acs_credential_id, - public string|null $starts_at, - public string|null $user_identity_id, - public UnmanagedAcsCredentialVisionlineMetadata|null $visionline_metadata, - public array $warnings, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php b/src/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php deleted file mode 100644 index 721f762b..00000000 --- a/src/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php +++ /dev/null @@ -1,32 +0,0 @@ -auto_join ?? null, - door_names: $json->door_names ?? null, - endpoint_id: $json->endpoint_id ?? null, - key_id: $json->key_id ?? null, - key_issuing_request_id: $json->key_issuing_request_id ?? null, - override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? - null, - ); - } - - public function __construct( - public bool|null $auto_join, - public array|null $door_names, - public string|null $endpoint_id, - public string|null $key_id, - public string|null $key_issuing_request_id, - public array|null $override_guest_acs_entrance_ids, - ) {} -} diff --git a/src/Objects/UnmanagedAcsCredentialErrors.php b/src/Objects/UnmanagedAcsCredentialErrors.php deleted file mode 100644 index 82df3410..00000000 --- a/src/Objects/UnmanagedAcsCredentialErrors.php +++ /dev/null @@ -1,23 +0,0 @@ -error_code ?? null, - message: $json->message ?? null, - ); - } - - public function __construct( - public string|null $error_code, - public string|null $message, - ) {} -} diff --git a/src/Objects/UnmanagedAcsCredentialVisionlineMetadata.php b/src/Objects/UnmanagedAcsCredentialVisionlineMetadata.php deleted file mode 100644 index dbf01217..00000000 --- a/src/Objects/UnmanagedAcsCredentialVisionlineMetadata.php +++ /dev/null @@ -1,35 +0,0 @@ -auto_join ?? null, - card_function_type: $json->card_function_type ?? null, - card_id: $json->card_id ?? null, - common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, - credential_id: $json->credential_id ?? null, - guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, - is_valid: $json->is_valid ?? null, - joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null, - ); - } - - public function __construct( - public bool|null $auto_join, - public string|null $card_function_type, - public string|null $card_id, - public array|null $common_acs_entrance_ids, - public string|null $credential_id, - public array|null $guest_acs_entrance_ids, - public bool|null $is_valid, - public array|null $joiner_acs_credential_ids, - ) {} -} diff --git a/src/Objects/UnmanagedAcsCredentialWarnings.php b/src/Objects/UnmanagedAcsCredentialWarnings.php deleted file mode 100644 index 98a73528..00000000 --- a/src/Objects/UnmanagedAcsCredentialWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at ?? null, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $message, - public string|null $warning_code, - ) {} -} diff --git a/src/Objects/UnmanagedAcsUser.php b/src/Objects/UnmanagedAcsUser.php deleted file mode 100644 index a840929e..00000000 --- a/src/Objects/UnmanagedAcsUser.php +++ /dev/null @@ -1,88 +0,0 @@ -access_schedule) - ? UnmanagedAcsUserAccessSchedule::from_json( - $json->access_schedule, - ) - : null, - acs_system_id: $json->acs_system_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - connected_account_id: $json->connected_account_id ?? null, - created_at: $json->created_at ?? null, - display_name: $json->display_name ?? null, - email: $json->email ?? null, - email_address: $json->email_address ?? null, - errors: array_map( - fn($e) => UnmanagedAcsUserErrors::from_json($e), - $json->errors ?? [], - ), - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - full_name: $json->full_name ?? null, - hid_acs_system_id: $json->hid_acs_system_id ?? null, - is_managed: $json->is_managed ?? null, - is_suspended: $json->is_suspended ?? null, - last_successful_sync_at: $json->last_successful_sync_at ?? null, - pending_mutations: array_map( - fn($p) => UnmanagedAcsUserPendingMutations::from_json($p), - $json->pending_mutations ?? [], - ), - phone_number: $json->phone_number ?? null, - salto_space_metadata: isset($json->salto_space_metadata) - ? UnmanagedAcsUserSaltoSpaceMetadata::from_json( - $json->salto_space_metadata, - ) - : null, - user_identity_email_address: $json->user_identity_email_address ?? - null, - user_identity_full_name: $json->user_identity_full_name ?? null, - user_identity_id: $json->user_identity_id ?? null, - user_identity_phone_number: $json->user_identity_phone_number ?? - null, - warnings: array_map( - fn($w) => UnmanagedAcsUserWarnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, - ); - } - - public function __construct( - public UnmanagedAcsUserAccessSchedule|null $access_schedule, - public string|null $acs_system_id, - public string|null $acs_user_id, - public string|null $connected_account_id, - public string|null $created_at, - public string|null $display_name, - public string|null $email, - public string|null $email_address, - public array $errors, - public string|null $external_type, - public string|null $external_type_display_name, - public string|null $full_name, - public string|null $hid_acs_system_id, - public bool|null $is_managed, - public bool|null $is_suspended, - public string|null $last_successful_sync_at, - public array $pending_mutations, - public string|null $phone_number, - public UnmanagedAcsUserSaltoSpaceMetadata|null $salto_space_metadata, - public string|null $user_identity_email_address, - public string|null $user_identity_full_name, - public string|null $user_identity_id, - public string|null $user_identity_phone_number, - public array $warnings, - public string|null $workspace_id, - ) {} -} diff --git a/src/Objects/UnmanagedAcsUserAccessSchedule.php b/src/Objects/UnmanagedAcsUserAccessSchedule.php deleted file mode 100644 index 63d5ef48..00000000 --- a/src/Objects/UnmanagedAcsUserAccessSchedule.php +++ /dev/null @@ -1,23 +0,0 @@ -ends_at ?? null, - starts_at: $json->starts_at ?? null, - ); - } - - public function __construct( - public string|null $ends_at, - public string|null $starts_at, - ) {} -} diff --git a/src/Objects/UnmanagedAcsUserErrors.php b/src/Objects/UnmanagedAcsUserErrors.php deleted file mode 100644 index 4fdbdd2f..00000000 --- a/src/Objects/UnmanagedAcsUserErrors.php +++ /dev/null @@ -1,24 +0,0 @@ -created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $error_code, - public string|null $message, - ) {} -} diff --git a/src/Objects/UnmanagedAcsUserFrom.php b/src/Objects/UnmanagedAcsUserFrom.php deleted file mode 100644 index d1ea2519..00000000 --- a/src/Objects/UnmanagedAcsUserFrom.php +++ /dev/null @@ -1,34 +0,0 @@ -acs_access_group_id ?? null, - acs_credential_id: $json->acs_credential_id ?? null, - email_address: $json->email_address ?? null, - ends_at: $json->ends_at ?? null, - full_name: $json->full_name ?? null, - is_suspended: $json->is_suspended ?? null, - phone_number: $json->phone_number ?? null, - starts_at: $json->starts_at ?? null, - ); - } - - public function __construct( - public string|null $acs_access_group_id, - public string|null $acs_credential_id, - public string|null $email_address, - public string|null $ends_at, - public string|null $full_name, - public bool|null $is_suspended, - public string|null $phone_number, - public string|null $starts_at, - ) {} -} diff --git a/src/Objects/UnmanagedAcsUserPendingMutations.php b/src/Objects/UnmanagedAcsUserPendingMutations.php deleted file mode 100644 index 82281844..00000000 --- a/src/Objects/UnmanagedAcsUserPendingMutations.php +++ /dev/null @@ -1,39 +0,0 @@ -acs_access_group_id ?? null, - created_at: $json->created_at ?? null, - from: isset($json->from) - ? UnmanagedAcsUserFrom::from_json($json->from) - : null, - message: $json->message ?? null, - mutation_code: $json->mutation_code ?? null, - scheduled_at: $json->scheduled_at ?? null, - to: isset($json->to) - ? UnmanagedAcsUserTo::from_json($json->to) - : null, - variant: $json->variant ?? null, - ); - } - - public function __construct( - public string|null $acs_access_group_id, - public string|null $created_at, - public UnmanagedAcsUserFrom|null $from, - public string|null $message, - public string|null $mutation_code, - public string|null $scheduled_at, - public UnmanagedAcsUserTo|null $to, - public string|null $variant, - ) {} -} diff --git a/src/Objects/UnmanagedAcsUserSaltoSpaceMetadata.php b/src/Objects/UnmanagedAcsUserSaltoSpaceMetadata.php deleted file mode 100644 index 00174154..00000000 --- a/src/Objects/UnmanagedAcsUserSaltoSpaceMetadata.php +++ /dev/null @@ -1,23 +0,0 @@ -audit_openings ?? null, - user_id: $json->user_id ?? null, - ); - } - - public function __construct( - public bool|null $audit_openings, - public string|null $user_id, - ) {} -} diff --git a/src/Objects/UnmanagedAcsUserTo.php b/src/Objects/UnmanagedAcsUserTo.php deleted file mode 100644 index b2c793ed..00000000 --- a/src/Objects/UnmanagedAcsUserTo.php +++ /dev/null @@ -1,34 +0,0 @@ -acs_access_group_id ?? null, - acs_credential_id: $json->acs_credential_id ?? null, - email_address: $json->email_address ?? null, - ends_at: $json->ends_at ?? null, - full_name: $json->full_name ?? null, - is_suspended: $json->is_suspended ?? null, - phone_number: $json->phone_number ?? null, - starts_at: $json->starts_at ?? null, - ); - } - - public function __construct( - public string|null $acs_access_group_id, - public string|null $acs_credential_id, - public string|null $email_address, - public string|null $ends_at, - public string|null $full_name, - public bool|null $is_suspended, - public string|null $phone_number, - public string|null $starts_at, - ) {} -} diff --git a/src/Objects/UnmanagedAcsUserWarnings.php b/src/Objects/UnmanagedAcsUserWarnings.php deleted file mode 100644 index 17f9cfc9..00000000 --- a/src/Objects/UnmanagedAcsUserWarnings.php +++ /dev/null @@ -1,24 +0,0 @@ -created_at ?? null, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - ); - } - - public function __construct( - public string|null $created_at, - public string|null $message, - public string|null $warning_code, - ) {} -} diff --git a/src/SeamClient.php b/src/SeamClient.php index 171493c9..20584d88 100644 --- a/src/SeamClient.php +++ b/src/SeamClient.php @@ -7,39 +7,26 @@ use Seam\Objects\AccessMethod; use Seam\Objects\AcsAccessGroup; use Seam\Objects\AcsCredential; -use Seam\Objects\AcsCredentialPool; -use Seam\Objects\AcsCredentialProvisioningAutomation; use Seam\Objects\AcsEncoder; use Seam\Objects\AcsEntrance; use Seam\Objects\AcsSystem; use Seam\Objects\AcsUser; use Seam\Objects\ActionAttempt; use Seam\Objects\Batch; -use Seam\Objects\BridgeClientSession; -use Seam\Objects\BridgeConnectedSystems; use Seam\Objects\ClientSession; use Seam\Objects\ConnectWebview; use Seam\Objects\ConnectedAccount; -use Seam\Objects\Customer; use Seam\Objects\CustomerPortal; -use Seam\Objects\CustomizationProfile; use Seam\Objects\Device; use Seam\Objects\DeviceProvider; -use Seam\Objects\EnrollmentAutomation; use Seam\Objects\Event; use Seam\Objects\InstantKey; -use Seam\Objects\MagicLink; use Seam\Objects\NoiseThreshold; use Seam\Objects\Phone; -use Seam\Objects\PhoneSession; use Seam\Objects\Space; -use Seam\Objects\StaffMember; use Seam\Objects\ThermostatDailyProgram; use Seam\Objects\ThermostatSchedule; use Seam\Objects\UnmanagedAccessCode; -use Seam\Objects\UnmanagedAcsAccessGroup; -use Seam\Objects\UnmanagedAcsCredential; -use Seam\Objects\UnmanagedAcsUser; use Seam\Objects\UnmanagedDevice; use Seam\Objects\UserIdentity; use Seam\Objects\Webhook; From 38ff400ba260fe4c2f0bdfd2f3f69519e9ad5d7b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Jul 2026 15:28:52 +0000 Subject: [PATCH 3/5] 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 Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H --- codegen/lib/map-php-type.ts | 7 +++++++ codegen/lib/routes.ts | 4 ++-- package-lock.json | 8 ++++---- package.json | 2 +- src/SeamClient.php | 20 ++++++++++---------- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/codegen/lib/map-php-type.ts b/codegen/lib/map-php-type.ts index 3edf20d5..da0b1c8d 100644 --- a/codegen/lib/map-php-type.ts +++ b/codegen/lib/map-php-type.ts @@ -1,5 +1,12 @@ // Maps a blueprint JSON type to the PHP type used in generated declarations. +import type { Parameter } from '@seamapi/blueprint' + +export const getParameterPhpType = (parameter: Parameter): string => + parameter.format === 'number' && parameter.isInt + ? 'int' + : getPhpType(parameter.jsonType) + export const getPhpType = (jsonType: string): string => { switch (jsonType) { case 'string': diff --git a/codegen/lib/routes.ts b/codegen/lib/routes.ts index a084b645..36c381e0 100644 --- a/codegen/lib/routes.ts +++ b/codegen/lib/routes.ts @@ -11,7 +11,7 @@ import type Metalsmith from 'metalsmith' import type { PhpClient, PhpClientMethod } from './class-model.js' import { setObjectLayoutContext } from './layouts/object.js' import { setSeamClientLayoutContext } from './layouts/seam-client.js' -import { getPhpType } from './map-php-type.js' +import { getParameterPhpType } from './map-php-type.js' import { createResourceObjectModel } from './resource-model.js' interface Metadata { @@ -118,7 +118,7 @@ const createClientMethod = (endpoint: Endpoint): PhpClientMethod => { .filter((parameter) => !parameter.isUndocumented) .map((parameter) => ({ name: parameter.name, - type: getPhpType(parameter.jsonType), + type: getParameterPhpType(parameter), required: parameter.isRequired, // The primary identifier of a get endpoint always sorts first in the // method signature. diff --git a/package-lock.json b/package-lock.json index e8f2c3f1..2528b3b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "devDependencies": { "@prettier/plugin-php": "^0.24.0", - "@seamapi/blueprint": "^0.56.0", + "@seamapi/blueprint": "^0.57.0", "@seamapi/smith": "^0.5.2", "@seamapi/types": "1.964.0", "change-case": "^5.4.4", @@ -832,9 +832,9 @@ "license": "MIT" }, "node_modules/@seamapi/blueprint": { - "version": "0.56.0", - "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.56.0.tgz", - "integrity": "sha512-6trN/T2hGnoWE8l1tmHYv+QHexF1NzeG+hiGUm6nfTBIqCsndl457p10VCtfB7ew0CqSUzNkjfhrb7hww3SZPQ==", + "version": "0.57.0", + "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.57.0.tgz", + "integrity": "sha512-Ca7EKZaxNpd5afo0GjnUZWtfnX7gA6yNhgHhjGmLt8xFvgITjrggjMtAgTd1UmxTmtKGOZH0KQPipHu3GrosnA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 023d415a..2743c59f 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "devDependencies": { "@prettier/plugin-php": "^0.24.0", - "@seamapi/blueprint": "^0.56.0", + "@seamapi/blueprint": "^0.57.0", "@seamapi/smith": "^0.5.2", "@seamapi/types": "1.964.0", "change-case": "^5.4.4", diff --git a/src/SeamClient.php b/src/SeamClient.php index 20584d88..b968b812 100644 --- a/src/SeamClient.php +++ b/src/SeamClient.php @@ -490,8 +490,8 @@ public function pull_backup_access_code(string $access_code_id): AccessCode public function report_device_constraints( string $device_id, - ?float $max_code_length = null, - ?float $min_code_length = null, + ?int $max_code_length = null, + ?int $min_code_length = null, ?array $supported_code_lengths = null, ): void { $request_payload = []; @@ -2266,7 +2266,7 @@ public function list( ?string $acs_system_id = null, ?string $connected_account_id = null, ?string $customer_key = null, - ?float $limit = null, + ?int $limit = null, ?string $location_id = null, ?string $page_cursor = null, ?string $search = null, @@ -2602,7 +2602,7 @@ public function get( public function list( ?string $acs_system_id = null, ?string $created_before = null, - ?float $limit = null, + ?int $limit = null, ?string $page_cursor = null, ?string $search = null, ?string $user_identity_email_address = null, @@ -2857,7 +2857,7 @@ public function get(string $action_attempt_id): ActionAttempt public function list( ?array $action_attempt_ids = null, ?string $device_id = null, - ?float $limit = null, + ?int $limit = null, ?string $page_cursor = null, ?callable $on_response = null, ): array { @@ -3338,7 +3338,7 @@ public function get( public function list( mixed $custom_metadata_has = null, ?string $customer_key = null, - ?float $limit = null, + ?int $limit = null, ?string $page_cursor = null, ?string $search = null, ?string $space_id = null, @@ -6087,7 +6087,7 @@ public function create( string $ends_at, string $starts_at, ?bool $is_override_allowed = null, - ?float $max_override_period_minutes = null, + ?int $max_override_period_minutes = null, ?string $name = null, ): ThermostatSchedule { $request_payload = []; @@ -6191,7 +6191,7 @@ public function update( ?string $climate_preset_key = null, ?string $ends_at = null, ?bool $is_override_allowed = null, - ?float $max_override_period_minutes = null, + ?int $max_override_period_minutes = null, ?string $name = null, ?string $starts_at = null, ): void { @@ -6467,7 +6467,7 @@ public function grant_access_to_device( public function list( ?string $created_before = null, ?string $credential_manager_acs_system_id = null, - ?float $limit = null, + ?int $limit = null, ?string $page_cursor = null, ?string $search = null, ?array $user_identity_ids = null, @@ -6682,7 +6682,7 @@ public function get(string $user_identity_id): void public function list( ?string $created_before = null, - ?float $limit = null, + ?int $limit = null, ?string $page_cursor = null, ?string $search = null, ?callable $on_response = null, From b8657a19c15a4db7ce5e1749d02b6c59fc7f20f6 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Jul 2026 15:55:25 +0000 Subject: [PATCH 4/5] Generate int properties using the blueprint isInt flag Upgrade @seamapi/blueprint to 0.58.0, which adds the isInt flag to number properties, and @seamapi/types to 1.966.0, which restores the missing created_at property on error and warning resources. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H --- codegen/lib/map-php-type.ts | 14 ++++++-------- codegen/lib/resource-model.ts | 2 +- codegen/lib/routes.ts | 4 ++-- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- .../AccessGrantRequestedAccessMethods.php | 2 +- src/Objects/AcsCredentialErrors.php | 2 ++ src/Objects/AcsEntranceErrors.php | 2 ++ src/Objects/ActionAttemptErrors.php | 2 ++ src/Objects/ConnectedAccountSites.php | 4 ++-- src/Objects/DeviceActiveThermostatSchedule.php | 2 +- src/Objects/DeviceWarnings.php | 4 ++-- src/Objects/PhoneErrors.php | 2 ++ src/Objects/PhoneWarnings.php | 2 ++ src/Objects/ThermostatSchedule.php | 2 +- src/Objects/ThermostatScheduleErrors.php | 2 ++ src/Objects/UnmanagedDeviceWarnings.php | 4 ++-- 17 files changed, 40 insertions(+), 30 deletions(-) diff --git a/codegen/lib/map-php-type.ts b/codegen/lib/map-php-type.ts index da0b1c8d..7ca5e2c6 100644 --- a/codegen/lib/map-php-type.ts +++ b/codegen/lib/map-php-type.ts @@ -1,14 +1,12 @@ -// Maps a blueprint JSON type to the PHP type used in generated declarations. +// Maps a blueprint parameter or property to the PHP type used in generated +// declarations. -import type { Parameter } from '@seamapi/blueprint' +import type { Parameter, Property } from '@seamapi/blueprint' -export const getParameterPhpType = (parameter: Parameter): string => - parameter.format === 'number' && parameter.isInt - ? 'int' - : getPhpType(parameter.jsonType) +export const getPhpType = (schema: Parameter | Property): string => { + if (schema.format === 'number' && schema.isInt) return 'int' -export const getPhpType = (jsonType: string): string => { - switch (jsonType) { + switch (schema.jsonType) { case 'string': return 'string' diff --git a/codegen/lib/resource-model.ts b/codegen/lib/resource-model.ts index 3c9effa4..ac8ff301 100644 --- a/codegen/lib/resource-model.ts +++ b/codegen/lib/resource-model.ts @@ -136,7 +136,7 @@ const createResourceObjectProperty = ( return { name: property.name, kind: 'value', - phpType: getPhpType(property.jsonType), + phpType: getPhpType(property), } } diff --git a/codegen/lib/routes.ts b/codegen/lib/routes.ts index 36c381e0..0869564f 100644 --- a/codegen/lib/routes.ts +++ b/codegen/lib/routes.ts @@ -11,7 +11,7 @@ import type Metalsmith from 'metalsmith' import type { PhpClient, PhpClientMethod } from './class-model.js' import { setObjectLayoutContext } from './layouts/object.js' import { setSeamClientLayoutContext } from './layouts/seam-client.js' -import { getParameterPhpType } from './map-php-type.js' +import { getPhpType } from './map-php-type.js' import { createResourceObjectModel } from './resource-model.js' interface Metadata { @@ -118,7 +118,7 @@ const createClientMethod = (endpoint: Endpoint): PhpClientMethod => { .filter((parameter) => !parameter.isUndocumented) .map((parameter) => ({ name: parameter.name, - type: getParameterPhpType(parameter), + type: getPhpType(parameter), required: parameter.isRequired, // The primary identifier of a get endpoint always sorts first in the // method signature. diff --git a/package-lock.json b/package-lock.json index 2528b3b4..13dbceb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,9 @@ "license": "MIT", "devDependencies": { "@prettier/plugin-php": "^0.24.0", - "@seamapi/blueprint": "^0.57.0", + "@seamapi/blueprint": "^0.58.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.964.0", + "@seamapi/types": "^1.966.0", "change-case": "^5.4.4", "prettier": "^3.0.0" } @@ -832,9 +832,9 @@ "license": "MIT" }, "node_modules/@seamapi/blueprint": { - "version": "0.57.0", - "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.57.0.tgz", - "integrity": "sha512-Ca7EKZaxNpd5afo0GjnUZWtfnX7gA6yNhgHhjGmLt8xFvgITjrggjMtAgTd1UmxTmtKGOZH0KQPipHu3GrosnA==", + "version": "0.58.0", + "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.58.0.tgz", + "integrity": "sha512-9CrIV3pcLheTg+B3Kw5AvipIAD8SXQO/Xjxa0daFlIJBjMTyxUyqcikUiKspUddedsCGudlW8ty4OShCedb9/g==", "dev": true, "license": "MIT", "dependencies": { @@ -880,9 +880,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.964.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.964.0.tgz", - "integrity": "sha512-Pr3p4FQoYXYoVBiNDahaZdwYVJm0Klh2/IVjWmz67nsT+yWXsYSSA83HL9iNty150xY8fTHcNVvOOKVnX4tueA==", + "version": "1.966.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.966.0.tgz", + "integrity": "sha512-OT866NO3iI4zUuYT9auupkuNJNbSiJDi9/feiAL3LTJMowzERG5PYU/KIK1QlfI2x3umfTdeUzqqh4xVjq47DA==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 2743c59f..d0a8a44a 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ }, "devDependencies": { "@prettier/plugin-php": "^0.24.0", - "@seamapi/blueprint": "^0.57.0", + "@seamapi/blueprint": "^0.58.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.964.0", + "@seamapi/types": "^1.966.0", "change-case": "^5.4.4", "prettier": "^3.0.0" } diff --git a/src/Objects/AccessGrantRequestedAccessMethods.php b/src/Objects/AccessGrantRequestedAccessMethods.php index 384f0d60..a3127279 100644 --- a/src/Objects/AccessGrantRequestedAccessMethods.php +++ b/src/Objects/AccessGrantRequestedAccessMethods.php @@ -25,7 +25,7 @@ public function __construct( public array|null $created_access_method_ids, public string|null $created_at, public string|null $display_name, - public float|null $instant_key_max_use_count, + public int|null $instant_key_max_use_count, public string|null $mode, ) {} } diff --git a/src/Objects/AcsCredentialErrors.php b/src/Objects/AcsCredentialErrors.php index 414c19da..28d93723 100644 --- a/src/Objects/AcsCredentialErrors.php +++ b/src/Objects/AcsCredentialErrors.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): AcsCredentialErrors|null return null; } return new self( + created_at: $json->created_at ?? null, error_code: $json->error_code ?? null, message: $json->message ?? null, ); } public function __construct( + public string|null $created_at, public string|null $error_code, public string|null $message, ) {} diff --git a/src/Objects/AcsEntranceErrors.php b/src/Objects/AcsEntranceErrors.php index eae7219d..f33a8479 100644 --- a/src/Objects/AcsEntranceErrors.php +++ b/src/Objects/AcsEntranceErrors.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): AcsEntranceErrors|null return null; } return new self( + created_at: $json->created_at ?? null, error_code: $json->error_code ?? null, message: $json->message ?? null, ); } public function __construct( + public string|null $created_at, public string|null $error_code, public string|null $message, ) {} diff --git a/src/Objects/ActionAttemptErrors.php b/src/Objects/ActionAttemptErrors.php index 9fd0a67b..222c5720 100644 --- a/src/Objects/ActionAttemptErrors.php +++ b/src/Objects/ActionAttemptErrors.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): ActionAttemptErrors|null return null; } return new self( + created_at: $json->created_at ?? null, error_code: $json->error_code ?? null, message: $json->message ?? null, ); } public function __construct( + public string|null $created_at, public string|null $error_code, public string|null $message, ) {} diff --git a/src/Objects/ConnectedAccountSites.php b/src/Objects/ConnectedAccountSites.php index 1dbbdb1a..133da75e 100644 --- a/src/Objects/ConnectedAccountSites.php +++ b/src/Objects/ConnectedAccountSites.php @@ -22,7 +22,7 @@ public static function from_json(mixed $json): ConnectedAccountSites|null public function __construct( public string|null $site_id, public string|null $site_name, - public float|null $site_user_subscription_limit, - public float|null $subscribed_site_user_count, + public int|null $site_user_subscription_limit, + public int|null $subscribed_site_user_count, ) {} } diff --git a/src/Objects/DeviceActiveThermostatSchedule.php b/src/Objects/DeviceActiveThermostatSchedule.php index 4c12afbb..5bbfe1a7 100644 --- a/src/Objects/DeviceActiveThermostatSchedule.php +++ b/src/Objects/DeviceActiveThermostatSchedule.php @@ -36,7 +36,7 @@ public function __construct( public string|null $ends_at, public array $errors, public bool|null $is_override_allowed, - public float|null $max_override_period_minutes, + public int|null $max_override_period_minutes, public string|null $name, public string|null $starts_at, public string|null $thermostat_schedule_id, diff --git a/src/Objects/DeviceWarnings.php b/src/Objects/DeviceWarnings.php index f9fa718f..168b5dd9 100644 --- a/src/Objects/DeviceWarnings.php +++ b/src/Objects/DeviceWarnings.php @@ -20,9 +20,9 @@ public static function from_json(mixed $json): DeviceWarnings|null } public function __construct( - public float|null $active_access_code_count, + public int|null $active_access_code_count, public string|null $created_at, - public float|null $max_active_access_code_count, + public int|null $max_active_access_code_count, public string|null $message, public string|null $warning_code, ) {} diff --git a/src/Objects/PhoneErrors.php b/src/Objects/PhoneErrors.php index aff9abd1..f107f264 100644 --- a/src/Objects/PhoneErrors.php +++ b/src/Objects/PhoneErrors.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): PhoneErrors|null return null; } return new self( + created_at: $json->created_at ?? null, error_code: $json->error_code ?? null, message: $json->message ?? null, ); } public function __construct( + public string|null $created_at, public string|null $error_code, public string|null $message, ) {} diff --git a/src/Objects/PhoneWarnings.php b/src/Objects/PhoneWarnings.php index 1a20f80a..30424953 100644 --- a/src/Objects/PhoneWarnings.php +++ b/src/Objects/PhoneWarnings.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): PhoneWarnings|null return null; } return new self( + created_at: $json->created_at ?? null, message: $json->message ?? null, warning_code: $json->warning_code ?? null, ); } public function __construct( + public string|null $created_at, public string|null $message, public string|null $warning_code, ) {} diff --git a/src/Objects/ThermostatSchedule.php b/src/Objects/ThermostatSchedule.php index 02a77b7f..e943520f 100644 --- a/src/Objects/ThermostatSchedule.php +++ b/src/Objects/ThermostatSchedule.php @@ -35,7 +35,7 @@ public function __construct( public string|null $ends_at, public array $errors, public bool|null $is_override_allowed, - public float|null $max_override_period_minutes, + public int|null $max_override_period_minutes, public string|null $name, public string|null $starts_at, public string|null $thermostat_schedule_id, diff --git a/src/Objects/ThermostatScheduleErrors.php b/src/Objects/ThermostatScheduleErrors.php index 857b6817..e0eae80b 100644 --- a/src/Objects/ThermostatScheduleErrors.php +++ b/src/Objects/ThermostatScheduleErrors.php @@ -10,12 +10,14 @@ public static function from_json(mixed $json): ThermostatScheduleErrors|null return null; } return new self( + created_at: $json->created_at ?? null, error_code: $json->error_code ?? null, message: $json->message ?? null, ); } public function __construct( + public string|null $created_at, public string|null $error_code, public string|null $message, ) {} diff --git a/src/Objects/UnmanagedDeviceWarnings.php b/src/Objects/UnmanagedDeviceWarnings.php index 41db733f..224d6ad1 100644 --- a/src/Objects/UnmanagedDeviceWarnings.php +++ b/src/Objects/UnmanagedDeviceWarnings.php @@ -20,9 +20,9 @@ public static function from_json(mixed $json): UnmanagedDeviceWarnings|null } public function __construct( - public float|null $active_access_code_count, + public int|null $active_access_code_count, public string|null $created_at, - public float|null $max_active_access_code_count, + public int|null $max_active_access_code_count, public string|null $message, public string|null $warning_code, ) {} From 824e3b47343e74d45281b9ccec6944eaf33f6174 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Jul 2026 21:02:39 +0000 Subject: [PATCH 5/5] Upgrade @seamapi/blueprint to 0.58.1 Pick up the isItemInt flag on number list parameters and properties. Generated output is unchanged since PHP list types do not declare an item type. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01EjeywMUAsXPYML3H7imc4H --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 13dbceb3..4419d4bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "devDependencies": { "@prettier/plugin-php": "^0.24.0", - "@seamapi/blueprint": "^0.58.0", + "@seamapi/blueprint": "^0.58.1", "@seamapi/smith": "^0.5.2", "@seamapi/types": "^1.966.0", "change-case": "^5.4.4", @@ -832,9 +832,9 @@ "license": "MIT" }, "node_modules/@seamapi/blueprint": { - "version": "0.58.0", - "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.58.0.tgz", - "integrity": "sha512-9CrIV3pcLheTg+B3Kw5AvipIAD8SXQO/Xjxa0daFlIJBjMTyxUyqcikUiKspUddedsCGudlW8ty4OShCedb9/g==", + "version": "0.58.1", + "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-0.58.1.tgz", + "integrity": "sha512-jAK9TWr1F6Q5pYAEMG4DUnQJpSYwht5sYdKjcNoF3RbHJkc1qDd1sFIFvJNJDosnZyLMZsSs6X4ywKy1TRyw0A==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index d0a8a44a..9f18ce3f 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "devDependencies": { "@prettier/plugin-php": "^0.24.0", - "@seamapi/blueprint": "^0.58.0", + "@seamapi/blueprint": "^0.58.1", "@seamapi/smith": "^0.5.2", "@seamapi/types": "^1.966.0", "change-case": "^5.4.4",