From 76466938054c80ce75b57e11b89516d8bf27701c Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Wed, 19 Aug 2026 16:09:08 -0700 Subject: [PATCH 1/4] feat: restore discriminated resource variants --- README.md | 11 +- codegen/layouts/resource.hbs | 36 +- codegen/lib/layouts/resource.ts | 130 +- codegen/lib/map-php-type.ts | 27 +- codegen/lib/resource-model.ts | 672 +- src/Http/ResolveActionAttempt.php | 5 +- src/Resources/AccessCode.php | 2575 ++- src/Resources/AccessGrant.php | 1051 +- src/Resources/AccessMethod.php | 829 +- src/Resources/AcsAccessGroup.php | 968 +- src/Resources/AcsCredential.php | 526 +- src/Resources/AcsEncoder.php | 19 +- src/Resources/AcsEntrance.php | 461 +- src/Resources/AcsSystem.php | 891 +- src/Resources/AcsUser.php | 1619 +- src/Resources/ActionAttempt.php | 3344 +++- src/Resources/ClientSession.php | 9 +- src/Resources/ConnectWebview.php | 40 +- src/Resources/ConnectedAccount.php | 888 +- src/Resources/Device.php | 6355 +++++--- src/Resources/DeviceProvider.php | 88 +- src/Resources/Event.php | 13009 +++++++++++++++- src/Resources/InstantKey.php | 14 +- src/Resources/NoiseThreshold.php | 2 +- src/Resources/Phone.php | 42 +- src/Resources/Space.php | 22 +- src/Resources/ThermostatDailyProgram.php | 8 +- src/Resources/ThermostatSchedule.php | 14 +- src/Resources/UnmanagedAccessCode.php | 2002 ++- src/Resources/UnmanagedAccessGrant.php | 1046 +- src/Resources/UnmanagedAccessMethod.php | 829 +- src/Resources/UnmanagedDevice.php | 2579 ++- src/Resources/UnmanagedUserIdentity.php | 330 +- src/Resources/UserIdentity.php | 324 +- src/Resources/Webhook.php | 6 +- src/Resources/Workspace.php | 22 +- src/Routes/AccessCodesClient.php | 6 +- src/Routes/AccessGrantsClient.php | 24 +- src/Routes/AccessMethodsClient.php | 6 +- src/Routes/AcsCredentialsClient.php | 2 +- src/Routes/AcsEncodersClient.php | 4 +- src/Routes/AcsEntrancesClient.php | 4 +- src/Routes/AcsSystemsClient.php | 4 +- src/Routes/AcsUsersClient.php | 2 +- src/Routes/ActionAttemptsClient.php | 2 +- src/Routes/ClientSessionsClient.php | 18 +- src/Routes/ConnectWebviewsClient.php | 6 +- src/Routes/ConnectedAccountsClient.php | 2 +- src/Routes/CustomersClient.php | 78 +- src/Routes/DevicesClient.php | 8 +- src/Routes/DevicesUnmanagedClient.php | 6 +- src/Routes/EventsClient.php | 18 +- src/Routes/LocksClient.php | 2 +- src/Routes/NoiseSensorsClient.php | 2 +- src/Routes/SpacesClient.php | 26 +- src/Routes/ThermostatsClient.php | 2 +- src/Routes/ThermostatsDailyProgramsClient.php | 4 +- src/Routes/UserIdentitiesClient.php | 4 +- src/Routes/WebhooksClient.php | 4 +- src/SeamWebhook.php | 10 + tests/LiteralBooleanTypesTest.php | 16 +- tests/RecordTypesTest.php | 7 +- tests/ResourceTest.php | 26 +- tests/SeamWebhookTest.php | 44 +- tests/WaitForActionAttemptTest.php | 34 +- 65 files changed, 36979 insertions(+), 4185 deletions(-) diff --git a/README.md b/README.md index 5989b5e3..cf9dfcf7 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ Waiting may be disabled for the whole client: $seam = new Seam\Seam(wait_for_action_attempt: false); $action_attempt = $seam->locks->unlock_door(device_id: $device_id); -$action_attempt->status; // "pending" +$action_attempt->status; // Seam\Resources\ActionAttempt\Status::PENDING ``` or for a single request: @@ -329,7 +329,14 @@ $webhook = new Seam\SeamWebhook($webhook_secret); try { $event = $webhook->verify($request_body, $request_headers); - print $event->event_type; + + print match (true) { + $event instanceof Seam\Resources\Event\AccessCodeCreated + => "Created access code {$event->access_code_id}", + $event instanceof Seam\Resources\Event\UnknownEvent + => "Unknown event type {$event->event_type}", + default => "Received {$event->event_type->value}", + }; } catch (Svix\Exception\WebhookVerificationException $error) { http_response_code(401); } catch (Seam\InvalidWebhookPayloadError $error) { diff --git a/codegen/layouts/resource.hbs b/codegen/layouts/resource.hbs index 271e4355..98e89801 100644 --- a/codegen/layouts/resource.hbs +++ b/codegen/layouts/resource.hbs @@ -6,18 +6,31 @@ namespace {{namespace}} { {{#if (hasPhpDoc this)}} {{{resourcePhpDoc this}}} {{/if}} - class {{className}} + {{#if isAbstract}}abstract {{else}}{{#if isFinal}}final {{/if}}{{/if}}class {{className}}{{#if extendsName}} extends {{extendsName}}{{/if}} { public static function from_json(mixed $json): {{className}}|null { if (!$json) { return null; } +{{#if factory}} + $discriminant = is_string($json->{{factory.discriminant}} ?? null) + ? {{factory.enumType}}::tryFrom($json->{{factory.discriminant}}) + : null; + + return match ($discriminant) { +{{#each factory.variants}} + {{enumCase}} => {{className}}::from_json($json), +{{/each}} + default => {{factory.fallbackClass}}::from_json($json), + }; +{{else}} return new self( {{#each fromJsonProps}} {{{this}}} {{/each}} ); +{{/if}} } public function __construct( @@ -28,9 +41,30 @@ namespace {{namespace}} { {{{declaration}}} {{/each}} ) { +{{#if parentArgs}} + parent::__construct( +{{#each parentArgs}} + {{{this}}} +{{/each}} + ); +{{/if}} } } +{{/each}} +{{#each enums}} + enum {{enumName}}: string + { +{{#each cases}} +{{#if description}} + /** + * {{description}} + */ +{{/if}} + case {{name}} = {{{value}}}; +{{/each}} + } + {{/each}} } diff --git a/codegen/lib/layouts/resource.ts b/codegen/lib/layouts/resource.ts index 03ea8c16..a8d2d47b 100644 --- a/codegen/lib/layouts/resource.ts +++ b/codegen/lib/layouts/resource.ts @@ -1,16 +1,9 @@ -// Builds the template context for resource files (src/Resources/{Name}.php): -// the resource class and the nested classes for its object properties, grouped -// into one braced namespace block per namespace. Each class contributes its -// from_json body lines and constructor parameter lines. -// -// Whether a property is required is carried on isOptional: an optional one -// gets a null default, a required one does not. Constructor parameters are -// emitted required first, since PHP deprecates an optional parameter -// declared before a required one. +// Builds the template context for generated resource files. import type { ResourceClassProperty, ResourceClassSchema, + ResourceEnumSchema, ResourceSchema, } from '../resource-model.js' @@ -19,8 +12,20 @@ export interface ClassLayoutContext { description: string isDeprecated: boolean deprecationMessage: string + isAbstract: boolean + isFinal: boolean + extendsName: string + factory?: FactoryLayoutContext fromJsonProps: string[] constructorParams: ConstructorParamLayoutContext[] + parentArgs: string[] +} + +export interface FactoryLayoutContext { + discriminant: string + enumType: string + fallbackClass: string + variants: Array<{ enumCase: string; className: string }> } export interface ConstructorParamLayoutContext { @@ -31,9 +36,15 @@ export interface ConstructorParamLayoutContext { deprecationMessage: string } +export interface EnumLayoutContext { + enumName: string + cases: Array<{ name: string; value: string; description: string }> +} + export interface NamespaceLayoutContext { namespace: string classes: ClassLayoutContext[] + enums: EnumLayoutContext[] } export interface ResourceLayoutContext { @@ -54,44 +65,49 @@ const generateFromJsonProp = (property: ResourceClassProperty): string => { return `${name}: $json->${name} ?? null,` case 'value': - return `${name}: $json->${name} ?? null,` + if (property.enumType == null) { + return `${name}: $json->${name} ?? null,` + } + return `${name}: is_string($json->${name} ?? null) ? ${property.enumType}::tryFrom($json->${name})${property.preserveUnknownEnum ? ` ?? $json->${name}` : ''} : null,` } } const generateConstructorParam = ( property: ResourceClassProperty, + promote: boolean, ): ConstructorParamLayoutContext => { - let declaration: string + let type: string let phpDocType = '' - // Resource decoding remains tolerant of sparse response envelopes. Optional - // properties can also be omitted when constructing a resource directly; - // nullable properties retain the same null-safe representation. const defaultValue = property.isOptional ? ' = null' : '' switch (property.kind) { case 'objectReference': - declaration = `public ${property.referenceName}|null $${property.name}${defaultValue},` + type = `${property.referenceName}|null` break case 'listReference': - declaration = `public array${property.isOptional ? '|null' : ''} $${property.name}${defaultValue},` + type = `array${property.isOptional ? '|null' : ''}` + phpDocType = `list<${property.referenceName}>${property.isOptional ? '|null' : ''}` break case 'record': + type = `${property.phpType}|null` phpDocType = `${property.phpDocType}|null` - declaration = `public ${property.phpType}|null $${property.name}${defaultValue},` break case 'value': { - const { phpType } = property - const nullSuffix = phpType === 'mixed' ? '' : '|null' - declaration = `public ${phpType}${nullSuffix} $${property.name}${defaultValue},` + const nullSuffix = property.phpType === 'mixed' ? '' : '|null' + type = `${property.phpType}${nullSuffix}` + phpDocType = + property.phpDocType === '' || property.phpDocType === property.phpType + ? '' + : `${property.phpDocType}|null` break } } return { - declaration, + declaration: `${promote ? 'public ' : ''}${type} $${property.name}${defaultValue},`, phpDocType, description: property.description, isDeprecated: property.isDeprecated, @@ -102,52 +118,70 @@ const generateConstructorParam = ( const getClassLayoutContext = ( schema: ResourceClassSchema, ): ClassLayoutContext => { - const sorted = [...schema.properties].sort((a, b) => - a.name.localeCompare(b.name), + const inheritedNames = new Set( + schema.inheritedProperties.map(({ name }) => name), ) - - const parameterOrder = sortRequiredFirst(sorted) + const properties = sortRequiredFirst([ + ...schema.inheritedProperties, + ...schema.properties, + ]) return { className: schema.name, description: schema.description, isDeprecated: schema.isDeprecated, deprecationMessage: schema.deprecationMessage, - fromJsonProps: sorted.map(generateFromJsonProp), - constructorParams: parameterOrder.map(generateConstructorParam), + isAbstract: schema.isAbstract, + isFinal: schema.isFinal, + extendsName: schema.extendsName, + ...(schema.factory == null ? {} : { factory: schema.factory }), + fromJsonProps: properties.map(generateFromJsonProp), + constructorParams: properties.map((property) => + generateConstructorParam(property, !inheritedNames.has(property.name)), + ), + parentArgs: schema.inheritedProperties.map( + ({ name }) => `${name}: $${name},`, + ), } } +const getEnumLayoutContext = ( + schema: ResourceEnumSchema, +): EnumLayoutContext => ({ + enumName: schema.name, + cases: schema.cases.map((enumCase) => ({ + ...enumCase, + value: JSON.stringify(enumCase.value), + })), +}) + const sortRequiredFirst = ( properties: ResourceClassProperty[], -): ResourceClassProperty[] => [ - ...properties.filter(({ isOptional }) => !isOptional), - ...properties.filter(({ isOptional }) => isOptional), -] +): ResourceClassProperty[] => + [...properties].sort( + (a, b) => + Number(a.isOptional) - Number(b.isOptional) || + a.name.localeCompare(b.name), + ) export const setResourceLayoutContext = ( resource: ResourceSchema, ): ResourceLayoutContext => { - // First appearance order, so the resource class leads the file and every - // owning namespace precedes the namespaces nested inside it. - const namespaces = new Map() - - for (const schema of resource.classes) { - const classes = namespaces.get(schema.namespace) - const context = getClassLayoutContext(schema) + const namespaces = new Map() - if (classes == null) { - namespaces.set(schema.namespace, [context]) - continue + for (const declaration of resource.declarations) { + let context = namespaces.get(declaration.namespace) + if (context == null) { + context = { namespace: declaration.namespace, classes: [], enums: [] } + namespaces.set(declaration.namespace, context) } - classes.push(context) + if (declaration.kind === 'class') { + context.classes.push(getClassLayoutContext(declaration)) + } else { + context.enums.push(getEnumLayoutContext(declaration)) + } } - return { - namespaces: [...namespaces.entries()].map(([namespace, classes]) => ({ - namespace, - classes, - })), - } + return { namespaces: [...namespaces.values()] } } diff --git a/codegen/lib/map-php-type.ts b/codegen/lib/map-php-type.ts index 0ea504a7..f7f206e0 100644 --- a/codegen/lib/map-php-type.ts +++ b/codegen/lib/map-php-type.ts @@ -7,7 +7,11 @@ type RecordValueType = NonNullable< Extract['valueTypes'] >[number] -export const getPhpType = (schema: Parameter | Property): string => { +export const getPhpType = ( + schema: Parameter | Property, + enumType = 'string', +): string => { + if (schema.format === 'enum') return enumType if (schema.format === 'record' && !('resourceType' in schema)) { return 'array|\\stdClass' } @@ -34,6 +38,10 @@ export const getPhpType = (schema: Parameter | Property): string => { } export const getPhpDocType = (schema: Parameter | Property): string => { + if (schema.format === 'list') { + return `list<${getListItemPhpType(schema)}>` + } + if (schema.format !== 'record' || 'resourceType' in schema) { return getPhpType(schema) } @@ -45,6 +53,23 @@ export const getPhpDocType = (schema: Parameter | Property): string => { return `array|\\stdClass` } +const getListItemPhpType = ( + schema: Extract, +): string => { + switch (schema.itemFormat) { + case 'number': + return 'isItemInt' in schema && schema.isItemInt ? 'int' : 'float' + case 'boolean': + return 'bool' + case 'object': + case 'record': + case 'discriminated_object': + return 'array|\\stdClass' + default: + return 'string' + } +} + const getRecordValuePhpType = (type: RecordValueType): string => { switch (type) { case 'string': diff --git a/codegen/lib/resource-model.ts b/codegen/lib/resource-model.ts index 5fb92983..5a4d5f85 100644 --- a/codegen/lib/resource-model.ts +++ b/codegen/lib/resource-model.ts @@ -1,25 +1,27 @@ // Builds the resource class model for src/Resources from the blueprint. // -// Each blueprint resource becomes a PHP class in its own file. A nested object -// property, or a list of objects, becomes its own class named after the -// property alone and declared in the namespace of the class that owns it, so -// the device battery is Seam\Resources\Device\Properties\Battery. Nesting the -// classes keeps Seam\Resources free of the hundreds of names that exist only -// to type a property, and lets two properties of the same name at different -// depths keep their own shapes. -// -// Discriminated unions (events, action attempts, and discriminated object -// lists) are flattened into a single class holding the union of the variant -// properties. - -import type { Blueprint, Property, Resource } from '@seamapi/blueprint' -import { pascalCase } from 'change-case' +// Nested objects are emitted recursively in the namespace of their owner. +// Discriminated resources and object lists are emitted as an abstract base, +// one final class per variant, and an unknown-discriminant fallback. + +import type { + Blueprint, + EnumProperty, + Property, + Resource, +} from '@seamapi/blueprint' +import { constantCase, pascalCase } from 'change-case' import { getPhpDocType, getPhpType } from './map-php-type.js' -import { mergeProperties } from './merge-properties.js' export type ResourceClassProperty = - | ({ kind: 'value'; phpType: string } & ResourceClassPropertyMetadata) + | ({ + kind: 'value' + phpType: string + phpDocType: string + enumType?: string + preserveUnknownEnum?: boolean + } & ResourceClassPropertyMetadata) | ({ kind: 'record' phpType: string @@ -43,18 +45,45 @@ interface ResourceClassPropertyMetadata { deprecationMessage: string } +export interface ResourceFactoryVariant { + enumCase: string + className: string +} + +export interface ResourceFactory { + discriminant: string + enumType: string + fallbackClass: string + variants: ResourceFactoryVariant[] +} + export interface ResourceClassSchema { + kind: 'class' name: string namespace: string description: string isDeprecated: boolean deprecationMessage: string + isAbstract: boolean + isFinal: boolean + extendsName: string properties: ResourceClassProperty[] + inheritedProperties: ResourceClassProperty[] + factory?: ResourceFactory +} + +export interface ResourceEnumSchema { + kind: 'enum' + name: string + namespace: string + cases: Array<{ name: string; value: string; description: string }> } +export type ResourceDeclaration = ResourceClassSchema | ResourceEnumSchema + export interface ResourceSchema { name: string - classes: ResourceClassSchema[] + declarations: ResourceDeclaration[] } export interface ResourceModel { @@ -63,15 +92,9 @@ export interface ResourceModel { } const rootNamespace = 'Seam\\Resources' - -// A cyclic schema would recurse forever. Real shapes are nowhere near this -// deep, so exceeding it means the blueprint is cyclic rather than nested. const maxDepth = 16 -// PHP reserves these as type names or keywords, so a class cannot be called -// any of them. Class names are case insensitive, so the check has to be too. const reservedClassNames = new Set([ - // Type names. 'array', 'bool', 'callable', @@ -90,7 +113,6 @@ const reservedClassNames = new Set([ 'string', 'true', 'void', - // Keywords. 'abstract', 'and', 'as', @@ -164,83 +186,96 @@ interface ClassDocs { deprecationMessage: string } -interface BuiltClass { - schema: ResourceClassSchema - nestedClasses: BuiltClass[] +interface BuiltDeclaration { + declaration: ResourceDeclaration + nestedDeclarations: BuiltDeclaration[] } -export const createResourceModel = (blueprint: Blueprint): ResourceModel => { - 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. - const { events } = blueprint - if (events.length > 0) { - baseResources.set( - 'event', - mergeProperties( - events.map((event) => event.properties), - 'event', - ), - ) - } - - const { actionAttempts } = blueprint - if (actionAttempts.length > 0) { - baseResources.set( - 'action_attempt', - mergeProperties( - actionAttempts.map((actionAttempt) => actionAttempt.properties), - 'action_attempt', - ), - ) - } - - const baseResourceTypes = [...baseResources.keys()].sort() +interface VariantInput { + properties: Property[] + description: string +} - const resources = baseResourceTypes.map((resourceType) => { +export const createResourceModel = (blueprint: Blueprint): ResourceModel => { + const discriminatedTypes = new Set( + [...blueprint.events, ...blueprint.actionAttempts].map( + ({ resourceType }) => resourceType, + ), + ) + const resources = new Map( + blueprint.resources + .filter(({ resourceType }) => !discriminatedTypes.has(resourceType)) + .map((resource) => [resource.resourceType, resource] as const), + ) + + const resourceTypes: string[] = [ + ...resources.keys(), + ...(blueprint.events.length > 0 ? ['event'] : []), + ...(blueprint.actionAttempts.length > 0 ? ['action_attempt'] : []), + ].sort() + + const schemas = resourceTypes.map((resourceType): ResourceSchema => { const name = pascalCase(resourceType) - const sourceResource = getSourceResource(blueprint, resourceType) - - const built = buildClass( - name, - rootNamespace, - baseResources.get(resourceType) ?? [], - resourceType, - 0, - { - description: sourceResource?.description ?? '', - isDeprecated: sourceResource?.isDeprecated ?? false, - deprecationMessage: sourceResource?.deprecationMessage ?? '', - }, - ) + let built: BuiltDeclaration + + if (resourceType === 'event') { + built = buildDiscriminatedClass( + name, + rootNamespace, + blueprint.events, + 'event_type', + resourceType, + 0, + { + description: 'Base class for events returned by the Seam API.', + isDeprecated: false, + deprecationMessage: '', + }, + 'UnknownEvent', + ) + } else if (resourceType === 'action_attempt') { + built = buildDiscriminatedClass( + name, + rootNamespace, + blueprint.actionAttempts, + 'action_type', + resourceType, + 0, + { + description: + 'Base class for actions whose completion is tracked asynchronously.', + isDeprecated: false, + deprecationMessage: '', + }, + 'UnknownActionAttempt', + true, + ) + } else { + const resource = resources.get(resourceType) + built = buildClass( + name, + rootNamespace, + resource?.properties ?? [], + resourceType, + 0, + docsFor(resource), + ) + } - return { name, classes: flattenClasses(built) } + return { name, declarations: flattenDeclarations(built) } }) return { - resourceNames: resources.map((resource) => resource.name), - resources, + resourceNames: schemas.map(({ name }) => name), + resources: schemas, } } -const getSourceResource = ( - blueprint: Blueprint, - resourceType: string, -): Resource | undefined => - blueprint.resources.find( - (resource) => resource.resourceType === resourceType, - ) ?? - (resourceType === 'event' - ? blueprint.events[0] - : resourceType === 'action_attempt' - ? blueprint.actionAttempts[0] - : undefined) +const docsFor = (resource: Resource | undefined): ClassDocs => ({ + description: resource?.description ?? '', + isDeprecated: resource?.isDeprecated ?? false, + deprecationMessage: resource?.deprecationMessage ?? '', +}) const buildClass = ( className: string, @@ -249,128 +284,411 @@ const buildClass = ( path: string, depth: number, docs: ClassDocs, -): BuiltClass => { - if (depth > maxDepth) { - throw new Error( - `Cannot generate ${path}: nesting exceeded a depth of ${maxDepth}, which means the schema is cyclic`, - ) - } + options: { + isAbstract?: boolean + isFinal?: boolean + extendsName?: string + inheritedProperties?: ResourceClassProperty[] + factory?: ResourceFactory + enumOverrides?: Map + } = {}, +): BuiltDeclaration => { + assertDepth(path, depth) - // A class at namespace N with short name S owns its children at N\S. const nestedNamespace = `${namespace}\\${className}` - const nestedClasses: BuiltClass[] = [] - const takenClassNames = new Set() + const nestedDeclarations: BuiltDeclaration[] = [] + const takenNames = new Set() const properties = classProperties.map((property): ResourceClassProperty => { - const metadata = { - name: property.name, - description: property.description, - isOptional: property.isOptional, - isNullable: property.isNullable, - isDeprecated: property.isDeprecated, - deprecationMessage: property.deprecationMessage, - } - - const nestedProperties = getNestedProperties( - property, - `${path}.${property.name}`, - ) - - if (nestedProperties == null) { - return property.format === 'record' && !('resourceType' in property) - ? { - ...metadata, - kind: 'record', - phpType: getPhpType(property), - phpDocType: getPhpDocType(property), - } - : { ...metadata, kind: 'value', phpType: getPhpType(property) } - } - - const nestedClassName = pascalCase(property.name) + const metadata = propertyMetadata(property) const nestedPath = `${path}.${property.name}` + const nestedClassName = pascalCase(property.name) - if (reservedClassNames.has(nestedClassName.toLowerCase())) { - throw new Error( - `Cannot generate ${nestedPath}: ${nestedClassName} is reserved in PHP`, + if (property.format === 'enum') { + const override = options.enumOverrides?.get(property.name) + if (override != null) { + return { + ...metadata, + kind: 'value', + phpType: `${override.type}${override.preserveUnknown ? '|string' : ''}`, + phpDocType: '', + enumType: override.type, + ...(override.preserveUnknown ? { preserveUnknownEnum: true } : {}), + } + } + + assertAvailableName( + nestedClassName, + nestedPath, + nestedNamespace, + takenNames, ) + const enumType = `\\${nestedNamespace}\\${nestedClassName}` + nestedDeclarations.push( + buildEnum(nestedClassName, nestedNamespace, property), + ) + return { + ...metadata, + kind: 'value', + phpType: enumType, + phpDocType: '', + enumType, + } } - if (takenClassNames.has(nestedClassName)) { - throw new Error( - `Cannot generate ${nestedPath}: ${nestedClassName} is already used by a sibling property in ${nestedNamespace}`, + if ( + property.format === 'list' && + property.itemFormat === 'discriminated_object' + ) { + assertAvailableName( + nestedClassName, + nestedPath, + nestedNamespace, + takenNames, + ) + nestedDeclarations.push( + buildDiscriminatedClass( + nestedClassName, + nestedNamespace, + property.variants, + property.discriminator, + nestedPath, + depth + 1, + propertyDocs(property), + 'Unknown', + ), ) + return { + ...metadata, + kind: 'listReference', + referenceName: `\\${nestedNamespace}\\${nestedClassName}`, + } } - takenClassNames.add(nestedClassName) - - nestedClasses.push( - buildClass( + const nestedProperties = getNestedProperties(property) + if (nestedProperties != null) { + assertAvailableName( nestedClassName, - nestedNamespace, - nestedProperties, nestedPath, - depth + 1, - { - description: property.description, - isDeprecated: property.isDeprecated, - deprecationMessage: property.deprecationMessage, - }, - ), - ) - - // Referenced relative to the namespace the owning class is declared in, - // so PHP resolves Device\Properties from within Seam\Resources. - return { - ...metadata, - kind: property.format === 'list' ? 'listReference' : 'objectReference', - referenceName: `${className}\\${nestedClassName}`, + nestedNamespace, + takenNames, + ) + nestedDeclarations.push( + buildClass( + nestedClassName, + nestedNamespace, + nestedProperties, + nestedPath, + depth + 1, + propertyDocs(property), + ), + ) + const referenceName = `\\${nestedNamespace}\\${nestedClassName}` + return { + ...metadata, + kind: property.format === 'list' ? 'listReference' : 'objectReference', + referenceName, + } } + + return property.format === 'record' && !('resourceType' in property) + ? { + ...metadata, + kind: 'record', + phpType: getPhpType(property), + phpDocType: getPhpDocType(property), + } + : { + ...metadata, + kind: 'value', + phpType: getPhpType(property), + phpDocType: getPhpDocType(property), + } }) return { - schema: { + declaration: { + kind: 'class', name: className, namespace, ...docs, + isAbstract: options.isAbstract ?? false, + isFinal: options.isFinal ?? false, + extendsName: options.extendsName ?? '', properties, + inheritedProperties: options.inheritedProperties ?? [], + ...(options.factory == null ? {} : { factory: options.factory }), }, - nestedClasses, + nestedDeclarations, } } -// Decides whether a property earns a class of its own. An object with no -// documented properties stays a plain value rather than becoming an empty -// class. -const getNestedProperties = ( - property: Property, +const buildDiscriminatedClass = ( + className: string, + namespace: string, + variants: VariantInput[], + discriminator: string, path: string, -): Property[] | undefined => { - if (property.format === 'object') { - return property.properties.length > 0 ? property.properties : undefined + depth: number, + docs: ClassDocs, + fallbackName: string, + actionAttempt = false, +): BuiltDeclaration => { + assertDepth(path, depth) + if (variants.length === 0) { + return buildClass(className, namespace, [], path, depth, docs) } - if (property.format === 'list') { - if (property.itemFormat === 'object') { - return property.itemProperties.length > 0 - ? property.itemProperties - : undefined + const variantInfo = variants.map((variant) => { + const property = variant.properties.find( + ({ name }) => name === discriminator, + ) + if (property?.format !== 'enum' || property.values.length !== 1) { + throw new Error( + `Cannot generate ${path}: ${discriminator} is not a single-value enum`, + ) } + return { variant, value: property.values[0]?.name ?? '' } + }) - if (property.itemFormat === 'discriminated_object') { - const itemProperties = mergeProperties( - property.variants.map((variant) => variant.properties), - path, + const commonNames = new Set( + variants[0]?.properties + .filter((property) => + variants.every((variant) => { + const candidate = variant.properties.find( + ({ name }) => name === property.name, + ) + return ( + candidate != null && + (property.name === discriminator || + (actionAttempt && property.name === 'error') || + propertyShape(candidate) === propertyShape(property)) + ) + }), ) - return itemProperties.length > 0 ? itemProperties : undefined - } + .map(({ name }) => name) ?? [], + ) + + const commonProperties = (variants[0]?.properties ?? []) + .filter(({ name }) => commonNames.has(name)) + .map((property) => { + if (property.format !== 'enum') return property + const values = uniqueEnumValues( + variants.flatMap( + (variant) => + ( + variant.properties.find(({ name }) => name === property.name) as + EnumProperty | undefined + )?.values ?? [], + ), + ) + return { ...property, values } + }) + .map((property) => { + if (!actionAttempt || !['error', 'result'].includes(property.name)) { + return property + } + return { + ...property, + description: `${property.description}${property.description === '' ? '' : ' '}Null while the action attempt is pending or when this value does not apply.`, + } + }) + + const discriminantProperty = commonProperties.find( + ({ name }) => name === discriminator, + ) + if (discriminantProperty?.format !== 'enum') { + throw new Error(`Cannot generate ${path}: missing ${discriminator}`) + } + + const enumName = pascalCase(discriminator) + const enumType = `\\${namespace}\\${className}\\${enumName}` + const factory: ResourceFactory = { + discriminant: discriminator, + enumType, + fallbackClass: `\\${namespace}\\${className}\\${fallbackName}`, + variants: variantInfo.map(({ value }) => ({ + enumCase: `${enumType}::${enumCaseName(value)}`, + className: `\\${namespace}\\${className}\\${pascalCase(value)}`, + })), + } + + const built = buildClass( + className, + namespace, + commonProperties, + path, + depth, + docs, + { isAbstract: true, factory }, + ) + const base = built.declaration + if (base.kind !== 'class') throw new Error(`Cannot generate ${path}`) + const discriminant = base.properties.find( + ({ name }) => name === discriminator, + ) + if (discriminant?.kind === 'value') { + discriminant.phpType = `${discriminant.phpType}|string` + discriminant.preserveUnknownEnum = true + } + + const baseName = `\\${namespace}\\${className}` + for (const { variant, value } of variantInfo) { + const ownProperties = variant.properties + .filter(({ name }) => !commonNames.has(name)) + .map((property) => { + if (!actionAttempt || property.name !== 'result') return property + return { + ...property, + description: `${property.description}${property.description === '' ? '' : ' '}Null while the action attempt is pending or when this value does not apply.`, + } + }) + built.nestedDeclarations.push( + buildClass( + pascalCase(value), + `${namespace}\\${className}`, + ownProperties, + `${path}.${value}`, + depth + 1, + { + description: variant.description, + isDeprecated: false, + deprecationMessage: '', + }, + { + isFinal: true, + extendsName: baseName, + inheritedProperties: base.properties, + }, + ), + ) } + built.nestedDeclarations.push( + buildClass( + fallbackName, + `${namespace}\\${className}`, + [], + `${path}.unknown`, + depth + 1, + { + description: `Fallback for ${path} values introduced after this SDK version.`, + isDeprecated: false, + deprecationMessage: '', + }, + { + isFinal: true, + extendsName: baseName, + inheritedProperties: base.properties, + }, + ), + ) + + return built +} + +const buildEnum = ( + name: string, + namespace: string, + property: EnumProperty, +): BuiltDeclaration => ({ + declaration: { + kind: 'enum', + name, + namespace, + cases: uniqueEnumValues(property.values).map((value) => ({ + name: enumCaseName(value.name), + value: value.name, + description: value.description, + })), + }, + nestedDeclarations: [], +}) + +const enumCaseName = (value: string): string => { + const name = constantCase(value) + return /^[A-Z_]/.test(name) && !reservedClassNames.has(name.toLowerCase()) + ? name + : `VALUE_${name}` +} + +const uniqueEnumValues = (values: T[]): T[] => [ + ...new Map(values.map((value) => [value.name, value])).values(), +] + +const propertyShape = (property: Property): string => + JSON.stringify(property, (key, value: unknown) => + [ + 'description', + 'isDeprecated', + 'deprecationMessage', + 'isUndocumented', + 'undocumentedMessage', + 'isDraft', + 'draftMessage', + 'propertyGroupKey', + ].includes(key) + ? undefined + : value, + ) + +const propertyMetadata = ( + property: Property, +): ResourceClassPropertyMetadata => ({ + name: property.name, + description: property.description, + isOptional: property.isOptional, + isNullable: property.isNullable, + isDeprecated: property.isDeprecated, + deprecationMessage: property.deprecationMessage, +}) + +const propertyDocs = (property: Property): ClassDocs => ({ + description: property.description, + isDeprecated: property.isDeprecated, + deprecationMessage: property.deprecationMessage, +}) + +const getNestedProperties = (property: Property): Property[] | undefined => { + if (property.format === 'object') { + return property.properties.length > 0 ? property.properties : undefined + } + if (property.format === 'list' && property.itemFormat === 'object') { + return property.itemProperties.length > 0 + ? property.itemProperties + : undefined + } return undefined } -// Depth first, so an owning class always precedes the children it references. -const flattenClasses = (built: BuiltClass): ResourceClassSchema[] => [ - built.schema, - ...built.nestedClasses.flatMap(flattenClasses), +const assertDepth = (path: string, depth: number): void => { + if (depth > maxDepth) { + throw new Error( + `Cannot generate ${path}: nesting exceeded a depth of ${maxDepth}, which means the schema is cyclic`, + ) + } +} + +const assertAvailableName = ( + name: string, + path: string, + namespace: string, + takenNames: Set, +): void => { + if (reservedClassNames.has(name.toLowerCase())) { + throw new Error(`Cannot generate ${path}: ${name} is reserved in PHP`) + } + if (takenNames.has(name.toLowerCase())) { + throw new Error( + `Cannot generate ${path}: ${name} is already used in ${namespace}`, + ) + } + takenNames.add(name.toLowerCase()) +} + +const flattenDeclarations = ( + built: BuiltDeclaration, +): ResourceDeclaration[] => [ + built.declaration, + ...built.nestedDeclarations.flatMap(flattenDeclarations), ] diff --git a/src/Http/ResolveActionAttempt.php b/src/Http/ResolveActionAttempt.php index 90c3db54..3d645c28 100644 --- a/src/Http/ResolveActionAttempt.php +++ b/src/Http/ResolveActionAttempt.php @@ -8,6 +8,7 @@ use Seam\InvalidOptionsError; use Seam\InvalidResponseError; use Seam\Resources\ActionAttempt; +use Seam\Resources\ActionAttempt\Status; /** * Waits for an action attempt to reach a terminal state. @@ -72,11 +73,11 @@ private static function poll( $deadline = self::now() + $timeout; while (true) { - if ($action_attempt->status === "success") { + if ($action_attempt->status === Status::SUCCESS) { return $action_attempt; } - if ($action_attempt->status === "error") { + if ($action_attempt->status === Status::ERROR) { throw new ActionAttemptFailedError($action_attempt); } diff --git a/src/Resources/AccessCode.php b/src/Resources/AccessCode.php index bbdb20bc..5129e3a9 100644 --- a/src/Resources/AccessCode.php +++ b/src/Resources/AccessCode.php @@ -25,19 +25,10 @@ public static function from_json(mixed $json): AccessCode|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, - ) - ? AccessCode\DormakabaOracodeMetadata::from_json( - $json->dormakaba_oracode_metadata, - ) - : null, - ends_at: $json->ends_at ?? null, errors: array_map( - fn($e) => AccessCode\Errors::from_json($e), + fn($e) => \Seam\Resources\AccessCode\Errors::from_json($e), $json->errors ?? [], ), - 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 ?? @@ -45,24 +36,43 @@ public static function from_json(mixed $json): AccessCode|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, name: $json->name ?? null, pending_mutations: array_map( - fn($p) => AccessCode\PendingMutations::from_json($p), + fn( + $p, + ) => \Seam\Resources\AccessCode\PendingMutations::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, + status: is_string($json->status ?? null) + ? \Seam\Resources\AccessCode\Status::tryFrom($json->status) + : null, + type: is_string($json->type ?? null) + ? \Seam\Resources\AccessCode\Type::tryFrom($json->type) + : null, warnings: array_map( - fn($w) => AccessCode\Warnings::from_json($w), + fn($w) => \Seam\Resources\AccessCode\Warnings::from_json( + $w, + ), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + dormakaba_oracode_metadata: isset( + $json->dormakaba_oracode_metadata, + ) + ? \Seam\Resources\AccessCode\DormakabaOracodeMetadata::from_json( + $json->dormakaba_oracode_metadata, + ) + : null, + ends_at: $json->ends_at ?? null, + is_backup: $json->is_backup ?? null, + is_scheduled_on_device: $json->is_scheduled_on_device ?? null, + is_waiting_for_code_assignment: $json->is_waiting_for_code_assignment ?? + null, + pulled_backup_access_code_id: $json->pulled_backup_access_code_id ?? + null, + starts_at: $json->starts_at ?? null, ); } @@ -89,6 +99,8 @@ public function __construct( public string|null $device_id, /** * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * + * @var list<\Seam\Resources\AccessCode\Errors> */ public array $errors, /** @@ -117,18 +129,22 @@ public function __construct( public string|null $name, /** * Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device. + * + * @var list<\Seam\Resources\AccessCode\PendingMutations> */ public array $pending_mutations, /** * Current status of the access code within the operational lifecycle. Values are `setting`, a transitional phase that indicates that the code is being configured or activated; `set`, which indicates that the code is active and operational; `unset`, which indicates a deactivated or unused state, either before activation or after deliberate deactivation; `removing`, which indicates a transitional period in which the code is being deleted or made inactive; and `unknown`, which indicates an indeterminate state, due to reasons such as system errors or incomplete data, that highlights a potential need for system review or troubleshooting. See also [Lifecycle of Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/lifecycle-of-access-codes). */ - public string|null $status, + public \Seam\Resources\AccessCode\Status|null $status, /** * Type of the access code. `ongoing` access codes are active continuously until deactivated manually. `time_bound` access codes have a specific duration. */ - public string|null $type, + public \Seam\Resources\AccessCode\Type|null $type, /** * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * + * @var list<\Seam\Resources\AccessCode\Warnings> */ public array $warnings, /** @@ -138,7 +154,7 @@ public function __construct( /** * Metadata for a dormakaba Oracode managed access code. Only present for access codes from dormakaba Oracode devices. */ - public AccessCode\DormakabaOracodeMetadata|null $dormakaba_oracode_metadata = null, + public \Seam\Resources\AccessCode\DormakabaOracodeMetadata|null $dormakaba_oracode_metadata = null, /** * Date and time after which the time-bound access code becomes inactive. */ @@ -230,97 +246,168 @@ public function __construct( /** * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - 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) => Errors\ModifiedFields::from_json($m), - $json->modified_fields ?? [], + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessCode\Errors\ErrorCode::PROVIDER_ISSUE + => \Seam\Resources\AccessCode\Errors\ProviderIssue::from_json( + $json, ), - unmanaged_access_code_id: $json->unmanaged_access_code_id ?? - null, - ); + \Seam\Resources\AccessCode\Errors\ErrorCode::FAILED_TO_SET_ON_DEVICE + => \Seam\Resources\AccessCode\Errors\FailedToSetOnDevice::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::FAILED_TO_REMOVE_FROM_DEVICE + => \Seam\Resources\AccessCode\Errors\FailedToRemoveFromDevice::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::DUPLICATE_CODE_ON_DEVICE + => \Seam\Resources\AccessCode\Errors\DuplicateCodeOnDevice::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::NO_SPACE_FOR_ACCESS_CODE_ON_DEVICE + => \Seam\Resources\AccessCode\Errors\NoSpaceForAccessCodeOnDevice::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::CONFLICTING_EXTERNAL_MODIFICATION + => \Seam\Resources\AccessCode\Errors\ConflictingExternalModification::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::ACCESS_CODE_INACTIVE + => \Seam\Resources\AccessCode\Errors\AccessCodeInactive::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::ACCOUNT_DISCONNECTED + => \Seam\Resources\AccessCode\Errors\AccountDisconnected::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED + => \Seam\Resources\AccessCode\Errors\SaltoKsSubscriptionLimitExceeded::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::INSUFFICIENT_PERMISSIONS + => \Seam\Resources\AccessCode\Errors\InsufficientPermissions::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::DORMAKABA_SITES_DISCONNECTED + => \Seam\Resources\AccessCode\Errors\DormakabaSitesDisconnected::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::DEVICE_OFFLINE + => \Seam\Resources\AccessCode\Errors\DeviceOffline::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::DEVICE_REMOVED + => \Seam\Resources\AccessCode\Errors\DeviceRemoved::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::HUB_DISCONNECTED + => \Seam\Resources\AccessCode\Errors\HubDisconnected::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::DEVICE_DISCONNECTED + => \Seam\Resources\AccessCode\Errors\DeviceDisconnected::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::EMPTY_BACKUP_ACCESS_CODE_POOL + => \Seam\Resources\AccessCode\Errors\EmptyBackupAccessCodePool::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::AUGUST_LOCK_NOT_AUTHORIZED + => \Seam\Resources\AccessCode\Errors\AugustLockNotAuthorized::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS + => \Seam\Resources\AccessCode\Errors\MissingDeviceCredentials::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::AUXILIARY_HEAT_RUNNING + => \Seam\Resources\AccessCode\Errors\AuxiliaryHeatRunning::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::SUBSCRIPTION_REQUIRED + => \Seam\Resources\AccessCode\Errors\SubscriptionRequired::from_json( + $json, + ), + \Seam\Resources\AccessCode\Errors\ErrorCode::BRIDGE_DISCONNECTED + => \Seam\Resources\AccessCode\Errors\BridgeDisconnected::from_json( + $json, + ), + default => \Seam\Resources\AccessCode\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, - /** - * Indicates that this is an access code error. - */ - public true|null $is_access_code_error, - public bool|null $is_connected_account_error, - public bool|null $is_device_error, + public \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, - /** - * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. - */ - public string|null $change_type = null, - /** - * Date and time at which Seam created the error. - */ - public string|null $created_at = null, - /** - * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). - */ - public bool|null $is_bridge_error = null, - /** - * ID of the managed access code that conflicts with this managed access code, when Seam can identify it. - */ - public string|null $managed_access_code_id = null, - /** - * List of fields that were changed externally, with their previous and new values. - */ - public array|null $modified_fields = null, - /** - * ID of the unmanaged access code that conflicts with this managed access code, when Seam can identify it. - */ - public string|null $unmanaged_access_code_id = null, ) {} } /** * Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device. */ - class PendingMutations + abstract class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - from: isset($json->from) - ? PendingMutations\From::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) - ? PendingMutations\To::from_json($json->to) - : null, - ); + $discriminant = is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessCode\PendingMutations\MutationCode::CREATING + => \Seam\Resources\AccessCode\PendingMutations\Creating::from_json( + $json, + ), + \Seam\Resources\AccessCode\PendingMutations\MutationCode::DEFERRING_CREATION + => \Seam\Resources\AccessCode\PendingMutations\DeferringCreation::from_json( + $json, + ), + \Seam\Resources\AccessCode\PendingMutations\MutationCode::DELETING + => \Seam\Resources\AccessCode\PendingMutations\Deleting::from_json( + $json, + ), + \Seam\Resources\AccessCode\PendingMutations\MutationCode::UPDATING_CODE + => \Seam\Resources\AccessCode\PendingMutations\UpdatingCode::from_json( + $json, + ), + \Seam\Resources\AccessCode\PendingMutations\MutationCode::UPDATING_NAME + => \Seam\Resources\AccessCode\PendingMutations\UpdatingName::from_json( + $json, + ), + \Seam\Resources\AccessCode\PendingMutations\MutationCode::UPDATING_TIME_FRAME + => \Seam\Resources\AccessCode\PendingMutations\UpdatingTimeFrame::from_json( + $json, + ), + default + => \Seam\Resources\AccessCode\PendingMutations\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -328,40 +415,83 @@ public function __construct( * Date and time at which the mutation was created. */ public string|null $created_at, - public PendingMutations\From|null $from, /** * Detailed description of the mutation. */ public string|null $message, - public string|null $mutation_code, /** - * Date and time at which Seam will attempt to program this access code on the device. + * Mutation code to indicate that Seam is in the process of setting an access code on the device. */ - public string|null $scheduled_at, - public PendingMutations\To|null $to, + public \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, ) {} } /** * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { if (!$json) { return null; } - return new self( - change_type: $json->change_type ?? null, - created_at: $json->created_at ?? null, - message: $json->message ?? null, - modified_fields: array_map( - fn($m) => Warnings\ModifiedFields::from_json($m), - $json->modified_fields ?? [], + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessCode\Warnings\WarningCode::CODE_ROTATES_PERIODICALLY + => \Seam\Resources\AccessCode\Warnings\CodeRotatesPeriodically::from_json( + $json, ), - warning_code: $json->warning_code ?? null, - ); + \Seam\Resources\AccessCode\Warnings\WarningCode::TIME_FRAME_ADJUSTED_FOR_UNKNOWN_TIME_ZONE + => \Seam\Resources\AccessCode\Warnings\TimeFrameAdjustedForUnknownTimeZone::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::EXTERNAL_MODIFICATION_IN_EFFECT + => \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::DELAY_IN_SETTING_ON_DEVICE + => \Seam\Resources\AccessCode\Warnings\DelayInSettingOnDevice::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::DELAY_IN_REMOVING_FROM_DEVICE + => \Seam\Resources\AccessCode\Warnings\DelayInRemovingFromDevice::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::THIRD_PARTY_INTEGRATION_DETECTED + => \Seam\Resources\AccessCode\Warnings\ThirdPartyIntegrationDetected::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::IGLOO_ALGOPIN_MUST_BE_USED_WITHIN_24_HOURS + => \Seam\Resources\AccessCode\Warnings\IglooAlgopinMustBeUsedWithin_24Hours::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::MANAGEMENT_TRANSFERRED + => \Seam\Resources\AccessCode\Warnings\ManagementTransferred::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::USING_BACKUP_ACCESS_CODE + => \Seam\Resources\AccessCode\Warnings\UsingBackupAccessCode::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\AccessCode\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\AccessCode\Warnings\WarningCode::UNKNOWN_ISSUE_WITH_ACCESS_CODE + => \Seam\Resources\AccessCode\Warnings\UnknownIssueWithAccessCode::from_json( + $json, + ), + default + => \Seam\Resources\AccessCode\Warnings\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -372,155 +502,2260 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, - /** - * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. - */ - public string|null $change_type = null, + public \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, /** * Date and time at which Seam created the warning. */ public string|null $created_at = null, - /** - * List of fields that were changed externally, with their previous and new values. - */ - public array|null $modified_fields = null, ) {} } + + enum Status: string + { + case SETTING = "setting"; + case SET = "set"; + case VALUE_UNSET = "unset"; + case REMOVING = "removing"; + case UNKNOWN = "unknown"; + } + + enum Type: string + { + case TIME_BOUND = "time_bound"; + case ONGOING = "ongoing"; + } } namespace Seam\Resources\AccessCode\Errors { /** - * List of fields that were changed externally, with their previous and new values. + * Indicates a provider-specific issue that prevents the access code from being set or managed. Check the error message for details. */ - class ModifiedFields + final class ProviderIssue extends \Seam\Resources\AccessCode\Errors { - public static function from_json(mixed $json): ModifiedFields|null + public static function from_json(mixed $json): ProviderIssue|null { if (!$json) { return null; } return new self( - field: $json->field ?? null, - from: $json->from ?? null, - to: $json->to ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, ); } public function __construct( /** - * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $field, + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, /** - * The previous value of the field. + * Indicates that this is an access code error. */ - public string|null $from, + public true|null $is_access_code_error, /** - * The new value of the field. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $to, - ) {} + string|null $message, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } } -} -namespace Seam\Resources\AccessCode\PendingMutations { - class From + /** + * Failed to set code on device. + */ + final class FailedToSetOnDevice extends \Seam\Resources\AccessCode\Errors { - public static function from_json(mixed $json): From|null + public static function from_json(mixed $json): FailedToSetOnDevice|null { if (!$json) { 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, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, ); } public function __construct( /** - * Previous PIN code. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $code, + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, /** - * Previous end time for the access code. + * Indicates that this is an access code error. */ - public string|null $ends_at, + public true|null $is_access_code_error, /** - * Previous access code name. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $name, + string|null $message, /** - * Previous start time for the access code. + * Date and time at which Seam created the error. */ - public string|null $starts_at, - ) {} + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } } - class To + /** + * Failed to remove code from device. + */ + final class FailedToRemoveFromDevice extends + \Seam\Resources\AccessCode\Errors { - public static function from_json(mixed $json): To|null - { + public static function from_json( + mixed $json, + ): FailedToRemoveFromDevice|null { if (!$json) { 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, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, ); } public function __construct( /** - * New PIN code. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $code, + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, /** - * New end time for the access code. + * Indicates that this is an access code error. */ - public string|null $ends_at, + public true|null $is_access_code_error, /** - * New access code name. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $name, + string|null $message, /** - * New start time for the access code. + * Date and time at which Seam created the error. */ - public string|null $starts_at, - ) {} + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } } -} -namespace Seam\Resources\AccessCode\Warnings { /** - * List of fields that were changed externally, with their previous and new values. + * Duplicate access code detected on device. */ - class ModifiedFields + final class DuplicateCodeOnDevice extends \Seam\Resources\AccessCode\Errors { - public static function from_json(mixed $json): ModifiedFields|null - { + public static function from_json( + mixed $json, + ): DuplicateCodeOnDevice|null { if (!$json) { return null; } return new self( - field: $json->field ?? null, - from: $json->from ?? null, - to: $json->to ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, + managed_access_code_id: $json->managed_access_code_id ?? null, + unmanaged_access_code_id: $json->unmanaged_access_code_id ?? + null, ); } public function __construct( /** - * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $field, + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, /** - * The previous value of the field. + * Indicates that this is an access code error. + */ + public true|null $is_access_code_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + /** + * ID of the managed access code that conflicts with this managed access code, when Seam can identify it. + */ + public string|null $managed_access_code_id = null, + /** + * ID of the unmanaged access code that conflicts with this managed access code, when Seam can identify it. + */ + public string|null $unmanaged_access_code_id = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * No space for access code on device. + */ + final class NoSpaceForAccessCodeOnDevice extends + \Seam\Resources\AccessCode\Errors + { + public static function from_json( + mixed $json, + ): NoSpaceForAccessCodeOnDevice|null { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that this is an access code error. + */ + public true|null $is_access_code_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Code was modified or removed externally after Seam successfully set it on the device. The external change conflicts with the state that Seam is trying to apply, so Seam will attempt to set the code on the device again. + */ + final class ConflictingExternalModification extends + \Seam\Resources\AccessCode\Errors + { + public static function from_json( + mixed $json, + ): ConflictingExternalModification|null { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + change_type: is_string($json->change_type ?? null) + ? \Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ChangeType::tryFrom( + $json->change_type, + ) + : null, + created_at: $json->created_at ?? null, + modified_fields: array_map( + fn( + $m, + ) => \Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ModifiedFields::from_json( + $m, + ), + $json->modified_fields ?? [], + ), + ); + } + + public function __construct( + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that this is an access code error. + */ + public true|null $is_access_code_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + */ + public \Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ChangeType|null $change_type = null, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + /** + * List of fields that were changed externally, with their previous and new values. + * + * @var list<\Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ModifiedFields>|null + */ + public array|null $modified_fields = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the access code is disabled or inactive on the device. The code exists but will not grant access until re-enabled. + */ + final class AccessCodeInactive extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): AccessCodeInactive|null + { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that this is an access code error. + */ + public true|null $is_access_code_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the account is disconnected. + */ + final class AccountDisconnected extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): AccountDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the Salto site user limit has been reached. + */ + final class SaltoKsSubscriptionLimitExceeded extends + \Seam\Resources\AccessCode\Errors + { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitExceeded|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that Seam's integration user does not have sufficient permissions on the provider's system to which this device belongs, so Seam cannot manage access codes or unlock the device. See the error message for specifics, then either reauthorize the connected account in Seam or grant the integration user the required permissions in the provider's system. + */ + final class InsufficientPermissions extends + \Seam\Resources\AccessCode\Errors + { + public static function from_json( + mixed $json, + ): InsufficientPermissions|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that one or more dormakaba sites associated with the connected account could not be connected. Contact dormakaba support. + */ + final class DormakabaSitesDisconnected extends + \Seam\Resources\AccessCode\Errors + { + public static function from_json( + mixed $json, + ): DormakabaSitesDisconnected|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the device is offline. + */ + final class DeviceOffline extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): DeviceOffline|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the device has been removed. + */ + final class DeviceRemoved extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): DeviceRemoved|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the hub is disconnected. + */ + final class HubDisconnected extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): HubDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the device is disconnected. + */ + final class DeviceDisconnected extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): DeviceDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) is empty. + */ + final class EmptyBackupAccessCodePool extends + \Seam\Resources\AccessCode\Errors + { + public static function from_json( + mixed $json, + ): EmptyBackupAccessCodePool|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the user is not authorized to use the August lock. + */ + final class AugustLockNotAuthorized extends + \Seam\Resources\AccessCode\Errors + { + public static function from_json( + mixed $json, + ): AugustLockNotAuthorized|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that device credentials are missing. + */ + final class MissingDeviceCredentials extends + \Seam\Resources\AccessCode\Errors + { + public static function from_json( + mixed $json, + ): MissingDeviceCredentials|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the auxiliary heat is running. + */ + final class AuxiliaryHeatRunning extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): AuxiliaryHeatRunning|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that a subscription is required to connect. + */ + final class SubscriptionRequired extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): SubscriptionRequired|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the Seam API cannot communicate with [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge), for example, if the Seam Bridge executable has stopped or if the computer running the Seam Bridge executable is offline. See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-seam_bridge_disconnected). + */ + final class BridgeDisconnected extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): BridgeDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + public bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + public bool|null $is_connected_account_error = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Fallback for access_code.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + enum ErrorCode: string + { + case PROVIDER_ISSUE = "provider_issue"; + case FAILED_TO_SET_ON_DEVICE = "failed_to_set_on_device"; + case FAILED_TO_REMOVE_FROM_DEVICE = "failed_to_remove_from_device"; + case DUPLICATE_CODE_ON_DEVICE = "duplicate_code_on_device"; + case NO_SPACE_FOR_ACCESS_CODE_ON_DEVICE = "no_space_for_access_code_on_device"; + case CONFLICTING_EXTERNAL_MODIFICATION = "conflicting_external_modification"; + case ACCESS_CODE_INACTIVE = "access_code_inactive"; + case ACCOUNT_DISCONNECTED = "account_disconnected"; + case SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED = "salto_ks_subscription_limit_exceeded"; + case INSUFFICIENT_PERMISSIONS = "insufficient_permissions"; + case DORMAKABA_SITES_DISCONNECTED = "dormakaba_sites_disconnected"; + case DEVICE_OFFLINE = "device_offline"; + case DEVICE_REMOVED = "device_removed"; + case HUB_DISCONNECTED = "hub_disconnected"; + case DEVICE_DISCONNECTED = "device_disconnected"; + case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; + case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; + case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; + case SUBSCRIPTION_REQUIRED = "subscription_required"; + case BRIDGE_DISCONNECTED = "bridge_disconnected"; + } +} + +namespace Seam\Resources\AccessCode\Errors\ConflictingExternalModification { + /** + * List of fields that were changed externally, with their previous and new values. + */ + class ModifiedFields + { + public static function from_json(mixed $json): ModifiedFields|null + { + if (!$json) { + return null; + } + return new self( + field: $json->field ?? null, + from: $json->from ?? null, + to: $json->to ?? null, + ); + } + + public function __construct( + /** + * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). + */ + public string|null $field, + /** + * The previous value of the field. + */ + public string|null $from, + /** + * The new value of the field. + */ + public string|null $to, + ) {} + } + + enum ChangeType: string + { + case MODIFIED = "modified"; + case REMOVED = "removed"; + } +} + +namespace Seam\Resources\AccessCode\PendingMutations { + /** + * Seam is in the process of setting an access code on the device. + */ + final class Creating extends \Seam\Resources\AccessCode\PendingMutations + { + public static function from_json(mixed $json): Creating|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of setting an access code on the device. + */ + \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is waiting until closer to the access code's start time before programming it on the device. + */ + final class DeferringCreation extends + \Seam\Resources\AccessCode\PendingMutations + { + public static function from_json(mixed $json): DeferringCreation|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + scheduled_at: $json->scheduled_at ?? null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of setting an access code on the device. + */ + \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + /** + * Date and time at which Seam will attempt to program this access code on the device. + */ + public string|null $scheduled_at, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of removing an access code from the device. + */ + final class Deleting extends \Seam\Resources\AccessCode\PendingMutations + { + public static function from_json(mixed $json): Deleting|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of setting an access code on the device. + */ + \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an updated PIN code to the device. + */ + final class UpdatingCode extends \Seam\Resources\AccessCode\PendingMutations + { + public static function from_json(mixed $json): UpdatingCode|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AccessCode\PendingMutations\UpdatingCode\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AccessCode\PendingMutations\UpdatingCode\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Previous code configuration. + */ + public \Seam\Resources\AccessCode\PendingMutations\UpdatingCode\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of setting an access code on the device. + */ + \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New code configuration. + */ + public \Seam\Resources\AccessCode\PendingMutations\UpdatingCode\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an updated access code name to the device. + */ + final class UpdatingName extends \Seam\Resources\AccessCode\PendingMutations + { + public static function from_json(mixed $json): UpdatingName|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AccessCode\PendingMutations\UpdatingName\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AccessCode\PendingMutations\UpdatingName\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Previous name configuration. + */ + public \Seam\Resources\AccessCode\PendingMutations\UpdatingName\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of setting an access code on the device. + */ + \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New name configuration. + */ + public \Seam\Resources\AccessCode\PendingMutations\UpdatingName\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an updated time frame to the device. + */ + final class UpdatingTimeFrame extends + \Seam\Resources\AccessCode\PendingMutations + { + public static function from_json(mixed $json): UpdatingTimeFrame|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AccessCode\PendingMutations\UpdatingTimeFrame\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AccessCode\PendingMutations\UpdatingTimeFrame\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Previous time frame configuration. + */ + public \Seam\Resources\AccessCode\PendingMutations\UpdatingTimeFrame\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of setting an access code on the device. + */ + \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New time frame configuration. + */ + public \Seam\Resources\AccessCode\PendingMutations\UpdatingTimeFrame\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Fallback for access_code.pending_mutations values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AccessCode\PendingMutations + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of setting an access code on the device. + */ + \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + enum MutationCode: string + { + case CREATING = "creating"; + case DEFERRING_CREATION = "deferring_creation"; + case DELETING = "deleting"; + case UPDATING_CODE = "updating_code"; + case UPDATING_NAME = "updating_name"; + case UPDATING_TIME_FRAME = "updating_time_frame"; + } +} + +namespace Seam\Resources\AccessCode\PendingMutations\UpdatingCode { + /** + * Previous code configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(code: $json->code ?? null); + } + + public function __construct( + /** + * Previous PIN code. + */ + public string|null $code, + ) {} + } + + /** + * New code configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(code: $json->code ?? null); + } + + public function __construct( + /** + * New PIN code. + */ + public string|null $code, + ) {} + } +} + +namespace Seam\Resources\AccessCode\PendingMutations\UpdatingName { + /** + * Previous name configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(name: $json->name ?? null); + } + + public function __construct( + /** + * Previous access code name. + */ + public string|null $name, + ) {} + } + + /** + * New name configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(name: $json->name ?? null); + } + + public function __construct( + /** + * New access code name. + */ + public string|null $name, + ) {} + } +} + +namespace Seam\Resources\AccessCode\PendingMutations\UpdatingTimeFrame { + /** + * Previous time frame configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * Previous end time for the access code. + */ + public string|null $ends_at, + /** + * Previous start time for the access code. + */ + public string|null $starts_at, + ) {} + } + + /** + * New time frame configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * New end time for the access code. + */ + public string|null $ends_at, + /** + * New start time for the access code. + */ + public string|null $starts_at, + ) {} + } +} + +namespace Seam\Resources\AccessCode\Warnings { + /** + * The access code's PIN rotates periodically when the code is renewed. Retrieve the latest code before each use. + */ + final class CodeRotatesPeriodically extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): CodeRotatesPeriodically|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * The device's time zone is unknown and this code's time frame crosses a daylight-saving transition in at least one plausible time zone. A 1-hour safety buffer has been applied to the side of the time frame affected by the transition (`ends_at` for spring-forward, `starts_at` for fall-back) so the code stays active through the shift — the code may be usable up to 1 hour beyond your requested window. Set the device's time zone via `/devices/report_provider_metadata` to clear the buffer and guarantee exact handling. + */ + final class TimeFrameAdjustedForUnknownTimeZone extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): TimeFrameAdjustedForUnknownTimeZone|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Code was modified or removed externally after Seam successfully set it on the device. External modification is allowed for this code, so the externally modified state is being honored. + */ + final class ExternalModificationInEffect extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): ExternalModificationInEffect|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + change_type: is_string($json->change_type ?? null) + ? \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ChangeType::tryFrom( + $json->change_type, + ) + : null, + created_at: $json->created_at ?? null, + modified_fields: array_map( + fn( + $m, + ) => \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ModifiedFields::from_json( + $m, + ), + $json->modified_fields ?? [], + ), + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + */ + public \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ChangeType|null $change_type = null, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + /** + * List of fields that were changed externally, with their previous and new values. + * + * @var list<\Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ModifiedFields>|null + */ + public array|null $modified_fields = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Delay in setting code on device. + */ + final class DelayInSettingOnDevice extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): DelayInSettingOnDevice|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Delay in removing code from device. + */ + final class DelayInRemovingFromDevice extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): DelayInRemovingFromDevice|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Third-party integration detected that may cause access codes to fail. + */ + final class ThirdPartyIntegrationDetected extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): ThirdPartyIntegrationDetected|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Algopins must be used within 24 hours. + */ + final class IglooAlgopinMustBeUsedWithin_24Hours extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): IglooAlgopinMustBeUsedWithin_24Hours|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Management was transferred to another workspace. + */ + final class ManagementTransferred extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): ManagementTransferred|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * A backup access code has been pulled and is being used in place of this access code. + */ + final class UsingBackupAccessCode extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): UsingBackupAccessCode|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Access code is being deleted. + */ + final class BeingDeleted extends \Seam\Resources\AccessCode\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * An unknown issue occurred with the access code. + */ + final class UnknownIssueWithAccessCode extends + \Seam\Resources\AccessCode\Warnings + { + public static function from_json( + mixed $json, + ): UnknownIssueWithAccessCode|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for access_code.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AccessCode\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case CODE_ROTATES_PERIODICALLY = "code_rotates_periodically"; + case TIME_FRAME_ADJUSTED_FOR_UNKNOWN_TIME_ZONE = "time_frame_adjusted_for_unknown_time_zone"; + case EXTERNAL_MODIFICATION_IN_EFFECT = "external_modification_in_effect"; + case DELAY_IN_SETTING_ON_DEVICE = "delay_in_setting_on_device"; + case DELAY_IN_REMOVING_FROM_DEVICE = "delay_in_removing_from_device"; + case THIRD_PARTY_INTEGRATION_DETECTED = "third_party_integration_detected"; + case IGLOO_ALGOPIN_MUST_BE_USED_WITHIN_24_HOURS = "igloo_algopin_must_be_used_within_24_hours"; + case MANAGEMENT_TRANSFERRED = "management_transferred"; + case USING_BACKUP_ACCESS_CODE = "using_backup_access_code"; + case BEING_DELETED = "being_deleted"; + case UNKNOWN_ISSUE_WITH_ACCESS_CODE = "unknown_issue_with_access_code"; + } +} + +namespace Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect { + /** + * List of fields that were changed externally, with their previous and new values. + */ + class ModifiedFields + { + public static function from_json(mixed $json): ModifiedFields|null + { + if (!$json) { + return null; + } + return new self( + field: $json->field ?? null, + from: $json->from ?? null, + to: $json->to ?? null, + ); + } + + public function __construct( + /** + * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). + */ + public string|null $field, + /** + * The previous value of the field. */ public string|null $from, /** @@ -529,4 +2764,10 @@ public function __construct( public string|null $to, ) {} } + + enum ChangeType: string + { + case MODIFIED = "modified"; + case REMOVED = "removed"; + } } diff --git a/src/Resources/AccessGrant.php b/src/Resources/AccessGrant.php index c2b7ae5c..dd319717 100644 --- a/src/Resources/AccessGrant.php +++ b/src/Resources/AccessGrant.php @@ -13,38 +13,48 @@ public static function from_json(mixed $json): AccessGrant|null } return new self( 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) => AccessGrant\Errors::from_json($e), + fn($e) => \Seam\Resources\AccessGrant\Errors::from_json($e), $json->errors ?? [], ), - instant_key_url: $json->instant_key_url ?? null, location_ids: $json->location_ids ?? null, name: $json->name ?? null, pending_mutations: array_map( - fn($p) => AccessGrant\PendingMutations::from_json($p), + fn( + $p, + ) => \Seam\Resources\AccessGrant\PendingMutations::from_json( + $p, + ), $json->pending_mutations ?? [], ), requested_access_methods: array_map( - fn($r) => AccessGrant\RequestedAccessMethods::from_json($r), + fn( + $r, + ) => \Seam\Resources\AccessGrant\RequestedAccessMethods::from_json( + $r, + ), $json->requested_access_methods ?? [], ), - 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) => AccessGrant\Warnings::from_json($w), + fn($w) => \Seam\Resources\AccessGrant\Warnings::from_json( + $w, + ), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + 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, ); } @@ -55,6 +65,8 @@ public function __construct( public string|null $access_grant_id, /** * IDs of the access methods created for the Access Grant. + * + * @var list|null */ public array|null $access_method_ids, /** @@ -71,9 +83,12 @@ public function __construct( public string|null $ends_at, /** * Errors associated with the [access grant](https://docs.seam.co/use-cases/granting-access). + * + * @var list<\Seam\Resources\AccessGrant\Errors> */ public array $errors, /** + * @var list|null * @deprecated Use `space_ids`. */ public array|null $location_ids, @@ -83,14 +98,20 @@ public function __construct( public string|null $name, /** * List of pending mutations for the access grant. This shows updates that are in progress. + * + * @var list<\Seam\Resources\AccessGrant\PendingMutations> */ public array $pending_mutations, /** * Access methods that the user requested for the Access Grant. + * + * @var list<\Seam\Resources\AccessGrant\RequestedAccessMethods> */ public array $requested_access_methods, /** * IDs of the spaces to which the Access Grant gives access. + * + * @var list|null */ public array|null $space_ids, /** @@ -103,6 +124,8 @@ public function __construct( public string|null $user_identity_id, /** * Warnings associated with the [access grant](https://docs.seam.co/use-cases/granting-access). + * + * @var list<\Seam\Resources\AccessGrant\Warnings> */ public array $warnings, /** @@ -137,19 +160,29 @@ public function __construct( /** * Errors associated with the [access grant](https://docs.seam.co/use-cases/granting-access). */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, - missing_device_ids: $json->missing_device_ids ?? null, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\AccessGrant\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessGrant\Errors\ErrorCode::CANNOT_CREATE_REQUESTED_ACCESS_METHODS + => \Seam\Resources\AccessGrant\Errors\CannotCreateRequestedAccessMethods::from_json( + $json, + ), + default + => \Seam\Resources\AccessGrant\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -160,13 +193,15 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\AccessGrant\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, /** * IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure. + * + * @var list|null */ public array|null $missing_device_ids = null, ) {} @@ -175,43 +210,48 @@ public function __construct( /** * List of pending mutations for the access grant. This shows updates that are in progress. */ - class PendingMutations + abstract class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { if (!$json) { return null; } - return new self( - access_method_ids: $json->access_method_ids ?? null, - created_at: $json->created_at ?? null, - from: isset($json->from) - ? PendingMutations\From::from_json($json->from) - : null, - message: $json->message ?? null, - mutation_code: $json->mutation_code ?? null, - to: isset($json->to) - ? PendingMutations\To::from_json($json->to) - : null, - ); + $discriminant = is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessGrant\PendingMutations\MutationCode::UPDATING_SPACES + => \Seam\Resources\AccessGrant\PendingMutations\UpdatingSpaces::from_json( + $json, + ), + \Seam\Resources\AccessGrant\PendingMutations\MutationCode::UPDATING_ACCESS_TIMES + => \Seam\Resources\AccessGrant\PendingMutations\UpdatingAccessTimes::from_json( + $json, + ), + default + => \Seam\Resources\AccessGrant\PendingMutations\Unknown::from_json( + $json, + ), + }; } public function __construct( - /** - * IDs of the access methods being updated. - */ - public array|null $access_method_ids, /** * Date and time at which the mutation was created. */ public string|null $created_at, - public PendingMutations\From|null $from, /** * Detailed description of the mutation. */ public string|null $message, - public string|null $mutation_code, - public PendingMutations\To|null $to, + /** + * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + */ + public \Seam\Resources\AccessGrant\PendingMutations\MutationCode|string|null $mutation_code, ) {} } @@ -227,20 +267,26 @@ public static function from_json( return null; } return new self( - 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, + mode: is_string($json->mode ?? null) + ? \Seam\Resources\AccessGrant\RequestedAccessMethods\Mode::tryFrom( + $json->mode, + ) + : null, + code: $json->code ?? null, instant_key_max_use_count: $json->instant_key_max_use_count ?? null, - mode: $json->mode ?? null, ); } public function __construct( /** * IDs of the access methods created for the requested access method. + * + * @var list|null */ public array|null $created_access_method_ids, /** @@ -254,7 +300,7 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public string|null $mode, + public \Seam\Resources\AccessGrant\RequestedAccessMethods\Mode|null $mode, /** * Specific PIN code to use for this access method. Only applicable when mode is 'code'. */ @@ -269,165 +315,950 @@ public function __construct( /** * Warnings associated with the [access grant](https://docs.seam.co/use-cases/granting-access). */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessGrant\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\AccessGrant\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\AccessGrant\Warnings\WarningCode::UNDERPROVISIONED_ACCESS + => \Seam\Resources\AccessGrant\Warnings\UnderprovisionedAccess::from_json( + $json, + ), + \Seam\Resources\AccessGrant\Warnings\WarningCode::OVERPROVISIONED_ACCESS + => \Seam\Resources\AccessGrant\Warnings\OverprovisionedAccess::from_json( + $json, + ), + \Seam\Resources\AccessGrant\Warnings\WarningCode::UPDATING_ACCESS_TIMES + => \Seam\Resources\AccessGrant\Warnings\UpdatingAccessTimes::from_json( + $json, + ), + \Seam\Resources\AccessGrant\Warnings\WarningCode::REQUESTED_CODE_UNAVAILABLE + => \Seam\Resources\AccessGrant\Warnings\RequestedCodeUnavailable::from_json( + $json, + ), + \Seam\Resources\AccessGrant\Warnings\WarningCode::DEVICE_DOES_NOT_SUPPORT_ACCESS_CODES + => \Seam\Resources\AccessGrant\Warnings\DeviceDoesNotSupportAccessCodes::from_json( + $json, + ), + \Seam\Resources\AccessGrant\Warnings\WarningCode::DEVICE_TIME_CONSTRAINTS_VIOLATED + => \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated::from_json( + $json, + ), + default + => \Seam\Resources\AccessGrant\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\AccessGrant\Errors { + /** + * Indicates that Seam could not create one or more of the requested access methods for the access grant. + */ + final class CannotCreateRequestedAccessMethods extends + \Seam\Resources\AccessGrant\Errors + { + public static function from_json( + mixed $json, + ): CannotCreateRequestedAccessMethods|null { if (!$json) { return null; } return new self( - 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) => Warnings\FailedDevices::from_json($f), - $json->failed_devices ?? [], - ), + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessGrant\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, 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, + missing_device_ids: $json->missing_device_ids ?? null, ); } public function __construct( /** - * IDs of the access methods being updated. + * Date and time at which Seam created the error. */ - public array|null $access_method_ids, + string|null $created_at, /** - * Date and time at which Seam created the warning. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $created_at, - public string|null $device_id, + \Seam\Resources\AccessGrant\Errors\ErrorCode|string|null $error_code, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $message, + string|null $message, /** - * The new PIN code that was assigned instead. + * IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure. + * + * @var list|null */ - public string|null $new_code, + array|null $missing_device_ids = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + missing_device_ids: $missing_device_ids, + ); + } + } + + /** + * Fallback for access_grant.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AccessGrant\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessGrant\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + missing_device_ids: $json->missing_device_ids ?? null, + ); + } + + public function __construct( /** - * The originally requested PIN code that was unavailable. + * Date and time at which Seam created the error. */ - public string|null $original_code, + string|null $created_at, /** - * Specific reason why the grant's times are not programmable on the device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $reason, + \Seam\Resources\AccessGrant\Errors\ErrorCode|string|null $error_code, /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $warning_code, + string|null $message, /** - * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). + * IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure. + * + * @var list|null */ - public array|null $failed_devices = null, - ) {} + array|null $missing_device_ids = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + missing_device_ids: $missing_device_ids, + ); + } + } + + enum ErrorCode: string + { + case CANNOT_CREATE_REQUESTED_ACCESS_METHODS = "cannot_create_requested_access_methods"; } } namespace Seam\Resources\AccessGrant\PendingMutations { - class From + /** + * Seam is in the process of updating the devices/spaces associated with this access grant. + */ + final class UpdatingSpaces extends + \Seam\Resources\AccessGrant\PendingMutations { - public static function from_json(mixed $json): From|null + public static function from_json(mixed $json): UpdatingSpaces|null { if (!$json) { return null; } return new self( - device_ids: $json->device_ids ?? null, - ends_at: $json->ends_at ?? null, - starts_at: $json->starts_at ?? null, + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AccessGrant\PendingMutations\UpdatingSpaces\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AccessGrant\PendingMutations\UpdatingSpaces\To::from_json( + $json->to, + ) + : null, ); } public function __construct( /** - * Previous device IDs where access codes existed. + * Date and time at which the mutation was created. */ - public array|null $device_ids, + string|null $created_at, /** - * Previous end time for access. + * Previous location configuration. */ - public string|null $ends_at, + public \Seam\Resources\AccessGrant\PendingMutations\UpdatingSpaces\From|null $from, /** - * Previous start time for access. + * Detailed description of the mutation. */ - public string|null $starts_at, - ) {} + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + */ + \Seam\Resources\AccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New location configuration. + */ + public \Seam\Resources\AccessGrant\PendingMutations\UpdatingSpaces\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } } - class To + /** + * Seam is in the process of updating the access times for this access grant. + */ + final class UpdatingAccessTimes extends + \Seam\Resources\AccessGrant\PendingMutations { - public static function from_json(mixed $json): To|null + public static function from_json(mixed $json): UpdatingAccessTimes|null { if (!$json) { 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, + access_method_ids: $json->access_method_ids ?? null, + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AccessGrant\PendingMutations\UpdatingAccessTimes\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AccessGrant\PendingMutations\UpdatingAccessTimes\To::from_json( + $json->to, + ) + : null, ); } public function __construct( /** - * New device IDs where access codes should be created. + * IDs of the access methods being updated. + * + * @var list|null */ - public array|null $device_ids, + public array|null $access_method_ids, /** - * New end time for access. + * Date and time at which the mutation was created. */ - public string|null $ends_at, + string|null $created_at, /** - * New start time for access. + * Previous access time configuration. */ - public string|null $starts_at, + public \Seam\Resources\AccessGrant\PendingMutations\UpdatingAccessTimes\From|null $from, /** - * Common code key to ensure PIN code reuse across devices. + * Detailed description of the mutation. */ - public string|null $common_code_key = null, - ) {} + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + */ + \Seam\Resources\AccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access time configuration. + */ + public \Seam\Resources\AccessGrant\PendingMutations\UpdatingAccessTimes\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } } -} -namespace Seam\Resources\AccessGrant\Warnings { /** - * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). + * Fallback for access_grant.pending_mutations values introduced after this SDK version. */ - class FailedDevices + final class Unknown extends \Seam\Resources\AccessGrant\PendingMutations { - public static function from_json(mixed $json): FailedDevices|null + public static function from_json(mixed $json): Unknown|null { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? null, - error_code: $json->error_code ?? null, + created_at: $json->created_at ?? null, message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ); } public function __construct( /** - * Device whose access code could not be revoked. + * Date and time at which the mutation was created. */ - public string|null $device_id, + string|null $created_at, /** - * Reason the access code could not be revoked (e.g. `offline_access_code_not_revocable`). + * Detailed description of the mutation. */ - public string|null $error_code, + string|null $message, /** - * Human-readable description of why revocation failed. + * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. */ - public string|null $message, + \Seam\Resources\AccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + enum MutationCode: string + { + case UPDATING_SPACES = "updating_spaces"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + } +} + +namespace Seam\Resources\AccessGrant\PendingMutations\UpdatingSpaces { + /** + * Previous location configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * Previous device IDs where access codes existed. + * + * @var list|null + */ + public array|null $device_ids, ) {} } + + /** + * New location configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + device_ids: $json->device_ids ?? null, + common_code_key: $json->common_code_key ?? null, + ); + } + + public function __construct( + /** + * New device IDs where access codes should be created. + * + * @var list|null + */ + public array|null $device_ids, + /** + * Common code key to ensure PIN code reuse across devices. + */ + public string|null $common_code_key = null, + ) {} + } +} + +namespace Seam\Resources\AccessGrant\PendingMutations\UpdatingAccessTimes { + /** + * Previous access time configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * Previous end time for access. + */ + public string|null $ends_at, + /** + * Previous start time for access. + */ + public string|null $starts_at, + ) {} + } + + /** + * New access time configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * New end time for access. + */ + public string|null $ends_at, + /** + * New start time for access. + */ + public string|null $starts_at, + ) {} + } +} + +namespace Seam\Resources\AccessGrant\RequestedAccessMethods { + enum Mode: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } +} + +namespace Seam\Resources\AccessGrant\Warnings { + /** + * Indicates that the [access grant](https://docs.seam.co/use-cases/granting-access) is being deleted. + */ + final class BeingDeleted extends \Seam\Resources\AccessGrant\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access grant should have access to more locations than it currently does. Access methods are being created for the missing locations. + */ + final class UnderprovisionedAccess extends + \Seam\Resources\AccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): UnderprovisionedAccess|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access grant has access to locations it should not have. Access methods are being removed from the extra locations. + */ + final class OverprovisionedAccess extends + \Seam\Resources\AccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): OverprovisionedAccess|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + failed_devices: array_map( + fn( + $f, + ) => \Seam\Resources\AccessGrant\Warnings\OverprovisionedAccess\FailedDevices::from_json( + $f, + ), + $json->failed_devices ?? [], + ), + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + /** + * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). + * + * @var list<\Seam\Resources\AccessGrant\Warnings\OverprovisionedAccess\FailedDevices>|null + */ + public array|null $failed_devices = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access times for this [access grant](https://docs.seam.co/use-cases/granting-access) are being updated. + */ + final class UpdatingAccessTimes extends \Seam\Resources\AccessGrant\Warnings + { + public static function from_json(mixed $json): UpdatingAccessTimes|null + { + if (!$json) { + return null; + } + return new self( + access_method_ids: $json->access_method_ids ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * IDs of the access methods being updated. + * + * @var list|null + */ + public array|null $access_method_ids, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the requested PIN code was already in use on a device, so a different code was assigned. + */ + final class RequestedCodeUnavailable extends + \Seam\Resources\AccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): RequestedCodeUnavailable|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + message: $json->message ?? null, + new_code: $json->new_code ?? null, + original_code: $json->original_code ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * ID of the device where the requested code was unavailable. + */ + public string|null $device_id, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * The new PIN code that was assigned instead. + */ + public string|null $new_code, + /** + * The originally requested PIN code that was unavailable. + */ + public string|null $original_code, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that a device in the access grant does not support access codes and was excluded from code materialization. + */ + final class DeviceDoesNotSupportAccessCodes extends + \Seam\Resources\AccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): DeviceDoesNotSupportAccessCodes|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * ID of the device that does not support access codes. + */ + public string|null $device_id, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that a device in the access grant cannot program an access code for the grant's time range because of device-specific time constraints. + */ + final class DeviceTimeConstraintsViolated extends + \Seam\Resources\AccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): DeviceTimeConstraintsViolated|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + message: $json->message ?? null, + reason: is_string($json->reason ?? null) + ? \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason::tryFrom( + $json->reason, + ) + : null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * ID of the device whose time constraints the access grant violates. + */ + public string|null $device_id, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Specific reason why the grant's times are not programmable on the device. + */ + public \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason|null $reason, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for access_grant.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AccessGrant\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case BEING_DELETED = "being_deleted"; + case UNDERPROVISIONED_ACCESS = "underprovisioned_access"; + case OVERPROVISIONED_ACCESS = "overprovisioned_access"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + case REQUESTED_CODE_UNAVAILABLE = "requested_code_unavailable"; + case DEVICE_DOES_NOT_SUPPORT_ACCESS_CODES = "device_does_not_support_access_codes"; + case DEVICE_TIME_CONSTRAINTS_VIOLATED = "device_time_constraints_violated"; + } +} + +namespace Seam\Resources\AccessGrant\Warnings\OverprovisionedAccess { + /** + * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). + */ + class FailedDevices + { + public static function from_json(mixed $json): FailedDevices|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Device whose access code could not be revoked. + */ + public string|null $device_id, + /** + * Reason the access code could not be revoked (e.g. `offline_access_code_not_revocable`). + */ + public string|null $error_code, + /** + * Human-readable description of why revocation failed. + */ + public string|null $message, + ) {} + } +} + +namespace Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated { + enum Reason: string + { + case DURATION_EXCEEDS_MAX = "duration_exceeds_max"; + case TIMES_DO_NOT_MATCH_SLOTS = "times_do_not_match_slots"; + case ONGOING_NOT_SUPPORTED = "ongoing_not_supported"; + } } diff --git a/src/Resources/AccessMethod.php b/src/Resources/AccessMethod.php index f6ae0845..2ce60df4 100644 --- a/src/Resources/AccessMethod.php +++ b/src/Resources/AccessMethod.php @@ -13,33 +13,43 @@ public static function from_json(mixed $json): AccessMethod|null } return new self( 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) => AccessMethod\Errors::from_json($e), + fn($e) => \Seam\Resources\AccessMethod\Errors::from_json( + $e, + ), $json->errors ?? [], ), - 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, + mode: is_string($json->mode ?? null) + ? \Seam\Resources\AccessMethod\Mode::tryFrom($json->mode) + : null, pending_mutations: array_map( - fn($p) => AccessMethod\PendingMutations::from_json($p), + fn( + $p, + ) => \Seam\Resources\AccessMethod\PendingMutations::from_json( + $p, + ), $json->pending_mutations ?? [], ), warnings: array_map( - fn($w) => AccessMethod\Warnings::from_json($w), + fn($w) => \Seam\Resources\AccessMethod\Warnings::from_json( + $w, + ), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + client_session_token: $json->client_session_token ?? null, + code: $json->code ?? 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, ); } @@ -58,6 +68,8 @@ public function __construct( public string|null $display_name, /** * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * + * @var list<\Seam\Resources\AccessMethod\Errors> */ public array $errors, /** @@ -71,13 +83,17 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public string|null $mode, + public \Seam\Resources\AccessMethod\Mode|null $mode, /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. + * + * @var list<\Seam\Resources\AccessMethod\PendingMutations> */ public array $pending_mutations, /** * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * + * @var list<\Seam\Resources\AccessMethod\Warnings> */ public array $warnings, /** @@ -124,18 +140,29 @@ public function __construct( /** * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\AccessMethod\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessMethod\Errors\ErrorCode::FAILED_TO_ISSUE + => \Seam\Resources\AccessMethod\Errors\FailedToIssue::from_json( + $json, + ), + default + => \Seam\Resources\AccessMethod\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -146,7 +173,7 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\AccessMethod\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -157,9 +184,221 @@ public function __construct( /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. */ - class PendingMutations + abstract class PendingMutations { public static function from_json(mixed $json): PendingMutations|null + { + if (!$json) { + return null; + } + $discriminant = is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessMethod\PendingMutations\MutationCode::PROVISIONING_ACCESS + => \Seam\Resources\AccessMethod\PendingMutations\ProvisioningAccess::from_json( + $json, + ), + \Seam\Resources\AccessMethod\PendingMutations\MutationCode::REVOKING_ACCESS + => \Seam\Resources\AccessMethod\PendingMutations\RevokingAccess::from_json( + $json, + ), + \Seam\Resources\AccessMethod\PendingMutations\MutationCode::UPDATING_ACCESS_TIMES + => \Seam\Resources\AccessMethod\PendingMutations\UpdatingAccessTimes::from_json( + $json, + ), + default + => \Seam\Resources\AccessMethod\PendingMutations\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + public string|null $created_at, + /** + * Detailed description of the mutation. + */ + public string|null $message, + /** + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + */ + public \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + ) {} + } + + /** + * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + */ + abstract class Warnings + { + public static function from_json(mixed $json): Warnings|null + { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AccessMethod\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\AccessMethod\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\AccessMethod\Warnings\WarningCode::UPDATING_ACCESS_TIMES + => \Seam\Resources\AccessMethod\Warnings\UpdatingAccessTimes::from_json( + $json, + ), + \Seam\Resources\AccessMethod\Warnings\WarningCode::PULLED_BACKUP_ACCESS_CODE + => \Seam\Resources\AccessMethod\Warnings\PulledBackupAccessCode::from_json( + $json, + ), + \Seam\Resources\AccessMethod\Warnings\WarningCode::DELAY_IN_ISSUING + => \Seam\Resources\AccessMethod\Warnings\DelayInIssuing::from_json( + $json, + ), + default + => \Seam\Resources\AccessMethod\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + ) {} + } + + enum Mode: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } +} + +namespace Seam\Resources\AccessMethod\Errors { + /** + * Indicates that Seam was unable to issue this [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant) before its access grant started, so the recipient may be unable to access the space. This usually points to a problem that needs attention, such as an offline or disconnected device. Seam keeps retrying, and this error clears automatically if the access method is eventually issued. + */ + final class FailedToIssue extends \Seam\Resources\AccessMethod\Errors + { + public static function from_json(mixed $json): FailedToIssue|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessMethod\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessMethod\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Fallback for access_method.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AccessMethod\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessMethod\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessMethod\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case FAILED_TO_ISSUE = "failed_to_issue"; + } +} + +namespace Seam\Resources\AccessMethod\PendingMutations { + /** + * Seam is in the process of provisioning access for this access method on new devices. + */ + final class ProvisioningAccess extends + \Seam\Resources\AccessMethod\PendingMutations + { + public static function from_json(mixed $json): ProvisioningAccess|null { if (!$json) { return null; @@ -167,12 +406,20 @@ public static function from_json(mixed $json): PendingMutations|null return new self( created_at: $json->created_at ?? null, from: isset($json->from) - ? PendingMutations\From::from_json($json->from) + ? \Seam\Resources\AccessMethod\PendingMutations\ProvisioningAccess\From::from_json( + $json->from, + ) : null, message: $json->message ?? null, - mutation_code: $json->mutation_code ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, to: isset($json->to) - ? PendingMutations\To::from_json($json->to) + ? \Seam\Resources\AccessMethod\PendingMutations\ProvisioningAccess\To::from_json( + $json->to, + ) : null, ); } @@ -181,58 +428,307 @@ public function __construct( /** * Date and time at which the mutation was created. */ - public string|null $created_at, - public PendingMutations\From|null $from, + string|null $created_at, + /** + * Previous device configuration. + */ + public \Seam\Resources\AccessMethod\PendingMutations\ProvisioningAccess\From|null $from, /** * Detailed description of the mutation. */ - public string|null $message, - public string|null $mutation_code, - public PendingMutations\To|null $to, - ) {} + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + */ + \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New device configuration. + */ + public \Seam\Resources\AccessMethod\PendingMutations\ProvisioningAccess\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } } /** - * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Seam is in the process of revoking access for this access method from devices. */ - class Warnings + final class RevokingAccess extends + \Seam\Resources\AccessMethod\PendingMutations { - public static function from_json(mixed $json): Warnings|null + public static function from_json(mixed $json): RevokingAccess|null { if (!$json) { return null; } return new self( created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AccessMethod\PendingMutations\RevokingAccess\From::from_json( + $json->from, + ) + : null, message: $json->message ?? null, - original_access_method_id: $json->original_access_method_id ?? - null, - warning_code: $json->warning_code ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AccessMethod\PendingMutations\RevokingAccess\To::from_json( + $json->to, + ) + : null, ); } public function __construct( /** - * Date and time at which Seam created the warning. + * Date and time at which the mutation was created. */ - public string|null $created_at, + string|null $created_at, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Previous device configuration. */ - public string|null $message, + public \Seam\Resources\AccessMethod\PendingMutations\RevokingAccess\From|null $from, /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * Detailed description of the mutation. */ - public string|null $warning_code, + string|null $message, /** - * ID of the original access method from which this backup access method was split, if applicable. + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. */ - public string|null $original_access_method_id = null, + \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New device configuration. + */ + public \Seam\Resources\AccessMethod\PendingMutations\RevokingAccess\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of updating the access times for this access method. + */ + final class UpdatingAccessTimes extends + \Seam\Resources\AccessMethod\PendingMutations + { + public static function from_json(mixed $json): UpdatingAccessTimes|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AccessMethod\PendingMutations\UpdatingAccessTimes\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AccessMethod\PendingMutations\UpdatingAccessTimes\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Previous access time configuration. + */ + public \Seam\Resources\AccessMethod\PendingMutations\UpdatingAccessTimes\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + */ + \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access time configuration. + */ + public \Seam\Resources\AccessMethod\PendingMutations\UpdatingAccessTimes\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Fallback for access_method.pending_mutations values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AccessMethod\PendingMutations + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + */ + \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + enum MutationCode: string + { + case PROVISIONING_ACCESS = "provisioning_access"; + case REVOKING_ACCESS = "revoking_access"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + } +} + +namespace Seam\Resources\AccessMethod\PendingMutations\ProvisioningAccess { + /** + * Previous device configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * Previous device IDs where access was provisioned. + * + * @var list|null + */ + public array|null $device_ids, + ) {} + } + + /** + * New device configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * New device IDs where access is being provisioned. + * + * @var list|null + */ + public array|null $device_ids, ) {} } } -namespace Seam\Resources\AccessMethod\PendingMutations { +namespace Seam\Resources\AccessMethod\PendingMutations\RevokingAccess { + /** + * Previous device configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * Previous device IDs where access existed. + * + * @var list|null + */ + public array|null $device_ids, + ) {} + } + + /** + * New device configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * New device IDs where access should remain. + * + * @var list|null + */ + public array|null $device_ids, + ) {} + } +} + +namespace Seam\Resources\AccessMethod\PendingMutations\UpdatingAccessTimes { + /** + * Previous access time configuration. + */ class From { public static function from_json(mixed $json): From|null @@ -241,14 +737,12 @@ public static function from_json(mixed $json): From|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, /** * Previous end time for access. */ @@ -260,6 +754,9 @@ public function __construct( ) {} } + /** + * New access time configuration. + */ class To { public static function from_json(mixed $json): To|null @@ -268,14 +765,12 @@ public static function from_json(mixed $json): To|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, /** * New end time for access. */ @@ -287,3 +782,237 @@ public function __construct( ) {} } } + +namespace Seam\Resources\AccessMethod\Warnings { + /** + * Indicates that the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant) is being deleted. + */ + final class BeingDeleted extends \Seam\Resources\AccessMethod\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access times for this [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant) are being updated. + */ + final class UpdatingAccessTimes extends + \Seam\Resources\AccessMethod\Warnings + { + public static function from_json(mixed $json): UpdatingAccessTimes|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that all attempts to create an access code on this device before the start time failed and a backup access code was used to ensure access was provided in time. + */ + final class PulledBackupAccessCode extends + \Seam\Resources\AccessMethod\Warnings + { + public static function from_json( + mixed $json, + ): PulledBackupAccessCode|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + original_access_method_id: $json->original_access_method_id ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + /** + * ID of the original access method from which this backup access method was split, if applicable. + */ + public string|null $original_access_method_id = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that Seam has not yet issued this [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant), even though its access grant is about to begin, so access may not be ready when the recipient arrives. Seam is still attempting to issue it, and this warning clears automatically once issuance succeeds. + */ + final class DelayInIssuing extends \Seam\Resources\AccessMethod\Warnings + { + public static function from_json(mixed $json): DelayInIssuing|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for access_method.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AccessMethod\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case BEING_DELETED = "being_deleted"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + case PULLED_BACKUP_ACCESS_CODE = "pulled_backup_access_code"; + case DELAY_IN_ISSUING = "delay_in_issuing"; + } +} diff --git a/src/Resources/AcsAccessGroup.php b/src/Resources/AcsAccessGroup.php index fb38046e..442795f2 100644 --- a/src/Resources/AcsAccessGroup.php +++ b/src/Resources/AcsAccessGroup.php @@ -16,37 +16,53 @@ public static function from_json(mixed $json): AcsAccessGroup|null return null; } return new self( - 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) - ? AcsAccessGroup\AccessSchedule::from_json( - $json->access_schedule, + access_group_type: is_string($json->access_group_type ?? null) + ? \Seam\Resources\AcsAccessGroup\AccessGroupType::tryFrom( + $json->access_group_type, ) : null, + access_group_type_display_name: $json->access_group_type_display_name ?? + 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) => AcsAccessGroup\Errors::from_json($e), + fn($e) => \Seam\Resources\AcsAccessGroup\Errors::from_json( + $e, + ), $json->errors ?? [], ), - external_type: $json->external_type ?? null, + external_type: is_string($json->external_type ?? null) + ? \Seam\Resources\AcsAccessGroup\ExternalType::tryFrom( + $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) => AcsAccessGroup\PendingMutations::from_json($p), + fn( + $p, + ) => \Seam\Resources\AcsAccessGroup\PendingMutations::from_json( + $p, + ), $json->pending_mutations ?? [], ), warnings: array_map( - fn($w) => AcsAccessGroup\Warnings::from_json($w), + fn( + $w, + ) => \Seam\Resources\AcsAccessGroup\Warnings::from_json($w), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + access_schedule: isset($json->access_schedule) + ? \Seam\Resources\AcsAccessGroup\AccessSchedule::from_json( + $json->access_schedule, + ) + : null, ); } @@ -54,7 +70,7 @@ public function __construct( /** * @deprecated Use `external_type`. */ - public string|null $access_group_type, + public \Seam\Resources\AcsAccessGroup\AccessGroupType|null $access_group_type, /** * @deprecated Use `external_type_display_name`. */ @@ -81,12 +97,14 @@ public function __construct( public string|null $display_name, /** * Errors associated with the `acs_access_group`. + * + * @var list<\Seam\Resources\AcsAccessGroup\Errors> */ public array $errors, /** * Brand-specific terminology for the access group type. */ - public string|null $external_type, + public \Seam\Resources\AcsAccessGroup\ExternalType|null $external_type, /** * Display name that corresponds to the brand-specific terminology for the access group type. */ @@ -101,10 +119,14 @@ public function __construct( public string|null $name, /** * Collection of pending mutations for the access group. Represents operations that have been requested but not yet completed on the integrated access system. + * + * @var list<\Seam\Resources\AcsAccessGroup\PendingMutations> */ public array $pending_mutations, /** * Warnings associated with the `acs_access_group`. + * + * @var list<\Seam\Resources\AcsAccessGroup\Warnings> */ public array $warnings, /** @@ -114,7 +136,7 @@ public function __construct( /** * `starts_at` and `ends_at` timestamps for the access group's access. */ - public AcsAccessGroup\AccessSchedule|null $access_schedule = null, + public \Seam\Resources\AcsAccessGroup\AccessSchedule|null $access_schedule = null, ) {} } } @@ -151,18 +173,29 @@ public function __construct( /** * Errors associated with the `acs_access_group`. */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\AcsAccessGroup\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsAccessGroup\Errors\ErrorCode::FAILED_TO_CREATE_ON_ACS_SYSTEM + => \Seam\Resources\AcsAccessGroup\Errors\FailedToCreateOnAcsSystem::from_json( + $json, + ), + default + => \Seam\Resources\AcsAccessGroup\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -173,7 +206,7 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\AcsAccessGroup\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -184,48 +217,72 @@ public function __construct( /** * Collection of pending mutations for the access group. Represents operations that have been requested but not yet completed on the integrated access system. */ - class PendingMutations + abstract class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { if (!$json) { return null; } - return new self( - acs_user_id: $json->acs_user_id ?? null, - created_at: $json->created_at ?? null, - from: isset($json->from) - ? PendingMutations\From::from_json($json->from) - : null, - message: $json->message ?? null, - mutation_code: $json->mutation_code ?? null, - to: isset($json->to) - ? PendingMutations\To::from_json($json->to) - : null, - variant: $json->variant ?? null, - ); + $discriminant = is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::CREATING + => \Seam\Resources\AcsAccessGroup\PendingMutations\Creating::from_json( + $json, + ), + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::DELETING + => \Seam\Resources\AcsAccessGroup\PendingMutations\Deleting::from_json( + $json, + ), + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::DEFERRING_DELETION + => \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringDeletion::from_json( + $json, + ), + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::UPDATING_GROUP_INFORMATION + => \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingGroupInformation::from_json( + $json, + ), + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::UPDATING_ACCESS_SCHEDULE + => \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingAccessSchedule::from_json( + $json, + ), + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::UPDATING_USER_MEMBERSHIP + => \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingUserMembership::from_json( + $json, + ), + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::UPDATING_ENTRANCE_MEMBERSHIP + => \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingEntranceMembership::from_json( + $json, + ), + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::DEFERRING_USER_MEMBERSHIP_UPDATE + => \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate::from_json( + $json, + ), + default + => \Seam\Resources\AcsAccessGroup\PendingMutations\Unknown::from_json( + $json, + ), + }; } public function __construct( - /** - * ID of the user involved in the scheduled change. - */ - public string|null $acs_user_id, /** * Date and time at which the mutation was created. */ public string|null $created_at, - public PendingMutations\From|null $from, /** * Detailed description of the mutation. */ public string|null $message, - public string|null $mutation_code, - public PendingMutations\To|null $to, /** - * Whether the user is scheduled to be added to or removed from this access group. + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. */ - public string|null $variant, + public \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, ) {} } @@ -242,7 +299,11 @@ public static function from_json(mixed $json): Warnings|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: $json->warning_code ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsAccessGroup\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null, ); } @@ -258,89 +319,834 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, + public \Seam\Resources\AcsAccessGroup\Warnings\WarningCode|null $warning_code, ) {} } + + enum AccessGroupType: string + { + case PTI_UNIT = "pti_unit"; + case PTI_ACCESS_LEVEL = "pti_access_level"; + case SALTO_KS_ACCESS_GROUP = "salto_ks_access_group"; + case BRIVO_GROUP = "brivo_group"; + case SALTO_SPACE_GROUP = "salto_space_group"; + case DORMAKABA_COMMUNITY_ACCESS_GROUP = "dormakaba_community_access_group"; + case DORMAKABA_AMBIANCE_ACCESS_GROUP = "dormakaba_ambiance_access_group"; + case AVIGILON_ALTA_GROUP = "avigilon_alta_group"; + case KISI_ACCESS_GROUP = "kisi_access_group"; + case AKILES_MEMBER_GROUP = "akiles_member_group"; + } + + enum ExternalType: string + { + case PTI_UNIT = "pti_unit"; + case PTI_ACCESS_LEVEL = "pti_access_level"; + case SALTO_KS_ACCESS_GROUP = "salto_ks_access_group"; + case BRIVO_GROUP = "brivo_group"; + case SALTO_SPACE_GROUP = "salto_space_group"; + case DORMAKABA_COMMUNITY_ACCESS_GROUP = "dormakaba_community_access_group"; + case DORMAKABA_AMBIANCE_ACCESS_GROUP = "dormakaba_ambiance_access_group"; + case AVIGILON_ALTA_GROUP = "avigilon_alta_group"; + case KISI_ACCESS_GROUP = "kisi_access_group"; + case AKILES_MEMBER_GROUP = "akiles_member_group"; + } +} + +namespace Seam\Resources\AcsAccessGroup\Errors { + /** + * Indicates that the [access group](https://docs.seam.co/low-level-apis/access-systems/user-management/assigning-users-to-access-groups) was not created on the [access system](https://docs.seam.co/low-level-apis/access-systems). This is likely due to an internal unexpected error. Contact Seam [support](mailto:support@seam.co). + */ + final class FailedToCreateOnAcsSystem extends + \Seam\Resources\AcsAccessGroup\Errors + { + public static function from_json( + mixed $json, + ): FailedToCreateOnAcsSystem|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsAccessGroup\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsAccessGroup\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Fallback for acs_access_group.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsAccessGroup\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsAccessGroup\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsAccessGroup\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case FAILED_TO_CREATE_ON_ACS_SYSTEM = "failed_to_create_on_acs_system"; + } } namespace Seam\Resources\AcsAccessGroup\PendingMutations { - class From + /** + * Seam is in the process of pushing an access group creation to the integrated access system. + */ + final class Creating extends \Seam\Resources\AcsAccessGroup\PendingMutations { - public static function from_json(mixed $json): From|null + public static function from_json(mixed $json): Creating|null { if (!$json) { return 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, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ); } public function __construct( /** - * Old entrance ID. + * Date and time at which the mutation was created. */ - public string|null $acs_entrance_id, + string|null $created_at, /** - * Old user ID. + * Detailed description of the mutation. */ - public string|null $acs_user_id, + string|null $message, /** - * Ending time for the access schedule. + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. */ - public string|null $ends_at, + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an access group deletion to the integrated access system. + */ + final class Deleting extends \Seam\Resources\AcsAccessGroup\PendingMutations + { + public static function from_json(mixed $json): Deleting|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( /** - * Starting time for the access schedule. + * Date and time at which the mutation was created. */ - public string|null $starts_at, + string|null $created_at, /** - * Name of the access group. + * Detailed description of the mutation. */ - public string|null $name = null, - ) {} + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + */ + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } } - class To + /** + * This access group is scheduled for automatic deletion when its access window expires. + */ + final class DeferringDeletion extends + \Seam\Resources\AcsAccessGroup\PendingMutations { - public static function from_json(mixed $json): To|null + public static function from_json(mixed $json): DeferringDeletion|null { if (!$json) { return 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, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ); } public function __construct( /** - * New entrance ID. + * Date and time at which the mutation was created. */ - public string|null $acs_entrance_id, + string|null $created_at, /** - * New user ID. + * Detailed description of the mutation. */ - public string|null $acs_user_id, + string|null $message, /** - * Ending time for the access schedule. + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. */ - public string|null $ends_at, + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an access group information update to the integrated access system. + */ + final class UpdatingGroupInformation extends + \Seam\Resources\AcsAccessGroup\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingGroupInformation|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingGroupInformation\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingGroupInformation\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( /** - * Starting time for the access schedule. + * Date and time at which the mutation was created. */ - public string|null $starts_at, + string|null $created_at, /** - * Name of the access group. + * Old access group information. */ - public string|null $name = null, - ) {} + public \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingGroupInformation\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + */ + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access group information. + */ + public \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingGroupInformation\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an access schedule update to the integrated access system. + */ + final class UpdatingAccessSchedule extends + \Seam\Resources\AcsAccessGroup\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingAccessSchedule|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingAccessSchedule\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingAccessSchedule\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Old access schedule information. + */ + public \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingAccessSchedule\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + */ + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access schedule information. + */ + public \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingAccessSchedule\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing a user membership update to the integrated access system. + */ + final class UpdatingUserMembership extends + \Seam\Resources\AcsAccessGroup\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingUserMembership|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingUserMembership\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingUserMembership\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Old user membership. + */ + public \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingUserMembership\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + */ + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New user membership. + */ + public \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingUserMembership\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an entrance membership update to the integrated access system. + */ + final class UpdatingEntranceMembership extends + \Seam\Resources\AcsAccessGroup\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingEntranceMembership|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingEntranceMembership\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingEntranceMembership\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Old entrance membership. + */ + public \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingEntranceMembership\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + */ + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New entrance membership. + */ + public \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingEntranceMembership\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * A scheduled user membership change is pending for this access group. + */ + final class DeferringUserMembershipUpdate extends + \Seam\Resources\AcsAccessGroup\PendingMutations + { + public static function from_json( + mixed $json, + ): DeferringUserMembershipUpdate|null { + if (!$json) { + return null; + } + return new self( + acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + variant: is_string($json->variant ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate\Variant::tryFrom( + $json->variant, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the user involved in the scheduled change. + */ + public string|null $acs_user_id, + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + */ + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + /** + * Whether the user is scheduled to be added to or removed from this access group. + */ + public \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate\Variant|null $variant, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Fallback for acs_access_group.pending_mutations values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsAccessGroup\PendingMutations + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + */ + \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + enum MutationCode: string + { + case CREATING = "creating"; + case DELETING = "deleting"; + case DEFERRING_DELETION = "deferring_deletion"; + case UPDATING_GROUP_INFORMATION = "updating_group_information"; + case UPDATING_ACCESS_SCHEDULE = "updating_access_schedule"; + case UPDATING_USER_MEMBERSHIP = "updating_user_membership"; + case UPDATING_ENTRANCE_MEMBERSHIP = "updating_entrance_membership"; + case DEFERRING_USER_MEMBERSHIP_UPDATE = "deferring_user_membership_update"; + } +} + +namespace Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingGroupInformation { + /** + * Old access group information. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(name: $json->name ?? null); + } + + public function __construct( + /** + * Name of the access group. + */ + public string|null $name = null, + ) {} + } + + /** + * New access group information. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(name: $json->name ?? null); + } + + public function __construct( + /** + * Name of the access group. + */ + public string|null $name = null, + ) {} + } +} + +namespace Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingAccessSchedule { + /** + * Old access schedule information. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * Ending time for the access schedule. + */ + public string|null $ends_at, + /** + * Starting time for the access schedule. + */ + public string|null $starts_at, + ) {} + } + + /** + * New access schedule information. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * Ending time for the access schedule. + */ + public string|null $ends_at, + /** + * Starting time for the access schedule. + */ + public string|null $starts_at, + ) {} + } +} + +namespace Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingUserMembership { + /** + * Old user membership. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(acs_user_id: $json->acs_user_id ?? null); + } + + public function __construct( + /** + * Old user ID. + */ + public string|null $acs_user_id, + ) {} + } + + /** + * New user membership. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(acs_user_id: $json->acs_user_id ?? null); + } + + public function __construct( + /** + * New user ID. + */ + public string|null $acs_user_id, + ) {} + } +} + +namespace Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingEntranceMembership { + /** + * Old entrance membership. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(acs_entrance_id: $json->acs_entrance_id ?? null); + } + + public function __construct( + /** + * Old entrance ID. + */ + public string|null $acs_entrance_id, + ) {} + } + + /** + * New entrance membership. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(acs_entrance_id: $json->acs_entrance_id ?? null); + } + + public function __construct( + /** + * New entrance ID. + */ + public string|null $acs_entrance_id, + ) {} + } +} + +namespace Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate { + enum Variant: string + { + case ADDING = "adding"; + case REMOVING = "removing"; + } +} + +namespace Seam\Resources\AcsAccessGroup\Warnings { + enum WarningCode: string + { + case UNKNOWN_ISSUE_WITH_ACS_ACCESS_GROUP = "unknown_issue_with_acs_access_group"; + case BEING_DELETED = "being_deleted"; } } diff --git a/src/Resources/AcsCredential.php b/src/Resources/AcsCredential.php index e18bc0bc..cf2ca919 100644 --- a/src/Resources/AcsCredential.php +++ b/src/Resources/AcsCredential.php @@ -18,40 +18,57 @@ public static function from_json(mixed $json): AcsCredential|null return null; } return new self( - access_method: $json->access_method ?? null, + access_method: is_string($json->access_method ?? null) + ? \Seam\Resources\AcsCredential\AccessMethod::tryFrom( + $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, + 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) => \Seam\Resources\AcsCredential\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + warnings: array_map( + fn($w) => \Seam\Resources\AcsCredential\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, acs_user_id: $json->acs_user_id ?? null, akiles_metadata: isset($json->akiles_metadata) - ? AcsCredential\AkilesMetadata::from_json( + ? \Seam\Resources\AcsCredential\AkilesMetadata::from_json( $json->akiles_metadata, ) : null, assa_abloy_vostio_metadata: isset( $json->assa_abloy_vostio_metadata, ) - ? AcsCredential\AssaAbloyVostioMetadata::from_json( + ? \Seam\Resources\AcsCredential\AssaAbloyVostioMetadata::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) => AcsCredential\Errors::from_json($e), - $json->errors ?? [], - ), - external_type: $json->external_type ?? null, + external_type: is_string($json->external_type ?? null) + ? \Seam\Resources\AcsCredential\ExternalType::tryFrom( + $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, @@ -63,15 +80,10 @@ public static function from_json(mixed $json): AcsCredential|null starts_at: $json->starts_at ?? null, user_identity_id: $json->user_identity_id ?? null, visionline_metadata: isset($json->visionline_metadata) - ? AcsCredential\VisionlineMetadata::from_json( + ? \Seam\Resources\AcsCredential\VisionlineMetadata::from_json( $json->visionline_metadata, ) : null, - warnings: array_map( - fn($w) => AcsCredential\Warnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, ); } @@ -79,7 +91,7 @@ public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public string|null $access_method, + public \Seam\Resources\AcsCredential\AccessMethod|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -102,6 +114,8 @@ public function __construct( public string|null $display_name, /** * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list<\Seam\Resources\AcsCredential\Errors> */ public array $errors, /** @@ -110,6 +124,8 @@ public function __construct( public true|null $is_managed, /** * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list<\Seam\Resources\AcsCredential\Warnings> */ public array $warnings, /** @@ -127,11 +143,11 @@ public function __construct( /** * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public AcsCredential\AkilesMetadata|null $akiles_metadata = null, + public \Seam\Resources\AcsCredential\AkilesMetadata|null $akiles_metadata = null, /** * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public AcsCredential\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, + public \Seam\Resources\AcsCredential\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, /** * Number of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -147,7 +163,7 @@ public function __construct( /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. */ - public string|null $external_type = null, + public \Seam\Resources\AcsCredential\ExternalType|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -191,7 +207,7 @@ public function __construct( /** * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public AcsCredential\VisionlineMetadata|null $visionline_metadata = null, + public \Seam\Resources\AcsCredential\VisionlineMetadata|null $visionline_metadata = null, ) {} } } @@ -247,6 +263,8 @@ public function __construct( public bool|null $auto_join = null, /** * Names of the doors to which to grant access in the Vostio access system. + * + * @var list|null */ public array|null $door_names = null, /** @@ -263,6 +281,8 @@ public function __construct( public string|null $key_issuing_request_id = null, /** * IDs of the guest entrances to override in the Vostio access system. + * + * @var list|null */ public array|null $override_guest_acs_entrance_ids = null, ) {} @@ -307,7 +327,11 @@ public static function from_json(mixed $json): VisionlineMetadata|null } return new self( auto_join: $json->auto_join ?? null, - card_function_type: $json->card_function_type ?? null, + card_function_type: is_string($json->card_function_type ?? null) + ? \Seam\Resources\AcsCredential\VisionlineMetadata\CardFunctionType::tryFrom( + $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, @@ -326,13 +350,15 @@ public function __construct( /** * Card function type in the Visionline access system. */ - public string|null $card_function_type = null, + public \Seam\Resources\AcsCredential\VisionlineMetadata\CardFunctionType|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ public string|null $card_id = null, /** * Common entrance IDs in the Visionline access system. + * + * @var list|null */ public array|null $common_acs_entrance_ids = null, /** @@ -341,6 +367,8 @@ public function __construct( public string|null $credential_id = null, /** * Guest entrance IDs in the Visionline access system. + * + * @var list|null */ public array|null $guest_acs_entrance_ids = null, /** @@ -349,6 +377,8 @@ public function __construct( public bool|null $is_valid = null, /** * IDs of the credentials to which you want to join. + * + * @var list|null */ public array|null $joiner_acs_credential_ids = null, ) {} @@ -357,10 +387,378 @@ public function __construct( /** * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsCredential\Warnings\WarningCode::WAITING_TO_BE_ISSUED + => \Seam\Resources\AcsCredential\Warnings\WaitingToBeIssued::from_json( + $json, + ), + \Seam\Resources\AcsCredential\Warnings\WarningCode::SCHEDULE_EXTERNALLY_MODIFIED + => \Seam\Resources\AcsCredential\Warnings\ScheduleExternallyModified::from_json( + $json, + ), + \Seam\Resources\AcsCredential\Warnings\WarningCode::SCHEDULE_MODIFIED + => \Seam\Resources\AcsCredential\Warnings\ScheduleModified::from_json( + $json, + ), + \Seam\Resources\AcsCredential\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\AcsCredential\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\AcsCredential\Warnings\WarningCode::UNKNOWN_ISSUE_WITH_ACS_CREDENTIAL + => \Seam\Resources\AcsCredential\Warnings\UnknownIssueWithAcsCredential::from_json( + $json, + ), + \Seam\Resources\AcsCredential\Warnings\WarningCode::NEEDS_TO_BE_REISSUED + => \Seam\Resources\AcsCredential\Warnings\NeedsToBeReissued::from_json( + $json, + ), + \Seam\Resources\AcsCredential\Warnings\WarningCode::REQUESTED_CODE_UNAVAILABLE + => \Seam\Resources\AcsCredential\Warnings\RequestedCodeUnavailable::from_json( + $json, + ), + default + => \Seam\Resources\AcsCredential\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) {} + } + + enum AccessMethod: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } + + enum ExternalType: string + { + case PTI_CARD = "pti_card"; + case BRIVO_CREDENTIAL = "brivo_credential"; + case HID_CREDENTIAL = "hid_credential"; + case VISIONLINE_CARD = "visionline_card"; + case SALTO_KS_CREDENTIAL = "salto_ks_credential"; + case ASSA_ABLOY_VOSTIO_KEY = "assa_abloy_vostio_key"; + case SALTO_SPACE_KEY = "salto_space_key"; + case LATCH_ACCESS = "latch_access"; + case DORMAKABA_AMBIANCE_CREDENTIAL = "dormakaba_ambiance_credential"; + case HOTEK_CARD = "hotek_card"; + case SALTO_KS_TAG = "salto_ks_tag"; + case AVIGILON_ALTA_CREDENTIAL = "avigilon_alta_credential"; + case KISI_CREDENTIAL = "kisi_credential"; + case AKILES_CREDENTIAL = "akiles_credential"; + } +} + +namespace Seam\Resources\AcsCredential\VisionlineMetadata { + enum CardFunctionType: string + { + case GUEST = "guest"; + case STAFF = "staff"; + } +} + +namespace Seam\Resources\AcsCredential\Warnings { + /** + * Indicates that the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is waiting to be issued. + */ + final class WaitingToBeIssued extends \Seam\Resources\AcsCredential\Warnings + { + public static function from_json(mixed $json): WaitingToBeIssued|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the schedule of one of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials)'s children was modified externally. + */ + final class ScheduleExternallyModified extends + \Seam\Resources\AcsCredential\Warnings + { + public static function from_json( + mixed $json, + ): ScheduleExternallyModified|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the schedule of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was modified to avoid creating a credential with a start date in the past. + */ + final class ScheduleModified extends \Seam\Resources\AcsCredential\Warnings + { + public static function from_json(mixed $json): ScheduleModified|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is being deleted. + */ + final class BeingDeleted extends \Seam\Resources\AcsCredential\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * An unknown issue occurred while syncing the state of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) with the provider. This issue may affect the proper functioning of the credential. + */ + final class UnknownIssueWithAcsCredential extends + \Seam\Resources\AcsCredential\Warnings + { + public static function from_json( + mixed $json, + ): UnknownIssueWithAcsCredential|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Access permissions for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) have changed. [Reissue](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners/creating-and-encoding-card-based-credentials) (re-encode) the credential. This issue may affect the proper functioning of the credential. + */ + final class NeedsToBeReissued extends \Seam\Resources\AcsCredential\Warnings + { + public static function from_json(mixed $json): NeedsToBeReissued|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the requested PIN code could not be used, so the access system assigned a different code. Give the guest the assigned code. + */ + final class RequestedCodeUnavailable extends + \Seam\Resources\AcsCredential\Warnings + { + public static function from_json( + mixed $json, + ): RequestedCodeUnavailable|null { if (!$json) { return null; } @@ -369,7 +767,11 @@ public static function from_json(mixed $json): Warnings|null message: $json->message ?? null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, - warning_code: $json->warning_code ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } @@ -377,11 +779,11 @@ public function __construct( /** * Date and time at which Seam created the warning. */ - public string|null $created_at, + string|null $created_at, /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $message, + string|null $message, /** * The PIN code that was assigned instead. */ @@ -393,7 +795,67 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, - ) {} + \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for acs_credential.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsCredential\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case WAITING_TO_BE_ISSUED = "waiting_to_be_issued"; + case SCHEDULE_EXTERNALLY_MODIFIED = "schedule_externally_modified"; + case SCHEDULE_MODIFIED = "schedule_modified"; + case BEING_DELETED = "being_deleted"; + case UNKNOWN_ISSUE_WITH_ACS_CREDENTIAL = "unknown_issue_with_acs_credential"; + case NEEDS_TO_BE_REISSUED = "needs_to_be_reissued"; + case REQUESTED_CODE_UNAVAILABLE = "requested_code_unavailable"; } } diff --git a/src/Resources/AcsEncoder.php b/src/Resources/AcsEncoder.php index fdb6ee77..a2b3e8ed 100644 --- a/src/Resources/AcsEncoder.php +++ b/src/Resources/AcsEncoder.php @@ -31,7 +31,7 @@ public static function from_json(mixed $json): AcsEncoder|null created_at: $json->created_at ?? null, display_name: $json->display_name ?? null, errors: array_map( - fn($e) => AcsEncoder\Errors::from_json($e), + fn($e) => \Seam\Resources\AcsEncoder\Errors::from_json($e), $json->errors ?? [], ), workspace_id: $json->workspace_id ?? null, @@ -61,6 +61,8 @@ public function __construct( public string|null $display_name, /** * Errors associated with the [encoder](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners). + * + * @var list<\Seam\Resources\AcsEncoder\Errors> */ public array $errors, /** @@ -84,7 +86,11 @@ public static function from_json(mixed $json): Errors|null } return new self( created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsEncoder\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null, message: $json->message ?? null, ); } @@ -97,7 +103,7 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\AcsEncoder\Errors\ErrorCode|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -105,3 +111,10 @@ public function __construct( ) {} } } + +namespace Seam\Resources\AcsEncoder\Errors { + enum ErrorCode: string + { + case ACS_ENCODER_REMOVED = "acs_encoder_removed"; + } +} diff --git a/src/Resources/AcsEntrance.php b/src/Resources/AcsEntrance.php index 116c81c7..48920438 100644 --- a/src/Resources/AcsEntrance.php +++ b/src/Resources/AcsEntrance.php @@ -16,25 +16,39 @@ public static function from_json(mixed $json): AcsEntrance|null return new self( acs_entrance_id: $json->acs_entrance_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) => \Seam\Resources\AcsEntrance\Errors::from_json($e), + $json->errors ?? [], + ), + space_ids: $json->space_ids ?? null, + warnings: array_map( + fn($w) => \Seam\Resources\AcsEntrance\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), akiles_metadata: isset($json->akiles_metadata) - ? AcsEntrance\AkilesMetadata::from_json( + ? \Seam\Resources\AcsEntrance\AkilesMetadata::from_json( $json->akiles_metadata, ) : null, assa_abloy_vostio_metadata: isset( $json->assa_abloy_vostio_metadata, ) - ? AcsEntrance\AssaAbloyVostioMetadata::from_json( + ? \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata::from_json( $json->assa_abloy_vostio_metadata, ) : null, avigilon_alta_metadata: isset($json->avigilon_alta_metadata) - ? AcsEntrance\AvigilonAltaMetadata::from_json( + ? \Seam\Resources\AcsEntrance\AvigilonAltaMetadata::from_json( $json->avigilon_alta_metadata, ) : null, brivo_metadata: isset($json->brivo_metadata) - ? AcsEntrance\BrivoMetadata::from_json( + ? \Seam\Resources\AcsEntrance\BrivoMetadata::from_json( $json->brivo_metadata, ) : null, @@ -46,58 +60,46 @@ 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, ) - ? AcsEntrance\DormakabaAmbianceMetadata::from_json( + ? \Seam\Resources\AcsEntrance\DormakabaAmbianceMetadata::from_json( $json->dormakaba_ambiance_metadata, ) : null, dormakaba_community_metadata: isset( $json->dormakaba_community_metadata, ) - ? AcsEntrance\DormakabaCommunityMetadata::from_json( + ? \Seam\Resources\AcsEntrance\DormakabaCommunityMetadata::from_json( $json->dormakaba_community_metadata, ) : null, - errors: array_map( - fn($e) => AcsEntrance\Errors::from_json($e), - $json->errors ?? [], - ), hotek_metadata: isset($json->hotek_metadata) - ? AcsEntrance\HotekMetadata::from_json( + ? \Seam\Resources\AcsEntrance\HotekMetadata::from_json( $json->hotek_metadata, ) : null, is_locked: $json->is_locked ?? null, latch_metadata: isset($json->latch_metadata) - ? AcsEntrance\LatchMetadata::from_json( + ? \Seam\Resources\AcsEntrance\LatchMetadata::from_json( $json->latch_metadata, ) : null, salto_ks_metadata: isset($json->salto_ks_metadata) - ? AcsEntrance\SaltoKsMetadata::from_json( + ? \Seam\Resources\AcsEntrance\SaltoKsMetadata::from_json( $json->salto_ks_metadata, ) : null, salto_space_metadata: isset($json->salto_space_metadata) - ? AcsEntrance\SaltoSpaceMetadata::from_json( + ? \Seam\Resources\AcsEntrance\SaltoSpaceMetadata::from_json( $json->salto_space_metadata, ) : null, - space_ids: $json->space_ids ?? null, visionline_metadata: isset($json->visionline_metadata) - ? AcsEntrance\VisionlineMetadata::from_json( + ? \Seam\Resources\AcsEntrance\VisionlineMetadata::from_json( $json->visionline_metadata, ) : null, - warnings: array_map( - fn($w) => AcsEntrance\Warnings::from_json($w), - $json->warnings ?? [], - ), ); } @@ -124,32 +126,38 @@ public function __construct( public string|null $display_name, /** * Errors associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). + * + * @var list<\Seam\Resources\AcsEntrance\Errors> */ public array $errors, /** * IDs of the spaces that the entrance is in. + * + * @var list|null */ public array|null $space_ids, /** * Warnings associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). + * + * @var list<\Seam\Resources\AcsEntrance\Warnings> */ public array $warnings, /** * Akiles-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\AkilesMetadata|null $akiles_metadata = null, + public \Seam\Resources\AcsEntrance\AkilesMetadata|null $akiles_metadata = null, /** * ASSA ABLOY Vostio-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, + public \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, /** * Avigilon Alta-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\AvigilonAltaMetadata|null $avigilon_alta_metadata = null, + public \Seam\Resources\AcsEntrance\AvigilonAltaMetadata|null $avigilon_alta_metadata = null, /** * Brivo-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\BrivoMetadata|null $brivo_metadata = null, + public \Seam\Resources\AcsEntrance\BrivoMetadata|null $brivo_metadata = null, /** * Indicates whether the ACS entrance can belong to a reservation via an access_grant.reservation_key. */ @@ -173,15 +181,15 @@ public function __construct( /** * dormakaba Ambiance-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\DormakabaAmbianceMetadata|null $dormakaba_ambiance_metadata = null, + public \Seam\Resources\AcsEntrance\DormakabaAmbianceMetadata|null $dormakaba_ambiance_metadata = null, /** * dormakaba Community-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\DormakabaCommunityMetadata|null $dormakaba_community_metadata = null, + public \Seam\Resources\AcsEntrance\DormakabaCommunityMetadata|null $dormakaba_community_metadata = null, /** * Hotek-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\HotekMetadata|null $hotek_metadata = null, + public \Seam\Resources\AcsEntrance\HotekMetadata|null $hotek_metadata = null, /** * Indicates whether the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) is currently locked. */ @@ -189,19 +197,19 @@ public function __construct( /** * Latch-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\LatchMetadata|null $latch_metadata = null, + public \Seam\Resources\AcsEntrance\LatchMetadata|null $latch_metadata = null, /** * Salto KS-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\SaltoKsMetadata|null $salto_ks_metadata = null, + public \Seam\Resources\AcsEntrance\SaltoKsMetadata|null $salto_ks_metadata = null, /** * Salto Space-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\SaltoSpaceMetadata|null $salto_space_metadata = null, + public \Seam\Resources\AcsEntrance\SaltoSpaceMetadata|null $salto_space_metadata = null, /** * Visionline-specific metadata associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - public AcsEntrance\VisionlineMetadata|null $visionline_metadata = null, + public \Seam\Resources\AcsEntrance\VisionlineMetadata|null $visionline_metadata = null, ) {} } } @@ -219,7 +227,11 @@ public static function from_json(mixed $json): AkilesMetadata|null } return new self( actions: array_map( - fn($a) => AkilesMetadata\Actions::from_json($a), + fn( + $a, + ) => \Seam\Resources\AcsEntrance\AkilesMetadata\Actions::from_json( + $a, + ), $json->actions ?? [], ), gadget_id: $json->gadget_id ?? null, @@ -231,6 +243,8 @@ public static function from_json(mixed $json): AkilesMetadata|null public function __construct( /** * Actions the gadget exposes (for example, open). + * + * @var list<\Seam\Resources\AcsEntrance\AkilesMetadata\Actions>|null */ public array|null $actions = null, /** @@ -262,7 +276,11 @@ public static function from_json( return new self( door_name: $json->door_name ?? null, door_number: $json->door_number ?? null, - door_type: $json->door_type ?? null, + door_type: is_string($json->door_type ?? null) + ? \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata\DoorType::tryFrom( + $json->door_type, + ) + : null, pms_id: $json->pms_id ?? null, stand_open: $json->stand_open ?? null, ); @@ -280,7 +298,7 @@ public function __construct( /** * Type of the door in the Vostio access system. */ - public string|null $door_type = null, + public \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata\DoorType|null $door_type = null, /** * PMS ID of the door in the Vostio access system. */ @@ -648,10 +666,18 @@ public static function from_json(mixed $json): VisionlineMetadata|null return null; } return new self( - door_category: $json->door_category ?? null, + door_category: is_string($json->door_category ?? null) + ? \Seam\Resources\AcsEntrance\VisionlineMetadata\DoorCategory::tryFrom( + $json->door_category, + ) + : null, door_name: $json->door_name ?? null, profiles: array_map( - fn($p) => VisionlineMetadata\Profiles::from_json($p), + fn( + $p, + ) => \Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles::from_json( + $p, + ), $json->profiles ?? [], ), ); @@ -661,13 +687,15 @@ public function __construct( /** * Category of the door in the Visionline access system. */ - public string|null $door_category = null, + public \Seam\Resources\AcsEntrance\VisionlineMetadata\DoorCategory|null $door_category = null, /** * Name of the door in the Visionline access system. */ public string|null $door_name = null, /** * Profile for the door in the Visionline access system. + * + * @var list<\Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles>|null */ public array|null $profiles = null, ) {} @@ -676,18 +704,45 @@ public function __construct( /** * Warnings associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - ); + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsEntrance\Warnings\WarningCode::SALTO_KS_ENTRANCE_ACCESS_CODE_SUPPORT_REMOVED + => \Seam\Resources\AcsEntrance\Warnings\SaltoKsEntranceAccessCodeSupportRemoved::from_json( + $json, + ), + \Seam\Resources\AcsEntrance\Warnings\WarningCode::ENTRANCE_SHARES_ZONE + => \Seam\Resources\AcsEntrance\Warnings\EntranceSharesZone::from_json( + $json, + ), + \Seam\Resources\AcsEntrance\Warnings\WarningCode::ENTRANCE_SETUP_REQUIRED + => \Seam\Resources\AcsEntrance\Warnings\EntranceSetupRequired::from_json( + $json, + ), + \Seam\Resources\AcsEntrance\Warnings\WarningCode::SALTO_KS_PRIVACY_MODE + => \Seam\Resources\AcsEntrance\Warnings\SaltoKsPrivacyMode::from_json( + $json, + ), + \Seam\Resources\AcsEntrance\Warnings\WarningCode::PRIVACY_MODE + => \Seam\Resources\AcsEntrance\Warnings\PrivacyMode::from_json( + $json, + ), + default + => \Seam\Resources\AcsEntrance\Warnings\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -702,7 +757,7 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, + public \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, ) {} } } @@ -734,6 +789,16 @@ public function __construct( } } +namespace Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata { + enum DoorType: string + { + case COMMON_DOOR = "CommonDoor"; + case ENTRANCE_DOOR = "EntranceDoor"; + case GUEST_DOOR = "GuestDoor"; + case ELEVATOR = "Elevator"; + } +} + namespace Seam\Resources\AcsEntrance\VisionlineMetadata { /** * Profile for the door in the Visionline access system. @@ -748,8 +813,13 @@ public static function from_json(mixed $json): Profiles|null return new self( visionline_door_profile_id: $json->visionline_door_profile_id ?? null, - visionline_door_profile_type: $json->visionline_door_profile_type ?? - null, + visionline_door_profile_type: is_string( + $json->visionline_door_profile_type ?? null, + ) + ? \Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles\VisionlineDoorProfileType::tryFrom( + $json->visionline_door_profile_type, + ) + : null, ); } @@ -761,7 +831,298 @@ public function __construct( /** * Door profile type in the Visionline access system. */ - public string|null $visionline_door_profile_type = null, + public \Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles\VisionlineDoorProfileType|null $visionline_door_profile_type = null, ) {} } + + enum DoorCategory: string + { + case ENTRANCE = "entrance"; + case GUEST = "guest"; + case ELEVATOR_READER = "elevator reader"; + case COMMON = "common"; + case COMMON_PMS = "common (PMS)"; + } +} + +namespace Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles { + enum VisionlineDoorProfileType: string + { + case BLE = "BLE"; + case COMMON_DOOR = "commonDoor"; + case TOUCH = "touch"; + } +} + +namespace Seam\Resources\AcsEntrance\Warnings { + /** + * Indicates that a change in the reported device model has been detected for this Salto KS entrance, which may occur after an IQ hub reset. Access code support may be affected. See https://help.getseam.com/articles/5098842588-salto-ks-lock-loses-access-code-support for troubleshooting steps. + */ + final class SaltoKsEntranceAccessCodeSupportRemoved extends + \Seam\Resources\AcsEntrance\Warnings + { + public static function from_json( + mixed $json, + ): SaltoKsEntranceAccessCodeSupportRemoved|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that this entrance shares a zone with other entrances in Avigilon Alta and cannot be added to an access group individually. + */ + final class EntranceSharesZone extends \Seam\Resources\AcsEntrance\Warnings + { + public static function from_json(mixed $json): EntranceSharesZone|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that this entrance requires additional configuration in the access control system before Seam can fully manage it. + */ + final class EntranceSetupRequired extends + \Seam\Resources\AcsEntrance\Warnings + { + public static function from_json( + mixed $json, + ): EntranceSetupRequired|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that this entrance is in privacy mode. When privacy mode is enabled, access codes, mobile keys, and remote unlocks will not work unless the user has admin access. + */ + final class SaltoKsPrivacyMode extends \Seam\Resources\AcsEntrance\Warnings + { + public static function from_json(mixed $json): SaltoKsPrivacyMode|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that this entrance is in privacy mode. When privacy mode is enabled, access codes, mobile keys, and remote unlocks will not work unless the user has admin access. + */ + final class PrivacyMode extends \Seam\Resources\AcsEntrance\Warnings + { + public static function from_json(mixed $json): PrivacyMode|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for acs_entrance.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsEntrance\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case SALTO_KS_ENTRANCE_ACCESS_CODE_SUPPORT_REMOVED = "salto_ks_entrance_access_code_support_removed"; + case ENTRANCE_SHARES_ZONE = "entrance_shares_zone"; + case ENTRANCE_SETUP_REQUIRED = "entrance_setup_required"; + case SALTO_KS_PRIVACY_MODE = "salto_ks_privacy_mode"; + case PRIVACY_MODE = "privacy_mode"; + } } diff --git a/src/Resources/AcsSystem.php b/src/Resources/AcsSystem.php index 2bbc80c4..dc18f090 100644 --- a/src/Resources/AcsSystem.php +++ b/src/Resources/AcsSystem.php @@ -16,41 +16,51 @@ public static function from_json(mixed $json): AcsSystem|null return null; } return new self( - 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) => AcsSystem\Errors::from_json($e), + fn($e) => \Seam\Resources\AcsSystem\Errors::from_json($e), $json->errors ?? [], ), - 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) - ? AcsSystem\Location::from_json($json->location) + ? \Seam\Resources\AcsSystem\Location::from_json( + $json->location, + ) : null, name: $json->name ?? null, - system_type: $json->system_type ?? null, + warnings: array_map( + fn($w) => \Seam\Resources\AcsSystem\Warnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, + acs_access_group_count: $json->acs_access_group_count ?? null, + acs_user_count: $json->acs_user_count ?? null, + default_credential_manager_acs_system_id: $json->default_credential_manager_acs_system_id ?? + null, + external_type: is_string($json->external_type ?? null) + ? \Seam\Resources\AcsSystem\ExternalType::tryFrom( + $json->external_type, + ) + : null, + external_type_display_name: $json->external_type_display_name ?? + null, + system_type: is_string($json->system_type ?? null) + ? \Seam\Resources\AcsSystem\SystemType::tryFrom( + $json->system_type, + ) + : null, system_type_display_name: $json->system_type_display_name ?? null, visionline_metadata: isset($json->visionline_metadata) - ? AcsSystem\VisionlineMetadata::from_json( + ? \Seam\Resources\AcsSystem\VisionlineMetadata::from_json( $json->visionline_metadata, ) : null, - warnings: array_map( - fn($w) => AcsSystem\Warnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, ); } @@ -66,6 +76,7 @@ public function __construct( /** * IDs of the [connected accounts](https://docs.seam.co/core-concepts/connected-accounts) associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). * + * @var list|null * @deprecated Use `connected_account_id`. */ public array|null $connected_account_ids, @@ -75,6 +86,8 @@ public function __construct( public string|null $created_at, /** * Errors associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). + * + * @var list<\Seam\Resources\AcsSystem\Errors> */ public array $errors, /** @@ -92,13 +105,15 @@ public function __construct( /** * Location information for the [access control system](https://docs.seam.co/low-level-apis/access-systems). */ - public AcsSystem\Location|null $location, + public \Seam\Resources\AcsSystem\Location|null $location, /** * Name of the [access control system](https://docs.seam.co/low-level-apis/access-systems). */ public string|null $name, /** * Warnings associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). + * + * @var list<\Seam\Resources\AcsSystem\Warnings> */ public array $warnings, /** @@ -120,7 +135,7 @@ public function __construct( /** * Brand-specific terminology for the [access control system](https://docs.seam.co/low-level-apis/access-systems) type. */ - public string|null $external_type = null, + public \Seam\Resources\AcsSystem\ExternalType|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [access control system](https://docs.seam.co/low-level-apis/access-systems) type. */ @@ -128,7 +143,7 @@ public function __construct( /** * @deprecated Use `external_type`. */ - public string|null $system_type = null, + public \Seam\Resources\AcsSystem\SystemType|null $system_type = null, /** * @deprecated Use `external_type_display_name`. */ @@ -136,7 +151,7 @@ public function __construct( /** * Visionline-specific metadata for the [access control system](https://docs.seam.co/low-level-apis/access-systems). */ - public AcsSystem\VisionlineMetadata|null $visionline_metadata = null, + public \Seam\Resources\AcsSystem\VisionlineMetadata|null $visionline_metadata = null, ) {} } } @@ -145,19 +160,60 @@ public function __construct( /** * Errors associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - is_bridge_error: $json->is_bridge_error ?? null, - message: $json->message ?? null, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsSystem\Errors\ErrorCode::SEAM_BRIDGE_DISCONNECTED + => \Seam\Resources\AcsSystem\Errors\SeamBridgeDisconnected::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Errors\ErrorCode::BRIDGE_DISCONNECTED + => \Seam\Resources\AcsSystem\Errors\BridgeDisconnected::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Errors\ErrorCode::VISIONLINE_INSTANCE_UNREACHABLE + => \Seam\Resources\AcsSystem\Errors\VisionlineInstanceUnreachable::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Errors\ErrorCode::SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED + => \Seam\Resources\AcsSystem\Errors\SaltoKsSubscriptionLimitExceeded::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Errors\ErrorCode::INSUFFICIENT_PERMISSIONS + => \Seam\Resources\AcsSystem\Errors\InsufficientPermissions::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Errors\ErrorCode::ACS_SYSTEM_DISCONNECTED + => \Seam\Resources\AcsSystem\Errors\AcsSystemDisconnected::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Errors\ErrorCode::ACCOUNT_DISCONNECTED + => \Seam\Resources\AcsSystem\Errors\AccountDisconnected::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Errors\ErrorCode::SALTO_KS_CERTIFICATION_EXPIRED + => \Seam\Resources\AcsSystem\Errors\SaltoKsCertificationExpired::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Errors\ErrorCode::PROVIDER_SERVICE_UNAVAILABLE + => \Seam\Resources\AcsSystem\Errors\ProviderServiceUnavailable::from_json( + $json, + ), + default => \Seam\Resources\AcsSystem\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -168,15 +224,11 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, - /** - * Indicates whether the error is related to the [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). - */ - public bool|null $is_bridge_error = null, ) {} } @@ -237,19 +289,636 @@ public function __construct( /** * Warnings associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsSystem\Warnings\WarningCode::SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED + => \Seam\Resources\AcsSystem\Warnings\SaltoKsSubscriptionLimitAlmostReached::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Warnings\WarningCode::TIME_ZONE_DOES_NOT_MATCH_LOCATION + => \Seam\Resources\AcsSystem\Warnings\TimeZoneDoesNotMatchLocation::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Warnings\WarningCode::SETUP_REQUIRED + => \Seam\Resources\AcsSystem\Warnings\SetupRequired::from_json( + $json, + ), + \Seam\Resources\AcsSystem\Warnings\WarningCode::UNKNOWN_ISSUE_WITH_ACS_SYSTEM + => \Seam\Resources\AcsSystem\Warnings\UnknownIssueWithAcsSystem::from_json( + $json, + ), + default + => \Seam\Resources\AcsSystem\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + ) {} + } + + enum ExternalType: string + { + case PTI_SITE = "pti_site"; + case AVIGILON_ALTA_ORG = "avigilon_alta_org"; + case SALTO_KS_SITE = "salto_ks_site"; + case SALTO_SPACE_SYSTEM = "salto_space_system"; + case BRIVO_ACCOUNT = "brivo_account"; + case HID_CREDENTIAL_MANAGER_ORGANIZATION = "hid_credential_manager_organization"; + case VISIONLINE_SYSTEM = "visionline_system"; + case ASSA_ABLOY_CREDENTIAL_SERVICE = "assa_abloy_credential_service"; + case LATCH_BUILDING = "latch_building"; + case DORMAKABA_COMMUNITY_SITE = "dormakaba_community_site"; + case DORMAKABA_AMBIANCE_SITE = "dormakaba_ambiance_site"; + case LEGIC_CONNECT_CREDENTIAL_SERVICE = "legic_connect_credential_service"; + case ASSA_ABLOY_VOSTIO = "assa_abloy_vostio"; + case ASSA_ABLOY_VOSTIO_CREDENTIAL_SERVICE = "assa_abloy_vostio_credential_service"; + case HOTEK_SITE = "hotek_site"; + case KISI_ORGANIZATION = "kisi_organization"; + case AKILES_ORGANIZATION = "akiles_organization"; + } + + enum SystemType: string + { + case PTI_SITE = "pti_site"; + case AVIGILON_ALTA_ORG = "avigilon_alta_org"; + case SALTO_KS_SITE = "salto_ks_site"; + case SALTO_SPACE_SYSTEM = "salto_space_system"; + case BRIVO_ACCOUNT = "brivo_account"; + case HID_CREDENTIAL_MANAGER_ORGANIZATION = "hid_credential_manager_organization"; + case VISIONLINE_SYSTEM = "visionline_system"; + case ASSA_ABLOY_CREDENTIAL_SERVICE = "assa_abloy_credential_service"; + case LATCH_BUILDING = "latch_building"; + case DORMAKABA_COMMUNITY_SITE = "dormakaba_community_site"; + case DORMAKABA_AMBIANCE_SITE = "dormakaba_ambiance_site"; + case LEGIC_CONNECT_CREDENTIAL_SERVICE = "legic_connect_credential_service"; + case ASSA_ABLOY_VOSTIO = "assa_abloy_vostio"; + case ASSA_ABLOY_VOSTIO_CREDENTIAL_SERVICE = "assa_abloy_vostio_credential_service"; + case HOTEK_SITE = "hotek_site"; + case KISI_ORGANIZATION = "kisi_organization"; + case AKILES_ORGANIZATION = "akiles_organization"; + } +} + +namespace Seam\Resources\AcsSystem\Errors { + /** + * Indicates that the Seam API cannot communicate with [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge), for example, if Seam Bridge executable has stopped or if the computer running the Seam Bridge executable is offline. + * This error might also occur if Seam Bridge is connected to the wrong [workspace](https://docs.seam.co/core-concepts/workspaces). + * See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-seam_bridge_disconnected). + */ + final class SeamBridgeDisconnected extends \Seam\Resources\AcsSystem\Errors + { + public static function from_json( + mixed $json, + ): SeamBridgeDisconnected|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the Seam API cannot communicate with [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge), for example, if Seam Bridge executable has stopped or if the computer running the Seam Bridge executable is offline. + * See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-seam_bridge_disconnected). + */ + final class BridgeDisconnected extends \Seam\Resources\AcsSystem\Errors + { + public static function from_json(mixed $json): BridgeDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates whether the error is related to the [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + public bool|null $is_bridge_error = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge) is functioning correctly and the Seam API can communicate with Seam Bridge, but the Seam API cannot connect to the on-premises [Visionline access control system](https://docs.seam.co/device-and-system-integration-guides/assa-abloy-visionline-access-control-system). + * For example, the IP address of the on-premises access control system may be set incorrectly within the Seam [workspace](https://docs.seam.co/core-concepts/workspaces). + * See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-visionline_instance_unreachable). + */ + final class VisionlineInstanceUnreachable extends + \Seam\Resources\AcsSystem\Errors + { + public static function from_json( + mixed $json, + ): VisionlineInstanceUnreachable|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the maximum number of users allowed for the site has been reached. This means that new access codes cannot be created. Contact Salto support to increase the user limit. + */ + final class SaltoKsSubscriptionLimitExceeded extends + \Seam\Resources\AcsSystem\Errors + { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitExceeded|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that Seam's integration user does not have sufficient permissions on the provider's system backing this [access control system](https://docs.seam.co/low-level-apis/access-systems). Access cannot be managed until permissions are restored. See the error message for specifics, then either reauthorize the connected account in Seam or grant the integration user the required permissions in the provider's system. + */ + final class InsufficientPermissions extends \Seam\Resources\AcsSystem\Errors + { + public static function from_json( + mixed $json, + ): InsufficientPermissions|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the [access control system](https://docs.seam.co/low-level-apis/access-systems) has been disconnected. See [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system) to resolve the issue. + */ + final class AcsSystemDisconnected extends \Seam\Resources\AcsSystem\Errors + { + public static function from_json( + mixed $json, + ): AcsSystemDisconnected|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the login credentials are invalid. Reconnect the account using a [Connect Webview](https://docs.seam.co/core-concepts/connect-webviews) to restore access. + */ + final class AccountDisconnected extends \Seam\Resources\AcsSystem\Errors + { + public static function from_json(mixed $json): AccountDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the [access control system](https://docs.seam.co/low-level-apis/access-systems) has lost its Salto KS certification. Contact [support](mailto:support@seam.co) to regain access. + */ + final class SaltoKsCertificationExpired extends + \Seam\Resources\AcsSystem\Errors + { + public static function from_json( + mixed $json, + ): SaltoKsCertificationExpired|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the access control system provider's service is temporarily unavailable. Seam will automatically retry and reconnect when the service becomes available again. + */ + final class ProviderServiceUnavailable extends + \Seam\Resources\AcsSystem\Errors + { + public static function from_json( + mixed $json, + ): ProviderServiceUnavailable|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Fallback for acs_system.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsSystem\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case SEAM_BRIDGE_DISCONNECTED = "seam_bridge_disconnected"; + case BRIDGE_DISCONNECTED = "bridge_disconnected"; + case VISIONLINE_INSTANCE_UNREACHABLE = "visionline_instance_unreachable"; + case SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED = "salto_ks_subscription_limit_exceeded"; + case INSUFFICIENT_PERMISSIONS = "insufficient_permissions"; + case ACS_SYSTEM_DISCONNECTED = "acs_system_disconnected"; + case ACCOUNT_DISCONNECTED = "account_disconnected"; + case SALTO_KS_CERTIFICATION_EXPIRED = "salto_ks_certification_expired"; + case PROVIDER_SERVICE_UNAVAILABLE = "provider_service_unavailable"; + } +} + +namespace Seam\Resources\AcsSystem\Warnings { + /** + * Indicates that the Salto KS site has exceeded 80% of the maximum number of allowed users. Increase your subscription limit or delete some users from your site to rectify the issue. + */ + final class SaltoKsSubscriptionLimitAlmostReached extends + \Seam\Resources\AcsSystem\Warnings + { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitAlmostReached|null { if (!$json) { return null; } return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates the [access control system](https://docs.seam.co/low-level-apis/access-systems) time zone could not be determined because the reported physical location does not match the time zone configured on the physical [ACS entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). + */ + final class TimeZoneDoesNotMatchLocation extends + \Seam\Resources\AcsSystem\Warnings + { + public static function from_json( + mixed $json, + ): TimeZoneDoesNotMatchLocation|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, misconfigured_acs_entrance_ids: $json->misconfigured_acs_entrance_ids ?? null, - warning_code: $json->warning_code ?? null, ); } @@ -257,19 +926,165 @@ public function __construct( /** * Date and time at which Seam created the warning. */ - public string|null $created_at, + string|null $created_at, /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $message, + string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, + \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, /** + * @var list|null * @deprecated this field is deprecated. */ public array|null $misconfigured_acs_entrance_ids = null, - ) {} + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access control system requires additional setup before it can be fully operational. Follow the instructions in the warning message to complete the setup. + */ + final class SetupRequired extends \Seam\Resources\AcsSystem\Warnings + { + public static function from_json(mixed $json): SetupRequired|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that Seam encountered an unexpected error while syncing this [access control system](https://docs.seam.co/low-level-apis/access-systems), so its users, credentials, and access groups may be out of date. Seam retries on every sync cycle and clears this warning once a sync succeeds; if it persists, contact [support](mailto:support@seam.co). + */ + final class UnknownIssueWithAcsSystem extends + \Seam\Resources\AcsSystem\Warnings + { + public static function from_json( + mixed $json, + ): UnknownIssueWithAcsSystem|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for acs_system.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsSystem\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED = "salto_ks_subscription_limit_almost_reached"; + case TIME_ZONE_DOES_NOT_MATCH_LOCATION = "time_zone_does_not_match_location"; + case SETUP_REQUIRED = "setup_required"; + case UNKNOWN_ISSUE_WITH_ACS_SYSTEM = "unknown_issue_with_acs_system"; } } diff --git a/src/Resources/AcsUser.php b/src/Resources/AcsUser.php index 4ed77aa4..5619deb0 100644 --- a/src/Resources/AcsUser.php +++ b/src/Resources/AcsUser.php @@ -16,39 +16,54 @@ public static function from_json(mixed $json): AcsUser|null return null; } return new self( - access_schedule: isset($json->access_schedule) - ? AcsUser\AccessSchedule::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) => AcsUser\Errors::from_json($e), + fn($e) => \Seam\Resources\AcsUser\Errors::from_json($e), $json->errors ?? [], ), - external_type: $json->external_type ?? null, + is_managed: $json->is_managed ?? null, + warnings: array_map( + fn($w) => \Seam\Resources\AcsUser\Warnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, + access_schedule: isset($json->access_schedule) + ? \Seam\Resources\AcsUser\AccessSchedule::from_json( + $json->access_schedule, + ) + : null, + email: $json->email ?? null, + email_address: $json->email_address ?? null, + external_type: is_string($json->external_type ?? null) + ? \Seam\Resources\AcsUser\ExternalType::tryFrom( + $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, pending_mutations: array_map( - fn($p) => AcsUser\PendingMutations::from_json($p), + fn( + $p, + ) => \Seam\Resources\AcsUser\PendingMutations::from_json( + $p, + ), $json->pending_mutations ?? [], ), phone_number: $json->phone_number ?? null, salto_ks_metadata: isset($json->salto_ks_metadata) - ? AcsUser\SaltoKsMetadata::from_json( + ? \Seam\Resources\AcsUser\SaltoKsMetadata::from_json( $json->salto_ks_metadata, ) : null, salto_space_metadata: isset($json->salto_space_metadata) - ? AcsUser\SaltoSpaceMetadata::from_json( + ? \Seam\Resources\AcsUser\SaltoSpaceMetadata::from_json( $json->salto_space_metadata, ) : null, @@ -58,11 +73,6 @@ public static function from_json(mixed $json): AcsUser|null user_identity_id: $json->user_identity_id ?? null, user_identity_phone_number: $json->user_identity_phone_number ?? null, - warnings: array_map( - fn($w) => AcsUser\Warnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, ); } @@ -89,6 +99,8 @@ public function __construct( public string|null $display_name, /** * Errors associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). + * + * @var list<\Seam\Resources\AcsUser\Errors> */ public array $errors, /** @@ -97,6 +109,8 @@ public function __construct( public true|null $is_managed, /** * Warnings associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). + * + * @var list<\Seam\Resources\AcsUser\Warnings> */ public array $warnings, /** @@ -106,7 +120,7 @@ public function __construct( /** * `starts_at` and `ends_at` timestamps for the [access system user's](https://docs.seam.co/low-level-apis/access-systems/user-management) access. */ - public AcsUser\AccessSchedule|null $access_schedule = null, + public \Seam\Resources\AcsUser\AccessSchedule|null $access_schedule = null, /** * @deprecated use email_address. */ @@ -118,7 +132,7 @@ public function __construct( /** * Brand-specific terminology for the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) type. */ - public string|null $external_type = null, + public \Seam\Resources\AcsUser\ExternalType|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) type. */ @@ -137,6 +151,8 @@ public function __construct( public bool|null $is_suspended = null, /** * Pending mutations associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). Seam is in the process of pushing these mutations to the integrated access system. + * + * @var list<\Seam\Resources\AcsUser\PendingMutations>|null */ public array|null $pending_mutations = null, /** @@ -146,11 +162,11 @@ public function __construct( /** * Salto KS-specific metadata associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). */ - public AcsUser\SaltoKsMetadata|null $salto_ks_metadata = null, + public \Seam\Resources\AcsUser\SaltoKsMetadata|null $salto_ks_metadata = null, /** * Salto Space-specific metadata associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). */ - public AcsUser\SaltoSpaceMetadata|null $salto_space_metadata = null, + public \Seam\Resources\AcsUser\SaltoSpaceMetadata|null $salto_space_metadata = null, /** * Email address of the user identity associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). */ @@ -203,18 +219,48 @@ public function __construct( /** * Errors associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsUser\Errors\ErrorCode::DELETED_EXTERNALLY + => \Seam\Resources\AcsUser\Errors\DeletedExternally::from_json( + $json, + ), + \Seam\Resources\AcsUser\Errors\ErrorCode::SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED + => \Seam\Resources\AcsUser\Errors\SaltoKsSubscriptionLimitExceeded::from_json( + $json, + ), + \Seam\Resources\AcsUser\Errors\ErrorCode::FAILED_TO_CREATE_ON_ACS_SYSTEM + => \Seam\Resources\AcsUser\Errors\FailedToCreateOnAcsSystem::from_json( + $json, + ), + \Seam\Resources\AcsUser\Errors\ErrorCode::FAILED_TO_UPDATE_ON_ACS_SYSTEM + => \Seam\Resources\AcsUser\Errors\FailedToUpdateOnAcsSystem::from_json( + $json, + ), + \Seam\Resources\AcsUser\Errors\ErrorCode::FAILED_TO_DELETE_ON_ACS_SYSTEM + => \Seam\Resources\AcsUser\Errors\FailedToDeleteOnAcsSystem::from_json( + $json, + ), + \Seam\Resources\AcsUser\Errors\ErrorCode::LATCH_CONFLICT_WITH_RESIDENT_USER + => \Seam\Resources\AcsUser\Errors\LatchConflictWithResidentUser::from_json( + $json, + ), + default => \Seam\Resources\AcsUser\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -222,7 +268,7 @@ public function __construct( * Date and time at which Seam created the error. */ public string|null $created_at, - public string|null $error_code, + public \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -233,53 +279,76 @@ public function __construct( /** * Pending mutations associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). Seam is in the process of pushing these mutations to the integrated access system. */ - class PendingMutations + abstract class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { if (!$json) { return null; } - return new self( - acs_access_group_id: $json->acs_access_group_id ?? null, - created_at: $json->created_at ?? null, - from: isset($json->from) - ? PendingMutations\From::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) - ? PendingMutations\To::from_json($json->to) - : null, - variant: $json->variant ?? null, - ); + $discriminant = is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsUser\PendingMutations\MutationCode::CREATING + => \Seam\Resources\AcsUser\PendingMutations\Creating::from_json( + $json, + ), + \Seam\Resources\AcsUser\PendingMutations\MutationCode::DELETING + => \Seam\Resources\AcsUser\PendingMutations\Deleting::from_json( + $json, + ), + \Seam\Resources\AcsUser\PendingMutations\MutationCode::DEFERRING_CREATION + => \Seam\Resources\AcsUser\PendingMutations\DeferringCreation::from_json( + $json, + ), + \Seam\Resources\AcsUser\PendingMutations\MutationCode::UPDATING_USER_INFORMATION + => \Seam\Resources\AcsUser\PendingMutations\UpdatingUserInformation::from_json( + $json, + ), + \Seam\Resources\AcsUser\PendingMutations\MutationCode::UPDATING_ACCESS_SCHEDULE + => \Seam\Resources\AcsUser\PendingMutations\UpdatingAccessSchedule::from_json( + $json, + ), + \Seam\Resources\AcsUser\PendingMutations\MutationCode::UPDATING_SUSPENSION_STATE + => \Seam\Resources\AcsUser\PendingMutations\UpdatingSuspensionState::from_json( + $json, + ), + \Seam\Resources\AcsUser\PendingMutations\MutationCode::UPDATING_GROUP_MEMBERSHIP + => \Seam\Resources\AcsUser\PendingMutations\UpdatingGroupMembership::from_json( + $json, + ), + \Seam\Resources\AcsUser\PendingMutations\MutationCode::DEFERRING_GROUP_MEMBERSHIP_UPDATE + => \Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate::from_json( + $json, + ), + \Seam\Resources\AcsUser\PendingMutations\MutationCode::UPDATING_CREDENTIAL_ASSIGNMENT + => \Seam\Resources\AcsUser\PendingMutations\UpdatingCredentialAssignment::from_json( + $json, + ), + default + => \Seam\Resources\AcsUser\PendingMutations\Unknown::from_json( + $json, + ), + }; } public function __construct( - /** - * ID of the access group involved in the scheduled change. - */ - public string|null $acs_access_group_id, /** * Date and time at which the mutation was created. */ public string|null $created_at, - public PendingMutations\From|null $from, /** * Detailed description of the mutation. */ public string|null $message, - public string|null $mutation_code, - public PendingMutations\To|null $to, - /** - * Whether the user is scheduled to be added to or removed from the access group. - */ - public string|null $variant, /** - * Optional: When the user creation is scheduled to occur. + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. */ - public string|null $scheduled_at = null, + public \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, ) {} } @@ -335,18 +404,44 @@ public function __construct( /** * Warnings associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - ); + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\AcsUser\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\AcsUser\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\AcsUser\Warnings\WarningCode::SALTO_KS_USER_NOT_SUBSCRIBED + => \Seam\Resources\AcsUser\Warnings\SaltoKsUserNotSubscribed::from_json( + $json, + ), + \Seam\Resources\AcsUser\Warnings\WarningCode::ACS_USER_INACTIVE + => \Seam\Resources\AcsUser\Warnings\AcsUserInactive::from_json( + $json, + ), + \Seam\Resources\AcsUser\Warnings\WarningCode::UNKNOWN_ISSUE_WITH_ACS_USER + => \Seam\Resources\AcsUser\Warnings\UnknownIssueWithAcsUser::from_json( + $json, + ), + \Seam\Resources\AcsUser\Warnings\WarningCode::LATCH_RESIDENT_USER + => \Seam\Resources\AcsUser\Warnings\LatchResidentUser::from_json( + $json, + ), + default => \Seam\Resources\AcsUser\Warnings\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -358,113 +453,1401 @@ public function __construct( * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, - public string|null $warning_code, + public \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, ) {} } + + enum ExternalType: string + { + case PTI_USER = "pti_user"; + case BRIVO_USER = "brivo_user"; + case HID_CREDENTIAL_MANAGER_USER = "hid_credential_manager_user"; + case SALTO_SITE_USER = "salto_site_user"; + case LATCH_USER = "latch_user"; + case DORMAKABA_COMMUNITY_USER = "dormakaba_community_user"; + case SALTO_SPACE_USER = "salto_space_user"; + case AVIGILON_ALTA_USER = "avigilon_alta_user"; + case KISI_USER = "kisi_user"; + } } -namespace Seam\Resources\AcsUser\PendingMutations { - class From +namespace Seam\Resources\AcsUser\Errors { + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was deleted from the [access system](https://docs.seam.co/low-level-apis/access-systems) outside of Seam. + */ + final class DeletedExternally extends \Seam\Resources\AcsUser\Errors { - public static function from_json(mixed $json): From|null + public static function from_json(mixed $json): DeletedExternally|null { if (!$json) { return 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, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ); } public function __construct( /** - * Old access group ID. - */ - public string|null $acs_access_group_id, - /** - * Previous credential ID. + * Date and time at which Seam created the error. */ - public string|null $acs_credential_id, + string|null $created_at, + \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, /** - * Starting time for the access schedule. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $ends_at, - public bool|null $is_suspended, + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) could not be subscribed on Salto KS because the subscription limit has been exceeded. + */ + final class SaltoKsSubscriptionLimitExceeded extends + \Seam\Resources\AcsUser\Errors + { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitExceeded|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Starting time for the access schedule. + * Date and time at which Seam created the error. */ - public string|null $starts_at, + string|null $created_at, + \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, /** - * Email address of the access system user. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $email_address = null, + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was not created on the [access system](https://docs.seam.co/low-level-apis/access-systems). This is likely due to an internal unexpected error. Contact Seam [support](mailto:support@seam.co). + */ + final class FailedToCreateOnAcsSystem extends \Seam\Resources\AcsUser\Errors + { + public static function from_json( + mixed $json, + ): FailedToCreateOnAcsSystem|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Full name of the access system user. + * Date and time at which Seam created the error. */ - public string|null $full_name = null, + string|null $created_at, + \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, /** - * Phone number of the access system user. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $phone_number = null, - ) {} + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } - class To + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was not updated on the [access system](https://docs.seam.co/low-level-apis/access-systems). This is likely due to an internal unexpected error. Contact Seam [support](mailto:support@seam.co). + */ + final class FailedToUpdateOnAcsSystem extends \Seam\Resources\AcsUser\Errors { - public static function from_json(mixed $json): To|null - { + public static function from_json( + mixed $json, + ): FailedToUpdateOnAcsSystem|null { if (!$json) { return 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, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ); } public function __construct( /** - * New access group ID. + * Date and time at which Seam created the error. */ - public string|null $acs_access_group_id, + string|null $created_at, + \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, /** - * New credential ID. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $acs_credential_id, + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was not deleted on the [access system](https://docs.seam.co/low-level-apis/access-systems). This is likely due to an internal unexpected error. Contact Seam [support](mailto:support@seam.co). + */ + final class FailedToDeleteOnAcsSystem extends \Seam\Resources\AcsUser\Errors + { + public static function from_json( + mixed $json, + ): FailedToDeleteOnAcsSystem|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Starting time for the access schedule. + * Date and time at which Seam created the error. */ - public string|null $ends_at, - public bool|null $is_suspended, + string|null $created_at, + \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, /** - * Starting time for the access schedule. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $starts_at, + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was created from the Seam API but also exists on Mission Control. This is unsupported. Contact Seam [support](mailto:support@seam.co). + */ + final class LatchConflictWithResidentUser extends + \Seam\Resources\AcsUser\Errors + { + public static function from_json( + mixed $json, + ): LatchConflictWithResidentUser|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Email address of the access system user. + * Date and time at which Seam created the error. */ - public string|null $email_address = null, + string|null $created_at, + \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, /** - * Full name of the access system user. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $full_name = null, + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Fallback for acs_user.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsUser\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Phone number of the access system user. + * Date and time at which Seam created the error. */ - public string|null $phone_number = null, - ) {} + string|null $created_at, + \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case DELETED_EXTERNALLY = "deleted_externally"; + case SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED = "salto_ks_subscription_limit_exceeded"; + case FAILED_TO_CREATE_ON_ACS_SYSTEM = "failed_to_create_on_acs_system"; + case FAILED_TO_UPDATE_ON_ACS_SYSTEM = "failed_to_update_on_acs_system"; + case FAILED_TO_DELETE_ON_ACS_SYSTEM = "failed_to_delete_on_acs_system"; + case LATCH_CONFLICT_WITH_RESIDENT_USER = "latch_conflict_with_resident_user"; + } +} + +namespace Seam\Resources\AcsUser\PendingMutations { + /** + * Seam is in the process of pushing a user creation to the integrated access system. + */ + final class Creating extends \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json(mixed $json): Creating|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing a user deletion to the integrated access system. + */ + final class Deleting extends \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json(mixed $json): Deleting|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * User exists in Seam but has not been pushed to the provider yet. Will be created when a credential is issued. + */ + final class DeferringCreation extends + \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json(mixed $json): DeferringCreation|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + scheduled_at: $json->scheduled_at ?? null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + /** + * Optional: When the user creation is scheduled to occur. + */ + public string|null $scheduled_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + final class UpdatingUserInformation extends + \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingUserInformation|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingUserInformation\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingUserInformation\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Old access system user information. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingUserInformation\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access system user information. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingUserInformation\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an access schedule update to the integrated access system. + */ + final class UpdatingAccessSchedule extends + \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingAccessSchedule|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingAccessSchedule\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingAccessSchedule\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Old access schedule information. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingAccessSchedule\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access schedule information. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingAccessSchedule\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing a suspension state update to the integrated access system. + */ + final class UpdatingSuspensionState extends + \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingSuspensionState|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingSuspensionState\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingSuspensionState\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Old user suspension state information. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingSuspensionState\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New user suspension state information. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingSuspensionState\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of pushing an access group membership update to the integrated access system. + */ + final class UpdatingGroupMembership extends + \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingGroupMembership|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingGroupMembership\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingGroupMembership\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Old access group membership. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingGroupMembership\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access group membership. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingGroupMembership\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * A scheduled access group membership change is pending for this user. + */ + final class DeferringGroupMembershipUpdate extends + \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json( + mixed $json, + ): DeferringGroupMembershipUpdate|null { + if (!$json) { + return null; + } + return new self( + acs_access_group_id: $json->acs_access_group_id ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + variant: is_string($json->variant ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate\Variant::tryFrom( + $json->variant, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the access group involved in the scheduled change. + */ + public string|null $acs_access_group_id, + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + /** + * Whether the user is scheduled to be added to or removed from the access group. + */ + public \Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate\Variant|null $variant, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of assigning or unassigning a credential to the user on the integrated access system. + */ + final class UpdatingCredentialAssignment extends + \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json( + mixed $json, + ): UpdatingCredentialAssignment|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingCredentialAssignment\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\AcsUser\PendingMutations\UpdatingCredentialAssignment\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Previous credential assignment. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingCredentialAssignment\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New credential assignment. + */ + public \Seam\Resources\AcsUser\PendingMutations\UpdatingCredentialAssignment\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Fallback for acs_user.pending_mutations values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsUser\PendingMutations + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + */ + \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + enum MutationCode: string + { + case CREATING = "creating"; + case DELETING = "deleting"; + case DEFERRING_CREATION = "deferring_creation"; + case UPDATING_USER_INFORMATION = "updating_user_information"; + case UPDATING_ACCESS_SCHEDULE = "updating_access_schedule"; + case UPDATING_SUSPENSION_STATE = "updating_suspension_state"; + case UPDATING_GROUP_MEMBERSHIP = "updating_group_membership"; + case DEFERRING_GROUP_MEMBERSHIP_UPDATE = "deferring_group_membership_update"; + case UPDATING_CREDENTIAL_ASSIGNMENT = "updating_credential_assignment"; + } +} + +namespace Seam\Resources\AcsUser\PendingMutations\UpdatingUserInformation { + /** + * Old access system user information. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + email_address: $json->email_address ?? null, + full_name: $json->full_name ?? null, + phone_number: $json->phone_number ?? null, + ); + } + + public function __construct( + /** + * Email address of the access system user. + */ + public string|null $email_address = null, + /** + * Full name of the access system user. + */ + public string|null $full_name = null, + /** + * Phone number of the access system user. + */ + public string|null $phone_number = null, + ) {} + } + + /** + * New access system user information. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + email_address: $json->email_address ?? null, + full_name: $json->full_name ?? null, + phone_number: $json->phone_number ?? null, + ); + } + + public function __construct( + /** + * Email address of the access system user. + */ + public string|null $email_address = null, + /** + * Full name of the access system user. + */ + public string|null $full_name = null, + /** + * Phone number of the access system user. + */ + public string|null $phone_number = null, + ) {} + } +} + +namespace Seam\Resources\AcsUser\PendingMutations\UpdatingAccessSchedule { + /** + * Old access schedule information. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * Starting time for the access schedule. + */ + public string|null $ends_at, + /** + * Starting time for the access schedule. + */ + public string|null $starts_at, + ) {} + } + + /** + * New access schedule information. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * Starting time for the access schedule. + */ + public string|null $ends_at, + /** + * Starting time for the access schedule. + */ + public string|null $starts_at, + ) {} + } +} + +namespace Seam\Resources\AcsUser\PendingMutations\UpdatingSuspensionState { + /** + * Old user suspension state information. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(is_suspended: $json->is_suspended ?? null); + } + + public function __construct(public bool|null $is_suspended) {} + } + + /** + * New user suspension state information. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(is_suspended: $json->is_suspended ?? null); + } + + public function __construct(public bool|null $is_suspended) {} + } +} + +namespace Seam\Resources\AcsUser\PendingMutations\UpdatingGroupMembership { + /** + * Old access group membership. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + acs_access_group_id: $json->acs_access_group_id ?? null, + ); + } + + public function __construct( + /** + * Old access group ID. + */ + public string|null $acs_access_group_id, + ) {} + } + + /** + * New access group membership. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + acs_access_group_id: $json->acs_access_group_id ?? null, + ); + } + + public function __construct( + /** + * New access group ID. + */ + public string|null $acs_access_group_id, + ) {} + } +} + +namespace Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate { + enum Variant: string + { + case ADDING = "adding"; + case REMOVING = "removing"; + } +} + +namespace Seam\Resources\AcsUser\PendingMutations\UpdatingCredentialAssignment { + /** + * Previous credential assignment. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + acs_credential_id: $json->acs_credential_id ?? null, + ); + } + + public function __construct( + /** + * Previous credential ID. + */ + public string|null $acs_credential_id, + ) {} + } + + /** + * New credential assignment. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + acs_credential_id: $json->acs_credential_id ?? null, + ); + } + + public function __construct( + /** + * New credential ID. + */ + public string|null $acs_credential_id, + ) {} + } +} + +namespace Seam\Resources\AcsUser\Warnings { + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) is being deleted from the [access system](https://docs.seam.co/low-level-apis/access-systems). This is a temporary state, and the access system user will be deleted shortly. + */ + final class BeingDeleted extends \Seam\Resources\AcsUser\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) is not subscribed on Salto KS, so they cannot unlock doors or perform any actions. This occurs when the their access schedule hasn’t started yet, if their access schedule has ended, if the site has reached its limit for active users (subscription slots), or if they have been manually unsubscribed. + */ + final class SaltoKsUserNotSubscribed extends + \Seam\Resources\AcsUser\Warnings + { + public static function from_json( + mixed $json, + ): SaltoKsUserNotSubscribed|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) exists but is not currently able to gain access—for example, because their access schedule has not started yet or has ended, the access system has reached its limit for active users, or they have been unsubscribed or deactivated. Refer to the warning message for the provider-specific reason. This is distinct from `is_suspended`, which indicates the user has been explicitly blocked. + */ + final class AcsUserInactive extends \Seam\Resources\AcsUser\Warnings + { + public static function from_json(mixed $json): AcsUserInactive|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * An unknown issue occurred while syncing the state of this [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) with the provider. This issue may affect the proper functioning of this user. + */ + final class UnknownIssueWithAcsUser extends \Seam\Resources\AcsUser\Warnings + { + public static function from_json( + mixed $json, + ): UnknownIssueWithAcsUser|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was created on Latch Mission Control. Please use the Latch Mission Control to manage this user. + */ + final class LatchResidentUser extends \Seam\Resources\AcsUser\Warnings + { + public static function from_json(mixed $json): LatchResidentUser|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for acs_user.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\AcsUser\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case BEING_DELETED = "being_deleted"; + case SALTO_KS_USER_NOT_SUBSCRIBED = "salto_ks_user_not_subscribed"; + case ACS_USER_INACTIVE = "acs_user_inactive"; + case UNKNOWN_ISSUE_WITH_ACS_USER = "unknown_issue_with_acs_user"; + case LATCH_RESIDENT_USER = "latch_resident_user"; } } diff --git a/src/Resources/ActionAttempt.php b/src/Resources/ActionAttempt.php index 783e7d1d..4a20d00c 100644 --- a/src/Resources/ActionAttempt.php +++ b/src/Resources/ActionAttempt.php @@ -2,26 +2,109 @@ namespace Seam\Resources { /** - * Locking a door is pending. + * Base class for actions whose completion is tracked asynchronously. */ - class ActionAttempt + abstract class ActionAttempt { public static function from_json(mixed $json): ActionAttempt|null { if (!$json) { return null; } - return new self( - action_attempt_id: $json->action_attempt_id ?? null, - action_type: $json->action_type ?? null, - error: isset($json->error) - ? ActionAttempt\Error::from_json($json->error) - : null, - result: isset($json->result) - ? ActionAttempt\Result::from_json($json->result) - : null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\ActionType::LOCK_DOOR + => \Seam\Resources\ActionAttempt\LockDoor::from_json($json), + \Seam\Resources\ActionAttempt\ActionType::UNLOCK_DOOR + => \Seam\Resources\ActionAttempt\UnlockDoor::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::SCAN_CREDENTIAL + => \Seam\Resources\ActionAttempt\ScanCredential::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::ENCODE_CREDENTIAL + => \Seam\Resources\ActionAttempt\EncodeCredential::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::SCAN_TO_ASSIGN_CREDENTIAL + => \Seam\Resources\ActionAttempt\ScanToAssignCredential::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::ASSIGN_CREDENTIAL + => \Seam\Resources\ActionAttempt\AssignCredential::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::RESET_SANDBOX_WORKSPACE + => \Seam\Resources\ActionAttempt\ResetSandboxWorkspace::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::SET_FAN_MODE + => \Seam\Resources\ActionAttempt\SetFanMode::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::SET_HVAC_MODE + => \Seam\Resources\ActionAttempt\SetHvacMode::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::ACTIVATE_CLIMATE_PRESET + => \Seam\Resources\ActionAttempt\ActivateClimatePreset::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::SIMULATE_KEYPAD_CODE_ENTRY + => \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::SIMULATE_MANUAL_LOCK_VIA_KEYPAD + => \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::PUSH_THERMOSTAT_PROGRAMS + => \Seam\Resources\ActionAttempt\PushThermostatPrograms::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::CONFIGURE_AUTO_LOCK + => \Seam\Resources\ActionAttempt\ConfigureAutoLock::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::SYNC_ACCESS_CODES + => \Seam\Resources\ActionAttempt\SyncAccessCodes::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::CREATE_ACCESS_CODE + => \Seam\Resources\ActionAttempt\CreateAccessCode::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::DELETE_ACCESS_CODE + => \Seam\Resources\ActionAttempt\DeleteAccessCode::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::UPDATE_ACCESS_CODE + => \Seam\Resources\ActionAttempt\UpdateAccessCode::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::CREATE_NOISE_THRESHOLD + => \Seam\Resources\ActionAttempt\CreateNoiseThreshold::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::DELETE_NOISE_THRESHOLD + => \Seam\Resources\ActionAttempt\DeleteNoiseThreshold::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\ActionType::UPDATE_NOISE_THRESHOLD + => \Seam\Resources\ActionAttempt\UpdateNoiseThreshold::from_json( + $json, + ), + default + => \Seam\Resources\ActionAttempt\UnknownActionAttempt::from_json( + $json, + ), + }; } public function __construct( @@ -29,20 +112,22 @@ public function __construct( * ID of the action attempt. */ public string|null $action_attempt_id, - public string|null $action_type, /** - * Error associated with the action. + * Action attempt to track the status of locking a door. + */ + public \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ - public ActionAttempt\Error|null $error, - public ActionAttempt\Result|null $result, - public string|null $status, + public \Seam\Resources\ActionAttempt\Error|null $error, + public \Seam\Resources\ActionAttempt\Status|null $status, ) {} } } namespace Seam\Resources\ActionAttempt { /** - * Error associated with the action. + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ class Error { @@ -62,127 +147,2226 @@ public function __construct( * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, + /** + * Type of the error. + */ public string|null $type, ) {} } - class Result + /** + * Locking a door is pending. + */ + final class LockDoor extends \Seam\Resources\ActionAttempt { - public static function from_json(mixed $json): Result|null + public static function from_json(mixed $json): LockDoor|null { if (!$json) { return null; } return new self( - access_code: $json->access_code ?? null, - access_method: $json->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, - ) - ? Result\AcsCredentialOnEncoder::from_json( - $json->acs_credential_on_encoder, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, ) : null, - acs_credential_on_seam: isset($json->acs_credential_on_seam) - ? Result\AcsCredentialOnSeam::from_json( - $json->acs_credential_on_seam, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\LockDoor\Result::from_json( + $json->result, ) : null, - acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\LockDoor\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Unlocking a door is pending. + */ + final class UnlockDoor extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): UnlockDoor|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\UnlockDoor\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\UnlockDoor\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Reading credential data from the physical encoder is pending. + */ + final class ScanCredential extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): ScanCredential|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of scanning a card. If the attempt was successful, includes a snapshot of credential data read from the physical encoder, the corresponding data stored on Seam and the access system, and any associated warnings. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Encoding credential data from the physical encoder onto a card is pending. + */ + final class EncodeCredential extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): EncodeCredential|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of an encoding attempt. If the attempt was successful, includes the credential data that was encoded onto the card. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\EncodeCredential\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Scanning a physical card and assigning the credential is pending. + */ + final class ScanToAssignCredential extends \Seam\Resources\ActionAttempt + { + public static function from_json( + mixed $json, + ): ScanToAssignCredential|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of a scan to assign attempt. If the attempt was successful, includes the credential data that was scanned and assigned. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Assigning a credential to an access method is pending. + */ + final class AssignCredential extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): AssignCredential|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\AssignCredential\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of assigning a credential. If successful, includes the updated access method with the assigned credential. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\AssignCredential\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Resetting a sandbox workspace is pending. + */ + final class ResetSandboxWorkspace extends \Seam\Resources\ActionAttempt + { + public static function from_json( + mixed $json, + ): ResetSandboxWorkspace|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Setting the fan mode is pending. + */ + final class SetFanMode extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): SetFanMode|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Setting the HVAC mode is pending. + */ + final class SetHvacMode extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): SetHvacMode|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Activating a climate preset is pending. + */ + final class ActivateClimatePreset extends \Seam\Resources\ActionAttempt + { + public static function from_json( + mixed $json, + ): ActivateClimatePreset|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Simulating a keypad code entry is pending. + */ + final class SimulateKeypadCodeEntry extends \Seam\Resources\ActionAttempt + { + public static function from_json( + mixed $json, + ): SimulateKeypadCodeEntry|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Simulating a manual lock action using a keypad is pending. + */ + final class SimulateManualLockViaKeypad extends + \Seam\Resources\ActionAttempt + { + public static function from_json( + mixed $json, + ): SimulateManualLockViaKeypad|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Pushing thermostat weekly programs is pending. + */ + final class PushThermostatPrograms extends \Seam\Resources\ActionAttempt + { + public static function from_json( + mixed $json, + ): PushThermostatPrograms|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Configuring the auto-lock is pending. + */ + final class ConfigureAutoLock extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): ConfigureAutoLock|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + final class SyncAccessCodes extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): SyncAccessCodes|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + final class CreateAccessCode extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): CreateAccessCode|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\CreateAccessCode\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\CreateAccessCode\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + final class DeleteAccessCode extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): DeleteAccessCode|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + final class UpdateAccessCode extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): UpdateAccessCode|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\UpdateAccessCode\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\UpdateAccessCode\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + final class CreateNoiseThreshold extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): CreateNoiseThreshold|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + final class DeleteNoiseThreshold extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): DeleteNoiseThreshold|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: $json->result ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public mixed $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + final class UpdateNoiseThreshold extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): UpdateNoiseThreshold|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Result::from_json( + $json->result, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + public \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Result|null $result, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + /** + * Fallback for action_attempt values introduced after this SDK version. + */ + final class UnknownActionAttempt extends \Seam\Resources\ActionAttempt + { + public static function from_json(mixed $json): UnknownActionAttempt|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + */ + \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + /** + * Error associated with the action. Null while the action attempt is pending or when this value does not apply. + */ + \Seam\Resources\ActionAttempt\Error|null $error, + \Seam\Resources\ActionAttempt\Status|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + error: $error, + status: $status, + ); + } + } + + enum ActionType: string + { + case LOCK_DOOR = "LOCK_DOOR"; + case UNLOCK_DOOR = "UNLOCK_DOOR"; + case SCAN_CREDENTIAL = "SCAN_CREDENTIAL"; + case ENCODE_CREDENTIAL = "ENCODE_CREDENTIAL"; + case SCAN_TO_ASSIGN_CREDENTIAL = "SCAN_TO_ASSIGN_CREDENTIAL"; + case ASSIGN_CREDENTIAL = "ASSIGN_CREDENTIAL"; + case RESET_SANDBOX_WORKSPACE = "RESET_SANDBOX_WORKSPACE"; + case SET_FAN_MODE = "SET_FAN_MODE"; + case SET_HVAC_MODE = "SET_HVAC_MODE"; + case ACTIVATE_CLIMATE_PRESET = "ACTIVATE_CLIMATE_PRESET"; + case SIMULATE_KEYPAD_CODE_ENTRY = "SIMULATE_KEYPAD_CODE_ENTRY"; + case SIMULATE_MANUAL_LOCK_VIA_KEYPAD = "SIMULATE_MANUAL_LOCK_VIA_KEYPAD"; + case PUSH_THERMOSTAT_PROGRAMS = "PUSH_THERMOSTAT_PROGRAMS"; + case CONFIGURE_AUTO_LOCK = "CONFIGURE_AUTO_LOCK"; + case SYNC_ACCESS_CODES = "SYNC_ACCESS_CODES"; + case CREATE_ACCESS_CODE = "CREATE_ACCESS_CODE"; + case DELETE_ACCESS_CODE = "DELETE_ACCESS_CODE"; + case UPDATE_ACCESS_CODE = "UPDATE_ACCESS_CODE"; + case CREATE_NOISE_THRESHOLD = "CREATE_NOISE_THRESHOLD"; + case DELETE_NOISE_THRESHOLD = "DELETE_NOISE_THRESHOLD"; + case UPDATE_NOISE_THRESHOLD = "UPDATE_NOISE_THRESHOLD"; + } + + enum Status: string + { + case SUCCESS = "success"; + case PENDING = "pending"; + case ERROR = "error"; + } +} + +namespace Seam\Resources\ActionAttempt\LockDoor { + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self( + was_confirmed_by_device: $json->was_confirmed_by_device ?? null, + ); + } + + public function __construct( + /** + * Indicates whether the device confirmed that the lock action occurred. + */ + public bool|null $was_confirmed_by_device = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\UnlockDoor { + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self( + was_confirmed_by_device: $json->was_confirmed_by_device ?? null, + ); + } + + public function __construct( + /** + * Indicates whether the device confirmed that the unlock action occurred. + */ + public bool|null $was_confirmed_by_device = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential { + /** + * Result of scanning a card. If the attempt was successful, includes a snapshot of credential data read from the physical encoder, the corresponding data stored on Seam and the access system, and any associated warnings. Null while the action attempt is pending or when this value does not apply. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self( + acs_credential_on_encoder: isset( + $json->acs_credential_on_encoder, + ) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder::from_json( + $json->acs_credential_on_encoder, + ) + : null, + acs_credential_on_seam: isset($json->acs_credential_on_seam) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam::from_json( + $json->acs_credential_on_seam, + ) + : null, + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + ); + } + + public function __construct( + /** + * Snapshot of credential data read from the physical encoder. + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder|null $acs_credential_on_encoder, + /** + * Corresponding credential data as stored on Seam and the access system. + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam|null $acs_credential_on_seam, + /** + * Warnings related to scanning the credential, such as mismatches between the credential data currently encoded on the card and the corresponding data stored on Seam and the access system. + * + * @var list<\Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings> + */ + public array $warnings, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Result { + /** + * Snapshot of credential data read from the physical encoder. + */ + class AcsCredentialOnEncoder + { + public static function from_json( + mixed $json, + ): AcsCredentialOnEncoder|null { + if (!$json) { + return null; + } + return new self( + card_number: $json->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) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata::from_json( + $json->visionline_metadata, + ) + : null, + ); + } + + public function __construct( + /** + * A number or string that physically identifies the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $card_number, + /** + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created. + */ + public string|null $created_at, + /** + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) will stop being usable. + */ + public string|null $ends_at, + /** + * Indicates whether the credential has been issued (encoded onto a card). + */ + public bool|null $is_issued, + /** + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) becomes usable. + */ + public string|null $starts_at, + /** + * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata|null $visionline_metadata = null, + ) {} + } + + /** + * Corresponding credential data as stored on Seam and the access system. + */ + class AcsCredentialOnSeam + { + public static function from_json(mixed $json): AcsCredentialOnSeam|null + { + if (!$json) { + return null; + } + return new self( + access_method: is_string($json->access_method ?? null) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AccessMethod::tryFrom( + $json->access_method, + ) + : null, + acs_credential_id: $json->acs_credential_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, + ) => \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + akiles_metadata: isset($json->akiles_metadata) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AkilesMetadata::from_json( + $json->akiles_metadata, + ) + : null, + assa_abloy_vostio_metadata: isset( + $json->assa_abloy_vostio_metadata, + ) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata, + ) + : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + ends_at: $json->ends_at ?? null, + external_type: is_string($json->external_type ?? null) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType::tryFrom( + $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_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) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata::from_json( + $json->visionline_metadata, + ) + : null, + ); + } + + public function __construct( + /** + * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AccessMethod|null $access_method, + /** + * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $acs_credential_id, + /** + * ID of the [access control system](https://docs.seam.co/low-level-apis/access-systems) that contains the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $acs_system_id, + /** + * ID of the [connected account](https://docs.seam.co/core-concepts/connected-accounts) to which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) belongs. + */ + public string|null $connected_account_id, + /** + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created. + */ + public string|null $created_at, + /** + * Display name that corresponds to the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. + */ + public string|null $display_name, + /** + * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Errors> + */ + public array $errors, + public bool|null $is_managed, + /** + * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings> + */ + public array $warnings, + /** + * ID of the workspace that contains the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $workspace_id, + /** + * ID of the credential pool to which the credential belongs. + */ + public string|null $acs_credential_pool_id = null, + /** + * ID of the [ACS user](https://docs.seam.co/low-level-apis/access-systems/user-management) to whom the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) belongs. + */ + public string|null $acs_user_id = null, + /** + * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AkilesMetadata|null $akiles_metadata = null, + /** + * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, + /** + * Number of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $card_number = null, + /** + * Access (PIN) code for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $code = null, + /** + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) validity ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`. + */ + public string|null $ends_at = null, + /** + * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType|null $external_type = null, + /** + * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. + */ + public string|null $external_type_display_name = null, + /** + * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) has been encoded onto a card. + */ + public bool|null $is_issued = null, + /** + * Indicates whether the latest state of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) has been synced from Seam to the provider. + */ + public bool|null $is_latest_desired_state_synced_with_provider = null, + /** + * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is a [multi-phone sync credential](https://docs.seam.co/capability-guides/mobile-access/issuing-mobile-credentials-from-an-access-control-system#what-are-multi-phone-sync-credentials). + */ + public bool|null $is_multi_phone_sync_credential = null, + /** + * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) can only be used once. If `true`, the code becomes invalid after the first use. + */ + public bool|null $is_one_time_use = null, + /** + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was encoded onto a card. + */ + public string|null $issued_at = null, + /** + * Date and time at which the state of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was most recently synced from Seam to the provider. + */ + public string|null $latest_desired_state_synced_with_provider_at = null, + /** + * ID of the parent [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $parent_acs_credential_id = null, + /** + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) validity starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + */ + public string|null $starts_at = null, + /** + * ID of the [user identity](https://docs.seam.co/api/user_identities) to whom the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) belongs. + */ + public string|null $user_identity_id = null, + /** + * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata|null $visionline_metadata = null, + ) {} + } + + /** + * Warnings related to scanning the credential, such as mismatches between the credential data currently encoded on the card and the corresponding data stored on Seam and the access system. + */ + class Warnings + { + public static function from_json(mixed $json): Warnings|null + { + if (!$json) { + return null; + } + return new self( + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null, + warning_message: $json->warning_message ?? null, + ); + } + + public function __construct( + /** + * Indicates a warning related to scanning a credential. + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode|null $warning_code, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $warning_message, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder { + /** + * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class VisionlineMetadata + { + public static function from_json(mixed $json): VisionlineMetadata|null + { + if (!$json) { + return null; + } + return new self( + cancelled: $json->cancelled ?? null, + card_format: is_string($json->card_format ?? null) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat::tryFrom( + $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( + /** + * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is cancelled. + */ + public bool|null $cancelled = null, + /** + * Format of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat|null $card_format = null, + /** + * Holder of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $card_holder = null, + /** + * Card ID for the Visionline card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $card_id = null, + /** + * IDs of the common [entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list|null + */ + public array|null $common_acs_entrance_ids = null, + /** + * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is discarded. + */ + public bool|null $discarded = null, + /** + * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is expired. + */ + public bool|null $expired = null, + /** + * IDs of the guest [entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list|null + */ + public array|null $guest_acs_entrance_ids = null, + /** + * Number of issued cards associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public float|null $number_of_issued_cards = null, + /** + * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is overridden. + */ + public bool|null $overridden = null, + /** + * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is overwritten. + */ + public bool|null $overwritten = null, + /** + * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is pending auto-update. + */ + public bool|null $pending_auto_update = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata { + enum CardFormat: string + { + case TL_CODE = "TLCode"; + case RFID48 = "rfid48"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam { + /** + * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class AkilesMetadata + { + public static function from_json(mixed $json): AkilesMetadata|null + { + if (!$json) { + return null; + } + return new self(member_pin_id: $json->member_pin_id ?? null); + } + + public function __construct( + /** + * ID of the Akiles member PIN. + */ + public string|null $member_pin_id = null, + ) {} + } + + /** + * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class AssaAbloyVostioMetadata + { + public static function from_json( + mixed $json, + ): AssaAbloyVostioMetadata|null { + if (!$json) { + return null; + } + return new self( + auto_join: $json->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( + /** + * Indicates whether the credential should auto-join. For an auto-join credential, Seam automatically issues an override card if there are no other cards and a joiner card if there are existing cards on the doors. + */ + public bool|null $auto_join = null, + /** + * Names of the doors to which to grant access in the Vostio access system. + * + * @var list|null + */ + public array|null $door_names = null, + /** + * Endpoint ID in the Vostio access system. + */ + public string|null $endpoint_id = null, + /** + * Key ID in the Vostio access system. + */ + public string|null $key_id = null, + /** + * Key issuing request ID in the Vostio access system. + */ + public string|null $key_issuing_request_id = null, + /** + * IDs of the guest entrances to override in the Vostio access system. + * + * @var list|null + */ + public array|null $override_guest_acs_entrance_ids = null, + ) {} + } + + /** + * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class Errors + { + public static function from_json(mixed $json): Errors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + public string|null $error_code, + public string|null $message, + ) {} + } + + /** + * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class VisionlineMetadata + { + public static function from_json(mixed $json): VisionlineMetadata|null + { + if (!$json) { + return null; + } + return new self( + auto_join: $json->auto_join ?? null, + card_function_type: is_string($json->card_function_type ?? null) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType::tryFrom( + $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( + /** + * Indicates whether the credential should auto-join. For an auto-join credential, Seam automatically issues an override card if there are no other cards and a joiner card if there are existing cards on the doors. + */ + public bool|null $auto_join = null, + /** + * Card function type in the Visionline access system. + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType|null $card_function_type = null, + /** + * ID of the card in the Visionline access system. + */ + public string|null $card_id = null, + /** + * Common entrance IDs in the Visionline access system. + * + * @var list|null + */ + public array|null $common_acs_entrance_ids = null, + /** + * ID of the credential in the Visionline access system. + */ + public string|null $credential_id = null, + /** + * Guest entrance IDs in the Visionline access system. + * + * @var list|null + */ + public array|null $guest_acs_entrance_ids = null, + /** + * Indicates whether the credential is valid. + */ + public bool|null $is_valid = null, + /** + * IDs of the credentials to which you want to join. + * + * @var list|null + */ + public array|null $joiner_acs_credential_ids = null, + ) {} + } + + /** + * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class Warnings + { + public static function from_json(mixed $json): Warnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null, + new_code: $json->new_code ?? null, + original_code: $json->original_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings\WarningCode|null $warning_code, + /** + * The PIN code that was assigned instead. + */ + public string|null $new_code = null, + /** + * The originally requested PIN code that could not be used. + */ + public string|null $original_code = null, + ) {} + } + + enum AccessMethod: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } + + enum ExternalType: string + { + case PTI_CARD = "pti_card"; + case BRIVO_CREDENTIAL = "brivo_credential"; + case HID_CREDENTIAL = "hid_credential"; + case VISIONLINE_CARD = "visionline_card"; + case SALTO_KS_CREDENTIAL = "salto_ks_credential"; + case ASSA_ABLOY_VOSTIO_KEY = "assa_abloy_vostio_key"; + case SALTO_SPACE_KEY = "salto_space_key"; + case LATCH_ACCESS = "latch_access"; + case DORMAKABA_AMBIANCE_CREDENTIAL = "dormakaba_ambiance_credential"; + case HOTEK_CARD = "hotek_card"; + case SALTO_KS_TAG = "salto_ks_tag"; + case AVIGILON_ALTA_CREDENTIAL = "avigilon_alta_credential"; + case KISI_CREDENTIAL = "kisi_credential"; + case AKILES_CREDENTIAL = "akiles_credential"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata { + enum CardFunctionType: string + { + case GUEST = "guest"; + case STAFF = "staff"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings { + enum WarningCode: string + { + case WAITING_TO_BE_ISSUED = "waiting_to_be_issued"; + case SCHEDULE_EXTERNALLY_MODIFIED = "schedule_externally_modified"; + case SCHEDULE_MODIFIED = "schedule_modified"; + case BEING_DELETED = "being_deleted"; + case UNKNOWN_ISSUE_WITH_ACS_CREDENTIAL = "unknown_issue_with_acs_credential"; + case NEEDS_TO_BE_REISSUED = "needs_to_be_reissued"; + case REQUESTED_CODE_UNAVAILABLE = "requested_code_unavailable"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings { + enum WarningCode: string + { + case ACS_CREDENTIAL_ON_ENCODER_OUT_OF_SYNC = "acs_credential_on_encoder_out_of_sync"; + case ACS_CREDENTIAL_ON_SEAM_NOT_FOUND = "acs_credential_on_seam_not_found"; + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential { + /** + * Result of an encoding attempt. If the attempt was successful, includes the credential data that was encoded onto the card. Null while the action attempt is pending or when this value does not apply. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self( + access_method: is_string($json->access_method ?? null) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod::tryFrom( + $json->access_method, + ) + : null, + acs_credential_id: $json->acs_credential_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, + ) => \Seam\Resources\ActionAttempt\EncodeCredential\Result\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, acs_user_id: $json->acs_user_id ?? null, akiles_metadata: isset($json->akiles_metadata) - ? Result\AkilesMetadata::from_json($json->akiles_metadata) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\AkilesMetadata::from_json( + $json->akiles_metadata, + ) : null, assa_abloy_vostio_metadata: isset( $json->assa_abloy_vostio_metadata, ) - ? Result\AssaAbloyVostioMetadata::from_json( + ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\AssaAbloyVostioMetadata::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) => Result\Errors::from_json($e), - $json->errors ?? [], - ), - external_type: $json->external_type ?? null, + external_type: is_string($json->external_type ?? null) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType::tryFrom( + $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, - noise_threshold: $json->noise_threshold ?? null, parent_acs_credential_id: $json->parent_acs_credential_id ?? null, - pending_mutations: array_map( - fn($p) => Result\PendingMutations::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) - ? Result\VisionlineMetadata::from_json( + ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata::from_json( $json->visionline_metadata, ) : null, - warnings: array_map( - fn($w) => Result\Warnings::from_json($w), - $json->warnings ?? [], - ), - was_confirmed_by_device: $json->was_confirmed_by_device ?? null, - workspace_id: $json->workspace_id ?? null, ); } public function __construct( - /** - * @var array|\stdClass|null - */ - public array|\stdClass|null $access_code, /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public string|null $access_method, - /** - * ID of the access method. - */ - public string|null $access_method_id, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ public string|null $acs_credential_id, - /** - * Snapshot of credential data read from the physical encoder. - */ - public Result\AcsCredentialOnEncoder|null $acs_credential_on_encoder, - /** - * Corresponding credential data as stored on Seam and the access system. - */ - public Result\AcsCredentialOnSeam|null $acs_credential_on_seam, /** * ID of the [access control system](https://docs.seam.co/low-level-apis/access-systems) that contains the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -191,26 +2375,30 @@ public function __construct( * ID of the [connected account](https://docs.seam.co/core-concepts/connected-accounts) to which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) belongs. */ public string|null $connected_account_id, - public string|null $created_at, - public string|null $display_name, - public array $errors, /** - * Indicates whether Seam manages the credential. + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created. */ - public bool|null $is_managed, + public string|null $created_at, /** - * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * Display name that corresponds to the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ - public string|null $mode, + public string|null $display_name, /** - * @var array|\stdClass|null + * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list<\Seam\Resources\ActionAttempt\EncodeCredential\Result\Errors> */ - public array|\stdClass|null $noise_threshold, + public array $errors, + public bool|null $is_managed, /** - * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. + * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list<\Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings> */ - public array $pending_mutations, public array $warnings, + /** + * ID of the workspace that contains the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ public string|null $workspace_id, /** * ID of the credential pool to which the credential belongs. @@ -223,24 +2411,19 @@ public function __construct( /** * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public Result\AkilesMetadata|null $akiles_metadata = null, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\AkilesMetadata|null $akiles_metadata = null, /** * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public Result\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, /** * Number of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ public string|null $card_number = null, /** - * Token of the client session associated with the access method. + * Access (PIN) code for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public string|null $client_session_token = null, public string|null $code = null, - /** - * ID of the customization profile associated with the access method. - */ - public string|null $customization_profile_id = null, /** * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) validity ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`. */ @@ -248,23 +2431,14 @@ public function __construct( /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. */ - public string|null $external_type = null, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ public string|null $external_type_display_name = null, /** - * URL of the Instant Key for mobile key access methods. - */ - public string|null $instant_key_url = null, - /** - * Indicates whether an existing card credential must be assigned to this access method before it can be issued. Only applies to card-mode access methods on systems that support credential assignment. - */ - public bool|null $is_assignment_required = null, - /** - * Indicates whether encoding with an card encoder is required to issue or reissue the plastic card associated with the access method. + * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) has been encoded onto a card. */ - public bool|null $is_encoding_required = null, public bool|null $is_issued = null, /** * Indicates whether the latest state of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) has been synced from Seam to the provider. @@ -279,138 +2453,367 @@ public function __construct( */ public bool|null $is_one_time_use = null, /** - * Indicates whether the access method is ready for card assignment. This is true when the access method is in card mode, has not yet been issued, and the system supports credential assignment. - */ - public bool|null $is_ready_for_assignment = null, - /** - * Indicates whether the access method is ready to be encoded. This is true when the credential has been created and the card has not yet been issued. + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was encoded onto a card. */ - public bool|null $is_ready_for_encoding = null, public string|null $issued_at = null, /** * Date and time at which the state of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was most recently synced from Seam to the provider. */ public string|null $latest_desired_state_synced_with_provider_at = null, /** - * ID of the parent [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * ID of the parent [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public string|null $parent_acs_credential_id = null, + /** + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) validity starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + */ + public string|null $starts_at = null, + /** + * ID of the [user identity](https://docs.seam.co/api/user_identities) to whom the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) belongs. + */ + public string|null $user_identity_id = null, + /** + * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata|null $visionline_metadata = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential\Result { + /** + * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class AkilesMetadata + { + public static function from_json(mixed $json): AkilesMetadata|null + { + if (!$json) { + return null; + } + return new self(member_pin_id: $json->member_pin_id ?? null); + } + + public function __construct( + /** + * ID of the Akiles member PIN. + */ + public string|null $member_pin_id = null, + ) {} + } + + /** + * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class AssaAbloyVostioMetadata + { + public static function from_json( + mixed $json, + ): AssaAbloyVostioMetadata|null { + if (!$json) { + return null; + } + return new self( + auto_join: $json->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( + /** + * Indicates whether the credential should auto-join. For an auto-join credential, Seam automatically issues an override card if there are no other cards and a joiner card if there are existing cards on the doors. + */ + public bool|null $auto_join = null, + /** + * Names of the doors to which to grant access in the Vostio access system. + * + * @var list|null + */ + public array|null $door_names = null, + /** + * Endpoint ID in the Vostio access system. + */ + public string|null $endpoint_id = null, + /** + * Key ID in the Vostio access system. + */ + public string|null $key_id = null, + /** + * Key issuing request ID in the Vostio access system. + */ + public string|null $key_issuing_request_id = null, + /** + * IDs of the guest entrances to override in the Vostio access system. + * + * @var list|null + */ + public array|null $override_guest_acs_entrance_ids = null, + ) {} + } + + /** + * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class Errors + { + public static function from_json(mixed $json): Errors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + public string|null $error_code, + public string|null $message, + ) {} + } + + /** + * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ + class VisionlineMetadata + { + public static function from_json(mixed $json): VisionlineMetadata|null + { + if (!$json) { + return null; + } + return new self( + auto_join: $json->auto_join ?? null, + card_function_type: is_string($json->card_function_type ?? null) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType::tryFrom( + $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( + /** + * Indicates whether the credential should auto-join. For an auto-join credential, Seam automatically issues an override card if there are no other cards and a joiner card if there are existing cards on the doors. + */ + public bool|null $auto_join = null, + /** + * Card function type in the Visionline access system. + */ + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType|null $card_function_type = null, + /** + * ID of the card in the Visionline access system. + */ + public string|null $card_id = null, + /** + * Common entrance IDs in the Visionline access system. + * + * @var list|null + */ + public array|null $common_acs_entrance_ids = null, + /** + * ID of the credential in the Visionline access system. */ - public string|null $parent_acs_credential_id = null, + public string|null $credential_id = null, /** - * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) validity starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + * Guest entrance IDs in the Visionline access system. + * + * @var list|null */ - public string|null $starts_at = null, + public array|null $guest_acs_entrance_ids = null, /** - * ID of the [user identity](https://docs.seam.co/api/user_identities) to whom the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) belongs. + * Indicates whether the credential is valid. */ - public string|null $user_identity_id = null, + public bool|null $is_valid = null, /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * IDs of the credentials to which you want to join. + * + * @var list|null */ - public Result\VisionlineMetadata|null $visionline_metadata = null, - public bool|null $was_confirmed_by_device = null, + public array|null $joiner_acs_credential_ids = null, ) {} } -} -namespace Seam\Resources\ActionAttempt\Result { /** - * Snapshot of credential data read from the physical encoder. + * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - class AcsCredentialOnEncoder + class Warnings { - public static function from_json( - mixed $json, - ): AcsCredentialOnEncoder|null { + public static function from_json(mixed $json): Warnings|null + { if (!$json) { return null; } return new self( - card_number: $json->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) - ? AcsCredentialOnEncoder\VisionlineMetadata::from_json( - $json->visionline_metadata, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings\WarningCode::tryFrom( + $json->warning_code, ) : null, + new_code: $json->new_code ?? null, + original_code: $json->original_code ?? null, ); } public function __construct( /** - * A number or string that physically identifies the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). - */ - public string|null $card_number, - /** - * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created. + * Date and time at which Seam created the warning. */ public string|null $created_at, /** - * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) will stop being usable. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $ends_at, + public string|null $message, /** - * Indicates whether the credential has been issued (encoded onto a card). + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public bool|null $is_issued, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings\WarningCode|null $warning_code, /** - * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) becomes usable. + * The PIN code that was assigned instead. */ - public string|null $starts_at, + public string|null $new_code = null, /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * The originally requested PIN code that could not be used. */ - public AcsCredentialOnEncoder\VisionlineMetadata|null $visionline_metadata = null, + public string|null $original_code = null, ) {} } + enum AccessMethod: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } + + enum ExternalType: string + { + case PTI_CARD = "pti_card"; + case BRIVO_CREDENTIAL = "brivo_credential"; + case HID_CREDENTIAL = "hid_credential"; + case VISIONLINE_CARD = "visionline_card"; + case SALTO_KS_CREDENTIAL = "salto_ks_credential"; + case ASSA_ABLOY_VOSTIO_KEY = "assa_abloy_vostio_key"; + case SALTO_SPACE_KEY = "salto_space_key"; + case LATCH_ACCESS = "latch_access"; + case DORMAKABA_AMBIANCE_CREDENTIAL = "dormakaba_ambiance_credential"; + case HOTEK_CARD = "hotek_card"; + case SALTO_KS_TAG = "salto_ks_tag"; + case AVIGILON_ALTA_CREDENTIAL = "avigilon_alta_credential"; + case KISI_CREDENTIAL = "kisi_credential"; + case AKILES_CREDENTIAL = "akiles_credential"; + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata { + enum CardFunctionType: string + { + case GUEST = "guest"; + case STAFF = "staff"; + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings { + enum WarningCode: string + { + case WAITING_TO_BE_ISSUED = "waiting_to_be_issued"; + case SCHEDULE_EXTERNALLY_MODIFIED = "schedule_externally_modified"; + case SCHEDULE_MODIFIED = "schedule_modified"; + case BEING_DELETED = "being_deleted"; + case UNKNOWN_ISSUE_WITH_ACS_CREDENTIAL = "unknown_issue_with_acs_credential"; + case NEEDS_TO_BE_REISSUED = "needs_to_be_reissued"; + case REQUESTED_CODE_UNAVAILABLE = "requested_code_unavailable"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential { /** - * Corresponding credential data as stored on Seam and the access system. + * Result of a scan to assign attempt. If the attempt was successful, includes the credential data that was scanned and assigned. Null while the action attempt is pending or when this value does not apply. */ - class AcsCredentialOnSeam + class Result { - public static function from_json(mixed $json): AcsCredentialOnSeam|null + public static function from_json(mixed $json): Result|null { if (!$json) { return null; } return new self( - access_method: $json->access_method ?? null, + access_method: is_string($json->access_method ?? null) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AccessMethod::tryFrom( + $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, + 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, + ) => \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, acs_user_id: $json->acs_user_id ?? null, akiles_metadata: isset($json->akiles_metadata) - ? AcsCredentialOnSeam\AkilesMetadata::from_json( + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AkilesMetadata::from_json( $json->akiles_metadata, ) : null, assa_abloy_vostio_metadata: isset( $json->assa_abloy_vostio_metadata, ) - ? AcsCredentialOnSeam\AssaAbloyVostioMetadata::from_json( + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AssaAbloyVostioMetadata::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) => AcsCredentialOnSeam\Errors::from_json($e), - $json->errors ?? [], - ), - external_type: $json->external_type ?? null, + external_type: is_string($json->external_type ?? null) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType::tryFrom( + $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, @@ -422,15 +2825,10 @@ public static function from_json(mixed $json): AcsCredentialOnSeam|null starts_at: $json->starts_at ?? null, user_identity_id: $json->user_identity_id ?? null, visionline_metadata: isset($json->visionline_metadata) - ? AcsCredentialOnSeam\VisionlineMetadata::from_json( + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata::from_json( $json->visionline_metadata, ) : null, - warnings: array_map( - fn($w) => AcsCredentialOnSeam\Warnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, ); } @@ -438,7 +2836,7 @@ public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public string|null $access_method, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AccessMethod|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -461,11 +2859,18 @@ public function __construct( public string|null $display_name, /** * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Errors> */ public array $errors, - public bool|null $is_managed, + /** + * Indicates whether Seam manages the credential. + */ + public true|null $is_managed, /** * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var list<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings> */ public array $warnings, /** @@ -483,11 +2888,11 @@ public function __construct( /** * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public AcsCredentialOnSeam\AkilesMetadata|null $akiles_metadata = null, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AkilesMetadata|null $akiles_metadata = null, /** * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public AcsCredentialOnSeam\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, /** * Number of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -503,7 +2908,7 @@ public function __construct( /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. */ - public string|null $external_type = null, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -547,10 +2952,12 @@ public function __construct( /** * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public AcsCredentialOnSeam\VisionlineMetadata|null $visionline_metadata = null, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata|null $visionline_metadata = null, ) {} } +} +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Result { /** * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -601,6 +3008,8 @@ public function __construct( public bool|null $auto_join = null, /** * Names of the doors to which to grant access in the Vostio access system. + * + * @var list|null */ public array|null $door_names = null, /** @@ -617,11 +3026,16 @@ public function __construct( public string|null $key_issuing_request_id = null, /** * IDs of the guest entrances to override in the Vostio access system. + * + * @var list|null */ public array|null $override_guest_acs_entrance_ids = null, ) {} } + /** + * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ class Errors { public static function from_json(mixed $json): Errors|null @@ -641,61 +3055,8 @@ public function __construct( * Date and time at which Seam created the error. */ public string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ public string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - public string|null $message, - ) {} - } - - /** - * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. - */ - class PendingMutations - { - public static function from_json(mixed $json): PendingMutations|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - from: isset($json->from) - ? PendingMutations\From::from_json($json->from) - : null, - message: $json->message ?? null, - mutation_code: $json->mutation_code ?? null, - to: isset($json->to) - ? PendingMutations\To::from_json($json->to) - : null, - ); - } - - public function __construct( - /** - * Date and time at which the mutation was created. - */ - public string|null $created_at, - /** - * Previous access time configuration. - */ - public PendingMutations\From|null $from, - /** - * Detailed description of the mutation. - */ public string|null $message, - /** - * Mutation code to indicate that Seam is in the process of updating the access times for this access method. - */ - public string|null $mutation_code, - /** - * New access time configuration. - */ - public PendingMutations\To|null $to, ) {} } @@ -711,7 +3072,11 @@ public static function from_json(mixed $json): VisionlineMetadata|null } return new self( auto_join: $json->auto_join ?? null, - card_function_type: $json->card_function_type ?? null, + card_function_type: is_string($json->card_function_type ?? null) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType::tryFrom( + $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, @@ -730,13 +3095,15 @@ public function __construct( /** * Card function type in the Visionline access system. */ - public string|null $card_function_type = null, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ public string|null $card_id = null, /** * Common entrance IDs in the Visionline access system. + * + * @var list|null */ public array|null $common_acs_entrance_ids = null, /** @@ -745,6 +3112,8 @@ public function __construct( public string|null $credential_id = null, /** * Guest entrance IDs in the Visionline access system. + * + * @var list|null */ public array|null $guest_acs_entrance_ids = null, /** @@ -753,11 +3122,16 @@ public function __construct( public bool|null $is_valid = null, /** * IDs of the credentials to which you want to join. + * + * @var list|null */ public array|null $joiner_acs_credential_ids = null, ) {} } + /** + * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + */ class Warnings { public static function from_json(mixed $json): Warnings|null @@ -768,12 +3142,13 @@ public static function from_json(mixed $json): Warnings|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null, new_code: $json->new_code ?? null, - original_access_method_id: $json->original_access_method_id ?? - null, original_code: $json->original_code ?? null, - warning_code: $json->warning_code ?? null, - warning_message: $json->warning_message ?? null, ); } @@ -786,181 +3161,214 @@ public function __construct( * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, - public string|null $warning_code, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_message, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings\WarningCode|null $warning_code, /** * The PIN code that was assigned instead. */ public string|null $new_code = null, - /** - * ID of the original access method from which this backup access method was split, if applicable. - */ - public string|null $original_access_method_id = null, /** * The originally requested PIN code that could not be used. */ public string|null $original_code = null, ) {} } + + enum AccessMethod: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } + + enum ExternalType: string + { + case PTI_CARD = "pti_card"; + case BRIVO_CREDENTIAL = "brivo_credential"; + case HID_CREDENTIAL = "hid_credential"; + case VISIONLINE_CARD = "visionline_card"; + case SALTO_KS_CREDENTIAL = "salto_ks_credential"; + case ASSA_ABLOY_VOSTIO_KEY = "assa_abloy_vostio_key"; + case SALTO_SPACE_KEY = "salto_space_key"; + case LATCH_ACCESS = "latch_access"; + case DORMAKABA_AMBIANCE_CREDENTIAL = "dormakaba_ambiance_credential"; + case HOTEK_CARD = "hotek_card"; + case SALTO_KS_TAG = "salto_ks_tag"; + case AVIGILON_ALTA_CREDENTIAL = "avigilon_alta_credential"; + case KISI_CREDENTIAL = "kisi_credential"; + case AKILES_CREDENTIAL = "akiles_credential"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata { + enum CardFunctionType: string + { + case GUEST = "guest"; + case STAFF = "staff"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings { + enum WarningCode: string + { + case WAITING_TO_BE_ISSUED = "waiting_to_be_issued"; + case SCHEDULE_EXTERNALLY_MODIFIED = "schedule_externally_modified"; + case SCHEDULE_MODIFIED = "schedule_modified"; + case BEING_DELETED = "being_deleted"; + case UNKNOWN_ISSUE_WITH_ACS_CREDENTIAL = "unknown_issue_with_acs_credential"; + case NEEDS_TO_BE_REISSUED = "needs_to_be_reissued"; + case REQUESTED_CODE_UNAVAILABLE = "requested_code_unavailable"; + } } -namespace Seam\Resources\ActionAttempt\Result\AcsCredentialOnEncoder { +namespace Seam\Resources\ActionAttempt\AssignCredential { /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Result of assigning a credential. If successful, includes the updated access method with the assigned credential. Null while the action attempt is pending or when this value does not apply. */ - class VisionlineMetadata + class Result { - public static function from_json(mixed $json): VisionlineMetadata|null + public static function from_json(mixed $json): Result|null { if (!$json) { return null; } return new self( - cancelled: $json->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, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, + errors: array_map( + fn( + $e, + ) => \Seam\Resources\ActionAttempt\AssignCredential\Result\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_issued: $json->is_issued ?? null, + issued_at: $json->issued_at ?? null, + mode: is_string($json->mode ?? null) + ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Mode::tryFrom( + $json->mode, + ) + : null, + pending_mutations: array_map( + fn( + $p, + ) => \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations::from_json( + $p, + ), + $json->pending_mutations ?? [], + ), + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, + client_session_token: $json->client_session_token ?? null, + code: $json->code ?? 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, ); } public function __construct( /** - * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is cancelled. - */ - public bool|null $cancelled = null, - /** - * Format of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * ID of the access method. */ - public string|null $card_format = null, + public string|null $access_method_id, /** - * Holder of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Date and time at which the access method was created. */ - public string|null $card_holder = null, + public string|null $created_at, /** - * Card ID for the Visionline card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Display name of the access method. */ - public string|null $card_id = null, + public string|null $display_name, /** - * IDs of the common [entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * + * @var list<\Seam\Resources\ActionAttempt\AssignCredential\Result\Errors> */ - public array|null $common_acs_entrance_ids = null, + public array $errors, /** - * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is discarded. + * Indicates whether the access method has been issued. */ - public bool|null $discarded = null, + public bool|null $is_issued, /** - * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is expired. + * Date and time at which the access method was issued. */ - public bool|null $expired = null, + public string|null $issued_at, /** - * IDs of the guest [entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public array|null $guest_acs_entrance_ids = null, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\Mode|null $mode, /** - * Number of issued cards associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. + * + * @var list<\Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations> */ - public float|null $number_of_issued_cards = null, + public array $pending_mutations, /** - * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is overridden. + * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * + * @var list<\Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings> */ - public bool|null $overridden = null, + public array $warnings, /** - * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is overwritten. + * ID of the Seam workspace associated with the access method. */ - public bool|null $overwritten = null, + public string|null $workspace_id, /** - * Indicates whether the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is pending auto-update. + * Token of the client session associated with the access method. */ - public bool|null $pending_auto_update = null, - ) {} - } -} - -namespace Seam\Resources\ActionAttempt\Result\AcsCredentialOnSeam { - /** - * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). - */ - class AkilesMetadata - { - public static function from_json(mixed $json): AkilesMetadata|null - { - if (!$json) { - return null; - } - return new self(member_pin_id: $json->member_pin_id ?? null); - } - - public function __construct( + public string|null $client_session_token = null, /** - * ID of the Akiles member PIN. + * The actual PIN code for code access methods. */ - public string|null $member_pin_id = null, - ) {} - } - - /** - * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). - */ - class AssaAbloyVostioMetadata - { - public static function from_json( - mixed $json, - ): AssaAbloyVostioMetadata|null { - if (!$json) { - return null; - } - return new self( - auto_join: $json->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 string|null $code = null, /** - * Indicates whether the credential should auto-join. For an auto-join credential, Seam automatically issues an override card if there are no other cards and a joiner card if there are existing cards on the doors. + * ID of the customization profile associated with the access method. */ - public bool|null $auto_join = null, + public string|null $customization_profile_id = null, /** - * Names of the doors to which to grant access in the Vostio access system. + * URL of the Instant Key for mobile key access methods. */ - public array|null $door_names = null, + public string|null $instant_key_url = null, /** - * Endpoint ID in the Vostio access system. + * Indicates whether an existing card credential must be assigned to this access method before it can be issued. Only applies to card-mode access methods on systems that support credential assignment. */ - public string|null $endpoint_id = null, + public bool|null $is_assignment_required = null, /** - * Key ID in the Vostio access system. + * Indicates whether encoding with an card encoder is required to issue or reissue the plastic card associated with the access method. */ - public string|null $key_id = null, + public bool|null $is_encoding_required = null, /** - * Key issuing request ID in the Vostio access system. + * Indicates whether the access method is ready for card assignment. This is true when the access method is in card mode, has not yet been issued, and the system supports credential assignment. */ - public string|null $key_issuing_request_id = null, + public bool|null $is_ready_for_assignment = null, /** - * IDs of the guest entrances to override in the Vostio access system. + * Indicates whether the access method is ready to be encoded. This is true when the credential has been created and the card has not yet been issued. */ - public array|null $override_guest_acs_entrance_ids = null, + public bool|null $is_ready_for_encoding = null, ) {} } +} +namespace Seam\Resources\ActionAttempt\AssignCredential\Result { /** - * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). */ class Errors { @@ -971,7 +3379,11 @@ public static function from_json(mixed $json): Errors|null } return new self( created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null, message: $json->message ?? null, ); } @@ -981,72 +3393,74 @@ public function __construct( * Date and time at which Seam created the error. */ public string|null $created_at, - public string|null $error_code, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ public string|null $message, ) {} } /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. */ - class VisionlineMetadata + class PendingMutations { - public static function from_json(mixed $json): VisionlineMetadata|null + public static function from_json(mixed $json): PendingMutations|null { if (!$json) { return null; } return new self( - auto_join: $json->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, + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null, + to: isset($json->to) + ? \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\To::from_json( + $json->to, + ) + : null, ); } public function __construct( /** - * Indicates whether the credential should auto-join. For an auto-join credential, Seam automatically issues an override card if there are no other cards and a joiner card if there are existing cards on the doors. - */ - public bool|null $auto_join = null, - /** - * Card function type in the Visionline access system. - */ - public string|null $card_function_type = null, - /** - * ID of the card in the Visionline access system. - */ - public string|null $card_id = null, - /** - * Common entrance IDs in the Visionline access system. + * Date and time at which the mutation was created. */ - public array|null $common_acs_entrance_ids = null, + public string|null $created_at, /** - * ID of the credential in the Visionline access system. + * Previous access time configuration. */ - public string|null $credential_id = null, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\From|null $from, /** - * Guest entrance IDs in the Visionline access system. + * Detailed description of the mutation. */ - public array|null $guest_acs_entrance_ids = null, + public string|null $message, /** - * Indicates whether the credential is valid. + * Mutation code to indicate that Seam is in the process of updating the access times for this access method. */ - public bool|null $is_valid = null, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\MutationCode|null $mutation_code, /** - * IDs of the credentials to which you want to join. + * New access time configuration. */ - public array|null $joiner_acs_credential_ids = null, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\To|null $to, ) {} } /** - * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). */ class Warnings { @@ -1058,9 +3472,13 @@ public static function from_json(mixed $json): Warnings|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - new_code: $json->new_code ?? null, - original_code: $json->original_code ?? null, - warning_code: $json->warning_code ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null, + original_access_method_id: $json->original_access_method_id ?? + null, ); } @@ -1076,20 +3494,31 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, - /** - * The PIN code that was assigned instead. - */ - public string|null $new_code = null, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings\WarningCode|null $warning_code, /** - * The originally requested PIN code that could not be used. + * ID of the original access method from which this backup access method was split, if applicable. */ - public string|null $original_code = null, + public string|null $original_access_method_id = null, ) {} } + + enum Mode: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } +} + +namespace Seam\Resources\ActionAttempt\AssignCredential\Result\Errors { + enum ErrorCode: string + { + case FAILED_TO_ISSUE = "failed_to_issue"; + } } -namespace Seam\Resources\ActionAttempt\Result\PendingMutations { +namespace Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations { /** * Previous access time configuration. */ @@ -1145,4 +3574,121 @@ public function __construct( public string|null $starts_at, ) {} } + + enum MutationCode: string + { + case PROVISIONING_ACCESS = "provisioning_access"; + case REVOKING_ACCESS = "revoking_access"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + } +} + +namespace Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings { + enum WarningCode: string + { + case BEING_DELETED = "being_deleted"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + case PULLED_BACKUP_ACCESS_CODE = "pulled_backup_access_code"; + case DELAY_IN_ISSUING = "delay_in_issuing"; + } +} + +namespace Seam\Resources\ActionAttempt\CreateAccessCode { + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self(access_code: $json->access_code ?? null); + } + + public function __construct( + /** + * Created access code. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $access_code, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\UpdateAccessCode { + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self(access_code: $json->access_code ?? null); + } + + public function __construct( + /** + * Updated access code. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $access_code = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\CreateNoiseThreshold { + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self(noise_threshold: $json->noise_threshold ?? null); + } + + public function __construct( + /** + * Created noise threshold. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $noise_threshold, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\UpdateNoiseThreshold { + /** + * Result of the action. Null while the action attempt is pending or when this value does not apply. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self(noise_threshold: $json->noise_threshold ?? null); + } + + public function __construct( + /** + * Updated noise threshold. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $noise_threshold, + ) {} + } } diff --git a/src/Resources/ClientSession.php b/src/Resources/ClientSession.php index f481f7c6..d9664152 100644 --- a/src/Resources/ClientSession.php +++ b/src/Resources/ClientSession.php @@ -24,14 +24,14 @@ public static function from_json(mixed $json): ClientSession|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, 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, + customer_key: $json->customer_key ?? null, + user_identity_id: $json->user_identity_id ?? null, ); } @@ -42,10 +42,14 @@ public function __construct( public string|null $client_session_id, /** * IDs of the [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) associated with the [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens). + * + * @var list|null */ public array|null $connect_webview_ids, /** * IDs of the [connected accounts](https://docs.seam.co/core-concepts/connected-accounts) associated with the [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens). + * + * @var list|null */ public array|null $connected_account_ids, /** @@ -71,6 +75,7 @@ public function __construct( /** * IDs of the [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) associated with the client session. * + * @var list|null * @deprecated Use `user_identity_id` instead. */ public array|null $user_identity_ids, diff --git a/src/Resources/ConnectWebview.php b/src/Resources/ConnectWebview.php index 494aadc3..453af262 100644 --- a/src/Resources/ConnectWebview.php +++ b/src/Resources/ConnectWebview.php @@ -35,25 +35,39 @@ public static function from_json(mixed $json): ConnectWebview|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, + device_selection_mode: is_string( + $json->device_selection_mode ?? null, + ) + ? \Seam\Resources\ConnectWebview\DeviceSelectionMode::tryFrom( + $json->device_selection_mode, + ) + : null, login_successful: $json->login_successful ?? null, selected_provider: $json->selected_provider ?? null, - status: $json->status ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ConnectWebview\Status::tryFrom( + $json->status, + ) + : null, url: $json->url ?? null, wait_for_device_creation: $json->wait_for_device_creation ?? null, workspace_id: $json->workspace_id ?? null, + customer_key: $json->customer_key ?? null, ); } public function __construct( /** * High-level device capabilities that the Connect Webview can accept. When creating a Connect Webview, you can specify the types of devices that it can connect to Seam. If you do not set custom `accepted_capabilities`, Seam uses a default set of `accepted_capabilities` for each provider. For example, if you create a Connect Webview that accepts SmartThing devices, without specifying `accepted_capabilities`, Seam accepts only SmartThings locks. To connect SmartThings thermostats and locks to Seam, create a Connect Webview and include both `thermostat` and `lock` in the `accepted_capabilities`. + * + * @var list|null */ public array|null $accepted_capabilities, /** * List of accepted [provider keys](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-brands-to-display-in-your-connect-webviews). + * + * @var list|null */ public array|null $accepted_providers, /** @@ -97,7 +111,7 @@ public function __construct( /** * Device selection mode of the Connect Webview. Supported values: `none`, `single`, `multiple`. */ - public string|null $device_selection_mode, + public \Seam\Resources\ConnectWebview\DeviceSelectionMode|null $device_selection_mode, /** * Indicates whether the user logged in successfully using the Connect Webview. */ @@ -109,7 +123,7 @@ public function __construct( /** * Status of the Connect Webview. `authorized` indicates that the user has successfully logged into their device or system account, thereby completing the Connect Webview. */ - public string|null $status, + public \Seam\Resources\ConnectWebview\Status|null $status, /** * URL for the Connect Webview. You use the URL to display the Connect Webview flow to your user. */ @@ -129,3 +143,19 @@ public function __construct( ) {} } } + +namespace Seam\Resources\ConnectWebview { + enum DeviceSelectionMode: string + { + case NONE = "none"; + case SINGLE = "single"; + case MULTIPLE = "multiple"; + } + + enum Status: string + { + case PENDING = "pending"; + case FAILED = "failed"; + case AUTHORIZED = "authorized"; + } +} diff --git a/src/Resources/ConnectedAccount.php b/src/Resources/ConnectedAccount.php index 77d3076f..8b7a5594 100644 --- a/src/Resources/ConnectedAccount.php +++ b/src/Resources/ConnectedAccount.php @@ -13,41 +13,49 @@ public static function from_json(mixed $json): ConnectedAccount|null } return new self( 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) => ConnectedAccount\Errors::from_json($e), + fn( + $e, + ) => \Seam\Resources\ConnectedAccount\Errors::from_json($e), $json->errors ?? [], ), + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ConnectedAccount\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + account_type: $json->account_type ?? null, + created_at: $json->created_at ?? null, + customer_key: $json->customer_key ?? null, + default_checkin_time: $json->default_checkin_time ?? null, + default_checkout_time: $json->default_checkout_time ?? null, ical_feed_origin: $json->ical_feed_origin ?? null, ical_url: $json->ical_url ?? null, image_url: $json->image_url ?? null, time_zone: $json->time_zone ?? null, user_identifier: isset($json->user_identifier) - ? ConnectedAccount\UserIdentifier::from_json( + ? \Seam\Resources\ConnectedAccount\UserIdentifier::from_json( $json->user_identifier, ) : null, - warnings: array_map( - fn($w) => ConnectedAccount\Warnings::from_json($w), - $json->warnings ?? [], - ), ); } public function __construct( /** * List of capabilities that were accepted during the account connection process. + * + * @var list|null */ public array|null $accepted_capabilities, /** @@ -74,10 +82,14 @@ public function __construct( public string|null $display_name, /** * Errors associated with the connected account. + * + * @var list<\Seam\Resources\ConnectedAccount\Errors> */ public array $errors, /** * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\ConnectedAccount\Warnings> */ public array $warnings, /** @@ -121,7 +133,7 @@ public function __construct( * * @deprecated Use `display_name` instead. */ - public ConnectedAccount\UserIdentifier|null $user_identifier = null, + public \Seam\Resources\ConnectedAccount\UserIdentifier|null $user_identifier = null, ) {} } } @@ -130,26 +142,41 @@ public function __construct( /** * Errors associated with the connected account. */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - 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) - ? Errors\SaltoKsMetadata::from_json( - $json->salto_ks_metadata, - ) - : null, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\ConnectedAccount\Errors\ErrorCode::ACCOUNT_DISCONNECTED + => \Seam\Resources\ConnectedAccount\Errors\AccountDisconnected::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Errors\ErrorCode::BRIDGE_DISCONNECTED + => \Seam\Resources\ConnectedAccount\Errors\BridgeDisconnected::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Errors\ErrorCode::SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED + => \Seam\Resources\ConnectedAccount\Errors\SaltoKsSubscriptionLimitExceeded::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Errors\ErrorCode::DORMAKABA_SITES_DISCONNECTED + => \Seam\Resources\ConnectedAccount\Errors\DormakabaSitesDisconnected::from_json( + $json, + ), + default + => \Seam\Resources\ConnectedAccount\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -160,15 +187,11 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, - /** - * Salto KS metadata associated with the connected account that has an error. - */ - public Errors\SaltoKsMetadata|null $salto_ks_metadata, /** * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). */ @@ -228,47 +251,382 @@ public function __construct( /** * Warnings associated with the connected account. */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\ConnectedAccount\Warnings\WarningCode::SCHEDULED_MAINTENANCE_WINDOW + => \Seam\Resources\ConnectedAccount\Warnings\ScheduledMaintenanceWindow::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Warnings\WarningCode::UNKNOWN_ISSUE_WITH_CONNECTED_ACCOUNT + => \Seam\Resources\ConnectedAccount\Warnings\UnknownIssueWithConnectedAccount::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Warnings\WarningCode::SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED + => \Seam\Resources\ConnectedAccount\Warnings\SaltoKsSubscriptionLimitAlmostReached::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Warnings\WarningCode::ACCOUNT_REAUTHORIZATION_REQUESTED + => \Seam\Resources\ConnectedAccount\Warnings\AccountReauthorizationRequested::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\ConnectedAccount\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Warnings\WarningCode::PROVIDER_SERVICE_UNAVAILABLE + => \Seam\Resources\ConnectedAccount\Warnings\ProviderServiceUnavailable::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Warnings\WarningCode::SETUP_REQUIRED + => \Seam\Resources\ConnectedAccount\Warnings\SetupRequired::from_json( + $json, + ), + \Seam\Resources\ConnectedAccount\Warnings\WarningCode::DORMAKABA_SITES_UNAPPROVED + => \Seam\Resources\ConnectedAccount\Warnings\DormakabaSitesUnapproved::from_json( + $json, + ), + default + => \Seam\Resources\ConnectedAccount\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\ConnectedAccount\Errors { + /** + * Indicates that the account is disconnected. + */ + final class AccountDisconnected extends + \Seam\Resources\ConnectedAccount\Errors + { + public static function from_json(mixed $json): AccountDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + bool|null $is_connected_account_error = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + is_bridge_error: $is_bridge_error, + is_connected_account_error: $is_connected_account_error, + message: $message, + ); + } + } + + /** + * Indicates that the Seam API cannot communicate with [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge), for example, if the Seam Bridge executable has stopped or if the computer running the Seam Bridge executable is offline. See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-seam_bridge_disconnected). + */ + final class BridgeDisconnected extends + \Seam\Resources\ConnectedAccount\Errors + { + public static function from_json(mixed $json): BridgeDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + bool|null $is_connected_account_error = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + is_bridge_error: $is_bridge_error, + is_connected_account_error: $is_connected_account_error, + message: $message, + ); + } + } + + /** + * Indicates that the maximum number of users allowed for the site has been reached. This means that new access codes cannot be created. Contact Salto support to increase the user limit. + */ + final class SaltoKsSubscriptionLimitExceeded extends + \Seam\Resources\ConnectedAccount\Errors + { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitExceeded|null { if (!$json) { return null; } return new self( created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, message: $json->message ?? null, salto_ks_metadata: isset($json->salto_ks_metadata) - ? Warnings\SaltoKsMetadata::from_json( + ? \Seam\Resources\ConnectedAccount\Errors\SaltoKsSubscriptionLimitExceeded\SaltoKsMetadata::from_json( $json->salto_ks_metadata, ) : null, - warning_code: $json->warning_code ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, ); } public function __construct( /** - * Date and time at which Seam created the warning. + * Date and time at which Seam created the error. */ - public string|null $created_at, + string|null $created_at, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $message, + \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, /** - * Salto KS metadata associated with the connected account that has a warning. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public Warnings\SaltoKsMetadata|null $salto_ks_metadata, + string|null $message, /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * Salto KS metadata associated with the connected account that has an error. */ - public string|null $warning_code, - ) {} + public \Seam\Resources\ConnectedAccount\Errors\SaltoKsSubscriptionLimitExceeded\SaltoKsMetadata|null $salto_ks_metadata, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + bool|null $is_connected_account_error = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + is_bridge_error: $is_bridge_error, + is_connected_account_error: $is_connected_account_error, + message: $message, + ); + } + } + + /** + * Indicates that one or more dormakaba sites associated with the connected account could not be connected. Contact dormakaba support. + */ + final class DormakabaSitesDisconnected extends + \Seam\Resources\ConnectedAccount\Errors + { + public static function from_json( + mixed $json, + ): DormakabaSitesDisconnected|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + bool|null $is_connected_account_error = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + is_bridge_error: $is_bridge_error, + is_connected_account_error: $is_connected_account_error, + message: $message, + ); + } + } + + /** + * Fallback for connected_account.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\ConnectedAccount\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + bool|null $is_connected_account_error = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + is_bridge_error: $is_bridge_error, + is_connected_account_error: $is_connected_account_error, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case ACCOUNT_DISCONNECTED = "account_disconnected"; + case BRIDGE_DISCONNECTED = "bridge_disconnected"; + case SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED = "salto_ks_subscription_limit_exceeded"; + case DORMAKABA_SITES_DISCONNECTED = "dormakaba_sites_disconnected"; } } -namespace Seam\Resources\ConnectedAccount\Errors { +namespace Seam\Resources\ConnectedAccount\Errors\SaltoKsSubscriptionLimitExceeded { /** * Salto KS metadata associated with the connected account that has an error. */ @@ -281,7 +639,11 @@ public static function from_json(mixed $json): SaltoKsMetadata|null } return new self( sites: array_map( - fn($s) => SaltoKsMetadata\Sites::from_json($s), + fn( + $s, + ) => \Seam\Resources\ConnectedAccount\Errors\SaltoKsSubscriptionLimitExceeded\SaltoKsMetadata\Sites::from_json( + $s, + ), $json->sites ?? [], ), ); @@ -290,13 +652,15 @@ public static function from_json(mixed $json): SaltoKsMetadata|null public function __construct( /** * Salto sites associated with the connected account that has an error. + * + * @var list<\Seam\Resources\ConnectedAccount\Errors\SaltoKsSubscriptionLimitExceeded\SaltoKsMetadata\Sites>|null */ public array|null $sites = null, ) {} } } -namespace Seam\Resources\ConnectedAccount\Errors\SaltoKsMetadata { +namespace Seam\Resources\ConnectedAccount\Errors\SaltoKsSubscriptionLimitExceeded\SaltoKsMetadata { /** * Salto sites associated with the connected account that has an error. */ @@ -339,6 +703,428 @@ public function __construct( } namespace Seam\Resources\ConnectedAccount\Warnings { + /** + * Indicates that scheduled downtime is planned for the connected account. + */ + final class ScheduledMaintenanceWindow extends + \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json( + mixed $json, + ): ScheduledMaintenanceWindow|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that an unknown issue occurred while syncing the state of the connected account with the provider. This issue may affect the proper functioning of one or more resources in the account. + */ + final class UnknownIssueWithConnectedAccount extends + \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json( + mixed $json, + ): UnknownIssueWithConnectedAccount|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the Salto KS site has exceeded 80% of the maximum number of allowed users. Increase your subscription limit or delete some users from your site. + */ + final class SaltoKsSubscriptionLimitAlmostReached extends + \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitAlmostReached|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + salto_ks_metadata: isset($json->salto_ks_metadata) + ? \Seam\Resources\ConnectedAccount\Warnings\SaltoKsSubscriptionLimitAlmostReached\SaltoKsMetadata::from_json( + $json->salto_ks_metadata, + ) + : null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Salto KS metadata associated with the connected account that has a warning. + */ + public \Seam\Resources\ConnectedAccount\Warnings\SaltoKsSubscriptionLimitAlmostReached\SaltoKsMetadata|null $salto_ks_metadata, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the Connected Account requires reauthorization using a new Connect Webview. The account is still connected, but cannot access new features. Delaying reauthorization too long will eventually cause the Connected Account to become disconnected. + */ + final class AccountReauthorizationRequested extends + \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json( + mixed $json, + ): AccountReauthorizationRequested|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the connected account is currently being deleted. All devices, access codes, and other resources associated with this account are in the process of being removed from Seam. + */ + final class BeingDeleted extends \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the connected account's provider service is temporarily unavailable. Seam will automatically retry and reconnect when the service becomes available again. + */ + final class ProviderServiceUnavailable extends + \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json( + mixed $json, + ): ProviderServiceUnavailable|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the connected account requires additional setup before it can be fully operational. Follow the instructions in the warning message to complete the setup. + */ + final class SetupRequired extends \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json(mixed $json): SetupRequired|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that one or more dormakaba sites associated with the connected account are not approved. Contact support@getseam.com to finish setting up your account. + */ + final class DormakabaSitesUnapproved extends + \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json( + mixed $json, + ): DormakabaSitesUnapproved|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for connected_account.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\ConnectedAccount\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case SCHEDULED_MAINTENANCE_WINDOW = "scheduled_maintenance_window"; + case UNKNOWN_ISSUE_WITH_CONNECTED_ACCOUNT = "unknown_issue_with_connected_account"; + case SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED = "salto_ks_subscription_limit_almost_reached"; + case ACCOUNT_REAUTHORIZATION_REQUESTED = "account_reauthorization_requested"; + case BEING_DELETED = "being_deleted"; + case PROVIDER_SERVICE_UNAVAILABLE = "provider_service_unavailable"; + case SETUP_REQUIRED = "setup_required"; + case DORMAKABA_SITES_UNAPPROVED = "dormakaba_sites_unapproved"; + } +} + +namespace Seam\Resources\ConnectedAccount\Warnings\SaltoKsSubscriptionLimitAlmostReached { /** * Salto KS metadata associated with the connected account that has a warning. */ @@ -351,7 +1137,11 @@ public static function from_json(mixed $json): SaltoKsMetadata|null } return new self( sites: array_map( - fn($s) => SaltoKsMetadata\Sites::from_json($s), + fn( + $s, + ) => \Seam\Resources\ConnectedAccount\Warnings\SaltoKsSubscriptionLimitAlmostReached\SaltoKsMetadata\Sites::from_json( + $s, + ), $json->sites ?? [], ), ); @@ -360,13 +1150,15 @@ public static function from_json(mixed $json): SaltoKsMetadata|null public function __construct( /** * Salto sites associated with the connected account that has a warning. + * + * @var list<\Seam\Resources\ConnectedAccount\Warnings\SaltoKsSubscriptionLimitAlmostReached\SaltoKsMetadata\Sites>|null */ public array|null $sites = null, ) {} } } -namespace Seam\Resources\ConnectedAccount\Warnings\SaltoKsMetadata { +namespace Seam\Resources\ConnectedAccount\Warnings\SaltoKsSubscriptionLimitAlmostReached\SaltoKsMetadata { /** * Salto sites associated with the connected account that has a warning. */ diff --git a/src/Resources/Device.php b/src/Resources/Device.php index ee7ed893..73478dcc 100644 --- a/src/Resources/Device.php +++ b/src/Resources/Device.php @@ -12,6 +12,33 @@ public static function from_json(mixed $json): Device|null return null; } return new self( + 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: is_string($json->device_type ?? null) + ? \Seam\Resources\Device\DeviceType::tryFrom( + $json->device_type, + ) + : null, + display_name: $json->display_name ?? null, + errors: array_map( + fn($e) => \Seam\Resources\Device\Errors::from_json($e), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + properties: isset($json->properties) + ? \Seam\Resources\Device\Properties::from_json( + $json->properties, + ) + : null, + space_ids: $json->space_ids ?? null, + warnings: array_map( + fn($w) => \Seam\Resources\Device\Warnings::from_json($w), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, 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, @@ -42,45 +69,30 @@ 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) - ? Device\DeviceManufacturer::from_json( + ? \Seam\Resources\Device\DeviceManufacturer::from_json( $json->device_manufacturer, ) : null, device_provider: isset($json->device_provider) - ? Device\DeviceProvider::from_json($json->device_provider) + ? \Seam\Resources\Device\DeviceProvider::from_json( + $json->device_provider, + ) : null, - device_type: $json->device_type ?? null, - display_name: $json->display_name ?? null, - errors: array_map( - fn($e) => Device\Errors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed ?? null, location: isset($json->location) - ? Device\Location::from_json($json->location) + ? \Seam\Resources\Device\Location::from_json( + $json->location, + ) : null, nickname: $json->nickname ?? null, - properties: isset($json->properties) - ? Device\Properties::from_json($json->properties) - : null, - space_ids: $json->space_ids ?? null, - warnings: array_map( - fn($w) => Device\Warnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, ); } public function __construct( /** * Collection of capabilities that the device supports when connected to Seam. Values are `access_code`, which indicates that the device can manage and utilize digital PIN codes for secure access; `lock`, which indicates that the device controls a door locking mechanism, enabling the remote opening and closing of doors and other entry points; `noise_detection`, which indicates that the device supports monitoring and responding to ambient noise levels; `thermostat`, which indicates that the device can regulate and adjust indoor temperatures; `battery`, which indicates that the device can manage battery life and health; and `phone`, which indicates that the device is a mobile device, such as a smartphone. **Important:** Superseded by [capability flags](https://docs.seam.co/capability-guides/device-and-system-capabilities#capability-flags). + * + * @var list|null */ public array|null $capabilities_supported, /** @@ -104,13 +116,15 @@ public function __construct( /** * Type of the device. */ - public string|null $device_type, + public \Seam\Resources\Device\DeviceType|null $device_type, /** * Display name of the device, defaults to nickname (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the device easily, especially when there are numerous devices. */ public string|null $display_name, /** * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. + * + * @var list<\Seam\Resources\Device\Errors> */ public array $errors, /** @@ -120,13 +134,17 @@ public function __construct( /** * Properties of the device. */ - public Device\Properties|null $properties, + public \Seam\Resources\Device\Properties|null $properties, /** * IDs of the spaces the device is in. + * + * @var list|null */ public array|null $space_ids, /** * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. + * + * @var list<\Seam\Resources\Device\Warnings> */ public array $warnings, /** @@ -216,15 +234,15 @@ public function __construct( /** * Manufacturer of the device. Represents the hardware brand, which may differ from the provider. */ - public Device\DeviceManufacturer|null $device_manufacturer = null, + public \Seam\Resources\Device\DeviceManufacturer|null $device_manufacturer = null, /** * Provider of the device. Represents the third-party service through which the device is controlled. */ - public Device\DeviceProvider|null $device_provider = null, + public \Seam\Resources\Device\DeviceProvider|null $device_provider = null, /** * Location information for the device. */ - public Device\Location|null $location = null, + public \Seam\Resources\Device\Location|null $location = null, /** * Optional nickname to describe the device, settable through Seam. */ @@ -246,8 +264,8 @@ public static function from_json(mixed $json): DeviceManufacturer|null } return new self( display_name: $json->display_name ?? null, - image_url: $json->image_url ?? null, manufacturer: $json->manufacturer ?? null, + image_url: $json->image_url ?? null, ); } @@ -280,8 +298,8 @@ public static function from_json(mixed $json): DeviceProvider|null return new self( 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, + image_url: $json->image_url ?? null, ); } @@ -308,22 +326,80 @@ public function __construct( /** * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - 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, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\Device\Errors\ErrorCode::ACCOUNT_DISCONNECTED + => \Seam\Resources\Device\Errors\AccountDisconnected::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED + => \Seam\Resources\Device\Errors\SaltoKsSubscriptionLimitExceeded::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::INSUFFICIENT_PERMISSIONS + => \Seam\Resources\Device\Errors\InsufficientPermissions::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::DORMAKABA_SITES_DISCONNECTED + => \Seam\Resources\Device\Errors\DormakabaSitesDisconnected::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::DEVICE_OFFLINE + => \Seam\Resources\Device\Errors\DeviceOffline::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::DEVICE_REMOVED + => \Seam\Resources\Device\Errors\DeviceRemoved::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::HUB_DISCONNECTED + => \Seam\Resources\Device\Errors\HubDisconnected::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::DEVICE_DISCONNECTED + => \Seam\Resources\Device\Errors\DeviceDisconnected::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::EMPTY_BACKUP_ACCESS_CODE_POOL + => \Seam\Resources\Device\Errors\EmptyBackupAccessCodePool::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::AUGUST_LOCK_NOT_AUTHORIZED + => \Seam\Resources\Device\Errors\AugustLockNotAuthorized::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS + => \Seam\Resources\Device\Errors\MissingDeviceCredentials::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::AUXILIARY_HEAT_RUNNING + => \Seam\Resources\Device\Errors\AuxiliaryHeatRunning::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::SUBSCRIPTION_REQUIRED + => \Seam\Resources\Device\Errors\SubscriptionRequired::from_json( + $json, + ), + \Seam\Resources\Device\Errors\ErrorCode::BRIDGE_DISCONNECTED + => \Seam\Resources\Device\Errors\BridgeDisconnected::from_json( + $json, + ), + default => \Seam\Resources\Device\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -334,17 +410,11 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, - public bool|null $is_connected_account_error, - public bool|null $is_device_error, + public \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, - /** - * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). - */ - public bool|null $is_bridge_error = null, ) {} } @@ -399,47 +469,58 @@ public static function from_json(mixed $json): Properties|null return null; } return new self( + appearance: isset($json->appearance) + ? \Seam\Resources\Device\Properties\Appearance::from_json( + $json->appearance, + ) + : null, + model: isset($json->model) + ? \Seam\Resources\Device\Properties\Model::from_json( + $json->model, + ) + : null, + name: $json->name ?? null, + online: $json->online ?? null, accessory_keypad: isset($json->accessory_keypad) - ? Properties\AccessoryKeypad::from_json( + ? \Seam\Resources\Device\Properties\AccessoryKeypad::from_json( $json->accessory_keypad, ) : null, active_thermostat_schedule: isset( $json->active_thermostat_schedule, ) - ? Properties\ActiveThermostatSchedule::from_json( + ? \Seam\Resources\Device\Properties\ActiveThermostatSchedule::from_json( $json->active_thermostat_schedule, ) : null, active_thermostat_schedule_id: $json->active_thermostat_schedule_id ?? null, akiles_metadata: isset($json->akiles_metadata) - ? Properties\AkilesMetadata::from_json( + ? \Seam\Resources\Device\Properties\AkilesMetadata::from_json( $json->akiles_metadata, ) : null, - appearance: isset($json->appearance) - ? Properties\Appearance::from_json($json->appearance) - : null, aqara_metadata: isset($json->aqara_metadata) - ? Properties\AqaraMetadata::from_json($json->aqara_metadata) + ? \Seam\Resources\Device\Properties\AqaraMetadata::from_json( + $json->aqara_metadata, + ) : null, assa_abloy_credential_service_metadata: isset( $json->assa_abloy_credential_service_metadata, ) - ? Properties\AssaAbloyCredentialServiceMetadata::from_json( + ? \Seam\Resources\Device\Properties\AssaAbloyCredentialServiceMetadata::from_json( $json->assa_abloy_credential_service_metadata, ) : null, assa_abloy_vostio_metadata: isset( $json->assa_abloy_vostio_metadata, ) - ? Properties\AssaAbloyVostioMetadata::from_json( + ? \Seam\Resources\Device\Properties\AssaAbloyVostioMetadata::from_json( $json->assa_abloy_vostio_metadata, ) : null, august_metadata: isset($json->august_metadata) - ? Properties\AugustMetadata::from_json( + ? \Seam\Resources\Device\Properties\AugustMetadata::from_json( $json->august_metadata, ) : null, @@ -448,7 +529,11 @@ public static function from_json(mixed $json): Properties|null available_climate_preset_modes: $json->available_climate_preset_modes ?? null, available_climate_presets: array_map( - fn($a) => Properties\AvailableClimatePresets::from_json($a), + fn( + $a, + ) => \Seam\Resources\Device\Properties\AvailableClimatePresets::from_json( + $a, + ), $json->available_climate_presets ?? [], ), available_fan_mode_settings: $json->available_fan_mode_settings ?? @@ -456,37 +541,45 @@ public static function from_json(mixed $json): Properties|null available_hvac_mode_settings: $json->available_hvac_mode_settings ?? null, avigilon_alta_metadata: isset($json->avigilon_alta_metadata) - ? Properties\AvigilonAltaMetadata::from_json( + ? \Seam\Resources\Device\Properties\AvigilonAltaMetadata::from_json( $json->avigilon_alta_metadata, ) : null, backup_access_code_pool_enabled: $json->backup_access_code_pool_enabled ?? null, battery: isset($json->battery) - ? Properties\Battery::from_json($json->battery) + ? \Seam\Resources\Device\Properties\Battery::from_json( + $json->battery, + ) : null, battery_level: $json->battery_level ?? null, brivo_metadata: isset($json->brivo_metadata) - ? Properties\BrivoMetadata::from_json($json->brivo_metadata) + ? \Seam\Resources\Device\Properties\BrivoMetadata::from_json( + $json->brivo_metadata, + ) : null, code_constraints: array_map( - fn($c) => Properties\CodeConstraints::from_json($c), + fn( + $c, + ) => \Seam\Resources\Device\Properties\CodeConstraints::from_json( + $c, + ), $json->code_constraints ?? [], ), controlbyweb_metadata: isset($json->controlbyweb_metadata) - ? Properties\ControlbywebMetadata::from_json( + ? \Seam\Resources\Device\Properties\ControlbywebMetadata::from_json( $json->controlbyweb_metadata, ) : null, current_climate_setting: isset($json->current_climate_setting) - ? Properties\CurrentClimateSetting::from_json( + ? \Seam\Resources\Device\Properties\CurrentClimateSetting::from_json( $json->current_climate_setting, ) : null, currently_triggering_noise_threshold_ids: $json->currently_triggering_noise_threshold_ids ?? null, default_climate_setting: isset($json->default_climate_setting) - ? Properties\DefaultClimateSetting::from_json( + ? \Seam\Resources\Device\Properties\DefaultClimateSetting::from_json( $json->default_climate_setting, ) : null, @@ -494,40 +587,48 @@ public static function from_json(mixed $json): Properties|null dormakaba_oracode_metadata: isset( $json->dormakaba_oracode_metadata, ) - ? Properties\DormakabaOracodeMetadata::from_json( + ? \Seam\Resources\Device\Properties\DormakabaOracodeMetadata::from_json( $json->dormakaba_oracode_metadata, ) : null, ecobee_metadata: isset($json->ecobee_metadata) - ? Properties\EcobeeMetadata::from_json( + ? \Seam\Resources\Device\Properties\EcobeeMetadata::from_json( $json->ecobee_metadata, ) : null, fallback_climate_preset_key: $json->fallback_climate_preset_key ?? null, - fan_mode_setting: $json->fan_mode_setting ?? null, + fan_mode_setting: is_string($json->fan_mode_setting ?? null) + ? \Seam\Resources\Device\Properties\FanModeSetting::tryFrom( + $json->fan_mode_setting, + ) + : null, four_suites_metadata: isset($json->four_suites_metadata) - ? Properties\FourSuitesMetadata::from_json( + ? \Seam\Resources\Device\Properties\FourSuitesMetadata::from_json( $json->four_suites_metadata, ) : null, genie_metadata: isset($json->genie_metadata) - ? Properties\GenieMetadata::from_json($json->genie_metadata) + ? \Seam\Resources\Device\Properties\GenieMetadata::from_json( + $json->genie_metadata, + ) : null, has_direct_power: $json->has_direct_power ?? null, has_native_entry_events: $json->has_native_entry_events ?? null, honeywell_resideo_metadata: isset( $json->honeywell_resideo_metadata, ) - ? Properties\HoneywellResideoMetadata::from_json( + ? \Seam\Resources\Device\Properties\HoneywellResideoMetadata::from_json( $json->honeywell_resideo_metadata, ) : null, igloo_metadata: isset($json->igloo_metadata) - ? Properties\IglooMetadata::from_json($json->igloo_metadata) + ? \Seam\Resources\Device\Properties\IglooMetadata::from_json( + $json->igloo_metadata, + ) : null, igloohome_metadata: isset($json->igloohome_metadata) - ? Properties\IgloohomeMetadata::from_json( + ? \Seam\Resources\Device\Properties\IgloohomeMetadata::from_json( $json->igloohome_metadata, ) : null, @@ -539,29 +640,33 @@ public static function from_json(mixed $json): Properties|null is_temporary_manual_override_active: $json->is_temporary_manual_override_active ?? null, keynest_metadata: isset($json->keynest_metadata) - ? Properties\KeynestMetadata::from_json( + ? \Seam\Resources\Device\Properties\KeynestMetadata::from_json( $json->keynest_metadata, ) : null, keypad_battery: isset($json->keypad_battery) - ? Properties\KeypadBattery::from_json($json->keypad_battery) + ? \Seam\Resources\Device\Properties\KeypadBattery::from_json( + $json->keypad_battery, + ) : null, kisi_metadata: isset($json->kisi_metadata) - ? Properties\KisiMetadata::from_json($json->kisi_metadata) + ? \Seam\Resources\Device\Properties\KisiMetadata::from_json( + $json->kisi_metadata, + ) : null, korelock_metadata: isset($json->korelock_metadata) - ? Properties\KorelockMetadata::from_json( + ? \Seam\Resources\Device\Properties\KorelockMetadata::from_json( $json->korelock_metadata, ) : null, kwikset_metadata: isset($json->kwikset_metadata) - ? Properties\KwiksetMetadata::from_json( + ? \Seam\Resources\Device\Properties\KwiksetMetadata::from_json( $json->kwikset_metadata, ) : null, locked: $json->locked ?? null, lockly_metadata: isset($json->lockly_metadata) - ? Properties\LocklyMetadata::from_json( + ? \Seam\Resources\Device\Properties\LocklyMetadata::from_json( $json->lockly_metadata, ) : null, @@ -593,77 +698,92 @@ public static function from_json(mixed $json): Properties|null min_heating_set_point_fahrenheit: $json->min_heating_set_point_fahrenheit ?? null, minut_metadata: isset($json->minut_metadata) - ? Properties\MinutMetadata::from_json($json->minut_metadata) - : null, - model: isset($json->model) - ? Properties\Model::from_json($json->model) + ? \Seam\Resources\Device\Properties\MinutMetadata::from_json( + $json->minut_metadata, + ) : null, - name: $json->name ?? null, nest_metadata: isset($json->nest_metadata) - ? Properties\NestMetadata::from_json($json->nest_metadata) + ? \Seam\Resources\Device\Properties\NestMetadata::from_json( + $json->nest_metadata, + ) : null, noise_level_decibels: $json->noise_level_decibels ?? null, noiseaware_metadata: isset($json->noiseaware_metadata) - ? Properties\NoiseawareMetadata::from_json( + ? \Seam\Resources\Device\Properties\NoiseawareMetadata::from_json( $json->noiseaware_metadata, ) : null, nuki_metadata: isset($json->nuki_metadata) - ? Properties\NukiMetadata::from_json($json->nuki_metadata) + ? \Seam\Resources\Device\Properties\NukiMetadata::from_json( + $json->nuki_metadata, + ) : null, offline_access_codes_enabled: $json->offline_access_codes_enabled ?? null, offline_time_frame_options: array_map( - fn($o) => Properties\OfflineTimeFrameOptions::from_json($o), + fn( + $o, + ) => \Seam\Resources\Device\Properties\OfflineTimeFrameOptions::from_json( + $o, + ), $json->offline_time_frame_options ?? [], ), omnitec_metadata: isset($json->omnitec_metadata) - ? Properties\OmnitecMetadata::from_json( + ? \Seam\Resources\Device\Properties\OmnitecMetadata::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( - fn($o) => Properties\OnlineTimeFrameOptions::from_json($o), + fn( + $o, + ) => \Seam\Resources\Device\Properties\OnlineTimeFrameOptions::from_json( + $o, + ), $json->online_time_frame_options ?? [], ), relative_humidity: $json->relative_humidity ?? null, ring_metadata: isset($json->ring_metadata) - ? Properties\RingMetadata::from_json($json->ring_metadata) + ? \Seam\Resources\Device\Properties\RingMetadata::from_json( + $json->ring_metadata, + ) : null, salto_ks_metadata: isset($json->salto_ks_metadata) - ? Properties\SaltoKsMetadata::from_json( + ? \Seam\Resources\Device\Properties\SaltoKsMetadata::from_json( $json->salto_ks_metadata, ) : null, salto_metadata: isset($json->salto_metadata) - ? Properties\SaltoMetadata::from_json($json->salto_metadata) + ? \Seam\Resources\Device\Properties\SaltoMetadata::from_json( + $json->salto_metadata, + ) : null, salto_space_credential_service_metadata: isset( $json->salto_space_credential_service_metadata, ) - ? Properties\SaltoSpaceCredentialServiceMetadata::from_json( + ? \Seam\Resources\Device\Properties\SaltoSpaceCredentialServiceMetadata::from_json( $json->salto_space_credential_service_metadata, ) : null, schlage_metadata: isset($json->schlage_metadata) - ? Properties\SchlageMetadata::from_json( + ? \Seam\Resources\Device\Properties\SchlageMetadata::from_json( $json->schlage_metadata, ) : null, seam_bridge_metadata: isset($json->seam_bridge_metadata) - ? Properties\SeamBridgeMetadata::from_json( + ? \Seam\Resources\Device\Properties\SeamBridgeMetadata::from_json( $json->seam_bridge_metadata, ) : null, sensi_metadata: isset($json->sensi_metadata) - ? Properties\SensiMetadata::from_json($json->sensi_metadata) + ? \Seam\Resources\Device\Properties\SensiMetadata::from_json( + $json->sensi_metadata, + ) : null, serial_number: $json->serial_number ?? null, smartthings_metadata: isset($json->smartthings_metadata) - ? Properties\SmartthingsMetadata::from_json( + ? \Seam\Resources\Device\Properties\SmartthingsMetadata::from_json( $json->smartthings_metadata, ) : null, @@ -675,54 +795,68 @@ public static function from_json(mixed $json): Properties|null supports_offline_access_codes: $json->supports_offline_access_codes ?? null, tado_metadata: isset($json->tado_metadata) - ? Properties\TadoMetadata::from_json($json->tado_metadata) + ? \Seam\Resources\Device\Properties\TadoMetadata::from_json( + $json->tado_metadata, + ) : null, tedee_metadata: isset($json->tedee_metadata) - ? Properties\TedeeMetadata::from_json($json->tedee_metadata) + ? \Seam\Resources\Device\Properties\TedeeMetadata::from_json( + $json->tedee_metadata, + ) : null, temperature_celsius: $json->temperature_celsius ?? null, temperature_fahrenheit: $json->temperature_fahrenheit ?? null, temperature_threshold: isset($json->temperature_threshold) - ? Properties\TemperatureThreshold::from_json( + ? \Seam\Resources\Device\Properties\TemperatureThreshold::from_json( $json->temperature_threshold, ) : null, thermostat_daily_program_period_precision_minutes: $json->thermostat_daily_program_period_precision_minutes ?? null, thermostat_daily_programs: array_map( - fn($t) => Properties\ThermostatDailyPrograms::from_json($t), + fn( + $t, + ) => \Seam\Resources\Device\Properties\ThermostatDailyPrograms::from_json( + $t, + ), $json->thermostat_daily_programs ?? [], ), thermostat_weekly_program: isset( $json->thermostat_weekly_program, ) - ? Properties\ThermostatWeeklyProgram::from_json( + ? \Seam\Resources\Device\Properties\ThermostatWeeklyProgram::from_json( $json->thermostat_weekly_program, ) : null, ttlock_metadata: isset($json->ttlock_metadata) - ? Properties\TtlockMetadata::from_json( + ? \Seam\Resources\Device\Properties\TtlockMetadata::from_json( $json->ttlock_metadata, ) : null, two_n_metadata: isset($json->two_n_metadata) - ? Properties\TwoNMetadata::from_json($json->two_n_metadata) + ? \Seam\Resources\Device\Properties\TwoNMetadata::from_json( + $json->two_n_metadata, + ) : null, ultraloq_metadata: isset($json->ultraloq_metadata) - ? Properties\UltraloqMetadata::from_json( + ? \Seam\Resources\Device\Properties\UltraloqMetadata::from_json( $json->ultraloq_metadata, ) : null, visionline_metadata: isset($json->visionline_metadata) - ? Properties\VisionlineMetadata::from_json( + ? \Seam\Resources\Device\Properties\VisionlineMetadata::from_json( $json->visionline_metadata, ) : null, wyze_metadata: isset($json->wyze_metadata) - ? Properties\WyzeMetadata::from_json($json->wyze_metadata) + ? \Seam\Resources\Device\Properties\WyzeMetadata::from_json( + $json->wyze_metadata, + ) : null, yacan_metadata: isset($json->yacan_metadata) - ? Properties\YacanMetadata::from_json($json->yacan_metadata) + ? \Seam\Resources\Device\Properties\YacanMetadata::from_json( + $json->yacan_metadata, + ) : null, ); } @@ -731,11 +865,11 @@ public function __construct( /** * Appearance-related properties, as reported by the device. */ - public Properties\Appearance|null $appearance, + public \Seam\Resources\Device\Properties\Appearance|null $appearance, /** * Device model-related properties. */ - public Properties\Model|null $model, + public \Seam\Resources\Device\Properties\Model|null $model, /** * Name of the device. * @@ -749,13 +883,13 @@ public function __construct( /** * Accessory keypad properties and state. */ - public Properties\AccessoryKeypad|null $accessory_keypad = null, + public \Seam\Resources\Device\Properties\AccessoryKeypad|null $accessory_keypad = null, /** * Active [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). * * @deprecated Use `active_thermostat_schedule_id` with `/thermostats/schedules/get` instead. */ - public Properties\ActiveThermostatSchedule|null $active_thermostat_schedule = null, + public \Seam\Resources\Device\Properties\ActiveThermostatSchedule|null $active_thermostat_schedule = null, /** * ID of the active [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). */ @@ -763,23 +897,23 @@ public function __construct( /** * Metadata for an Akiles device. */ - public Properties\AkilesMetadata|null $akiles_metadata = null, + public \Seam\Resources\Device\Properties\AkilesMetadata|null $akiles_metadata = null, /** * Metadata for an Aqara device. */ - public Properties\AqaraMetadata|null $aqara_metadata = null, + public \Seam\Resources\Device\Properties\AqaraMetadata|null $aqara_metadata = null, /** * ASSA ABLOY Credential Service metadata for the phone. */ - public Properties\AssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata = null, + public \Seam\Resources\Device\Properties\AssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata = null, /** * Metadata for an ASSA ABLOY Vostio system. */ - public Properties\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, + public \Seam\Resources\Device\Properties\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, /** * Metadata for an August device. */ - public Properties\AugustMetadata|null $august_metadata = null, + public \Seam\Resources\Device\Properties\AugustMetadata|null $august_metadata = null, /** * The delay in seconds before the lock automatically locks after being unlocked. */ @@ -790,24 +924,32 @@ public function __construct( public bool|null $auto_lock_enabled = null, /** * Climate preset modes that the thermostat supports, such as "home", "away", "wake", "sleep", "occupied", and "unoccupied". + * + * @var list|null */ public array|null $available_climate_preset_modes = null, /** * Available [climate presets](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) for the thermostat. + * + * @var list<\Seam\Resources\Device\Properties\AvailableClimatePresets>|null */ public array|null $available_climate_presets = null, /** * Fan mode settings that the thermostat supports. + * + * @var list|null */ public array|null $available_fan_mode_settings = null, /** * HVAC mode settings that the thermostat supports. + * + * @var list|null */ public array|null $available_hvac_mode_settings = null, /** * Metadata for an Avigilon Alta system. */ - public Properties\AvigilonAltaMetadata|null $avigilon_alta_metadata = null, + public \Seam\Resources\Device\Properties\AvigilonAltaMetadata|null $avigilon_alta_metadata = null, /** * Indicates whether the [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) is currently enabled for the device. To disable it, set this to `false` using [/devices/update](https://docs.seam.co/api/devices/update). */ @@ -815,7 +957,7 @@ public function __construct( /** * Represents the current status of the battery charge level. */ - public Properties\Battery|null $battery = null, + public \Seam\Resources\Device\Properties\Battery|null $battery = null, /** * Indicates the battery level of the device as a decimal value between 0 and 1, inclusive. */ @@ -823,27 +965,31 @@ public function __construct( /** * Metadata for a Brivo device. */ - public Properties\BrivoMetadata|null $brivo_metadata = null, + public \Seam\Resources\Device\Properties\BrivoMetadata|null $brivo_metadata = null, /** * Constraints on access codes for the device. Seam represents each constraint as an object with a `constraint_type` property. Depending on the constraint type, there may also be additional properties. Note that some constraints are manufacturer- or device-specific. + * + * @var list<\Seam\Resources\Device\Properties\CodeConstraints>|null */ public array|null $code_constraints = null, /** * Metadata for a ControlByWeb device. */ - public Properties\ControlbywebMetadata|null $controlbyweb_metadata = null, + public \Seam\Resources\Device\Properties\ControlbywebMetadata|null $controlbyweb_metadata = null, /** * Current climate setting. */ - public Properties\CurrentClimateSetting|null $current_climate_setting = null, + public \Seam\Resources\Device\Properties\CurrentClimateSetting|null $current_climate_setting = null, /** * Array of noise threshold IDs that are currently triggering. + * + * @var list|null */ public array|null $currently_triggering_noise_threshold_ids = null, /** * @deprecated use fallback_climate_preset_key to specify a fallback climate preset instead. */ - public Properties\DefaultClimateSetting|null $default_climate_setting = null, + public \Seam\Resources\Device\Properties\DefaultClimateSetting|null $default_climate_setting = null, /** * Indicates whether the door is open. */ @@ -851,11 +997,11 @@ public function __construct( /** * Metadata for a dormakaba Oracode device. */ - public Properties\DormakabaOracodeMetadata|null $dormakaba_oracode_metadata = null, + public \Seam\Resources\Device\Properties\DormakabaOracodeMetadata|null $dormakaba_oracode_metadata = null, /** * Metadata for an ecobee device. */ - public Properties\EcobeeMetadata|null $ecobee_metadata = null, + public \Seam\Resources\Device\Properties\EcobeeMetadata|null $ecobee_metadata = null, /** * Key of the [fallback climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets/setting-the-fallback-climate-preset) for the thermostat. */ @@ -863,15 +1009,15 @@ public function __construct( /** * @deprecated Use `current_climate_setting.fan_mode_setting` instead. */ - public string|null $fan_mode_setting = null, + public \Seam\Resources\Device\Properties\FanModeSetting|null $fan_mode_setting = null, /** * Metadata for a 4SUITES device. */ - public Properties\FourSuitesMetadata|null $four_suites_metadata = null, + public \Seam\Resources\Device\Properties\FourSuitesMetadata|null $four_suites_metadata = null, /** * Metadata for a Genie device. */ - public Properties\GenieMetadata|null $genie_metadata = null, + public \Seam\Resources\Device\Properties\GenieMetadata|null $genie_metadata = null, /** * Indicates whether the device has direct power. */ @@ -883,15 +1029,15 @@ public function __construct( /** * Metadata for a Honeywell Resideo device. */ - public Properties\HoneywellResideoMetadata|null $honeywell_resideo_metadata = null, + public \Seam\Resources\Device\Properties\HoneywellResideoMetadata|null $honeywell_resideo_metadata = null, /** * Metadata for an igloo device. */ - public Properties\IglooMetadata|null $igloo_metadata = null, + public \Seam\Resources\Device\Properties\IglooMetadata|null $igloo_metadata = null, /** * Metadata for an igloohome device. */ - public Properties\IgloohomeMetadata|null $igloohome_metadata = null, + public \Seam\Resources\Device\Properties\IgloohomeMetadata|null $igloohome_metadata = null, /** * Alt text for the device image. */ @@ -919,23 +1065,23 @@ public function __construct( /** * Metadata for a KeyNest device. */ - public Properties\KeynestMetadata|null $keynest_metadata = null, + public \Seam\Resources\Device\Properties\KeynestMetadata|null $keynest_metadata = null, /** * Keypad battery status. */ - public Properties\KeypadBattery|null $keypad_battery = null, + public \Seam\Resources\Device\Properties\KeypadBattery|null $keypad_battery = null, /** * Metadata for a Kisi device. */ - public Properties\KisiMetadata|null $kisi_metadata = null, + public \Seam\Resources\Device\Properties\KisiMetadata|null $kisi_metadata = null, /** * Metadata for a Korelock device. */ - public Properties\KorelockMetadata|null $korelock_metadata = null, + public \Seam\Resources\Device\Properties\KorelockMetadata|null $korelock_metadata = null, /** * Metadata for a Kwikset device. */ - public Properties\KwiksetMetadata|null $kwikset_metadata = null, + public \Seam\Resources\Device\Properties\KwiksetMetadata|null $kwikset_metadata = null, /** * Indicates whether the lock is locked. */ @@ -943,7 +1089,7 @@ public function __construct( /** * Metadata for a Lockly device. */ - public Properties\LocklyMetadata|null $lockly_metadata = null, + public \Seam\Resources\Device\Properties\LocklyMetadata|null $lockly_metadata = null, /** * Manufacturer of the device. When a device, such as a smart lock, is connected through a smart hub, the manufacturer of the device might be different from that of the smart hub. */ @@ -1003,11 +1149,11 @@ public function __construct( /** * Metadata for a Minut device. */ - public Properties\MinutMetadata|null $minut_metadata = null, + public \Seam\Resources\Device\Properties\MinutMetadata|null $minut_metadata = null, /** * Metadata for a Google Nest device. */ - public Properties\NestMetadata|null $nest_metadata = null, + public \Seam\Resources\Device\Properties\NestMetadata|null $nest_metadata = null, /** * Indicates current noise level in decibels, if the device supports noise detection. */ @@ -1015,11 +1161,11 @@ public function __construct( /** * Metadata for a NoiseAware device. */ - public Properties\NoiseawareMetadata|null $noiseaware_metadata = null, + public \Seam\Resources\Device\Properties\NoiseawareMetadata|null $noiseaware_metadata = null, /** * Metadata for a Nuki device. */ - public Properties\NukiMetadata|null $nuki_metadata = null, + public \Seam\Resources\Device\Properties\NukiMetadata|null $nuki_metadata = null, /** * Indicates whether it is currently possible to use offline access codes for the device. * @@ -1028,12 +1174,14 @@ public function __construct( public bool|null $offline_access_codes_enabled = null, /** * Time frames that may be requested when creating an offline access code, expressed as a list of options. The caller picks one option (by matching the requested duration when the options' duration ranges do not overlap, or by `display_name` when they do) and satisfies that one option's rules. When `undefined`, any time frame works. + * + * @var list<\Seam\Resources\Device\Properties\OfflineTimeFrameOptions>|null */ public array|null $offline_time_frame_options = null, /** * Metadata for an Omnitec device. */ - public Properties\OmnitecMetadata|null $omnitec_metadata = null, + public \Seam\Resources\Device\Properties\OmnitecMetadata|null $omnitec_metadata = null, /** * Indicates whether it is currently possible to use online access codes for the device. * @@ -1042,6 +1190,8 @@ public function __construct( public bool|null $online_access_codes_enabled = null, /** * Time frames that may be requested when creating an online access code, expressed as a list of options. The caller picks one option (by matching the requested duration when the options' duration ranges do not overlap, or by `display_name` when they do) and satisfies that one option's rules. When `undefined`, any time frame works. + * + * @var list<\Seam\Resources\Device\Properties\OnlineTimeFrameOptions>|null */ public array|null $online_time_frame_options = null, /** @@ -1051,33 +1201,33 @@ public function __construct( /** * Metadata for a Ring device. */ - public Properties\RingMetadata|null $ring_metadata = null, + public \Seam\Resources\Device\Properties\RingMetadata|null $ring_metadata = null, /** * Metadata for a Salto KS device. */ - public Properties\SaltoKsMetadata|null $salto_ks_metadata = null, + public \Seam\Resources\Device\Properties\SaltoKsMetadata|null $salto_ks_metadata = null, /** * Metada for a Salto device. * * @deprecated Use `salto_ks_metadata` instead. */ - public Properties\SaltoMetadata|null $salto_metadata = null, + public \Seam\Resources\Device\Properties\SaltoMetadata|null $salto_metadata = null, /** * Salto Space credential service metadata for the phone. */ - public Properties\SaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata = null, + public \Seam\Resources\Device\Properties\SaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata = null, /** * Metadata for a Schlage device. */ - public Properties\SchlageMetadata|null $schlage_metadata = null, + public \Seam\Resources\Device\Properties\SchlageMetadata|null $schlage_metadata = null, /** * Metadata for Seam Bridge. */ - public Properties\SeamBridgeMetadata|null $seam_bridge_metadata = null, + public \Seam\Resources\Device\Properties\SeamBridgeMetadata|null $seam_bridge_metadata = null, /** * Metadata for a Sensi device. */ - public Properties\SensiMetadata|null $sensi_metadata = null, + public \Seam\Resources\Device\Properties\SensiMetadata|null $sensi_metadata = null, /** * Serial number of the device. */ @@ -1085,9 +1235,11 @@ public function __construct( /** * Metadata for a SmartThings device. */ - public Properties\SmartthingsMetadata|null $smartthings_metadata = null, + public \Seam\Resources\Device\Properties\SmartthingsMetadata|null $smartthings_metadata = null, /** * Supported code lengths for access codes. + * + * @var list|null */ public array|null $supported_code_lengths = null, /** @@ -1105,11 +1257,11 @@ public function __construct( /** * Metadata for a tado° device. */ - public Properties\TadoMetadata|null $tado_metadata = null, + public \Seam\Resources\Device\Properties\TadoMetadata|null $tado_metadata = null, /** * Metadata for a Tedee device. */ - public Properties\TedeeMetadata|null $tedee_metadata = null, + public \Seam\Resources\Device\Properties\TedeeMetadata|null $tedee_metadata = null, /** * Reported temperature in °C. */ @@ -1121,80 +1273,184 @@ public function __construct( /** * Current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. */ - public Properties\TemperatureThreshold|null $temperature_threshold = null, + public \Seam\Resources\Device\Properties\TemperatureThreshold|null $temperature_threshold = null, /** * Precision of the thermostat's period in minutes. For example, if the thermostat supports 15-minute periods, this value is 15. All values are relative to the top of the hour, so for 15 minutes, the periods would be 0, 15, 30, and 45 minutes past the hour. */ public float|null $thermostat_daily_program_period_precision_minutes = null, /** * Configured [daily programs](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-programs) for the thermostat. + * + * @var list<\Seam\Resources\Device\Properties\ThermostatDailyPrograms>|null */ public array|null $thermostat_daily_programs = null, /** * Current [weekly program](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-programs) for the thermostat. */ - public Properties\ThermostatWeeklyProgram|null $thermostat_weekly_program = null, + public \Seam\Resources\Device\Properties\ThermostatWeeklyProgram|null $thermostat_weekly_program = null, /** * Metadata for a TTLock device. */ - public Properties\TtlockMetadata|null $ttlock_metadata = null, + public \Seam\Resources\Device\Properties\TtlockMetadata|null $ttlock_metadata = null, /** * Metadata for a 2N device. */ - public Properties\TwoNMetadata|null $two_n_metadata = null, + public \Seam\Resources\Device\Properties\TwoNMetadata|null $two_n_metadata = null, /** * Metadata for an Ultraloq device. */ - public Properties\UltraloqMetadata|null $ultraloq_metadata = null, + public \Seam\Resources\Device\Properties\UltraloqMetadata|null $ultraloq_metadata = null, /** * Metadata for an ASSA ABLOY Visionline system. */ - public Properties\VisionlineMetadata|null $visionline_metadata = null, + public \Seam\Resources\Device\Properties\VisionlineMetadata|null $visionline_metadata = null, /** * Metadata for a Wyze device. */ - public Properties\WyzeMetadata|null $wyze_metadata = null, + public \Seam\Resources\Device\Properties\WyzeMetadata|null $wyze_metadata = null, /** * Metadata for a Yacan device. */ - public Properties\YacanMetadata|null $yacan_metadata = null, + public \Seam\Resources\Device\Properties\YacanMetadata|null $yacan_metadata = null, ) {} } /** * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { if (!$json) { return null; } - return new self( - 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, - ); + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\Device\Warnings\WarningCode::PARTIAL_BACKUP_ACCESS_CODE_POOL + => \Seam\Resources\Device\Warnings\PartialBackupAccessCodePool::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::MANY_ACTIVE_BACKUP_CODES + => \Seam\Resources\Device\Warnings\ManyActiveBackupCodes::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::THIRD_PARTY_INTEGRATION_DETECTED + => \Seam\Resources\Device\Warnings\ThirdPartyIntegrationDetected::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::TTLOCK_LOCK_GATEWAY_UNLOCKING_NOT_ENABLED + => \Seam\Resources\Device\Warnings\TtlockLockGatewayUnlockingNotEnabled::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::TTLOCK_WEAK_GATEWAY_SIGNAL + => \Seam\Resources\Device\Warnings\TtlockWeakGatewaySignal::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::POWER_SAVING_MODE + => \Seam\Resources\Device\Warnings\PowerSavingMode::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::TEMPERATURE_THRESHOLD_EXCEEDED + => \Seam\Resources\Device\Warnings\TemperatureThresholdExceeded::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::DEVICE_COMMUNICATION_DEGRADED + => \Seam\Resources\Device\Warnings\DeviceCommunicationDegraded::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::SCHEDULED_MAINTENANCE_WINDOW + => \Seam\Resources\Device\Warnings\ScheduledMaintenanceWindow::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::DEVICE_HAS_FLAKY_CONNECTION + => \Seam\Resources\Device\Warnings\DeviceHasFlakyConnection::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::SALTO_KS_OFFICE_MODE + => \Seam\Resources\Device\Warnings\SaltoKsOfficeMode::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::SALTO_KS_PRIVACY_MODE + => \Seam\Resources\Device\Warnings\SaltoKsPrivacyMode::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::PRIVACY_MODE + => \Seam\Resources\Device\Warnings\PrivacyMode::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED + => \Seam\Resources\Device\Warnings\SaltoKsSubscriptionLimitAlmostReached::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::SALTO_KS_LOCK_ACCESS_CODE_SUPPORT_REMOVED + => \Seam\Resources\Device\Warnings\SaltoKsLockAccessCodeSupportRemoved::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::UNKNOWN_ISSUE_WITH_PHONE + => \Seam\Resources\Device\Warnings\UnknownIssueWithPhone::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::LOCKLY_TIME_ZONE_NOT_CONFIGURED + => \Seam\Resources\Device\Warnings\LocklyTimeZoneNotConfigured::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::ULTRALOQ_TIME_ZONE_UNKNOWN + => \Seam\Resources\Device\Warnings\UltraloqTimeZoneUnknown::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::TIME_ZONE_UNKNOWN + => \Seam\Resources\Device\Warnings\TimeZoneUnknown::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::TIME_ZONE_MISMATCH + => \Seam\Resources\Device\Warnings\TimeZoneMismatch::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::TWO_N_DEVICE_MISSING_TIMEZONE + => \Seam\Resources\Device\Warnings\TwoNDeviceMissingTimezone::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::HUB_REQUIRED_FOR_ADDITIONAL_CAPABILITIES + => \Seam\Resources\Device\Warnings\HubRequiredForAdditionalCapabilities::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::PROVIDER_ISSUE + => \Seam\Resources\Device\Warnings\ProviderIssue::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::KEYNEST_UNSUPPORTED_LOCKER + => \Seam\Resources\Device\Warnings\KeynestUnsupportedLocker::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::ACCESSORY_KEYPAD_SETUP_REQUIRED + => \Seam\Resources\Device\Warnings\AccessoryKeypadSetupRequired::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::UNRELIABLE_ONLINE_STATUS + => \Seam\Resources\Device\Warnings\UnreliableOnlineStatus::from_json( + $json, + ), + \Seam\Resources\Device\Warnings\WarningCode::MAX_ACCESS_CODES_REACHED + => \Seam\Resources\Device\Warnings\MaxAccessCodesReached::from_json( + $json, + ), + default => \Seam\Resources\Device\Warnings\Unknown::from_json( + $json, + ), + }; } public function __construct( - /** - * Number of active access codes on the device when the warning was set. - */ - public int|null $active_access_code_count, /** * Date and time at which Seam created the warning. */ public string|null $created_at, - /** - * Maximum number of active access codes supported by the device. - */ - public int|null $max_active_access_code_count, /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ @@ -1202,1051 +1458,1293 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, + public \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, ) {} } + + enum DeviceType: string + { + case AKUVOX_LOCK = "akuvox_lock"; + case AUGUST_LOCK = "august_lock"; + case BRIVO_ACCESS_POINT = "brivo_access_point"; + case BUTTERFLYMX_PANEL = "butterflymx_panel"; + case AVIGILON_ALTA_ENTRY = "avigilon_alta_entry"; + case DOORKING_LOCK = "doorking_lock"; + case GENIE_DOOR = "genie_door"; + case IGLOO_LOCK = "igloo_lock"; + case LINEAR_LOCK = "linear_lock"; + case LOCKLY_LOCK = "lockly_lock"; + case KWIKSET_LOCK = "kwikset_lock"; + case NUKI_LOCK = "nuki_lock"; + case SALTO_LOCK = "salto_lock"; + case SCHLAGE_LOCK = "schlage_lock"; + case SMARTTHINGS_LOCK = "smartthings_lock"; + case WYZE_LOCK = "wyze_lock"; + case YALE_LOCK = "yale_lock"; + case TWO_N_INTERCOM = "two_n_intercom"; + case CONTROLBYWEB_DEVICE = "controlbyweb_device"; + case TTLOCK_LOCK = "ttlock_lock"; + case IGLOOHOME_LOCK = "igloohome_lock"; + case FOUR_SUITES_DOOR = "four_suites_door"; + case DORMAKABA_ORACODE_DOOR = "dormakaba_oracode_door"; + case TEDEE_LOCK = "tedee_lock"; + case AKILES_LOCK = "akiles_lock"; + case ULTRALOQ_LOCK = "ultraloq_lock"; + case YACAN_LOCK = "yacan_lock"; + case KEYINCODE_LOCK = "keyincode_lock"; + case OMNITEC_LOCK = "omnitec_lock"; + case KISI_LOCK = "kisi_lock"; + case AQARA_LOCK = "aqara_lock"; + case KEYNEST_KEY = "keynest_key"; + case NOISEAWARE_ACTIVITY_ZONE = "noiseaware_activity_zone"; + case MINUT_SENSOR = "minut_sensor"; + case ECOBEE_THERMOSTAT = "ecobee_thermostat"; + case NEST_THERMOSTAT = "nest_thermostat"; + case HONEYWELL_RESIDEO_THERMOSTAT = "honeywell_resideo_thermostat"; + case TADO_THERMOSTAT = "tado_thermostat"; + case SENSI_THERMOSTAT = "sensi_thermostat"; + case SMARTTHINGS_THERMOSTAT = "smartthings_thermostat"; + case IOS_PHONE = "ios_phone"; + case ANDROID_PHONE = "android_phone"; + case RING_CAMERA = "ring_camera"; + } } -namespace Seam\Resources\Device\Properties { +namespace Seam\Resources\Device\Errors { /** - * Accessory keypad properties and state. + * Indicates that the account is disconnected. */ - class AccessoryKeypad + final class AccountDisconnected extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): AccessoryKeypad|null + public static function from_json(mixed $json): AccountDisconnected|null { if (!$json) { return null; } return new self( - battery: isset($json->battery) - ? AccessoryKeypad\Battery::from_json($json->battery) + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code : null, - is_connected: $json->is_connected ?? 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( /** - * Indicates if an accessory keypad is connected to the device. + * Date and time at which Seam created the error. */ - public bool|null $is_connected, + string|null $created_at, /** - * Keypad battery properties. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public AccessoryKeypad\Battery|null $battery = null, - ) {} + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Appearance-related properties, as reported by the device. + * Indicates that the Salto site user limit has been reached. */ - class Appearance + final class SaltoKsSubscriptionLimitExceeded extends + \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): Appearance|null - { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitExceeded|null { if (!$json) { return null; } - return new self(name: $json->name ?? null); + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( /** - * Name of the device as seen from the provider API and application, not settable through Seam. + * Date and time at which Seam created the error. */ - public string|null $name, - ) {} + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Represents the current status of the battery charge level. + * Indicates that Seam's integration user does not have sufficient permissions on the provider's system to which this device belongs, so Seam cannot manage access codes or unlock the device. See the error message for specifics, then either reauthorize the connected account in Seam or grant the integration user the required permissions in the provider's system. */ - class Battery + final class InsufficientPermissions extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): Battery|null - { + public static function from_json( + mixed $json, + ): InsufficientPermissions|null { if (!$json) { return null; } return new self( - level: $json->level ?? null, - status: $json->status ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( /** - * Battery charge level as a value between 0 and 1, inclusive. + * Date and time at which Seam created the error. */ - public float|null $level, + string|null $created_at, /** - * Represents the current status of the battery charge level. Values are `critical`, which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; `low`, which signifies that the battery is under the preferred threshold and should be charged soon; `good`, which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and `full`, which represents a battery that is fully charged, providing the maximum duration of usage. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $status, - ) {} + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Device model-related properties. + * Indicates that one or more dormakaba sites associated with the connected account could not be connected. Contact dormakaba support. */ - class Model + final class DormakabaSitesDisconnected extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): Model|null - { + public static function from_json( + mixed $json, + ): DormakabaSitesDisconnected|null { if (!$json) { return null; } return new self( - 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 ?? + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( /** - * Display name of the device model. - */ - public string|null $display_name, - /** - * Display name that corresponds to the manufacturer-specific terminology for the device. - */ - public string|null $manufacturer_display_name, - /** - * @deprecated use device.properties.model.can_connect_accessory_keypad + * Date and time at which Seam created the error. */ - public bool|null $accessory_keypad_supported = null, + string|null $created_at, /** - * Indicates whether the device can connect a accessory keypad. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public bool|null $can_connect_accessory_keypad = null, + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** - * Indicates whether the device has a built in accessory keypad. + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - public bool|null $has_built_in_keypad = null, + public true|null $is_connected_account_error, /** - * @deprecated use device.can_program_offline_access_codes. + * Indicates that the error is not a device error. */ - public bool|null $offline_access_codes_supported = null, + public false|null $is_device_error, /** - * @deprecated use device.can_program_online_access_codes. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $online_access_codes_supported = null, - ) {} + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * ASSA ABLOY Credential Service metadata for the phone. + * Indicates that the device is offline. */ - class AssaAbloyCredentialServiceMetadata + final class DeviceOffline extends \Seam\Resources\Device\Errors { - public static function from_json( - mixed $json, - ): AssaAbloyCredentialServiceMetadata|null { + public static function from_json(mixed $json): DeviceOffline|null + { if (!$json) { return null; } return new self( - endpoints: array_map( - fn( - $e, - ) => AssaAbloyCredentialServiceMetadata\Endpoints::from_json( - $e, - ), - $json->endpoints ?? [], - ), - has_active_endpoint: $json->has_active_endpoint ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Endpoints associated with the phone. + * Date and time at which Seam created the error. */ - public array|null $endpoints = null, + string|null $created_at, /** - * Indicates whether the credential service has active endpoints associated with the phone. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public bool|null $has_active_endpoint = null, - ) {} + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Salto Space credential service metadata for the phone. + * Indicates that the device has been removed. */ - class SaltoSpaceCredentialServiceMetadata + final class DeviceRemoved extends \Seam\Resources\Device\Errors { - public static function from_json( - mixed $json, - ): SaltoSpaceCredentialServiceMetadata|null { + public static function from_json(mixed $json): DeviceRemoved|null + { if (!$json) { return null; } - return new self(has_active_phone: $json->has_active_phone ?? null); + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); } public function __construct( /** - * Indicates whether the credential service has an active associated phone. + * Date and time at which Seam created the error. */ - public bool|null $has_active_phone = null, - ) {} + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Metadata for an Akiles device. + * Indicates that the hub is disconnected. */ - class AkilesMetadata + final class HubDisconnected extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): AkilesMetadata|null + public static function from_json(mixed $json): HubDisconnected|null { if (!$json) { return null; } return new self( - _member_group_id: $json->_member_group_id ?? null, - gadget_id: $json->gadget_id ?? null, - gadget_name: $json->gadget_name ?? null, - product_name: $json->product_name ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Group ID to which to add users for an Akiles device. + * Date and time at which Seam created the error. */ - public string|null $_member_group_id = null, + string|null $created_at, /** - * Gadget ID for an Akiles device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $gadget_id = null, + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** - * Gadget name for an Akiles device. + * Indicates that the error is a device error. */ - public string|null $gadget_name = null, + public true|null $is_device_error, /** - * Product name for an Akiles device. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $product_name = null, - ) {} + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Metadata for an Aqara device. + * Indicates that the device is disconnected. */ - class AqaraMetadata + final class DeviceDisconnected extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): AqaraMetadata|null + public static function from_json(mixed $json): DeviceDisconnected|null { if (!$json) { return null; } return new self( - device_name: $json->device_name ?? null, - did: $json->did ?? null, - firmware_version: $json->firmware_version ?? null, - model: $json->model ?? null, - model_type: $json->model_type ?? null, - parent_did: $json->parent_did ?? null, - position_id: $json->position_id ?? null, - time_zone: $json->time_zone ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Device name for an Aqara device. + * Date and time at which Seam created the error. */ - public string|null $device_name = null, + string|null $created_at, /** - * Device ID (did) for an Aqara device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $did = null, + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** - * Firmware version for an Aqara device. + * Indicates that the error is a device error. */ - public string|null $firmware_version = null, + public true|null $is_device_error, /** - * Model identifier for an Aqara device. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $model = null, + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) is empty. + */ + final class EmptyBackupAccessCodePool extends \Seam\Resources\Device\Errors + { + public static function from_json( + mixed $json, + ): EmptyBackupAccessCodePool|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Model type for an Aqara device. + * Date and time at which Seam created the error. */ - public float|null $model_type = null, + string|null $created_at, /** - * Parent gateway device ID for an Aqara device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $parent_did = null, + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** - * Position (room) ID for an Aqara device. + * Indicates that the error is a device error. */ - public string|null $position_id = null, + public true|null $is_device_error, /** - * Time zone reported for an Aqara device (e.g. GMT-07:00). + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $time_zone = null, - ) {} + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Metadata for an ASSA ABLOY Vostio system. + * Indicates that the user is not authorized to use the August lock. */ - class AssaAbloyVostioMetadata + final class AugustLockNotAuthorized extends \Seam\Resources\Device\Errors { public static function from_json( mixed $json, - ): AssaAbloyVostioMetadata|null { + ): AugustLockNotAuthorized|null { if (!$json) { return null; } - return new self(encoder_name: $json->encoder_name ?? null); + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); } public function __construct( /** - * Encoder name for an ASSA ABLOY Vostio system. + * Date and time at which Seam created the error. */ - public string|null $encoder_name = null, - ) {} + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Metadata for an August device. + * Indicates that device credentials are missing. */ - class AugustMetadata + final class MissingDeviceCredentials extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): AugustMetadata|null - { + public static function from_json( + mixed $json, + ): MissingDeviceCredentials|null { if (!$json) { return null; } return new self( - has_keypad: $json->has_keypad ?? null, - house_id: $json->house_id ?? null, - house_name: $json->house_name ?? null, - keypad_battery_level: $json->keypad_battery_level ?? null, - lock_id: $json->lock_id ?? null, - lock_name: $json->lock_name ?? null, - model: $json->model ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Indicates whether an August device has a keypad. + * Date and time at which Seam created the error. */ - public bool|null $has_keypad = null, + string|null $created_at, /** - * House ID for an August device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $house_id = null, + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** - * House name for an August device. + * Indicates that the error is a device error. */ - public string|null $house_name = null, + public true|null $is_device_error, /** - * Keypad battery level for an August device. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $keypad_battery_level = null, - /** - * Lock ID for an August device. - */ - public string|null $lock_id = null, - /** - * Lock name for an August device. - */ - public string|null $lock_name = null, - /** - * Model for an August device. - */ - public string|null $model = null, - ) {} + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Metadata for an Avigilon Alta system. + * Indicates that the auxiliary heat is running. */ - class AvigilonAltaMetadata + final class AuxiliaryHeatRunning extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): AvigilonAltaMetadata|null + public static function from_json(mixed $json): AuxiliaryHeatRunning|null { if (!$json) { return null; } return new self( - entry_name: $json->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, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Entry name for an Avigilon Alta system. - */ - public string|null $entry_name = null, - /** - * Total count of entry relays for an Avigilon Alta system. - */ - public float|null $entry_relays_total_count = null, - /** - * Organization name for an Avigilon Alta system. - */ - public string|null $org_name = null, - /** - * Site ID for an Avigilon Alta system. + * Date and time at which Seam created the error. */ - public float|null $site_id = null, + string|null $created_at, /** - * Site name for an Avigilon Alta system. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $site_name = null, + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** - * Zone ID for an Avigilon Alta system. + * Indicates that the error is a device error. */ - public float|null $zone_id = null, + public true|null $is_device_error, /** - * Zone name for an Avigilon Alta system. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $zone_name = null, - ) {} + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Metadata for a Brivo device. + * Indicates that a subscription is required to connect. */ - class BrivoMetadata + final class SubscriptionRequired extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): BrivoMetadata|null + public static function from_json(mixed $json): SubscriptionRequired|null { if (!$json) { return null; } return new self( - activation_enabled: $json->activation_enabled ?? null, - device_name: $json->device_name ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Indicates whether the Brivo access point has activation (remote unlock) enabled. + * Date and time at which Seam created the error. */ - public bool|null $activation_enabled = null, + string|null $created_at, /** - * Device name for a Brivo device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $device_name = null, - ) {} + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Metadata for a ControlByWeb device. + * Indicates that the Seam API cannot communicate with [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge), for example, if the Seam Bridge executable has stopped or if the computer running the Seam Bridge executable is offline. See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-seam_bridge_disconnected). */ - class ControlbywebMetadata + final class BridgeDisconnected extends \Seam\Resources\Device\Errors { - public static function from_json(mixed $json): ControlbywebMetadata|null + public static function from_json(mixed $json): BridgeDisconnected|null { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? null, - device_name: $json->device_name ?? null, - relay_name: $json->relay_name ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, ); } public function __construct( /** - * Device ID for a ControlByWeb device. + * Date and time at which Seam created the error. */ - public string|null $device_id = null, + string|null $created_at, /** - * Device name for a ControlByWeb device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $device_name = null, + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** - * Relay name for a ControlByWeb device. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $relay_name = null, - ) {} + string|null $message, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + public bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + public bool|null $is_connected_account_error = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Metadata for a dormakaba Oracode device. + * Fallback for device.errors values introduced after this SDK version. */ - class DormakabaOracodeMetadata + final class Unknown extends \Seam\Resources\Device\Errors { - public static function from_json( - mixed $json, - ): DormakabaOracodeMetadata|null { + public static function from_json(mixed $json): Unknown|null + { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? null, - door_id: $json->door_id ?? null, - door_is_wireless: $json->door_is_wireless ?? null, - door_name: $json->door_name ?? null, - iana_timezone: $json->iana_timezone ?? null, - predefined_time_slots: array_map( - fn( - $p, - ) => DormakabaOracodeMetadata\PredefinedTimeSlots::from_json( - $p, - ), - $json->predefined_time_slots ?? [], - ), - site_id: $json->site_id ?? null, - site_name: $json->site_name ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ); } public function __construct( /** - * Device ID for a dormakaba Oracode device. - */ - public string|null $device_id = null, - /** - * Door ID for a dormakaba Oracode device. - */ - public float|null $door_id = null, - /** - * Indicates whether a door is wireless for a dormakaba Oracode device. - */ - public bool|null $door_is_wireless = null, - /** - * Door name for a dormakaba Oracode device. - */ - public string|null $door_name = null, - /** - * IANA time zone for a dormakaba Oracode device. - */ - public string|null $iana_timezone = null, - /** - * Predefined time slots for a dormakaba Oracode device. + * Date and time at which Seam created the error. */ - public array|null $predefined_time_slots = null, + string|null $created_at, /** - * Site ID for a dormakaba Oracode device. - * - * @deprecated Previously marked as "@DEPRECATED." + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public float|null $site_id = null, + \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, /** - * Site name for a dormakaba Oracode device. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $site_name = null, - ) {} + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case ACCOUNT_DISCONNECTED = "account_disconnected"; + case SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED = "salto_ks_subscription_limit_exceeded"; + case INSUFFICIENT_PERMISSIONS = "insufficient_permissions"; + case DORMAKABA_SITES_DISCONNECTED = "dormakaba_sites_disconnected"; + case DEVICE_OFFLINE = "device_offline"; + case DEVICE_REMOVED = "device_removed"; + case HUB_DISCONNECTED = "hub_disconnected"; + case DEVICE_DISCONNECTED = "device_disconnected"; + case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; + case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; + case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; + case SUBSCRIPTION_REQUIRED = "subscription_required"; + case BRIDGE_DISCONNECTED = "bridge_disconnected"; } +} +namespace Seam\Resources\Device\Properties { /** - * Metadata for an ecobee device. + * Accessory keypad properties and state. */ - class EcobeeMetadata + class AccessoryKeypad { - public static function from_json(mixed $json): EcobeeMetadata|null + public static function from_json(mixed $json): AccessoryKeypad|null { if (!$json) { return null; } return new self( - device_name: $json->device_name ?? null, - ecobee_device_id: $json->ecobee_device_id ?? null, + is_connected: $json->is_connected ?? null, + battery: isset($json->battery) + ? \Seam\Resources\Device\Properties\AccessoryKeypad\Battery::from_json( + $json->battery, + ) + : null, ); } public function __construct( /** - * Device name for an ecobee device. + * Indicates if an accessory keypad is connected to the device. */ - public string|null $device_name = null, + public bool|null $is_connected, /** - * Device ID for an ecobee device. + * Keypad battery properties. */ - public string|null $ecobee_device_id = null, + public \Seam\Resources\Device\Properties\AccessoryKeypad\Battery|null $battery = null, ) {} } /** - * Metadata for a 4SUITES device. + * Appearance-related properties, as reported by the device. */ - class FourSuitesMetadata + class Appearance { - public static function from_json(mixed $json): FourSuitesMetadata|null + public static function from_json(mixed $json): Appearance|null { if (!$json) { return null; } - return new self( - device_id: $json->device_id ?? null, - device_name: $json->device_name ?? null, - reclose_delay_in_seconds: $json->reclose_delay_in_seconds ?? - null, - ); + return new self(name: $json->name ?? null); } public function __construct( /** - * Device ID for a 4SUITES device. - */ - public float|null $device_id = null, - /** - * Device name for a 4SUITES device. - */ - public string|null $device_name = null, - /** - * Reclose delay, in seconds, for a 4SUITES device. + * Name of the device as seen from the provider API and application, not settable through Seam. */ - public float|null $reclose_delay_in_seconds = null, + public string|null $name, ) {} } /** - * Metadata for a Genie device. + * Represents the current status of the battery charge level. */ - class GenieMetadata + class Battery { - public static function from_json(mixed $json): GenieMetadata|null + public static function from_json(mixed $json): Battery|null { if (!$json) { return null; } return new self( - device_name: $json->device_name ?? null, - door_name: $json->door_name ?? null, + level: $json->level ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\Device\Properties\Battery\Status::tryFrom( + $json->status, + ) + : null, ); } public function __construct( /** - * Lock name for a Genie device. + * Battery charge level as a value between 0 and 1, inclusive. */ - public string|null $device_name = null, + public float|null $level, /** - * Door name for a Genie device. + * Represents the current status of the battery charge level. Values are `critical`, which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; `low`, which signifies that the battery is under the preferred threshold and should be charged soon; `good`, which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and `full`, which represents a battery that is fully charged, providing the maximum duration of usage. */ - public string|null $door_name = null, + public \Seam\Resources\Device\Properties\Battery\Status|null $status, ) {} } /** - * Metadata for a Honeywell Resideo device. + * Device model-related properties. */ - class HoneywellResideoMetadata + class Model { - public static function from_json( - mixed $json, - ): HoneywellResideoMetadata|null { + public static function from_json(mixed $json): Model|null + { if (!$json) { return null; } return new self( - device_name: $json->device_name ?? null, - honeywell_resideo_device_id: $json->honeywell_resideo_device_id ?? + display_name: $json->display_name ?? null, + manufacturer_display_name: $json->manufacturer_display_name ?? + null, + accessory_keypad_supported: $json->accessory_keypad_supported ?? + null, + can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? + null, + has_built_in_keypad: $json->has_built_in_keypad ?? null, + offline_access_codes_supported: $json->offline_access_codes_supported ?? + null, + online_access_codes_supported: $json->online_access_codes_supported ?? null, ); } public function __construct( /** - * Device name for a Honeywell Resideo device. + * Display name of the device model. */ - public string|null $device_name = null, + public string|null $display_name, /** - * Device ID for a Honeywell Resideo device. + * Display name that corresponds to the manufacturer-specific terminology for the device. */ - public string|null $honeywell_resideo_device_id = null, + public string|null $manufacturer_display_name, + /** + * @deprecated use device.properties.model.can_connect_accessory_keypad + */ + public bool|null $accessory_keypad_supported = null, + /** + * Indicates whether the device can connect a accessory keypad. + */ + public bool|null $can_connect_accessory_keypad = null, + /** + * Indicates whether the device has a built in accessory keypad. + */ + public bool|null $has_built_in_keypad = null, + /** + * @deprecated use device.can_program_offline_access_codes. + */ + public bool|null $offline_access_codes_supported = null, + /** + * @deprecated use device.can_program_online_access_codes. + */ + public bool|null $online_access_codes_supported = null, ) {} } /** - * Metadata for an igloo device. + * ASSA ABLOY Credential Service metadata for the phone. */ - class IglooMetadata + class AssaAbloyCredentialServiceMetadata { - public static function from_json(mixed $json): IglooMetadata|null - { + public static function from_json( + mixed $json, + ): AssaAbloyCredentialServiceMetadata|null { if (!$json) { return null; } return new self( - bridge_id: $json->bridge_id ?? null, - device_id: $json->device_id ?? null, - model: $json->model ?? null, + endpoints: array_map( + fn( + $e, + ) => \Seam\Resources\Device\Properties\AssaAbloyCredentialServiceMetadata\Endpoints::from_json( + $e, + ), + $json->endpoints ?? [], + ), + has_active_endpoint: $json->has_active_endpoint ?? null, ); } public function __construct( /** - * Bridge ID for an igloo device. + * Endpoints associated with the phone. + * + * @var list<\Seam\Resources\Device\Properties\AssaAbloyCredentialServiceMetadata\Endpoints>|null */ - public string|null $bridge_id = null, + public array|null $endpoints = null, /** - * Device ID for an igloo device. + * Indicates whether the credential service has active endpoints associated with the phone. */ - public string|null $device_id = null, + public bool|null $has_active_endpoint = null, + ) {} + } + + /** + * Salto Space credential service metadata for the phone. + */ + class SaltoSpaceCredentialServiceMetadata + { + public static function from_json( + mixed $json, + ): SaltoSpaceCredentialServiceMetadata|null { + if (!$json) { + return null; + } + return new self(has_active_phone: $json->has_active_phone ?? null); + } + + public function __construct( /** - * Model for an igloo device. + * Indicates whether the credential service has an active associated phone. */ - public string|null $model = null, + public bool|null $has_active_phone = null, ) {} } /** - * Metadata for an igloohome device. + * Metadata for an Akiles device. */ - class IgloohomeMetadata + class AkilesMetadata { - public static function from_json(mixed $json): IgloohomeMetadata|null + public static function from_json(mixed $json): AkilesMetadata|null { if (!$json) { return null; } return new self( - bridge_id: $json->bridge_id ?? null, - bridge_name: $json->bridge_name ?? null, - device_id: $json->device_id ?? null, - device_name: $json->device_name ?? null, - is_accessory_keypad_linked_to_bridge: $json->is_accessory_keypad_linked_to_bridge ?? - null, - keypad_id: $json->keypad_id ?? null, + _member_group_id: $json->_member_group_id ?? null, + gadget_id: $json->gadget_id ?? null, + gadget_name: $json->gadget_name ?? null, + product_name: $json->product_name ?? null, ); } public function __construct( /** - * Bridge ID for an igloohome device. - */ - public string|null $bridge_id = null, - /** - * Bridge name for an igloohome device. - */ - public string|null $bridge_name = null, - /** - * Device ID for an igloohome device. + * Group ID to which to add users for an Akiles device. */ - public string|null $device_id = null, + public string|null $_member_group_id = null, /** - * Device name for an igloohome device. + * Gadget ID for an Akiles device. */ - public string|null $device_name = null, + public string|null $gadget_id = null, /** - * Indicates whether a keypad is linked to a bridge for an igloohome device. + * Gadget name for an Akiles device. */ - public bool|null $is_accessory_keypad_linked_to_bridge = null, + public string|null $gadget_name = null, /** - * Keypad ID for an igloohome device. + * Product name for an Akiles device. */ - public string|null $keypad_id = null, + public string|null $product_name = null, ) {} } /** - * Metadata for a KeyNest device. + * Metadata for an Aqara device. */ - class KeynestMetadata + class AqaraMetadata { - public static function from_json(mixed $json): KeynestMetadata|null + public static function from_json(mixed $json): AqaraMetadata|null { if (!$json) { return null; } return new self( - 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, + did: $json->did ?? null, + firmware_version: $json->firmware_version ?? null, + model: $json->model ?? null, + model_type: $json->model_type ?? null, + parent_did: $json->parent_did ?? null, + position_id: $json->position_id ?? null, + time_zone: $json->time_zone ?? null, ); } public function __construct( /** - * Address for a KeyNest device. - */ - public string|null $address = null, - /** - * Current or last store ID for a KeyNest device. - */ - public float|null $current_or_last_store_id = null, - /** - * Current status for a KeyNest device. - */ - public string|null $current_status = null, - /** - * Current user company for a KeyNest device. - */ - public string|null $current_user_company = null, - /** - * Current user email for a KeyNest device. - */ - public string|null $current_user_email = null, - /** - * Current user name for a KeyNest device. - */ - public string|null $current_user_name = null, - /** - * Current user phone number for a KeyNest device. - */ - public string|null $current_user_phone_number = null, - /** - * Default office ID for a KeyNest device. - */ - public float|null $default_office_id = null, - /** - * Device name for a KeyNest device. + * Device name for an Aqara device. */ public string|null $device_name = null, /** - * Fob ID for a KeyNest device. - */ - public float|null $fob_id = null, - /** - * Handover method for a KeyNest device. - */ - public string|null $handover_method = null, - /** - * Whether the KeyNest device has a photo. - */ - public bool|null $has_photo = null, - /** - * Whether the key is in a locker that does not support the access codes API. - */ - public bool|null $is_quadient_locker = null, - /** - * Key ID for a KeyNest device. - */ - public string|null $key_id = null, - /** - * Key notes for a KeyNest device. + * Device ID (did) for an Aqara device. */ - public string|null $key_notes = null, + public string|null $did = null, /** - * KeyNest app user for a KeyNest device. + * Firmware version for an Aqara device. */ - public string|null $keynest_app_user = null, + public string|null $firmware_version = null, /** - * Last movement timestamp for a KeyNest device. + * Model identifier for an Aqara device. */ - public string|null $last_movement = null, + public string|null $model = null, /** - * Property ID for a KeyNest device. + * Model type for an Aqara device. */ - public string|null $property_id = null, + public float|null $model_type = null, /** - * Property postcode for a KeyNest device. + * Parent gateway device ID for an Aqara device. */ - public string|null $property_postcode = null, + public string|null $parent_did = null, /** - * Status type for a KeyNest device. + * Position (room) ID for an Aqara device. */ - public string|null $status_type = null, + public string|null $position_id = null, /** - * Subscription plan for a KeyNest device. + * Time zone reported for an Aqara device (e.g. GMT-07:00). */ - public string|null $subscription_plan = null, + public string|null $time_zone = null, ) {} } /** - * Metadata for a Kisi device. + * Metadata for an ASSA ABLOY Vostio system. */ - class KisiMetadata + class AssaAbloyVostioMetadata { - public static function from_json(mixed $json): KisiMetadata|null - { + public static function from_json( + mixed $json, + ): AssaAbloyVostioMetadata|null { if (!$json) { return null; } - return new self( - description: $json->description ?? null, - lock_id: $json->lock_id ?? null, - lock_name: $json->lock_name ?? null, - place_name: $json->place_name ?? null, - ); + return new self(encoder_name: $json->encoder_name ?? null); } public function __construct( /** - * Description for a Kisi device. + * Encoder name for an ASSA ABLOY Vostio system. */ - public string|null $description = null, - /** - * Lock ID for a Kisi device. - */ - public float|null $lock_id = null, - /** - * Lock name for a Kisi device. - */ - public string|null $lock_name = null, - /** - * Place name for a Kisi device. - */ - public string|null $place_name = null, + public string|null $encoder_name = null, ) {} } /** - * Metadata for a Korelock device. + * Metadata for an August device. */ - class KorelockMetadata + class AugustMetadata { - public static function from_json(mixed $json): KorelockMetadata|null + public static function from_json(mixed $json): AugustMetadata|null { if (!$json) { return null; } return new self( - 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, + has_keypad: $json->has_keypad ?? null, + house_id: $json->house_id ?? null, + house_name: $json->house_name ?? null, + keypad_battery_level: $json->keypad_battery_level ?? null, + lock_id: $json->lock_id ?? null, + lock_name: $json->lock_name ?? null, + model: $json->model ?? null, ); } public function __construct( /** - * Device ID for a Korelock device. + * Indicates whether an August device has a keypad. */ - public string|null $device_id = null, + public bool|null $has_keypad = null, /** - * Device name for a Korelock device. + * House ID for an August device. */ - public string|null $device_name = null, + public string|null $house_id = null, /** - * Firmware version for a Korelock device. + * House name for an August device. */ - public string|null $firmware_version = null, + public string|null $house_name = null, /** - * Location ID for a Korelock device. Required for timebound access codes. + * Keypad battery level for an August device. */ - public string|null $location_id = null, + public string|null $keypad_battery_level = null, /** - * Model code for a Korelock device. + * Lock ID for an August device. */ - public string|null $model_code = null, + public string|null $lock_id = null, /** - * Serial number for a Korelock device. + * Lock name for an August device. */ - public string|null $serial_number = null, + public string|null $lock_name = null, /** - * WiFi signal strength (0-1) for a Korelock device. + * Model for an August device. */ - public float|null $wifi_signal_strength = null, + public string|null $model = null, ) {} } /** - * Metadata for a Kwikset device. + * Metadata for an Avigilon Alta system. */ - class KwiksetMetadata + class AvigilonAltaMetadata { - public static function from_json(mixed $json): KwiksetMetadata|null + public static function from_json(mixed $json): AvigilonAltaMetadata|null { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? null, - device_name: $json->device_name ?? null, - model_number: $json->model_number ?? null, + entry_name: $json->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( /** - * Device ID for a Kwikset device. + * Entry name for an Avigilon Alta system. */ - public string|null $device_id = null, + public string|null $entry_name = null, /** - * Device name for a Kwikset device. + * Total count of entry relays for an Avigilon Alta system. */ - public string|null $device_name = null, + public float|null $entry_relays_total_count = null, /** - * Model number for a Kwikset device. + * Organization name for an Avigilon Alta system. */ - public string|null $model_number = null, + public string|null $org_name = null, + /** + * Site ID for an Avigilon Alta system. + */ + public float|null $site_id = null, + /** + * Site name for an Avigilon Alta system. + */ + public string|null $site_name = null, + /** + * Zone ID for an Avigilon Alta system. + */ + public float|null $zone_id = null, + /** + * Zone name for an Avigilon Alta system. + */ + public string|null $zone_name = null, ) {} } /** - * Metadata for a Lockly device. + * Metadata for a Brivo device. */ - class LocklyMetadata + class BrivoMetadata { - public static function from_json(mixed $json): LocklyMetadata|null + public static function from_json(mixed $json): BrivoMetadata|null { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? null, + activation_enabled: $json->activation_enabled ?? null, device_name: $json->device_name ?? null, - model: $json->model ?? null, ); } public function __construct( /** - * Device ID for a Lockly device. + * Indicates whether the Brivo access point has activation (remote unlock) enabled. */ - public string|null $device_id = null, + public bool|null $activation_enabled = null, /** - * Device name for a Lockly device. + * Device name for a Brivo device. */ public string|null $device_name = null, - /** - * Model for a Lockly device. - */ - public string|null $model = null, ) {} } /** - * Metadata for a Minut device. + * Metadata for a ControlByWeb device. */ - class MinutMetadata + class ControlbywebMetadata { - public static function from_json(mixed $json): MinutMetadata|null + public static function from_json(mixed $json): ControlbywebMetadata|null { if (!$json) { return null; @@ -2254,127 +2752,130 @@ public static function from_json(mixed $json): MinutMetadata|null return new self( device_id: $json->device_id ?? null, device_name: $json->device_name ?? null, - latest_sensor_values: isset($json->latest_sensor_values) - ? MinutMetadata\LatestSensorValues::from_json( - $json->latest_sensor_values, - ) - : null, + relay_name: $json->relay_name ?? null, ); } public function __construct( /** - * Device ID for a Minut device. + * Device ID for a ControlByWeb device. */ public string|null $device_id = null, /** - * Device name for a Minut device. + * Device name for a ControlByWeb device. */ public string|null $device_name = null, /** - * Latest sensor values for a Minut device. + * Relay name for a ControlByWeb device. */ - public MinutMetadata\LatestSensorValues|null $latest_sensor_values = null, + public string|null $relay_name = null, ) {} } /** - * Metadata for a Google Nest device. + * Metadata for a dormakaba Oracode device. */ - class NestMetadata + class DormakabaOracodeMetadata { - public static function from_json(mixed $json): NestMetadata|null - { + public static function from_json( + mixed $json, + ): DormakabaOracodeMetadata|null { if (!$json) { return null; } return new self( - device_custom_name: $json->device_custom_name ?? null, - device_name: $json->device_name ?? null, - display_name: $json->display_name ?? null, - nest_device_id: $json->nest_device_id ?? null, - nest_structure_id: $json->nest_structure_id ?? null, - structure_name: $json->structure_name ?? null, + device_id: $json->device_id ?? null, + door_id: $json->door_id ?? null, + door_is_wireless: $json->door_is_wireless ?? null, + door_name: $json->door_name ?? null, + iana_timezone: $json->iana_timezone ?? null, + predefined_time_slots: array_map( + fn( + $p, + ) => \Seam\Resources\Device\Properties\DormakabaOracodeMetadata\PredefinedTimeSlots::from_json( + $p, + ), + $json->predefined_time_slots ?? [], + ), + site_id: $json->site_id ?? null, + site_name: $json->site_name ?? null, ); } public function __construct( /** - * Custom device name for a Google Nest device. The device owner sets this value. + * Device ID for a dormakaba Oracode device. */ - public string|null $device_custom_name = null, + public string|null $device_id = null, /** - * Device name for a Google Nest device. Google sets this value. + * Door ID for a dormakaba Oracode device. */ - public string|null $device_name = null, + public float|null $door_id = null, /** - * Display name for a Google Nest device. + * Indicates whether a door is wireless for a dormakaba Oracode device. */ - public string|null $display_name = null, + public bool|null $door_is_wireless = null, /** - * Device ID for a Google Nest device. + * Door name for a dormakaba Oracode device. */ - public string|null $nest_device_id = null, + public string|null $door_name = null, /** - * ID of the Google Nest structure containing the device. + * IANA time zone for a dormakaba Oracode device. */ - public string|null $nest_structure_id = null, + public string|null $iana_timezone = null, /** - * Name of the Google Nest structure containing the device. The device owner sets this value. + * Predefined time slots for a dormakaba Oracode device. + * + * @var list<\Seam\Resources\Device\Properties\DormakabaOracodeMetadata\PredefinedTimeSlots>|null */ - public string|null $structure_name = null, + public array|null $predefined_time_slots = null, + /** + * Site ID for a dormakaba Oracode device. + * + * @deprecated Previously marked as "@DEPRECATED." + */ + public float|null $site_id = null, + /** + * Site name for a dormakaba Oracode device. + */ + public string|null $site_name = null, ) {} } /** - * Metadata for a NoiseAware device. + * Metadata for an ecobee device. */ - class NoiseawareMetadata + class EcobeeMetadata { - public static function from_json(mixed $json): NoiseawareMetadata|null + public static function from_json(mixed $json): EcobeeMetadata|null { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? null, - device_model: $json->device_model ?? null, device_name: $json->device_name ?? null, - noise_level_decibel: $json->noise_level_decibel ?? null, - noise_level_nrs: $json->noise_level_nrs ?? null, + ecobee_device_id: $json->ecobee_device_id ?? null, ); } public function __construct( /** - * Device ID for a NoiseAware device. - */ - public string|null $device_id = null, - /** - * Device model for a NoiseAware device. - */ - public string|null $device_model = null, - /** - * Device name for a NoiseAware device. + * Device name for an ecobee device. */ public string|null $device_name = null, /** - * Noise level, in decibels, for a NoiseAware device. - */ - public float|null $noise_level_decibel = null, - /** - * Noise level, expressed as a Noise Risk Score (NRS), for a NoiseAware device. + * Device ID for an ecobee device. */ - public float|null $noise_level_nrs = null, + public string|null $ecobee_device_id = null, ) {} } /** - * Metadata for a Nuki device. + * Metadata for a 4SUITES device. */ - class NukiMetadata + class FourSuitesMetadata { - public static function from_json(mixed $json): NukiMetadata|null + public static function from_json(mixed $json): FourSuitesMetadata|null { if (!$json) { return null; @@ -2382,535 +2883,422 @@ public static function from_json(mixed $json): NukiMetadata|null return new self( device_id: $json->device_id ?? null, device_name: $json->device_name ?? null, - keypad_2_paired: $json->keypad_2_paired ?? null, - keypad_battery_critical: $json->keypad_battery_critical ?? null, - keypad_paired: $json->keypad_paired ?? null, + reclose_delay_in_seconds: $json->reclose_delay_in_seconds ?? + null, ); } public function __construct( /** - * Device ID for a Nuki device. + * Device ID for a 4SUITES device. */ - public string|null $device_id = null, + public float|null $device_id = null, /** - * Device name for a Nuki device. + * Device name for a 4SUITES device. */ public string|null $device_name = null, /** - * Indicates whether keypad 2 is paired for a Nuki device. + * Reclose delay, in seconds, for a 4SUITES device. */ - public bool|null $keypad_2_paired = null, - /** - * Indicates whether the keypad battery is in a critical state for a Nuki device. - */ - public bool|null $keypad_battery_critical = null, - /** - * Indicates whether the keypad is paired for a Nuki device. - */ - public bool|null $keypad_paired = null, + public float|null $reclose_delay_in_seconds = null, ) {} } /** - * Metadata for an Omnitec device. + * Metadata for a Genie device. */ - class OmnitecMetadata + class GenieMetadata { - public static function from_json(mixed $json): OmnitecMetadata|null + public static function from_json(mixed $json): GenieMetadata|null { if (!$json) { return null; } return new self( - has_gateway: $json->has_gateway ?? null, - lock_alias: $json->lock_alias ?? null, - lock_id: $json->lock_id ?? null, - lock_mac: $json->lock_mac ?? null, - lock_name: $json->lock_name ?? null, - time_zone: $json->time_zone ?? null, - timezone_raw_offset_ms: $json->timezone_raw_offset_ms ?? null, + device_name: $json->device_name ?? null, + door_name: $json->door_name ?? null, ); } public function __construct( /** - * Whether the Omnitec lock has a connected gateway for remote operations. - */ - public bool|null $has_gateway = null, - /** - * Operator-assigned alias for an Omnitec device. - */ - public string|null $lock_alias = null, - /** - * Lock ID for an Omnitec device. - */ - public float|null $lock_id = null, - /** - * Bluetooth MAC address for an Omnitec device. - */ - public string|null $lock_mac = null, - /** - * Lock name for an Omnitec device. - */ - public string|null $lock_name = null, - /** - * IANA time zone for the Omnitec device, used to schedule time-bound access codes at the correct local time (accounting for DST). + * Lock name for a Genie device. */ - public string|null $time_zone = null, + public string|null $device_name = null, /** - * Static UTC offset of the Omnitec lock in milliseconds. Does not account for DST. + * Door name for a Genie device. */ - public float|null $timezone_raw_offset_ms = null, + public string|null $door_name = null, ) {} } /** - * Metadata for a Ring device. + * Metadata for a Honeywell Resideo device. */ - class RingMetadata + class HoneywellResideoMetadata { - public static function from_json(mixed $json): RingMetadata|null - { + public static function from_json( + mixed $json, + ): HoneywellResideoMetadata|null { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? null, device_name: $json->device_name ?? null, + honeywell_resideo_device_id: $json->honeywell_resideo_device_id ?? + null, ); } public function __construct( /** - * Device ID for a Ring device. + * Device name for a Honeywell Resideo device. */ - public string|null $device_id = null, + public string|null $device_name = null, /** - * Device name for a Ring device. + * Device ID for a Honeywell Resideo device. */ - public string|null $device_name = null, + public string|null $honeywell_resideo_device_id = null, ) {} } /** - * Metadata for a Salto KS device. + * Metadata for an igloo device. */ - class SaltoKsMetadata + class IglooMetadata { - public static function from_json(mixed $json): SaltoKsMetadata|null + public static function from_json(mixed $json): IglooMetadata|null { if (!$json) { return null; } return new self( - battery_level: $json->battery_level ?? null, - customer_reference: $json->customer_reference ?? null, - has_custom_pin_subscription: $json->has_custom_pin_subscription ?? - null, - lock_id: $json->lock_id ?? null, - lock_type: $json->lock_type ?? null, - locked_state: $json->locked_state ?? null, + bridge_id: $json->bridge_id ?? null, + device_id: $json->device_id ?? null, model: $json->model ?? null, - site_id: $json->site_id ?? null, - site_name: $json->site_name ?? null, ); } public function __construct( /** - * Battery level for a Salto KS device. - */ - public string|null $battery_level = null, - /** - * Customer reference for a Salto KS device. - */ - public string|null $customer_reference = null, - /** - * Indicates whether the site has a Salto KS subscription that supports custom PINs. - */ - public bool|null $has_custom_pin_subscription = null, - /** - * Lock ID for a Salto KS device. - */ - public string|null $lock_id = null, - /** - * Lock type for a Salto KS device. + * Bridge ID for an igloo device. */ - public string|null $lock_type = null, + public string|null $bridge_id = null, /** - * Locked state for a Salto KS device. + * Device ID for an igloo device. */ - public string|null $locked_state = null, + public string|null $device_id = null, /** - * Model for a Salto KS device. + * Model for an igloo device. */ public string|null $model = null, - /** - * Site ID for the Salto KS site to which the device belongs. - */ - public string|null $site_id = null, - /** - * Site name for the Salto KS site to which the device belongs. - */ - public string|null $site_name = null, ) {} } /** - * Metada for a Salto device. - * - * @deprecated Use `salto_ks_metadata` instead. + * Metadata for an igloohome device. */ - class SaltoMetadata + class IgloohomeMetadata { - public static function from_json(mixed $json): SaltoMetadata|null + public static function from_json(mixed $json): IgloohomeMetadata|null { if (!$json) { return null; } return new self( - battery_level: $json->battery_level ?? null, - customer_reference: $json->customer_reference ?? null, - lock_id: $json->lock_id ?? null, - lock_type: $json->lock_type ?? null, - locked_state: $json->locked_state ?? null, - model: $json->model ?? null, - site_id: $json->site_id ?? null, - site_name: $json->site_name ?? null, + bridge_id: $json->bridge_id ?? null, + bridge_name: $json->bridge_name ?? null, + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + is_accessory_keypad_linked_to_bridge: $json->is_accessory_keypad_linked_to_bridge ?? + null, + keypad_id: $json->keypad_id ?? null, ); } public function __construct( /** - * Battery level for a Salto device. - */ - public string|null $battery_level = null, - /** - * Customer reference for a Salto device. - */ - public string|null $customer_reference = null, - /** - * Lock ID for a Salto device. + * Bridge ID for an igloohome device. */ - public string|null $lock_id = null, + public string|null $bridge_id = null, /** - * Lock type for a Salto device. + * Bridge name for an igloohome device. */ - public string|null $lock_type = null, + public string|null $bridge_name = null, /** - * Locked state for a Salto device. + * Device ID for an igloohome device. */ - public string|null $locked_state = null, + public string|null $device_id = null, /** - * Model for a Salto device. + * Device name for an igloohome device. */ - public string|null $model = null, + public string|null $device_name = null, /** - * Site ID for the Salto KS site to which the device belongs. + * Indicates whether a keypad is linked to a bridge for an igloohome device. */ - public string|null $site_id = null, + public bool|null $is_accessory_keypad_linked_to_bridge = null, /** - * Site name for the Salto KS site to which the device belongs. + * Keypad ID for an igloohome device. */ - public string|null $site_name = null, + public string|null $keypad_id = null, ) {} } /** - * Metadata for a Schlage device. + * Metadata for a KeyNest device. */ - class SchlageMetadata + class KeynestMetadata { - public static function from_json(mixed $json): SchlageMetadata|null + public static function from_json(mixed $json): KeynestMetadata|null { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? 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, - model: $json->model ?? 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( /** - * Device ID for a Schlage device. + * Address for a KeyNest device. */ - public string|null $device_id = null, + public string|null $address = null, /** - * Device name for a Schlage device. + * Current or last store ID for a KeyNest device. */ - public string|null $device_name = null, + public float|null $current_or_last_store_id = null, /** - * Model for a Schlage device. + * Current status for a KeyNest device. */ - public string|null $model = null, - ) {} - } - - /** - * Metadata for Seam Bridge. - */ - class SeamBridgeMetadata - { - public static function from_json(mixed $json): SeamBridgeMetadata|null - { - if (!$json) { - return null; - } - return new self( - device_num: $json->device_num ?? null, - name: $json->name ?? null, - unlock_method: $json->unlock_method ?? null, - ); - } - - public function __construct( + public string|null $current_status = null, /** - * Device number for Seam Bridge. + * Current user company for a KeyNest device. */ - public float|null $device_num = null, + public string|null $current_user_company = null, /** - * Name for Seam Bridge. + * Current user email for a KeyNest device. */ - public string|null $name = null, + public string|null $current_user_email = null, /** - * Unlock method for Seam Bridge. + * Current user name for a KeyNest device. */ - public string|null $unlock_method = null, - ) {} - } - - /** - * Metadata for a Sensi device. - */ - class SensiMetadata - { - public static function from_json(mixed $json): SensiMetadata|null - { - if (!$json) { - return null; - } - return new self( - device_id: $json->device_id ?? 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, - ); - } - - public function __construct( + public string|null $current_user_name = null, /** - * Device ID for a Sensi device. + * Current user phone number for a KeyNest device. */ - public string|null $device_id = null, + public string|null $current_user_phone_number = null, /** - * Device name for a Sensi device. + * Default office ID for a KeyNest device. + */ + public float|null $default_office_id = null, + /** + * Device name for a KeyNest device. */ public string|null $device_name = null, /** - * Set to true when the device does not support the /dual-setpoints API endpoint. + * Fob ID for a KeyNest device. */ - public bool|null $dual_setpoints_not_supported = null, + public float|null $fob_id = null, /** - * Enforced setpoint range in Celsius for a Sensi device, derived from an OutOfRange API error. + * Handover method for a KeyNest device. */ - public array|null $enforced_setpoint_range_celsius = null, + public string|null $handover_method = null, /** - * Product type for a Sensi device. + * Whether the KeyNest device has a photo. */ - public string|null $product_type = null, - ) {} - } - - /** - * Metadata for a SmartThings device. - */ - class SmartthingsMetadata - { - public static function from_json(mixed $json): SmartthingsMetadata|null - { - if (!$json) { - return null; - } - return new self( - device_id: $json->device_id ?? null, - device_name: $json->device_name ?? null, - location_id: $json->location_id ?? null, - model: $json->model ?? null, - ); - } - - public function __construct( + public bool|null $has_photo = null, /** - * Device ID for a SmartThings device. + * Whether the key is in a locker that does not support the access codes API. */ - public string|null $device_id = null, + public bool|null $is_quadient_locker = null, /** - * Device name for a SmartThings device. + * Key ID for a KeyNest device. */ - public string|null $device_name = null, + public string|null $key_id = null, /** - * Location ID for a SmartThings device. + * Key notes for a KeyNest device. */ - public string|null $location_id = null, + public string|null $key_notes = null, /** - * Model for a SmartThings device. + * KeyNest app user for a KeyNest device. */ - public string|null $model = null, + public string|null $keynest_app_user = null, + /** + * Last movement timestamp for a KeyNest device. + */ + public string|null $last_movement = null, + /** + * Property ID for a KeyNest device. + */ + public string|null $property_id = null, + /** + * Property postcode for a KeyNest device. + */ + public string|null $property_postcode = null, + /** + * Status type for a KeyNest device. + */ + public string|null $status_type = null, + /** + * Subscription plan for a KeyNest device. + */ + public string|null $subscription_plan = null, ) {} } /** - * Metadata for a tado° device. + * Metadata for a Kisi device. */ - class TadoMetadata + class KisiMetadata { - public static function from_json(mixed $json): TadoMetadata|null + public static function from_json(mixed $json): KisiMetadata|null { if (!$json) { return null; } return new self( - device_type: $json->device_type ?? null, - serial_no: $json->serial_no ?? null, + description: $json->description ?? null, + lock_id: $json->lock_id ?? null, + lock_name: $json->lock_name ?? null, + place_name: $json->place_name ?? null, ); } public function __construct( /** - * Device type for a tado° device. + * Description for a Kisi device. */ - public string|null $device_type = null, + public string|null $description = null, /** - * Serial number for a tado° device. + * Lock ID for a Kisi device. */ - public string|null $serial_no = null, + public float|null $lock_id = null, + /** + * Lock name for a Kisi device. + */ + public string|null $lock_name = null, + /** + * Place name for a Kisi device. + */ + public string|null $place_name = null, ) {} } /** - * Metadata for a Tedee device. + * Metadata for a Korelock device. */ - class TedeeMetadata + class KorelockMetadata { - public static function from_json(mixed $json): TedeeMetadata|null + public static function from_json(mixed $json): KorelockMetadata|null { if (!$json) { return null; } return new self( - bridge_id: $json->bridge_id ?? null, - bridge_name: $json->bridge_name ?? null, device_id: $json->device_id ?? null, - device_model: $json->device_model ?? null, device_name: $json->device_name ?? null, - keypad_id: $json->keypad_id ?? 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, ); } public function __construct( /** - * Bridge ID for a Tedee device. + * Device ID for a Korelock device. */ - public float|null $bridge_id = null, + public string|null $device_id = null, /** - * Bridge name for a Tedee device. + * Device name for a Korelock device. */ - public string|null $bridge_name = null, + public string|null $device_name = null, /** - * Device ID for a Tedee device. + * Firmware version for a Korelock device. */ - public float|null $device_id = null, + public string|null $firmware_version = null, /** - * Device model for a Tedee device. + * Location ID for a Korelock device. Required for timebound access codes. */ - public string|null $device_model = null, + public string|null $location_id = null, /** - * Device name for a Tedee device. + * Model code for a Korelock device. */ - public string|null $device_name = null, + public string|null $model_code = null, /** - * Keypad ID for a Tedee device. + * Serial number for a Korelock device. */ - public float|null $keypad_id = null, + public string|null $serial_number = null, /** - * Serial number for a Tedee device. + * WiFi signal strength (0-1) for a Korelock device. */ - public string|null $serial_number = null, + public float|null $wifi_signal_strength = null, ) {} } /** - * Metadata for a TTLock device. + * Metadata for a Kwikset device. */ - class TtlockMetadata + class KwiksetMetadata { - public static function from_json(mixed $json): TtlockMetadata|null + public static function from_json(mixed $json): KwiksetMetadata|null { if (!$json) { return null; } return new self( - feature_value: $json->feature_value ?? null, - features: isset($json->features) - ? TtlockMetadata\Features::from_json($json->features) - : 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) => TtlockMetadata\WirelessKeypads::from_json($w), - $json->wireless_keypads ?? [], - ), + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + model_number: $json->model_number ?? null, ); } public function __construct( /** - * Feature value for a TTLock device. - */ - public string|null $feature_value = null, - /** - * Features for a TTLock device. - */ - public TtlockMetadata\Features|null $features = null, - /** - * Indicates whether a TTLock device has a gateway. - */ - public bool|null $has_gateway = null, - /** - * Lock alias for a TTLock device. - */ - public string|null $lock_alias = null, - /** - * Lock ID for a TTLock device. + * Device ID for a Kwikset device. */ - public float|null $lock_id = null, + public string|null $device_id = null, /** - * Lock-side timezone offset in milliseconds east of UTC, as configured in the TTLock app. Source of truth for the lock's wall-clock interpretation of access code start/end times — a misconfigured value here is the typical cause of customer "codes offset by N hours" reports. Diagnostic only; Seam does not convert times based on this value. + * Device name for a Kwikset device. */ - public float|null $timezone_raw_offset_ms = null, + public string|null $device_name = null, /** - * Wireless keypads for a TTLock device. + * Model number for a Kwikset device. */ - public array|null $wireless_keypads = null, + public string|null $model_number = null, ) {} } /** - * Metadata for a 2N device. + * Metadata for a Lockly device. */ - class TwoNMetadata + class LocklyMetadata { - public static function from_json(mixed $json): TwoNMetadata|null + public static function from_json(mixed $json): LocklyMetadata|null { if (!$json) { return null; @@ -2918,27 +3306,32 @@ public static function from_json(mixed $json): TwoNMetadata|null return new self( device_id: $json->device_id ?? null, device_name: $json->device_name ?? null, + model: $json->model ?? null, ); } public function __construct( /** - * Device ID for a 2N device. + * Device ID for a Lockly device. */ - public float|null $device_id = null, + public string|null $device_id = null, /** - * Device name for a 2N device. + * Device name for a Lockly device. */ public string|null $device_name = null, + /** + * Model for a Lockly device. + */ + public string|null $model = null, ) {} } /** - * Metadata for an Ultraloq device. + * Metadata for a Minut device. */ - class UltraloqMetadata + class MinutMetadata { - public static function from_json(mixed $json): UltraloqMetadata|null + public static function from_json(mixed $json): MinutMetadata|null { if (!$json) { return null; @@ -2946,116 +3339,131 @@ public static function from_json(mixed $json): UltraloqMetadata|null return new self( device_id: $json->device_id ?? null, device_name: $json->device_name ?? null, - device_type: $json->device_type ?? null, - time_zone: $json->time_zone ?? null, + latest_sensor_values: isset($json->latest_sensor_values) + ? \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues::from_json( + $json->latest_sensor_values, + ) + : null, ); } public function __construct( /** - * Device ID for an Ultraloq device. + * Device ID for a Minut device. */ public string|null $device_id = null, /** - * Device name for an Ultraloq device. + * Device name for a Minut device. */ public string|null $device_name = null, /** - * Device type for an Ultraloq device. - */ - public string|null $device_type = null, - /** - * IANA timezone for the Ultraloq device. + * Latest sensor values for a Minut device. */ - public string|null $time_zone = null, + public \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues|null $latest_sensor_values = null, ) {} } /** - * Metadata for an ASSA ABLOY Visionline system. + * Metadata for a Google Nest device. */ - class VisionlineMetadata + class NestMetadata { - public static function from_json(mixed $json): VisionlineMetadata|null + public static function from_json(mixed $json): NestMetadata|null { if (!$json) { return null; } - return new self(encoder_id: $json->encoder_id ?? null); + return new self( + device_custom_name: $json->device_custom_name ?? null, + device_name: $json->device_name ?? null, + display_name: $json->display_name ?? null, + nest_device_id: $json->nest_device_id ?? null, + nest_structure_id: $json->nest_structure_id ?? null, + structure_name: $json->structure_name ?? null, + ); } public function __construct( /** - * Encoder ID for an ASSA ABLOY Visionline system. + * Custom device name for a Google Nest device. The device owner sets this value. */ - public string|null $encoder_id = null, + public string|null $device_custom_name = null, + /** + * Device name for a Google Nest device. Google sets this value. + */ + public string|null $device_name = null, + /** + * Display name for a Google Nest device. + */ + public string|null $display_name = null, + /** + * Device ID for a Google Nest device. + */ + public string|null $nest_device_id = null, + /** + * ID of the Google Nest structure containing the device. + */ + public string|null $nest_structure_id = null, + /** + * Name of the Google Nest structure containing the device. The device owner sets this value. + */ + public string|null $structure_name = null, ) {} } /** - * Metadata for a Wyze device. + * Metadata for a NoiseAware device. */ - class WyzeMetadata + class NoiseawareMetadata { - public static function from_json(mixed $json): WyzeMetadata|null + public static function from_json(mixed $json): NoiseawareMetadata|null { if (!$json) { return null; } return new self( device_id: $json->device_id ?? null, - device_info_model: $json->device_info_model ?? null, + device_model: is_string($json->device_model ?? null) + ? \Seam\Resources\Device\Properties\NoiseawareMetadata\DeviceModel::tryFrom( + $json->device_model, + ) + : null, device_name: $json->device_name ?? null, - keypad_uuid: $json->keypad_uuid ?? null, - locker_status_hardlock: $json->locker_status_hardlock ?? null, - product_model: $json->product_model ?? null, - product_name: $json->product_name ?? null, - product_type: $json->product_type ?? null, + noise_level_decibel: $json->noise_level_decibel ?? null, + noise_level_nrs: $json->noise_level_nrs ?? null, ); } public function __construct( /** - * Device ID for a Wyze device. + * Device ID for a NoiseAware device. */ public string|null $device_id = null, /** - * Device information model for a Wyze device. + * Device model for a NoiseAware device. */ - public string|null $device_info_model = null, + public \Seam\Resources\Device\Properties\NoiseawareMetadata\DeviceModel|null $device_model = null, /** - * Device name for a Wyze device. + * Device name for a NoiseAware device. */ public string|null $device_name = null, /** - * Keypad UUID for a Wyze device. - */ - public string|null $keypad_uuid = null, - /** - * Locker status (hardlock) for a Wyze device. - */ - public float|null $locker_status_hardlock = null, - /** - * Product model for a Wyze device. - */ - public string|null $product_model = null, - /** - * Product name for a Wyze device. + * Noise level, in decibels, for a NoiseAware device. */ - public string|null $product_name = null, + public float|null $noise_level_decibel = null, /** - * Product type for a Wyze device. + * Noise level, expressed as a Noise Risk Score (NRS), for a NoiseAware device. */ - public string|null $product_type = null, + public float|null $noise_level_nrs = null, ) {} } /** - * Metadata for a Yacan device. + * Metadata for a Nuki device. */ - class YacanMetadata + class NukiMetadata { - public static function from_json(mixed $json): YacanMetadata|null + public static function from_json(mixed $json): NukiMetadata|null { if (!$json) { return null; @@ -3063,1397 +3471,3616 @@ public static function from_json(mixed $json): YacanMetadata|null return new self( device_id: $json->device_id ?? null, device_name: $json->device_name ?? null, - device_type: $json->device_type ?? null, - serial_number: $json->serial_number ?? null, + keypad_2_paired: $json->keypad_2_paired ?? null, + keypad_battery_critical: $json->keypad_battery_critical ?? null, + keypad_paired: $json->keypad_paired ?? null, ); } public function __construct( /** - * Device ID for a Yacan device. + * Device ID for a Nuki device. */ public string|null $device_id = null, /** - * Device name for a Yacan device. + * Device name for a Nuki device. */ public string|null $device_name = null, /** - * Device type for a Yacan device. + * Indicates whether keypad 2 is paired for a Nuki device. */ - public string|null $device_type = null, + public bool|null $keypad_2_paired = null, /** - * Serial number for a Yacan device. + * Indicates whether the keypad battery is in a critical state for a Nuki device. */ - public string|null $serial_number = null, + public bool|null $keypad_battery_critical = null, + /** + * Indicates whether the keypad is paired for a Nuki device. + */ + public bool|null $keypad_paired = null, ) {} } /** - * Constraints on access codes for the device. Seam represents each constraint as an object with a `constraint_type` property. Depending on the constraint type, there may also be additional properties. Note that some constraints are manufacturer- or device-specific. + * Metadata for an Omnitec device. */ - class CodeConstraints + class OmnitecMetadata { - public static function from_json(mixed $json): CodeConstraints|null + public static function from_json(mixed $json): OmnitecMetadata|null { if (!$json) { return null; } return new self( - constraint_type: $json->constraint_type ?? null, - max_length: $json->max_length ?? null, - min_length: $json->min_length ?? null, + has_gateway: $json->has_gateway ?? null, + lock_alias: $json->lock_alias ?? null, + lock_id: $json->lock_id ?? null, + lock_mac: $json->lock_mac ?? null, + lock_name: $json->lock_name ?? null, + time_zone: $json->time_zone ?? null, + timezone_raw_offset_ms: $json->timezone_raw_offset_ms ?? null, ); } public function __construct( - public string|null $constraint_type, /** - * Maximum name length constraint for access codes. + * Whether the Omnitec lock has a connected gateway for remote operations. */ - public float|null $max_length = null, + public bool|null $has_gateway = null, /** - * Minimum name length constraint for access codes. + * Operator-assigned alias for an Omnitec device. */ - public float|null $min_length = null, + public string|null $lock_alias = null, + /** + * Lock ID for an Omnitec device. + */ + public float|null $lock_id = null, + /** + * Bluetooth MAC address for an Omnitec device. + */ + public string|null $lock_mac = null, + /** + * Lock name for an Omnitec device. + */ + public string|null $lock_name = null, + /** + * IANA time zone for the Omnitec device, used to schedule time-bound access codes at the correct local time (accounting for DST). + */ + public string|null $time_zone = null, + /** + * Static UTC offset of the Omnitec lock in milliseconds. Does not account for DST. + */ + public float|null $timezone_raw_offset_ms = null, ) {} } /** - * Keypad battery status. + * Metadata for a Ring device. */ - class KeypadBattery + class RingMetadata { - public static function from_json(mixed $json): KeypadBattery|null + public static function from_json(mixed $json): RingMetadata|null { if (!$json) { return null; } - return new self(level: $json->level ?? null); + return new self( + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + ); } public function __construct( /** - * Keypad battery charge level. + * Device ID for a Ring device. */ - public float|null $level, + public string|null $device_id = null, + /** + * Device name for a Ring device. + */ + public string|null $device_name = null, ) {} } /** - * Time frames that may be requested when creating an offline access code, expressed as a list of options. The caller picks one option (by matching the requested duration when the options' duration ranges do not overlap, or by `display_name` when they do) and satisfies that one option's rules. When `undefined`, any time frame works. + * Metadata for a Salto KS device. */ - class OfflineTimeFrameOptions + class SaltoKsMetadata { - public static function from_json( - mixed $json, - ): OfflineTimeFrameOptions|null { + public static function from_json(mixed $json): SaltoKsMetadata|null + { if (!$json) { return null; } return new self( - 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, - min_duration: $json->min_duration ?? null, - start_date_recurrence_rule: $json->start_date_recurrence_rule ?? + battery_level: $json->battery_level ?? null, + customer_reference: $json->customer_reference ?? null, + has_custom_pin_subscription: $json->has_custom_pin_subscription ?? null, - time_pairs: array_map( - fn($t) => OfflineTimeFrameOptions\TimePairs::from_json($t), - $json->time_pairs ?? [], - ), - time_zone: $json->time_zone ?? null, + lock_id: $json->lock_id ?? null, + lock_type: $json->lock_type ?? null, + locked_state: $json->locked_state ?? null, + model: $json->model ?? null, + site_id: $json->site_id ?? null, + site_name: $json->site_name ?? null, ); } public function __construct( /** - * Label for this option. For a single-option device, the product name (for example, `algoPIN` or `SmartPIN`); for a multi-option device, a label that distinguishes it (for example, `Hourly` or `Fixed start times`). + * Battery level for a Salto KS device. */ - public string|null $display_name, + public string|null $battery_level = null, /** - * iCalendar recurrence rule (RRULE) that the end date must fall on. Constrains which calendar dates are selectable, independent of the time-of-day rules. + * Customer reference for a Salto KS device. */ - public string|null $end_date_recurrence_rule = null, + public string|null $customer_reference = null, /** - * When `true`, the start and end must fall at the same time of day (the caller picks which). Mutually exclusive with `time_pairs`. + * Indicates whether the site has a Salto KS subscription that supports custom PINs. */ - public true|null $matching_start_end_time = null, + public bool|null $has_custom_pin_subscription = null, /** - * Maximum duration this option covers, as an ISO 8601 duration (for example, `PT672H` or `P367D`). Omitted when there is no maximum. + * Lock ID for a Salto KS device. */ - public string|null $max_duration = null, + public string|null $lock_id = null, /** - * Minimum duration this option covers, as an ISO 8601 duration (for example, `PT1H` or `P29D`). Omitted when there is no minimum. + * Lock type for a Salto KS device. */ - public string|null $min_duration = null, + public string|null $lock_type = null, /** - * iCalendar recurrence rule (RRULE) that the start date must fall on (for example, `FREQ=MONTHLY;BYDAY=1MO,3MO`). Constrains which calendar dates are selectable, independent of the time-of-day rules. + * Locked state for a Salto KS device. */ - public string|null $start_date_recurrence_rule = null, + public string|null $locked_state = null, /** - * Fixed start/end time pairings the caller chooses from. Mutually exclusive with `matching_start_end_time`. + * Model for a Salto KS device. */ - public array|null $time_pairs = null, + public string|null $model = null, /** - * IANA time zone for interpreting `time_pairs` and the date recurrence rules. Present only when the option fixes times or dates. + * Site ID for the Salto KS site to which the device belongs. */ - public string|null $time_zone = null, + public string|null $site_id = null, + /** + * Site name for the Salto KS site to which the device belongs. + */ + public string|null $site_name = null, ) {} } /** - * Time frames that may be requested when creating an online access code, expressed as a list of options. The caller picks one option (by matching the requested duration when the options' duration ranges do not overlap, or by `display_name` when they do) and satisfies that one option's rules. When `undefined`, any time frame works. + * Metada for a Salto device. + * + * @deprecated Use `salto_ks_metadata` instead. */ - class OnlineTimeFrameOptions + class SaltoMetadata { - public static function from_json( - mixed $json, - ): OnlineTimeFrameOptions|null { + public static function from_json(mixed $json): SaltoMetadata|null + { if (!$json) { return null; } return new self( - 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, - min_duration: $json->min_duration ?? null, - start_date_recurrence_rule: $json->start_date_recurrence_rule ?? - null, - time_pairs: array_map( - fn($t) => OnlineTimeFrameOptions\TimePairs::from_json($t), - $json->time_pairs ?? [], - ), - time_zone: $json->time_zone ?? null, + battery_level: $json->battery_level ?? null, + customer_reference: $json->customer_reference ?? null, + lock_id: $json->lock_id ?? null, + lock_type: $json->lock_type ?? null, + locked_state: $json->locked_state ?? null, + model: $json->model ?? null, + site_id: $json->site_id ?? null, + site_name: $json->site_name ?? null, ); } public function __construct( /** - * Label for this option. For a single-option device, the product name (for example, `algoPIN` or `SmartPIN`); for a multi-option device, a label that distinguishes it (for example, `Hourly` or `Fixed start times`). + * Battery level for a Salto device. */ - public string|null $display_name, + public string|null $battery_level = null, /** - * iCalendar recurrence rule (RRULE) that the end date must fall on. Constrains which calendar dates are selectable, independent of the time-of-day rules. + * Customer reference for a Salto device. */ - public string|null $end_date_recurrence_rule = null, + public string|null $customer_reference = null, /** - * When `true`, the start and end must fall at the same time of day (the caller picks which). Mutually exclusive with `time_pairs`. + * Lock ID for a Salto device. */ - public true|null $matching_start_end_time = null, + public string|null $lock_id = null, /** - * Maximum duration this option covers, as an ISO 8601 duration (for example, `PT672H` or `P367D`). Omitted when there is no maximum. + * Lock type for a Salto device. */ - public string|null $max_duration = null, + public string|null $lock_type = null, /** - * Minimum duration this option covers, as an ISO 8601 duration (for example, `PT1H` or `P29D`). Omitted when there is no minimum. + * Locked state for a Salto device. */ - public string|null $min_duration = null, + public string|null $locked_state = null, /** - * iCalendar recurrence rule (RRULE) that the start date must fall on (for example, `FREQ=MONTHLY;BYDAY=1MO,3MO`). Constrains which calendar dates are selectable, independent of the time-of-day rules. + * Model for a Salto device. */ - public string|null $start_date_recurrence_rule = null, + public string|null $model = null, /** - * Fixed start/end time pairings the caller chooses from. Mutually exclusive with `matching_start_end_time`. + * Site ID for the Salto KS site to which the device belongs. */ - public array|null $time_pairs = null, + public string|null $site_id = null, /** - * IANA time zone for interpreting `time_pairs` and the date recurrence rules. Present only when the option fixes times or dates. + * Site name for the Salto KS site to which the device belongs. */ - public string|null $time_zone = null, + public string|null $site_name = null, ) {} } /** - * Active [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). - * - * @deprecated Use `active_thermostat_schedule_id` with `/thermostats/schedules/get` instead. + * Metadata for a Schlage device. */ - class ActiveThermostatSchedule + class SchlageMetadata { - public static function from_json( - mixed $json, - ): ActiveThermostatSchedule|null { + public static function from_json(mixed $json): SchlageMetadata|null + { if (!$json) { return null; } return new self( - 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) => ActiveThermostatSchedule\Errors::from_json($e), - $json->errors ?? [], - ), - is_override_allowed: $json->is_override_allowed ?? 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, + device_name: $json->device_name ?? null, + model: $json->model ?? null, ); } public function __construct( /** - * Key of the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) to use for the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). - */ - public string|null $climate_preset_key, - /** - * Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) was created. - */ - public string|null $created_at, - /** - * ID of the desired [thermostat](https://docs.seam.co/capability-guides/thermostats) device. - */ - public string|null $device_id, - /** - * Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - */ - public string|null $ends_at, - /** - * Errors associated with the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). - */ - public array $errors, - /** - * User-friendly name to identify the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + * Device ID for a Schlage device. */ - public string|null $name, + public string|null $device_id = null, /** - * Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + * Device name for a Schlage device. */ - public string|null $starts_at, + public string|null $device_name = null, /** - * ID of the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + * Model for a Schlage device. */ - public string|null $thermostat_schedule_id, + public string|null $model = null, + ) {} + } + + /** + * Metadata for Seam Bridge. + */ + class SeamBridgeMetadata + { + public static function from_json(mixed $json): SeamBridgeMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_num: $json->device_num ?? null, + name: $json->name ?? null, + unlock_method: is_string($json->unlock_method ?? null) + ? \Seam\Resources\Device\Properties\SeamBridgeMetadata\UnlockMethod::tryFrom( + $json->unlock_method, + ) + : null, + ); + } + + public function __construct( /** - * ID of the workspace that contains the thermostat schedule. + * Device number for Seam Bridge. */ - public string|null $workspace_id, + public float|null $device_num = null, /** - * Indicates whether a person at the thermostat can change the thermostat's settings after the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts. + * Name for Seam Bridge. */ - public bool|null $is_override_allowed = null, + public string|null $name = null, /** - * Number of minutes for which a person at the thermostat can change the thermostat's settings after the activation of the scheduled [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). See also [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). + * Unlock method for Seam Bridge. */ - public int|null $max_override_period_minutes = null, + public \Seam\Resources\Device\Properties\SeamBridgeMetadata\UnlockMethod|null $unlock_method = null, ) {} } /** - * Available [climate presets](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) for the thermostat. + * Metadata for a Sensi device. */ - class AvailableClimatePresets + class SensiMetadata { - public static function from_json( - mixed $json, - ): AvailableClimatePresets|null { + public static function from_json(mixed $json): SensiMetadata|null + { if (!$json) { return null; } return new self( - 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) - ? AvailableClimatePresets\EcobeeMetadata::from_json( - $json->ecobee_metadata, - ) - : null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + dual_setpoints_not_supported: $json->dual_setpoints_not_supported ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + enforced_setpoint_range_celsius: $json->enforced_setpoint_range_celsius ?? null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - manual_override_allowed: $json->manual_override_allowed ?? null, - name: $json->name ?? null, + product_type: $json->product_type ?? null, ); } public function __construct( /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be deleted. - */ - public bool|null $can_delete, - /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be edited. - */ - public bool|null $can_edit, - /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be programmed in a thermostat daily program. + * Device ID for a Sensi device. */ - public bool|null $can_use_with_thermostat_daily_programs, + public string|null $device_id = null, /** - * Unique key to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + * Device name for a Sensi device. */ - public string|null $climate_preset_key, + public string|null $device_name = null, /** - * Display name for the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + * Set to true when the device does not support the /dual-setpoints API endpoint. */ - public string|null $display_name, + public bool|null $dual_setpoints_not_supported = null, /** - * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). + * Enforced setpoint range in Celsius for a Sensi device, derived from an OutOfRange API error. * - * @deprecated Use 'thermostat_schedule.is_override_allowed' - */ - public bool|null $manual_override_allowed, - /** - * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. - */ - public string|null $climate_preset_mode = null, - /** - * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). - */ - public float|null $cooling_set_point_celsius = null, - /** - * Temperature to which the thermostat should cool (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). - */ - public float|null $cooling_set_point_fahrenheit = null, - /** - * Metadata specific to the Ecobee climate, if applicable. + * @var list|null */ - public AvailableClimatePresets\EcobeeMetadata|null $ecobee_metadata = null, + public array|null $enforced_setpoint_range_celsius = null, /** - * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + * Product type for a Sensi device. */ - public string|null $fan_mode_setting = null, + public string|null $product_type = null, + ) {} + } + + /** + * Metadata for a SmartThings device. + */ + class SmartthingsMetadata + { + public static function from_json(mixed $json): SmartthingsMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + location_id: $json->location_id ?? null, + model: $json->model ?? null, + ); + } + + public function __construct( /** - * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Device ID for a SmartThings device. */ - public float|null $heating_set_point_celsius = null, + public string|null $device_id = null, /** - * Temperature to which the thermostat should heat (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Device name for a SmartThings device. */ - public float|null $heating_set_point_fahrenheit = null, + public string|null $device_name = null, /** - * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + * Location ID for a SmartThings device. */ - public string|null $hvac_mode_setting = null, + public string|null $location_id = null, /** - * User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + * Model for a SmartThings device. */ - public string|null $name = null, + public string|null $model = null, ) {} } /** - * Current climate setting. + * Metadata for a tado° device. */ - class CurrentClimateSetting + class TadoMetadata { - public static function from_json( - mixed $json, - ): CurrentClimateSetting|null { + public static function from_json(mixed $json): TadoMetadata|null + { if (!$json) { return null; } return new self( - 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, + device_type: $json->device_type ?? null, + serial_no: $json->serial_no ?? null, + ); + } + + public function __construct( + /** + * Device type for a tado° device. + */ + public string|null $device_type = null, + /** + * Serial number for a tado° device. + */ + public string|null $serial_no = null, + ) {} + } + + /** + * Metadata for a Tedee device. + */ + class TedeeMetadata + { + public static function from_json(mixed $json): TedeeMetadata|null + { + if (!$json) { + return null; + } + return new self( + bridge_id: $json->bridge_id ?? null, + bridge_name: $json->bridge_name ?? null, + device_id: $json->device_id ?? null, + device_model: $json->device_model ?? null, + device_name: $json->device_name ?? null, + keypad_id: $json->keypad_id ?? null, + serial_number: $json->serial_number ?? null, + ); + } + + public function __construct( + /** + * Bridge ID for a Tedee device. + */ + public float|null $bridge_id = null, + /** + * Bridge name for a Tedee device. + */ + public string|null $bridge_name = null, + /** + * Device ID for a Tedee device. + */ + public float|null $device_id = null, + /** + * Device model for a Tedee device. + */ + public string|null $device_model = null, + /** + * Device name for a Tedee device. + */ + public string|null $device_name = null, + /** + * Keypad ID for a Tedee device. + */ + public float|null $keypad_id = null, + /** + * Serial number for a Tedee device. + */ + public string|null $serial_number = null, + ) {} + } + + /** + * Metadata for a TTLock device. + */ + class TtlockMetadata + { + public static function from_json(mixed $json): TtlockMetadata|null + { + if (!$json) { + return null; + } + return new self( + feature_value: $json->feature_value ?? null, + features: isset($json->features) + ? \Seam\Resources\Device\Properties\TtlockMetadata\Features::from_json( + $json->features, + ) + : 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, + ) => \Seam\Resources\Device\Properties\TtlockMetadata\WirelessKeypads::from_json( + $w, + ), + $json->wireless_keypads ?? [], + ), + ); + } + + public function __construct( + /** + * Feature value for a TTLock device. + */ + public string|null $feature_value = null, + /** + * Features for a TTLock device. + */ + public \Seam\Resources\Device\Properties\TtlockMetadata\Features|null $features = null, + /** + * Indicates whether a TTLock device has a gateway. + */ + public bool|null $has_gateway = null, + /** + * Lock alias for a TTLock device. + */ + public string|null $lock_alias = null, + /** + * Lock ID for a TTLock device. + */ + public float|null $lock_id = null, + /** + * Lock-side timezone offset in milliseconds east of UTC, as configured in the TTLock app. Source of truth for the lock's wall-clock interpretation of access code start/end times — a misconfigured value here is the typical cause of customer "codes offset by N hours" reports. Diagnostic only; Seam does not convert times based on this value. + */ + public float|null $timezone_raw_offset_ms = null, + /** + * Wireless keypads for a TTLock device. + * + * @var list<\Seam\Resources\Device\Properties\TtlockMetadata\WirelessKeypads>|null + */ + public array|null $wireless_keypads = null, + ) {} + } + + /** + * Metadata for a 2N device. + */ + class TwoNMetadata + { + public static function from_json(mixed $json): TwoNMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + ); + } + + public function __construct( + /** + * Device ID for a 2N device. + */ + public float|null $device_id = null, + /** + * Device name for a 2N device. + */ + public string|null $device_name = null, + ) {} + } + + /** + * Metadata for an Ultraloq device. + */ + class UltraloqMetadata + { + public static function from_json(mixed $json): UltraloqMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + device_type: $json->device_type ?? null, + time_zone: $json->time_zone ?? null, + ); + } + + public function __construct( + /** + * Device ID for an Ultraloq device. + */ + public string|null $device_id = null, + /** + * Device name for an Ultraloq device. + */ + public string|null $device_name = null, + /** + * Device type for an Ultraloq device. + */ + public string|null $device_type = null, + /** + * IANA timezone for the Ultraloq device. + */ + public string|null $time_zone = null, + ) {} + } + + /** + * Metadata for an ASSA ABLOY Visionline system. + */ + class VisionlineMetadata + { + public static function from_json(mixed $json): VisionlineMetadata|null + { + if (!$json) { + return null; + } + return new self(encoder_id: $json->encoder_id ?? null); + } + + public function __construct( + /** + * Encoder ID for an ASSA ABLOY Visionline system. + */ + public string|null $encoder_id = null, + ) {} + } + + /** + * Metadata for a Wyze device. + */ + class WyzeMetadata + { + public static function from_json(mixed $json): WyzeMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id ?? null, + device_info_model: $json->device_info_model ?? null, + device_name: $json->device_name ?? null, + keypad_uuid: $json->keypad_uuid ?? null, + locker_status_hardlock: $json->locker_status_hardlock ?? null, + product_model: $json->product_model ?? null, + product_name: $json->product_name ?? null, + product_type: $json->product_type ?? null, + ); + } + + public function __construct( + /** + * Device ID for a Wyze device. + */ + public string|null $device_id = null, + /** + * Device information model for a Wyze device. + */ + public string|null $device_info_model = null, + /** + * Device name for a Wyze device. + */ + public string|null $device_name = null, + /** + * Keypad UUID for a Wyze device. + */ + public string|null $keypad_uuid = null, + /** + * Locker status (hardlock) for a Wyze device. + */ + public float|null $locker_status_hardlock = null, + /** + * Product model for a Wyze device. + */ + public string|null $product_model = null, + /** + * Product name for a Wyze device. + */ + public string|null $product_name = null, + /** + * Product type for a Wyze device. + */ + public string|null $product_type = null, + ) {} + } + + /** + * Metadata for a Yacan device. + */ + class YacanMetadata + { + public static function from_json(mixed $json): YacanMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + device_type: $json->device_type ?? null, + serial_number: $json->serial_number ?? null, + ); + } + + public function __construct( + /** + * Device ID for a Yacan device. + */ + public string|null $device_id = null, + /** + * Device name for a Yacan device. + */ + public string|null $device_name = null, + /** + * Device type for a Yacan device. + */ + public string|null $device_type = null, + /** + * Serial number for a Yacan device. + */ + public string|null $serial_number = null, + ) {} + } + + /** + * Constraints on access codes for the device. Seam represents each constraint as an object with a `constraint_type` property. Depending on the constraint type, there may also be additional properties. Note that some constraints are manufacturer- or device-specific. + */ + class CodeConstraints + { + public static function from_json(mixed $json): CodeConstraints|null + { + if (!$json) { + return null; + } + return new self( + constraint_type: is_string($json->constraint_type ?? null) + ? \Seam\Resources\Device\Properties\CodeConstraints\ConstraintType::tryFrom( + $json->constraint_type, + ) + : null, + max_length: $json->max_length ?? null, + min_length: $json->min_length ?? null, + ); + } + + public function __construct( + public \Seam\Resources\Device\Properties\CodeConstraints\ConstraintType|null $constraint_type, + /** + * Maximum name length constraint for access codes. + */ + public float|null $max_length = null, + /** + * Minimum name length constraint for access codes. + */ + public float|null $min_length = null, + ) {} + } + + /** + * Keypad battery status. + */ + class KeypadBattery + { + public static function from_json(mixed $json): KeypadBattery|null + { + if (!$json) { + return null; + } + return new self(level: $json->level ?? null); + } + + public function __construct( + /** + * Keypad battery charge level. + */ + public float|null $level, + ) {} + } + + /** + * Time frames that may be requested when creating an offline access code, expressed as a list of options. The caller picks one option (by matching the requested duration when the options' duration ranges do not overlap, or by `display_name` when they do) and satisfies that one option's rules. When `undefined`, any time frame works. + */ + class OfflineTimeFrameOptions + { + public static function from_json( + mixed $json, + ): OfflineTimeFrameOptions|null { + if (!$json) { + return null; + } + return new self( + 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, + min_duration: $json->min_duration ?? null, + start_date_recurrence_rule: $json->start_date_recurrence_rule ?? + null, + time_pairs: array_map( + fn( + $t, + ) => \Seam\Resources\Device\Properties\OfflineTimeFrameOptions\TimePairs::from_json( + $t, + ), + $json->time_pairs ?? [], + ), + time_zone: $json->time_zone ?? null, + ); + } + + public function __construct( + /** + * Label for this option. For a single-option device, the product name (for example, `algoPIN` or `SmartPIN`); for a multi-option device, a label that distinguishes it (for example, `Hourly` or `Fixed start times`). + */ + public string|null $display_name, + /** + * iCalendar recurrence rule (RRULE) that the end date must fall on. Constrains which calendar dates are selectable, independent of the time-of-day rules. + */ + public string|null $end_date_recurrence_rule = null, + /** + * When `true`, the start and end must fall at the same time of day (the caller picks which). Mutually exclusive with `time_pairs`. + */ + public true|null $matching_start_end_time = null, + /** + * Maximum duration this option covers, as an ISO 8601 duration (for example, `PT672H` or `P367D`). Omitted when there is no maximum. + */ + public string|null $max_duration = null, + /** + * Minimum duration this option covers, as an ISO 8601 duration (for example, `PT1H` or `P29D`). Omitted when there is no minimum. + */ + public string|null $min_duration = null, + /** + * iCalendar recurrence rule (RRULE) that the start date must fall on (for example, `FREQ=MONTHLY;BYDAY=1MO,3MO`). Constrains which calendar dates are selectable, independent of the time-of-day rules. + */ + public string|null $start_date_recurrence_rule = null, + /** + * Fixed start/end time pairings the caller chooses from. Mutually exclusive with `matching_start_end_time`. + * + * @var list<\Seam\Resources\Device\Properties\OfflineTimeFrameOptions\TimePairs>|null + */ + public array|null $time_pairs = null, + /** + * IANA time zone for interpreting `time_pairs` and the date recurrence rules. Present only when the option fixes times or dates. + */ + public string|null $time_zone = null, + ) {} + } + + /** + * Time frames that may be requested when creating an online access code, expressed as a list of options. The caller picks one option (by matching the requested duration when the options' duration ranges do not overlap, or by `display_name` when they do) and satisfies that one option's rules. When `undefined`, any time frame works. + */ + class OnlineTimeFrameOptions + { + public static function from_json( + mixed $json, + ): OnlineTimeFrameOptions|null { + if (!$json) { + return null; + } + return new self( + 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, + min_duration: $json->min_duration ?? null, + start_date_recurrence_rule: $json->start_date_recurrence_rule ?? + null, + time_pairs: array_map( + fn( + $t, + ) => \Seam\Resources\Device\Properties\OnlineTimeFrameOptions\TimePairs::from_json( + $t, + ), + $json->time_pairs ?? [], + ), + time_zone: $json->time_zone ?? null, + ); + } + + public function __construct( + /** + * Label for this option. For a single-option device, the product name (for example, `algoPIN` or `SmartPIN`); for a multi-option device, a label that distinguishes it (for example, `Hourly` or `Fixed start times`). + */ + public string|null $display_name, + /** + * iCalendar recurrence rule (RRULE) that the end date must fall on. Constrains which calendar dates are selectable, independent of the time-of-day rules. + */ + public string|null $end_date_recurrence_rule = null, + /** + * When `true`, the start and end must fall at the same time of day (the caller picks which). Mutually exclusive with `time_pairs`. + */ + public true|null $matching_start_end_time = null, + /** + * Maximum duration this option covers, as an ISO 8601 duration (for example, `PT672H` or `P367D`). Omitted when there is no maximum. + */ + public string|null $max_duration = null, + /** + * Minimum duration this option covers, as an ISO 8601 duration (for example, `PT1H` or `P29D`). Omitted when there is no minimum. + */ + public string|null $min_duration = null, + /** + * iCalendar recurrence rule (RRULE) that the start date must fall on (for example, `FREQ=MONTHLY;BYDAY=1MO,3MO`). Constrains which calendar dates are selectable, independent of the time-of-day rules. + */ + public string|null $start_date_recurrence_rule = null, + /** + * Fixed start/end time pairings the caller chooses from. Mutually exclusive with `matching_start_end_time`. + * + * @var list<\Seam\Resources\Device\Properties\OnlineTimeFrameOptions\TimePairs>|null + */ + public array|null $time_pairs = null, + /** + * IANA time zone for interpreting `time_pairs` and the date recurrence rules. Present only when the option fixes times or dates. + */ + public string|null $time_zone = null, + ) {} + } + + /** + * Active [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + * + * @deprecated Use `active_thermostat_schedule_id` with `/thermostats/schedules/get` instead. + */ + class ActiveThermostatSchedule + { + public static function from_json( + mixed $json, + ): ActiveThermostatSchedule|null { + if (!$json) { + return null; + } + return new self( + 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, + ) => \Seam\Resources\Device\Properties\ActiveThermostatSchedule\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + name: $json->name ?? null, + starts_at: $json->starts_at ?? null, + thermostat_schedule_id: $json->thermostat_schedule_id ?? null, + workspace_id: $json->workspace_id ?? null, + is_override_allowed: $json->is_override_allowed ?? null, + max_override_period_minutes: $json->max_override_period_minutes ?? + null, + ); + } + + public function __construct( + /** + * Key of the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) to use for the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + */ + public string|null $climate_preset_key, + /** + * Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) was created. + */ + public string|null $created_at, + /** + * ID of the desired [thermostat](https://docs.seam.co/capability-guides/thermostats) device. + */ + public string|null $device_id, + /** + * Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + */ + public string|null $ends_at, + /** + * Errors associated with the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + * + * @var list<\Seam\Resources\Device\Properties\ActiveThermostatSchedule\Errors> + */ + public array $errors, + /** + * User-friendly name to identify the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + */ + public string|null $name, + /** + * Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + */ + public string|null $starts_at, + /** + * ID of the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + */ + public string|null $thermostat_schedule_id, + /** + * ID of the workspace that contains the thermostat schedule. + */ + public string|null $workspace_id, + /** + * Indicates whether a person at the thermostat can change the thermostat's settings after the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts. + */ + public bool|null $is_override_allowed = null, + /** + * Number of minutes for which a person at the thermostat can change the thermostat's settings after the activation of the scheduled [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). See also [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). + */ + public int|null $max_override_period_minutes = null, + ) {} + } + + /** + * Available [climate presets](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) for the thermostat. + */ + class AvailableClimatePresets + { + public static function from_json( + mixed $json, + ): AvailableClimatePresets|null { + if (!$json) { + return null; + } + return new self( + 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, + display_name: $json->display_name ?? null, + manual_override_allowed: $json->manual_override_allowed ?? null, + climate_preset_mode: is_string( + $json->climate_preset_mode ?? null, + ) + ? \Seam\Resources\Device\Properties\AvailableClimatePresets\ClimatePresetMode::tryFrom( + $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, + ecobee_metadata: isset($json->ecobee_metadata) + ? \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata::from_json( + $json->ecobee_metadata, + ) + : null, + fan_mode_setting: is_string($json->fan_mode_setting ?? null) + ? \Seam\Resources\Device\Properties\AvailableClimatePresets\FanModeSetting::tryFrom( + $json->fan_mode_setting, + ) + : null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? + null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) + ? \Seam\Resources\Device\Properties\AvailableClimatePresets\HvacModeSetting::tryFrom( + $json->hvac_mode_setting, + ) + : null, + name: $json->name ?? null, + ); + } + + public function __construct( + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be deleted. + */ + public bool|null $can_delete, + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be edited. + */ + public bool|null $can_edit, + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be programmed in a thermostat daily program. + */ + public bool|null $can_use_with_thermostat_daily_programs, + /** + * Unique key to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $climate_preset_key, + /** + * Display name for the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $display_name, + /** + * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). + * + * @deprecated Use 'thermostat_schedule.is_override_allowed' + */ + public bool|null $manual_override_allowed, + /** + * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. + */ + public \Seam\Resources\Device\Properties\AvailableClimatePresets\ClimatePresetMode|null $climate_preset_mode = null, + /** + * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $cooling_set_point_celsius = null, + /** + * Temperature to which the thermostat should cool (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $cooling_set_point_fahrenheit = null, + /** + * Metadata specific to the Ecobee climate, if applicable. + */ + public \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata|null $ecobee_metadata = null, + /** + * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + */ + public \Seam\Resources\Device\Properties\AvailableClimatePresets\FanModeSetting|null $fan_mode_setting = null, + /** + * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $heating_set_point_celsius = null, + /** + * Temperature to which the thermostat should heat (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $heating_set_point_fahrenheit = null, + /** + * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + */ + public \Seam\Resources\Device\Properties\AvailableClimatePresets\HvacModeSetting|null $hvac_mode_setting = null, + /** + * User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $name = null, + ) {} + } + + /** + * Current climate setting. + */ + class CurrentClimateSetting + { + public static function from_json( + mixed $json, + ): CurrentClimateSetting|null { + if (!$json) { + return null; + } + return new self( + 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: is_string( + $json->climate_preset_mode ?? null, + ) + ? \Seam\Resources\Device\Properties\CurrentClimateSetting\ClimatePresetMode::tryFrom( + $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) + ? \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata::from_json( + $json->ecobee_metadata, + ) + : null, + fan_mode_setting: is_string($json->fan_mode_setting ?? null) + ? \Seam\Resources\Device\Properties\CurrentClimateSetting\FanModeSetting::tryFrom( + $json->fan_mode_setting, + ) + : null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? + null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) + ? \Seam\Resources\Device\Properties\CurrentClimateSetting\HvacModeSetting::tryFrom( + $json->hvac_mode_setting, + ) + : null, + manual_override_allowed: $json->manual_override_allowed ?? null, + name: $json->name ?? null, + ); + } + + public function __construct( + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be deleted. + */ + public bool|null $can_delete = null, + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be edited. + */ + public bool|null $can_edit = null, + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be programmed in a thermostat daily program. + */ + public bool|null $can_use_with_thermostat_daily_programs = null, + /** + * Unique key to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $climate_preset_key = null, + /** + * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. + */ + public \Seam\Resources\Device\Properties\CurrentClimateSetting\ClimatePresetMode|null $climate_preset_mode = null, + /** + * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $cooling_set_point_celsius = null, + /** + * Temperature to which the thermostat should cool (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $cooling_set_point_fahrenheit = null, + /** + * Display name for the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $display_name = null, + /** + * Metadata specific to the Ecobee climate, if applicable. + */ + public \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata|null $ecobee_metadata = null, + /** + * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + */ + public \Seam\Resources\Device\Properties\CurrentClimateSetting\FanModeSetting|null $fan_mode_setting = null, + /** + * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $heating_set_point_celsius = null, + /** + * Temperature to which the thermostat should heat (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $heating_set_point_fahrenheit = null, + /** + * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + */ + public \Seam\Resources\Device\Properties\CurrentClimateSetting\HvacModeSetting|null $hvac_mode_setting = null, + /** + * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). + * + * @deprecated Use 'thermostat_schedule.is_override_allowed' + */ + public bool|null $manual_override_allowed = null, + /** + * User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $name = null, + ) {} + } + + /** + * @deprecated use fallback_climate_preset_key to specify a fallback climate preset instead. + */ + class DefaultClimateSetting + { + public static function from_json( + mixed $json, + ): DefaultClimateSetting|null { + if (!$json) { + return null; + } + return new self( + 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, + climate_preset_mode: is_string( + $json->climate_preset_mode ?? null, + ) + ? \Seam\Resources\Device\Properties\DefaultClimateSetting\ClimatePresetMode::tryFrom( + $json->climate_preset_mode, + ) + : null, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + display_name: $json->display_name ?? null, + ecobee_metadata: isset($json->ecobee_metadata) + ? \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata::from_json( + $json->ecobee_metadata, + ) + : null, + fan_mode_setting: is_string($json->fan_mode_setting ?? null) + ? \Seam\Resources\Device\Properties\DefaultClimateSetting\FanModeSetting::tryFrom( + $json->fan_mode_setting, + ) + : null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? + null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) + ? \Seam\Resources\Device\Properties\DefaultClimateSetting\HvacModeSetting::tryFrom( + $json->hvac_mode_setting, + ) + : null, + manual_override_allowed: $json->manual_override_allowed ?? null, + name: $json->name ?? null, + ); + } + + public function __construct( + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be deleted. + */ + public bool|null $can_delete = null, + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be edited. + */ + public bool|null $can_edit = null, + /** + * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be programmed in a thermostat daily program. + */ + public bool|null $can_use_with_thermostat_daily_programs = null, + /** + * Unique key to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $climate_preset_key = null, + /** + * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. + */ + public \Seam\Resources\Device\Properties\DefaultClimateSetting\ClimatePresetMode|null $climate_preset_mode = null, + /** + * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $cooling_set_point_celsius = null, + /** + * Temperature to which the thermostat should cool (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $cooling_set_point_fahrenheit = null, + /** + * Display name for the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $display_name = null, + /** + * Metadata specific to the Ecobee climate, if applicable. + */ + public \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata|null $ecobee_metadata = null, + /** + * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + */ + public \Seam\Resources\Device\Properties\DefaultClimateSetting\FanModeSetting|null $fan_mode_setting = null, + /** + * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $heating_set_point_celsius = null, + /** + * Temperature to which the thermostat should heat (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $heating_set_point_fahrenheit = null, + /** + * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + */ + public \Seam\Resources\Device\Properties\DefaultClimateSetting\HvacModeSetting|null $hvac_mode_setting = null, + /** + * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). + * + * @deprecated Use 'thermostat_schedule.is_override_allowed' + */ + public bool|null $manual_override_allowed = null, + /** + * User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + */ + public string|null $name = null, + ) {} + } + + /** + * Current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + */ + class TemperatureThreshold + { + public static function from_json(mixed $json): TemperatureThreshold|null + { + if (!$json) { + return null; + } + return new self( + lower_limit_celsius: $json->lower_limit_celsius ?? null, + lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, + upper_limit_celsius: $json->upper_limit_celsius ?? null, + upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null, + ); + } + + public function __construct( + /** + * Lower limit in °C within the current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + */ + public float|null $lower_limit_celsius, + /** + * Lower limit in °F within the current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + */ + public float|null $lower_limit_fahrenheit, + /** + * Upper limit in °C within the current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + */ + public float|null $upper_limit_celsius, + /** + * Upper limit in °F within the current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + */ + public float|null $upper_limit_fahrenheit, + ) {} + } + + /** + * Configured [daily programs](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-programs) for the thermostat. + */ + class ThermostatDailyPrograms + { + public static function from_json( + mixed $json, + ): ThermostatDailyPrograms|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + name: $json->name ?? null, + periods: array_map( + fn( + $p, + ) => \Seam\Resources\Device\Properties\ThermostatDailyPrograms\Periods::from_json( + $p, + ), + $json->periods ?? [], + ), + thermostat_daily_program_id: $json->thermostat_daily_program_id ?? + null, + workspace_id: $json->workspace_id ?? null, + ); + } + + public function __construct( + /** + * Date and time at which the thermostat daily program was created. + */ + public string|null $created_at, + /** + * ID of the thermostat device on which the thermostat daily program is configured. + */ + public string|null $device_id, + /** + * User-friendly name to identify the thermostat daily program. + */ + public string|null $name, + /** + * Array of thermostat daily program periods. + * + * @var list<\Seam\Resources\Device\Properties\ThermostatDailyPrograms\Periods> + */ + public array $periods, + /** + * ID of the thermostat daily program. + */ + public string|null $thermostat_daily_program_id, + /** + * ID of the workspace that contains the thermostat daily program. + */ + public string|null $workspace_id, + ) {} + } + + /** + * Current [weekly program](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-programs) for the thermostat. + */ + class ThermostatWeeklyProgram + { + public static function from_json( + mixed $json, + ): ThermostatWeeklyProgram|null { + if (!$json) { + return null; + } + return new self( + 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, + sunday_program_id: $json->sunday_program_id ?? null, + thursday_program_id: $json->thursday_program_id ?? null, + tuesday_program_id: $json->tuesday_program_id ?? null, + wednesday_program_id: $json->wednesday_program_id ?? null, + ); + } + + public function __construct( + /** + * Date and time at which the thermostat weekly program was created. + */ + public string|null $created_at, + /** + * ID of the thermostat daily program to run on Fridays. + */ + public string|null $friday_program_id, + /** + * ID of the thermostat daily program to run on Mondays. + */ + public string|null $monday_program_id, + /** + * ID of the thermostat daily program to run on Saturdays. + */ + public string|null $saturday_program_id, + /** + * ID of the thermostat daily program to run on Sundays. + */ + public string|null $sunday_program_id, + /** + * ID of the thermostat daily program to run on Thursdays. + */ + public string|null $thursday_program_id, + /** + * ID of the thermostat daily program to run on Tuesdays. + */ + public string|null $tuesday_program_id, + /** + * ID of the thermostat daily program to run on Wednesdays. + */ + public string|null $wednesday_program_id, + ) {} + } + + enum FanModeSetting: string + { + case AUTO = "auto"; + case ON = "on"; + case CIRCULATE = "circulate"; + } +} + +namespace Seam\Resources\Device\Properties\AccessoryKeypad { + /** + * Keypad battery properties. + */ + class Battery + { + public static function from_json(mixed $json): Battery|null + { + if (!$json) { + return null; + } + return new self(level: $json->level ?? null); + } + + public function __construct(public float|null $level) {} + } +} + +namespace Seam\Resources\Device\Properties\Battery { + enum Status: string + { + case CRITICAL = "critical"; + case LOW = "low"; + case GOOD = "good"; + case FULL = "full"; + } +} + +namespace Seam\Resources\Device\Properties\AssaAbloyCredentialServiceMetadata { + /** + * Endpoints associated with the phone. + */ + class Endpoints + { + public static function from_json(mixed $json): Endpoints|null + { + if (!$json) { + return null; + } + return new self( + endpoint_id: $json->endpoint_id ?? null, + is_active: $json->is_active ?? null, + ); + } + + public function __construct( + /** + * ID of the associated endpoint. + */ + public string|null $endpoint_id = null, + /** + * Indicated whether the endpoint is active. + */ + public bool|null $is_active = null, + ) {} + } +} + +namespace Seam\Resources\Device\Properties\DormakabaOracodeMetadata { + /** + * Predefined time slots for a dormakaba Oracode device. + */ + class PredefinedTimeSlots + { + public static function from_json(mixed $json): PredefinedTimeSlots|null + { + if (!$json) { + return null; + } + return new self( + check_in_time: $json->check_in_time ?? null, + check_out_time: $json->check_out_time ?? null, + dormakaba_oracode_user_level_id: $json->dormakaba_oracode_user_level_id ?? + null, + dormakaba_oracode_user_level_prefix: $json->dormakaba_oracode_user_level_prefix ?? + null, + is_24_hour: $json->is_24_hour ?? null, + is_biweekly_mode: $json->is_biweekly_mode ?? null, + is_master: $json->is_master ?? null, + is_one_shot: $json->is_one_shot ?? null, + name: $json->name ?? null, + prefix: $json->prefix ?? null, + ); + } + + public function __construct( + /** + * Check in time for a time slot for a dormakaba Oracode device. + */ + public string|null $check_in_time = null, + /** + * Checkout time for a time slot for a dormakaba Oracode device. + */ + public string|null $check_out_time = null, + /** + * ID of a user level for a dormakaba Oracode device. + */ + public string|null $dormakaba_oracode_user_level_id = null, + /** + * Prefix for a user level for a dormakaba Oracode device. + */ + public float|null $dormakaba_oracode_user_level_prefix = null, + /** + * Indicates whether a time slot for a dormakaba Oracode device is a 24-hour time slot. + */ + public bool|null $is_24_hour = null, + /** + * Indicates whether a time slot for a dormakaba Oracode device is in biweekly mode. + */ + public bool|null $is_biweekly_mode = null, + /** + * Indicates whether a time slot for a dormakaba Oracode device is a master time slot. + */ + public bool|null $is_master = null, + /** + * Indicates whether a time slot for a dormakaba Oracode device is a one-shot time slot. + */ + public bool|null $is_one_shot = null, + /** + * Name of a time slot for a dormakaba Oracode device. + */ + public string|null $name = null, + /** + * Prefix for a time slot for a dormakaba Oracode device. + */ + public float|null $prefix = null, + ) {} + } +} + +namespace Seam\Resources\Device\Properties\MinutMetadata { + /** + * Latest sensor values for a Minut device. + */ + class LatestSensorValues + { + public static function from_json(mixed $json): LatestSensorValues|null + { + if (!$json) { + return null; + } + return new self( + accelerometer_z: isset($json->accelerometer_z) + ? \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\AccelerometerZ::from_json( + $json->accelerometer_z, + ) + : null, + humidity: isset($json->humidity) + ? \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\Humidity::from_json( + $json->humidity, + ) + : null, + pressure: isset($json->pressure) + ? \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\Pressure::from_json( + $json->pressure, + ) + : null, + sound: isset($json->sound) + ? \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\Sound::from_json( + $json->sound, + ) + : null, + temperature: isset($json->temperature) + ? \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\Temperature::from_json( + $json->temperature, + ) + : null, + ); + } + + public function __construct( + /** + * Latest accelerometer Z-axis reading for a Minut device. + */ + public \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\AccelerometerZ|null $accelerometer_z = null, + /** + * Latest humidity reading for a Minut device. + */ + public \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\Humidity|null $humidity = null, + /** + * Latest pressure reading for a Minut device. + */ + public \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\Pressure|null $pressure = null, + /** + * Latest sound reading for a Minut device. + */ + public \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\Sound|null $sound = null, + /** + * Latest temperature reading for a Minut device. + */ + public \Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues\Temperature|null $temperature = null, + ) {} + } +} + +namespace Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues { + /** + * Latest accelerometer Z-axis reading for a Minut device. + */ + class AccelerometerZ + { + public static function from_json(mixed $json): AccelerometerZ|null + { + if (!$json) { + return null; + } + return new self( + time: $json->time ?? null, + value: $json->value ?? null, + ); + } + + public function __construct( + /** + * Time of latest accelerometer Z-axis reading for a Minut device. + */ + public string|null $time = null, + /** + * Value of latest accelerometer Z-axis reading for a Minut device. + */ + public float|null $value = null, + ) {} + } + + /** + * Latest humidity reading for a Minut device. + */ + class Humidity + { + public static function from_json(mixed $json): Humidity|null + { + if (!$json) { + return null; + } + return new self( + time: $json->time ?? null, + value: $json->value ?? null, + ); + } + + public function __construct( + /** + * Time of latest humidity reading for a Minut device. + */ + public string|null $time = null, + /** + * Value of latest humidity reading for a Minut device. + */ + public float|null $value = null, + ) {} + } + + /** + * Latest pressure reading for a Minut device. + */ + class Pressure + { + public static function from_json(mixed $json): Pressure|null + { + if (!$json) { + return null; + } + return new self( + time: $json->time ?? null, + value: $json->value ?? null, + ); + } + + public function __construct( + /** + * Time of latest pressure reading for a Minut device. + */ + public string|null $time = null, + /** + * Value of latest pressure reading for a Minut device. + */ + public float|null $value = null, + ) {} + } + + /** + * Latest sound reading for a Minut device. + */ + class Sound + { + public static function from_json(mixed $json): Sound|null + { + if (!$json) { + return null; + } + return new self( + time: $json->time ?? null, + value: $json->value ?? null, + ); + } + + public function __construct( + /** + * Time of latest sound reading for a Minut device. + */ + public string|null $time = null, + /** + * Value of latest sound reading for a Minut device. + */ + public float|null $value = null, + ) {} + } + + /** + * Latest temperature reading for a Minut device. + */ + class Temperature + { + public static function from_json(mixed $json): Temperature|null + { + if (!$json) { + return null; + } + return new self( + time: $json->time ?? null, + value: $json->value ?? null, + ); + } + + public function __construct( + /** + * Time of latest temperature reading for a Minut device. + */ + public string|null $time = null, + /** + * Value of latest temperature reading for a Minut device. + */ + public float|null $value = null, + ) {} + } +} + +namespace Seam\Resources\Device\Properties\NoiseawareMetadata { + enum DeviceModel: string + { + case INDOOR = "indoor"; + case OUTDOOR = "outdoor"; + } +} + +namespace Seam\Resources\Device\Properties\SeamBridgeMetadata { + enum UnlockMethod: string + { + case BRIDGE = "bridge"; + case DOORKING = "doorking"; + } +} + +namespace Seam\Resources\Device\Properties\TtlockMetadata { + /** + * Features for a TTLock device. + */ + class Features + { + public static function from_json(mixed $json): Features|null + { + if (!$json) { + return null; + } + return new self( + auto_lock_time_config: $json->auto_lock_time_config ?? null, + incomplete_keyboard_passcode: $json->incomplete_keyboard_passcode ?? null, + lock_command: $json->lock_command ?? null, + passcode: $json->passcode ?? null, + passcode_management: $json->passcode_management ?? null, + unlock_via_gateway: $json->unlock_via_gateway ?? null, + wifi: $json->wifi ?? null, + ); + } + + public function __construct( + /** + * Indicates whether a TTLock device supports auto-lock time configuration. + */ + public bool|null $auto_lock_time_config = null, + /** + * Indicates whether a TTLock device supports an incomplete keyboard passcode. + */ + public bool|null $incomplete_keyboard_passcode = null, + /** + * Indicates whether a TTLock device supports the lock command. + */ + public bool|null $lock_command = null, + /** + * Indicates whether a TTLock device supports a passcode. + */ + public bool|null $passcode = null, + /** + * Indicates whether a TTLock device supports passcode management. + */ + public bool|null $passcode_management = null, + /** + * Indicates whether a TTLock device supports unlock via gateway. + */ + public bool|null $unlock_via_gateway = null, + /** + * Indicates whether a TTLock device supports Wi-Fi. + */ + public bool|null $wifi = null, + ) {} + } + + /** + * Wireless keypads for a TTLock device. + */ + class WirelessKeypads + { + public static function from_json(mixed $json): WirelessKeypads|null + { + if (!$json) { + return null; + } + return new self( + wireless_keypad_id: $json->wireless_keypad_id ?? null, + wireless_keypad_name: $json->wireless_keypad_name ?? null, + ); + } + + public function __construct( + /** + * ID for a wireless keypad for a TTLock device. + */ + public float|null $wireless_keypad_id = null, + /** + * Name for a wireless keypad for a TTLock device. + */ + public string|null $wireless_keypad_name = null, + ) {} + } +} + +namespace Seam\Resources\Device\Properties\CodeConstraints { + enum ConstraintType: string + { + case NO_ZEROS = "no_zeros"; + case CANNOT_START_WITH_12 = "cannot_start_with_12"; + case NO_TRIPLE_CONSECUTIVE_INTS = "no_triple_consecutive_ints"; + case CANNOT_SPECIFY_PIN_CODE = "cannot_specify_pin_code"; + case PIN_CODE_MATCHES_EXISTING_SET = "pin_code_matches_existing_set"; + case START_DATE_IN_FUTURE = "start_date_in_future"; + case NO_ASCENDING_OR_DESCENDING_SEQUENCE = "no_ascending_or_descending_sequence"; + case AT_LEAST_THREE_UNIQUE_DIGITS = "at_least_three_unique_digits"; + case CANNOT_CONTAIN_089 = "cannot_contain_089"; + case CANNOT_CONTAIN_0789 = "cannot_contain_0789"; + case UNIQUE_FIRST_FOUR_DIGITS = "unique_first_four_digits"; + case NO_ALL_SAME_DIGITS = "no_all_same_digits"; + case NAME_LENGTH = "name_length"; + case NAME_MUST_BE_UNIQUE = "name_must_be_unique"; + } +} + +namespace Seam\Resources\Device\Properties\OfflineTimeFrameOptions { + /** + * Fixed start/end time pairings the caller chooses from. Mutually exclusive with `matching_start_end_time`. + */ + class TimePairs + { + public static function from_json(mixed $json): TimePairs|null + { + if (!$json) { + return null; + } + return new self( display_name: $json->display_name ?? null, - ecobee_metadata: isset($json->ecobee_metadata) - ? CurrentClimateSetting\EcobeeMetadata::from_json( - $json->ecobee_metadata, + end_time: $json->end_time ?? null, + start_time: $json->start_time ?? null, + ); + } + + public function __construct( + /** + * Label for the start/end time pairing. + */ + public string|null $display_name, + /** + * End time of day as a 24-hour `HH:MM` value, interpreted in the option's `time_zone`. An `end_time` earlier on the clock than `start_time` means the end falls on a later date. + */ + public string|null $end_time, + /** + * Start time of day as a 24-hour `HH:MM` value, interpreted in the option's `time_zone`. + */ + public string|null $start_time, + ) {} + } +} + +namespace Seam\Resources\Device\Properties\OnlineTimeFrameOptions { + /** + * Fixed start/end time pairings the caller chooses from. Mutually exclusive with `matching_start_end_time`. + */ + class TimePairs + { + public static function from_json(mixed $json): TimePairs|null + { + if (!$json) { + return null; + } + return new self( + display_name: $json->display_name ?? null, + end_time: $json->end_time ?? null, + start_time: $json->start_time ?? null, + ); + } + + public function __construct( + /** + * Label for the start/end time pairing. + */ + public string|null $display_name, + /** + * End time of day as a 24-hour `HH:MM` value, interpreted in the option's `time_zone`. An `end_time` earlier on the clock than `start_time` means the end falls on a later date. + */ + public string|null $end_time, + /** + * Start time of day as a 24-hour `HH:MM` value, interpreted in the option's `time_zone`. + */ + public string|null $start_time, + ) {} + } +} + +namespace Seam\Resources\Device\Properties\ActiveThermostatSchedule { + /** + * Errors associated with the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + */ + class Errors + { + public static function from_json(mixed $json): Errors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } +} + +namespace Seam\Resources\Device\Properties\AvailableClimatePresets { + /** + * Metadata specific to the Ecobee climate, if applicable. + */ + class EcobeeMetadata + { + public static function from_json(mixed $json): EcobeeMetadata|null + { + if (!$json) { + return null; + } + return new self( + climate_ref: $json->climate_ref ?? null, + is_optimized: $json->is_optimized ?? null, + owner: is_string($json->owner ?? null) + ? \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner::tryFrom( + $json->owner, ) : null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? - null, - 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( /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be deleted. + * Reference to the Ecobee climate, if applicable. */ - public bool|null $can_delete = null, + public string|null $climate_ref = null, /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be edited. + * Indicates if the climate preset is optimized by Ecobee. */ - public bool|null $can_edit = null, + public bool|null $is_optimized = null, /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be programmed in a thermostat daily program. + * Indicates whether the climate preset is owned by the user or the system. */ - public bool|null $can_use_with_thermostat_daily_programs = null, + public \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner|null $owner = null, + ) {} + } + + enum ClimatePresetMode: string + { + case HOME = "home"; + case AWAY = "away"; + case WAKE = "wake"; + case SLEEP = "sleep"; + case OCCUPIED = "occupied"; + case UNOCCUPIED = "unoccupied"; + } + + enum FanModeSetting: string + { + case AUTO = "auto"; + case ON = "on"; + case CIRCULATE = "circulate"; + } + + enum HvacModeSetting: string + { + case OFF = "off"; + case HEAT = "heat"; + case COOL = "cool"; + case HEAT_COOL = "heat_cool"; + case ECO = "eco"; + } +} + +namespace Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata { + enum Owner: string + { + case USER = "user"; + case SYSTEM = "system"; + } +} + +namespace Seam\Resources\Device\Properties\CurrentClimateSetting { + /** + * Metadata specific to the Ecobee climate, if applicable. + */ + class EcobeeMetadata + { + public static function from_json(mixed $json): EcobeeMetadata|null + { + if (!$json) { + return null; + } + return new self( + climate_ref: $json->climate_ref ?? null, + is_optimized: $json->is_optimized ?? null, + owner: is_string($json->owner ?? null) + ? \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata\Owner::tryFrom( + $json->owner, + ) + : null, + ); + } + + public function __construct( /** - * Unique key to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + * Reference to the Ecobee climate, if applicable. */ - public string|null $climate_preset_key = null, + public string|null $climate_ref = null, /** - * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. + * Indicates if the climate preset is optimized by Ecobee. */ - public string|null $climate_preset_mode = null, + public bool|null $is_optimized = null, /** - * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Indicates whether the climate preset is owned by the user or the system. */ - public float|null $cooling_set_point_celsius = null, + public \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata\Owner|null $owner = null, + ) {} + } + + enum ClimatePresetMode: string + { + case HOME = "home"; + case AWAY = "away"; + case WAKE = "wake"; + case SLEEP = "sleep"; + case OCCUPIED = "occupied"; + case UNOCCUPIED = "unoccupied"; + } + + enum FanModeSetting: string + { + case AUTO = "auto"; + case ON = "on"; + case CIRCULATE = "circulate"; + } + + enum HvacModeSetting: string + { + case OFF = "off"; + case HEAT = "heat"; + case COOL = "cool"; + case HEAT_COOL = "heat_cool"; + case ECO = "eco"; + } +} + +namespace Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata { + enum Owner: string + { + case USER = "user"; + case SYSTEM = "system"; + } +} + +namespace Seam\Resources\Device\Properties\DefaultClimateSetting { + /** + * Metadata specific to the Ecobee climate, if applicable. + */ + class EcobeeMetadata + { + public static function from_json(mixed $json): EcobeeMetadata|null + { + if (!$json) { + return null; + } + return new self( + climate_ref: $json->climate_ref ?? null, + is_optimized: $json->is_optimized ?? null, + owner: is_string($json->owner ?? null) + ? \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata\Owner::tryFrom( + $json->owner, + ) + : null, + ); + } + + public function __construct( /** - * Temperature to which the thermostat should cool (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Reference to the Ecobee climate, if applicable. */ - public float|null $cooling_set_point_fahrenheit = null, + public string|null $climate_ref = null, /** - * Display name for the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + * Indicates if the climate preset is optimized by Ecobee. */ - public string|null $display_name = null, + public bool|null $is_optimized = null, /** - * Metadata specific to the Ecobee climate, if applicable. + * Indicates whether the climate preset is owned by the user or the system. + */ + public \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata\Owner|null $owner = null, + ) {} + } + + enum ClimatePresetMode: string + { + case HOME = "home"; + case AWAY = "away"; + case WAKE = "wake"; + case SLEEP = "sleep"; + case OCCUPIED = "occupied"; + case UNOCCUPIED = "unoccupied"; + } + + enum FanModeSetting: string + { + case AUTO = "auto"; + case ON = "on"; + case CIRCULATE = "circulate"; + } + + enum HvacModeSetting: string + { + case OFF = "off"; + case HEAT = "heat"; + case COOL = "cool"; + case HEAT_COOL = "heat_cool"; + case ECO = "eco"; + } +} + +namespace Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata { + enum Owner: string + { + case USER = "user"; + case SYSTEM = "system"; + } +} + +namespace Seam\Resources\Device\Properties\ThermostatDailyPrograms { + /** + * Array of thermostat daily program periods. + */ + class Periods + { + public static function from_json(mixed $json): Periods|null + { + if (!$json) { + return null; + } + return new self( + climate_preset_key: $json->climate_preset_key ?? null, + starts_at_time: $json->starts_at_time ?? null, + ); + } + + public function __construct( + /** + * Key of the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) to activate at the `starts_at_time`. */ - public CurrentClimateSetting\EcobeeMetadata|null $ecobee_metadata = null, + public string|null $climate_preset_key, /** - * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + * Time at which the thermostat daily program period starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ - public string|null $fan_mode_setting = null, + public string|null $starts_at_time, + ) {} + } +} + +namespace Seam\Resources\Device\Warnings { + /** + * Indicates that the backup access code is unhealthy. + */ + final class PartialBackupAccessCodePool extends + \Seam\Resources\Device\Warnings + { + public static function from_json( + mixed $json, + ): PartialBackupAccessCodePool|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( /** - * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Date and time at which Seam created the warning. */ - public float|null $heating_set_point_celsius = null, + string|null $created_at, /** - * Temperature to which the thermostat should heat (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $heating_set_point_fahrenheit = null, + string|null $message, /** - * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that there are too many backup codes. + */ + final class ManyActiveBackupCodes extends \Seam\Resources\Device\Warnings + { + public static function from_json( + mixed $json, + ): ManyActiveBackupCodes|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. */ - public string|null $hvac_mode_setting = null, + string|null $created_at, /** - * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). - * - * @deprecated Use 'thermostat_schedule.is_override_allowed' + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $manual_override_allowed = null, + string|null $message, /** - * User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $name = null, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * @deprecated use fallback_climate_preset_key to specify a fallback climate preset instead. + * Indicates that a third-party integration has been detected. */ - class DefaultClimateSetting + final class ThirdPartyIntegrationDetected extends + \Seam\Resources\Device\Warnings { public static function from_json( mixed $json, - ): DefaultClimateSetting|null { + ): ThirdPartyIntegrationDetected|null { if (!$json) { return null; } return new self( - 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) - ? DefaultClimateSetting\EcobeeMetadata::from_json( - $json->ecobee_metadata, - ) + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code : null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? - null, - 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( /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be deleted. - */ - public bool|null $can_delete = null, - /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be edited. - */ - public bool|null $can_edit = null, - /** - * Indicates whether the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) key can be programmed in a thermostat daily program. - */ - public bool|null $can_use_with_thermostat_daily_programs = null, - /** - * Unique key to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). - */ - public string|null $climate_preset_key = null, - /** - * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. - */ - public string|null $climate_preset_mode = null, - /** - * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). - */ - public float|null $cooling_set_point_celsius = null, - /** - * Temperature to which the thermostat should cool (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Date and time at which Seam created the warning. */ - public float|null $cooling_set_point_fahrenheit = null, + string|null $created_at, /** - * Display name for the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $display_name = null, + string|null $message, /** - * Metadata specific to the Ecobee climate, if applicable. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public DefaultClimateSetting\EcobeeMetadata|null $ecobee_metadata = null, + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the Remote Unlock feature is not enabled in the settings." + */ + final class TtlockLockGatewayUnlockingNotEnabled extends + \Seam\Resources\Device\Warnings + { + public static function from_json( + mixed $json, + ): TtlockLockGatewayUnlockingNotEnabled|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( /** - * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + * Date and time at which Seam created the warning. */ - public string|null $fan_mode_setting = null, + string|null $created_at, /** - * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $heating_set_point_celsius = null, + string|null $message, /** - * Temperature to which the thermostat should heat (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public float|null $heating_set_point_fahrenheit = null, + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the gateway signal is weak. + */ + final class TtlockWeakGatewaySignal extends \Seam\Resources\Device\Warnings + { + public static function from_json( + mixed $json, + ): TtlockWeakGatewaySignal|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( /** - * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + * Date and time at which Seam created the warning. */ - public string|null $hvac_mode_setting = null, + string|null $created_at, /** - * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). - * - * @deprecated Use 'thermostat_schedule.is_override_allowed' + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $manual_override_allowed = null, + string|null $message, /** - * User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $name = null, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * Current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + * Indicates that the device is in power saving mode and may have limited functionality. */ - class TemperatureThreshold + final class PowerSavingMode extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): TemperatureThreshold|null + public static function from_json(mixed $json): PowerSavingMode|null { if (!$json) { return null; } return new self( - lower_limit_celsius: $json->lower_limit_celsius ?? null, - lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, - upper_limit_celsius: $json->upper_limit_celsius ?? null, - upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Lower limit in °C within the current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. - */ - public float|null $lower_limit_celsius, - /** - * Lower limit in °F within the current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + * Date and time at which Seam created the warning. */ - public float|null $lower_limit_fahrenheit, + string|null $created_at, /** - * Upper limit in °C within the current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $upper_limit_celsius, + string|null $message, /** - * Upper limit in °F within the current [temperature threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds) set for the thermostat. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public float|null $upper_limit_fahrenheit, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * Configured [daily programs](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-programs) for the thermostat. + * Indicates that the temperature threshold has been exceeded. */ - class ThermostatDailyPrograms + final class TemperatureThresholdExceeded extends + \Seam\Resources\Device\Warnings { public static function from_json( mixed $json, - ): ThermostatDailyPrograms|null { + ): TemperatureThresholdExceeded|null { if (!$json) { return null; } return new self( created_at: $json->created_at ?? null, - device_id: $json->device_id ?? null, - name: $json->name ?? null, - periods: array_map( - fn($p) => ThermostatDailyPrograms\Periods::from_json($p), - $json->periods ?? [], - ), - thermostat_daily_program_id: $json->thermostat_daily_program_id ?? - null, - workspace_id: $json->workspace_id ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Date and time at which the thermostat daily program was created. + * Date and time at which Seam created the warning. */ - public string|null $created_at, + string|null $created_at, /** - * ID of the thermostat device on which the thermostat daily program is configured. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $device_id, + string|null $message, /** - * User-friendly name to identify the thermostat daily program. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $name, + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the device appears to be unresponsive. + */ + final class DeviceCommunicationDegraded extends + \Seam\Resources\Device\Warnings + { + public static function from_json( + mixed $json, + ): DeviceCommunicationDegraded|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( /** - * Array of thermostat daily program periods. + * Date and time at which Seam created the warning. */ - public array $periods, + string|null $created_at, /** - * ID of the thermostat daily program. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $thermostat_daily_program_id, + string|null $message, /** - * ID of the workspace that contains the thermostat daily program. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $workspace_id, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * Current [weekly program](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-programs) for the thermostat. + * Indicates that a scheduled maintenance window has been detected. */ - class ThermostatWeeklyProgram + final class ScheduledMaintenanceWindow extends + \Seam\Resources\Device\Warnings { public static function from_json( mixed $json, - ): ThermostatWeeklyProgram|null { + ): ScheduledMaintenanceWindow|null { if (!$json) { return null; } return new self( 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, - sunday_program_id: $json->sunday_program_id ?? null, - thursday_program_id: $json->thursday_program_id ?? null, - tuesday_program_id: $json->tuesday_program_id ?? null, - wednesday_program_id: $json->wednesday_program_id ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Date and time at which the thermostat weekly program was created. - */ - public string|null $created_at, - /** - * ID of the thermostat daily program to run on Fridays. - */ - public string|null $friday_program_id, - /** - * ID of the thermostat daily program to run on Mondays. + * Date and time at which Seam created the warning. */ - public string|null $monday_program_id, + string|null $created_at, /** - * ID of the thermostat daily program to run on Saturdays. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $saturday_program_id, + string|null $message, /** - * ID of the thermostat daily program to run on Sundays. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $sunday_program_id, + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the device has a flaky connection. + */ + final class DeviceHasFlakyConnection extends \Seam\Resources\Device\Warnings + { + public static function from_json( + mixed $json, + ): DeviceHasFlakyConnection|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( /** - * ID of the thermostat daily program to run on Thursdays. + * Date and time at which Seam created the warning. */ - public string|null $thursday_program_id, + string|null $created_at, /** - * ID of the thermostat daily program to run on Tuesdays. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $tuesday_program_id, + string|null $message, /** - * ID of the thermostat daily program to run on Wednesdays. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $wednesday_program_id, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\AccessoryKeypad { /** - * Keypad battery properties. + * Indicates that the Salto KS lock is in Office Mode. Access Codes will not unlock doors. */ - class Battery + final class SaltoKsOfficeMode extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Battery|null + public static function from_json(mixed $json): SaltoKsOfficeMode|null { if (!$json) { return null; } - return new self(level: $json->level ?? null); + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); } - public function __construct(public float|null $level) {} + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\AssaAbloyCredentialServiceMetadata { /** - * Endpoints associated with the phone. + * Indicates that the Salto KS lock is in Privacy Mode. Access Codes will not unlock doors. */ - class Endpoints + final class SaltoKsPrivacyMode extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Endpoints|null + public static function from_json(mixed $json): SaltoKsPrivacyMode|null { if (!$json) { return null; } return new self( - endpoint_id: $json->endpoint_id ?? null, - is_active: $json->is_active ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * ID of the associated endpoint. + * Date and time at which Seam created the warning. */ - public string|null $endpoint_id = null, + string|null $created_at, /** - * Indicated whether the endpoint is active. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $is_active = null, - ) {} + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\DormakabaOracodeMetadata { /** - * Predefined time slots for a dormakaba Oracode device. + * Indicates that the lock is in Privacy Mode. Access codes and remote unlock are blocked until Privacy Mode is disabled. */ - class PredefinedTimeSlots + final class PrivacyMode extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): PredefinedTimeSlots|null + public static function from_json(mixed $json): PrivacyMode|null { if (!$json) { return null; } return new self( - check_in_time: $json->check_in_time ?? null, - check_out_time: $json->check_out_time ?? null, - dormakaba_oracode_user_level_id: $json->dormakaba_oracode_user_level_id ?? - null, - dormakaba_oracode_user_level_prefix: $json->dormakaba_oracode_user_level_prefix ?? - null, - is_24_hour: $json->is_24_hour ?? null, - is_biweekly_mode: $json->is_biweekly_mode ?? null, - is_master: $json->is_master ?? null, - is_one_shot: $json->is_one_shot ?? null, - name: $json->name ?? null, - prefix: $json->prefix ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Check in time for a time slot for a dormakaba Oracode device. - */ - public string|null $check_in_time = null, - /** - * Checkout time for a time slot for a dormakaba Oracode device. - */ - public string|null $check_out_time = null, - /** - * ID of a user level for a dormakaba Oracode device. - */ - public string|null $dormakaba_oracode_user_level_id = null, - /** - * Prefix for a user level for a dormakaba Oracode device. - */ - public float|null $dormakaba_oracode_user_level_prefix = null, - /** - * Indicates whether a time slot for a dormakaba Oracode device is a 24-hour time slot. - */ - public bool|null $is_24_hour = null, - /** - * Indicates whether a time slot for a dormakaba Oracode device is in biweekly mode. - */ - public bool|null $is_biweekly_mode = null, - /** - * Indicates whether a time slot for a dormakaba Oracode device is a master time slot. - */ - public bool|null $is_master = null, - /** - * Indicates whether a time slot for a dormakaba Oracode device is a one-shot time slot. + * Date and time at which Seam created the warning. */ - public bool|null $is_one_shot = null, + string|null $created_at, /** - * Name of a time slot for a dormakaba Oracode device. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $name = null, + string|null $message, /** - * Prefix for a time slot for a dormakaba Oracode device. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public float|null $prefix = null, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\MinutMetadata { /** - * Latest sensor values for a Minut device. + * Indicates that the Salto KS site has exceeded 80% of the maximum number of allowed users. Increase your subscription limit or delete some users from your site. */ - class LatestSensorValues + final class SaltoKsSubscriptionLimitAlmostReached extends + \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): LatestSensorValues|null - { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitAlmostReached|null { if (!$json) { return null; } return new self( - accelerometer_z: isset($json->accelerometer_z) - ? LatestSensorValues\AccelerometerZ::from_json( - $json->accelerometer_z, - ) - : null, - humidity: isset($json->humidity) - ? LatestSensorValues\Humidity::from_json($json->humidity) - : null, - pressure: isset($json->pressure) - ? LatestSensorValues\Pressure::from_json($json->pressure) - : null, - sound: isset($json->sound) - ? LatestSensorValues\Sound::from_json($json->sound) - : null, - temperature: isset($json->temperature) - ? LatestSensorValues\Temperature::from_json( - $json->temperature, - ) + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code : null, ); } public function __construct( /** - * Latest accelerometer Z-axis reading for a Minut device. - */ - public LatestSensorValues\AccelerometerZ|null $accelerometer_z = null, - /** - * Latest humidity reading for a Minut device. - */ - public LatestSensorValues\Humidity|null $humidity = null, - /** - * Latest pressure reading for a Minut device. + * Date and time at which Seam created the warning. */ - public LatestSensorValues\Pressure|null $pressure = null, + string|null $created_at, /** - * Latest sound reading for a Minut device. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public LatestSensorValues\Sound|null $sound = null, + string|null $message, /** - * Latest temperature reading for a Minut device. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public LatestSensorValues\Temperature|null $temperature = null, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\MinutMetadata\LatestSensorValues { /** - * Latest accelerometer Z-axis reading for a Minut device. + * Indicates that a change in the reported device model has been detected for this Salto KS lock, which may occur after an IQ hub reset. Access code support may be affected. See https://help.getseam.com/articles/5098842588-salto-ks-lock-loses-access-code-support for troubleshooting steps. */ - class AccelerometerZ + final class SaltoKsLockAccessCodeSupportRemoved extends + \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): AccelerometerZ|null - { + public static function from_json( + mixed $json, + ): SaltoKsLockAccessCodeSupportRemoved|null { if (!$json) { return null; } return new self( - time: $json->time ?? null, - value: $json->value ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Time of latest accelerometer Z-axis reading for a Minut device. + * Date and time at which Seam created the warning. */ - public string|null $time = null, + string|null $created_at, /** - * Value of latest accelerometer Z-axis reading for a Minut device. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $value = null, - ) {} + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * Latest humidity reading for a Minut device. + * Indicates that an unknown issue occurred while syncing the state of the phone with the provider. This issue may affect the proper functioning of the phone. */ - class Humidity + final class UnknownIssueWithPhone extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Humidity|null - { + public static function from_json( + mixed $json, + ): UnknownIssueWithPhone|null { if (!$json) { return null; } return new self( - time: $json->time ?? null, - value: $json->value ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Time of latest humidity reading for a Minut device. + * Date and time at which Seam created the warning. */ - public string|null $time = null, + string|null $created_at, /** - * Value of latest humidity reading for a Minut device. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $value = null, - ) {} + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * Latest pressure reading for a Minut device. + * Indicates that Seam detected that the Lockly device does not have a time zone configured. Time-bound codes may not work as expected. */ - class Pressure + final class LocklyTimeZoneNotConfigured extends + \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Pressure|null - { + public static function from_json( + mixed $json, + ): LocklyTimeZoneNotConfigured|null { if (!$json) { return null; } return new self( - time: $json->time ?? null, - value: $json->value ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Time of latest pressure reading for a Minut device. + * Date and time at which Seam created the warning. */ - public string|null $time = null, + string|null $created_at, /** - * Value of latest pressure reading for a Minut device. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $value = null, - ) {} + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * Latest sound reading for a Minut device. + * Indicates that Seam does not know the time zone of the Ultraloq device. Set a time zone to enable time-bound access codes. */ - class Sound + final class UltraloqTimeZoneUnknown extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Sound|null - { + public static function from_json( + mixed $json, + ): UltraloqTimeZoneUnknown|null { if (!$json) { return null; } return new self( - time: $json->time ?? null, - value: $json->value ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Time of latest sound reading for a Minut device. + * Date and time at which Seam created the warning. */ - public string|null $time = null, + string|null $created_at, /** - * Value of latest sound reading for a Minut device. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $value = null, - ) {} + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * Latest temperature reading for a Minut device. + * Indicates that Seam does not know the device's time zone. Set a time zone to enable time-bound access codes. */ - class Temperature + final class TimeZoneUnknown extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Temperature|null + public static function from_json(mixed $json): TimeZoneUnknown|null { if (!$json) { return null; } return new self( - time: $json->time ?? null, - value: $json->value ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Time of latest temperature reading for a Minut device. + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $time = null, + string|null $message, /** - * Value of latest temperature reading for a Minut device. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public float|null $value = null, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\TtlockMetadata { /** - * Features for a TTLock device. + * Indicates that the device's configured time zone does not match its hardware UTC offset. Time-bound access codes may activate at the wrong local time. */ - class Features + final class TimeZoneMismatch extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Features|null + public static function from_json(mixed $json): TimeZoneMismatch|null { if (!$json) { return null; } return new self( - auto_lock_time_config: $json->auto_lock_time_config ?? null, - incomplete_keyboard_passcode: $json->incomplete_keyboard_passcode ?? - null, - lock_command: $json->lock_command ?? null, - passcode: $json->passcode ?? null, - passcode_management: $json->passcode_management ?? null, - unlock_via_gateway: $json->unlock_via_gateway ?? null, - wifi: $json->wifi ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Indicates whether a TTLock device supports auto-lock time configuration. - */ - public bool|null $auto_lock_time_config = null, - /** - * Indicates whether a TTLock device supports an incomplete keyboard passcode. - */ - public bool|null $incomplete_keyboard_passcode = null, - /** - * Indicates whether a TTLock device supports the lock command. - */ - public bool|null $lock_command = null, - /** - * Indicates whether a TTLock device supports a passcode. - */ - public bool|null $passcode = null, - /** - * Indicates whether a TTLock device supports passcode management. + * Date and time at which Seam created the warning. */ - public bool|null $passcode_management = null, + string|null $created_at, /** - * Indicates whether a TTLock device supports unlock via gateway. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $unlock_via_gateway = null, + string|null $message, /** - * Indicates whether a TTLock device supports Wi-Fi. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public bool|null $wifi = null, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } /** - * Wireless keypads for a TTLock device. + * Indicates that the 2N device does not have a time zone configured. Configure a time zone on the device to enable access codes. */ - class WirelessKeypads + final class TwoNDeviceMissingTimezone extends + \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): WirelessKeypads|null - { + public static function from_json( + mixed $json, + ): TwoNDeviceMissingTimezone|null { if (!$json) { return null; } return new self( - wireless_keypad_id: $json->wireless_keypad_id ?? null, - wireless_keypad_name: $json->wireless_keypad_name ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * ID for a wireless keypad for a TTLock device. + * Date and time at which Seam created the warning. */ - public float|null $wireless_keypad_id = null, + string|null $created_at, /** - * Name for a wireless keypad for a TTLock device. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $wireless_keypad_name = null, - ) {} + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\OfflineTimeFrameOptions { /** - * Fixed start/end time pairings the caller chooses from. Mutually exclusive with `matching_start_end_time`. + * Indicates that a hub or relay must be connected to unlock additional capabilities such as remote unlock. */ - class TimePairs + final class HubRequiredForAdditionalCapabilities extends + \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): TimePairs|null - { + public static function from_json( + mixed $json, + ): HubRequiredForAdditionalCapabilities|null { if (!$json) { return null; } return new self( - display_name: $json->display_name ?? null, - end_time: $json->end_time ?? null, - start_time: $json->start_time ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Label for the start/end time pairing. + * Date and time at which Seam created the warning. */ - public string|null $display_name, + string|null $created_at, /** - * End time of day as a 24-hour `HH:MM` value, interpreted in the option's `time_zone`. An `end_time` earlier on the clock than `start_time` means the end falls on a later date. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $end_time, + string|null $message, /** - * Start time of day as a 24-hour `HH:MM` value, interpreted in the option's `time_zone`. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $start_time, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\OnlineTimeFrameOptions { /** - * Fixed start/end time pairings the caller chooses from. Mutually exclusive with `matching_start_end_time`. + * Indicates a provider-specific issue that may affect device functionality. */ - class TimePairs + final class ProviderIssue extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): TimePairs|null + public static function from_json(mixed $json): ProviderIssue|null { if (!$json) { return null; } return new self( - display_name: $json->display_name ?? null, - end_time: $json->end_time ?? null, - start_time: $json->start_time ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Label for the start/end time pairing. + * Date and time at which Seam created the warning. */ - public string|null $display_name, + string|null $created_at, /** - * End time of day as a 24-hour `HH:MM` value, interpreted in the option's `time_zone`. An `end_time` earlier on the clock than `start_time` means the end falls on a later date. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $end_time, + string|null $message, /** - * Start time of day as a 24-hour `HH:MM` value, interpreted in the option's `time_zone`. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $start_time, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\ActiveThermostatSchedule { /** - * Errors associated with the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + * Indicates that the key is in a locker that does not support the access codes API. */ - class Errors + final class KeynestUnsupportedLocker extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Errors|null - { + public static function from_json( + mixed $json, + ): KeynestUnsupportedLocker|null { if (!$json) { return null; } return new self( created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Date and time at which Seam created the error. + * Date and time at which Seam created the warning. */ - public string|null $created_at, + string|null $created_at, /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $error_code, + string|null $message, /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $message, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\AvailableClimatePresets { /** - * Metadata specific to the Ecobee climate, if applicable. + * Indicates that the accessory keypad exists, but is not linked to the Igloohome Bridge. Online access code programming will fail until the keypad is linked to the Igloohome Bridge in the Igloohome app. */ - class EcobeeMetadata + final class AccessoryKeypadSetupRequired extends + \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): EcobeeMetadata|null - { + public static function from_json( + mixed $json, + ): AccessoryKeypadSetupRequired|null { if (!$json) { return null; } return new self( - climate_ref: $json->climate_ref ?? null, - is_optimized: $json->is_optimized ?? null, - owner: $json->owner ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Reference to the Ecobee climate, if applicable. + * Date and time at which Seam created the warning. */ - public string|null $climate_ref = null, + string|null $created_at, /** - * Indicates if the climate preset is optimized by Ecobee. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $is_optimized = null, + string|null $message, /** - * Indicates whether the climate preset is owned by the user or the system. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $owner = null, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\CurrentClimateSetting { /** - * Metadata specific to the Ecobee climate, if applicable. + * Indicates that the device may optimistically be reported as online because the provider does not reliably report its online status. */ - class EcobeeMetadata + final class UnreliableOnlineStatus extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): EcobeeMetadata|null - { + public static function from_json( + mixed $json, + ): UnreliableOnlineStatus|null { if (!$json) { return null; } return new self( - climate_ref: $json->climate_ref ?? null, - is_optimized: $json->is_optimized ?? null, - owner: $json->owner ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Reference to the Ecobee climate, if applicable. + * Date and time at which Seam created the warning. */ - public string|null $climate_ref = null, + string|null $created_at, /** - * Indicates if the climate preset is optimized by Ecobee. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $is_optimized = null, + string|null $message, /** - * Indicates whether the climate preset is owned by the user or the system. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $owner = null, - ) {} + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\DefaultClimateSetting { /** - * Metadata specific to the Ecobee climate, if applicable. + * Indicates that the device has reached its maximum number of active access codes. Delete existing codes before creating new ones. */ - class EcobeeMetadata + final class MaxAccessCodesReached extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): EcobeeMetadata|null - { + public static function from_json( + mixed $json, + ): MaxAccessCodesReached|null { if (!$json) { return null; } return new self( - climate_ref: $json->climate_ref ?? null, - is_optimized: $json->is_optimized ?? null, - owner: $json->owner ?? null, + 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: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Reference to the Ecobee climate, if applicable. + * Number of active access codes on the device when the warning was set. */ - public string|null $climate_ref = null, + public int|null $active_access_code_count, /** - * Indicates if the climate preset is optimized by Ecobee. + * Date and time at which Seam created the warning. */ - public bool|null $is_optimized = null, + string|null $created_at, /** - * Indicates whether the climate preset is owned by the user or the system. + * Maximum number of active access codes supported by the device. */ - public string|null $owner = null, - ) {} + public int|null $max_active_access_code_count, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } } -} -namespace Seam\Resources\Device\Properties\ThermostatDailyPrograms { /** - * Array of thermostat daily program periods. + * Fallback for device.warnings values introduced after this SDK version. */ - class Periods + final class Unknown extends \Seam\Resources\Device\Warnings { - public static function from_json(mixed $json): Periods|null + public static function from_json(mixed $json): Unknown|null { if (!$json) { return null; } return new self( - climate_preset_key: $json->climate_preset_key ?? null, - starts_at_time: $json->starts_at_time ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } public function __construct( /** - * Key of the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) to activate at the `starts_at_time`. + * Date and time at which Seam created the warning. */ - public string|null $climate_preset_key, + string|null $created_at, /** - * Time at which the thermostat daily program period starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $starts_at_time, - ) {} + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case PARTIAL_BACKUP_ACCESS_CODE_POOL = "partial_backup_access_code_pool"; + case MANY_ACTIVE_BACKUP_CODES = "many_active_backup_codes"; + case THIRD_PARTY_INTEGRATION_DETECTED = "third_party_integration_detected"; + case TTLOCK_LOCK_GATEWAY_UNLOCKING_NOT_ENABLED = "ttlock_lock_gateway_unlocking_not_enabled"; + case TTLOCK_WEAK_GATEWAY_SIGNAL = "ttlock_weak_gateway_signal"; + case POWER_SAVING_MODE = "power_saving_mode"; + case TEMPERATURE_THRESHOLD_EXCEEDED = "temperature_threshold_exceeded"; + case DEVICE_COMMUNICATION_DEGRADED = "device_communication_degraded"; + case SCHEDULED_MAINTENANCE_WINDOW = "scheduled_maintenance_window"; + case DEVICE_HAS_FLAKY_CONNECTION = "device_has_flaky_connection"; + case SALTO_KS_OFFICE_MODE = "salto_ks_office_mode"; + case SALTO_KS_PRIVACY_MODE = "salto_ks_privacy_mode"; + case PRIVACY_MODE = "privacy_mode"; + case SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED = "salto_ks_subscription_limit_almost_reached"; + case SALTO_KS_LOCK_ACCESS_CODE_SUPPORT_REMOVED = "salto_ks_lock_access_code_support_removed"; + case UNKNOWN_ISSUE_WITH_PHONE = "unknown_issue_with_phone"; + case LOCKLY_TIME_ZONE_NOT_CONFIGURED = "lockly_time_zone_not_configured"; + case ULTRALOQ_TIME_ZONE_UNKNOWN = "ultraloq_time_zone_unknown"; + case TIME_ZONE_UNKNOWN = "time_zone_unknown"; + case TIME_ZONE_MISMATCH = "time_zone_mismatch"; + case TWO_N_DEVICE_MISSING_TIMEZONE = "two_n_device_missing_timezone"; + case HUB_REQUIRED_FOR_ADDITIONAL_CAPABILITIES = "hub_required_for_additional_capabilities"; + case PROVIDER_ISSUE = "provider_issue"; + case KEYNEST_UNSUPPORTED_LOCKER = "keynest_unsupported_locker"; + case ACCESSORY_KEYPAD_SETUP_REQUIRED = "accessory_keypad_setup_required"; + case UNRELIABLE_ONLINE_STATUS = "unreliable_online_status"; + case MAX_ACCESS_CODES_REACHED = "max_access_codes_reached"; } } diff --git a/src/Resources/DeviceProvider.php b/src/Resources/DeviceProvider.php index 41b60ac9..6b321d1a 100644 --- a/src/Resources/DeviceProvider.php +++ b/src/Resources/DeviceProvider.php @@ -9,6 +9,16 @@ public static function from_json(mixed $json): DeviceProvider|null return null; } return new self( + device_provider_name: is_string( + $json->device_provider_name ?? null, + ) + ? \Seam\Resources\DeviceProvider\DeviceProviderName::tryFrom( + $json->device_provider_name, + ) + : null, + display_name: $json->display_name ?? null, + image_url: $json->image_url ?? null, + provider_categories: $json->provider_categories ?? null, 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, @@ -39,10 +49,6 @@ 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, ); } @@ -50,7 +56,7 @@ public function __construct( /** * Name of the device provider. */ - public string|null $device_provider_name, + public \Seam\Resources\DeviceProvider\DeviceProviderName|null $device_provider_name, /** * Display name for the device provider. */ @@ -61,6 +67,8 @@ public function __construct( public string|null $image_url, /** * List of provider categories to which the device provider belongs, such as `stable`, `consumer_smartlocks`, `thermostats`, and so on. + * + * @var list|null */ public array|null $provider_categories, /** @@ -146,3 +154,73 @@ public function __construct( ) {} } } + +namespace Seam\Resources\DeviceProvider { + enum DeviceProviderName: string + { + case HOTEK = "hotek"; + case DORMAKABA_COMMUNITY = "dormakaba_community"; + case LEGIC_CONNECT = "legic_connect"; + case AKUVOX = "akuvox"; + case AUGUST = "august"; + case AVIGILON_ALTA = "avigilon_alta"; + case BRIVO = "brivo"; + case BUTTERFLYMX = "butterflymx"; + case SCHLAGE = "schlage"; + case SMARTTHINGS = "smartthings"; + case YALE = "yale"; + case GENIE = "genie"; + case DOORKING = "doorking"; + case SALTO = "salto"; + case SALTO_KS = "salto_ks"; + case SALTO_KS_ACCEPT = "salto_ks_accept"; + case LOCKLY = "lockly"; + case TTLOCK = "ttlock"; + case LINEAR = "linear"; + case NOISEAWARE = "noiseaware"; + case NUKI = "nuki"; + case IGLOO = "igloo"; + case KWIKSET = "kwikset"; + case MINUT = "minut"; + case MY_2N = "my_2n"; + case CONTROLBYWEB = "controlbyweb"; + case NEST = "nest"; + case IGLOOHOME = "igloohome"; + case ECOBEE = "ecobee"; + case FOUR_SUITES = "four_suites"; + case DORMAKABA_ORACODE = "dormakaba_oracode"; + case PTI = "pti"; + case WYZE = "wyze"; + case SEAM_PASSPORT = "seam_passport"; + case VISIONLINE = "visionline"; + case ASSA_ABLOY_CREDENTIAL_SERVICE = "assa_abloy_credential_service"; + case TEDEE = "tedee"; + case HONEYWELL_RESIDEO = "honeywell_resideo"; + case FIRST_ALERT = "first_alert"; + case LATCH = "latch"; + case AKILES = "akiles"; + case ASSA_ABLOY_VOSTIO = "assa_abloy_vostio"; + case ASSA_ABLOY_VOSTIO_CREDENTIAL_SERVICE = "assa_abloy_vostio_credential_service"; + case TADO = "tado"; + case SALTO_SPACE = "salto_space"; + case SENSI = "sensi"; + case KEYNEST = "keynest"; + case KORELOCK = "korelock"; + case KEYINCODE = "keyincode"; + case DORMAKABA_AMBIANCE = "dormakaba_ambiance"; + case ULTRALOQ = "ultraloq"; + case YACAN = "yacan"; + case DUSAW = "dusaw"; + case SIFELY = "sifely"; + case THIRTY_THREE_LOCK = "thirty_three_lock"; + case RING = "ring"; + case ICAL = "ical"; + case LODGIFY = "lodgify"; + case HOSTAWAY = "hostaway"; + case GUESTY = "guesty"; + case ACUITY_SCHEDULING = "acuity_scheduling"; + case OMNITEC = "omnitec"; + case KISI = "kisi"; + case AQARA = "aqara"; + } +} diff --git a/src/Resources/Event.php b/src/Resources/Event.php index a7119251..d4c4054f 100644 --- a/src/Resources/Event.php +++ b/src/Resources/Event.php @@ -1,466 +1,12581 @@ Event\AccessCodeErrors::from_json($a), - $json->access_code_errors ?? [], + $discriminant = is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom($json->event_type) + : null; + + return match ($discriminant) { + \Seam\Resources\Event\EventType::ACCESS_CODE_CREATED + => \Seam\Resources\Event\AccessCodeCreated::from_json( + $json, ), - access_code_id: $json->access_code_id ?? null, - access_code_is_managed: $json->access_code_is_managed ?? null, - access_code_warnings: array_map( - fn($a) => Event\AccessCodeWarnings::from_json($a), - $json->access_code_warnings ?? [], + \Seam\Resources\Event\EventType::ACCESS_CODE_CHANGED + => \Seam\Resources\Event\AccessCodeChanged::from_json( + $json, ), - access_grant_id: $json->access_grant_id ?? null, - access_grant_ids: $json->access_grant_ids ?? null, - access_grant_key: $json->access_grant_key ?? null, - access_grant_keys: $json->access_grant_keys ?? null, - access_method_id: $json->access_method_id ?? null, - acs_access_group_id: $json->acs_access_group_id ?? null, - acs_credential_id: $json->acs_credential_id ?? null, - acs_encoder_id: $json->acs_encoder_id ?? null, - acs_entrance_id: $json->acs_entrance_id ?? null, - acs_entrance_ids: $json->acs_entrance_ids ?? null, - acs_system_errors: array_map( - fn($a) => Event\AcsSystemErrors::from_json($a), - $json->acs_system_errors ?? [], + \Seam\Resources\Event\EventType::ACCESS_CODE_NAME_CHANGED + => \Seam\Resources\Event\AccessCodeNameChanged::from_json( + $json, ), - acs_system_id: $json->acs_system_id ?? null, - acs_system_warnings: array_map( - fn($a) => Event\AcsSystemWarnings::from_json($a), - $json->acs_system_warnings ?? [], + \Seam\Resources\Event\EventType::ACCESS_CODE_CODE_CHANGED + => \Seam\Resources\Event\AccessCodeCodeChanged::from_json( + $json, ), - acs_user_id: $json->acs_user_id ?? null, - action_attempt_id: $json->action_attempt_id ?? null, - action_type: $json->action_type ?? null, - activation_reason: $json->activation_reason ?? null, - backup_access_code_id: $json->backup_access_code_id ?? null, - battery_level: $json->battery_level ?? null, - battery_status: $json->battery_status ?? null, - change_reason: $json->change_reason ?? null, - changed_properties: array_map( - fn($c) => Event\ChangedProperties::from_json($c), - $json->changed_properties ?? [], + \Seam\Resources\Event\EventType::ACCESS_CODE_TIME_FRAME_CHANGED + => \Seam\Resources\Event\AccessCodeTimeFrameChanged::from_json( + $json, ), - client_session_id: $json->client_session_id ?? null, - climate_preset_key: $json->climate_preset_key ?? null, - code: $json->code ?? null, - connect_webview_id: $json->connect_webview_id ?? null, - connected_account_custom_metadata: $json->connected_account_custom_metadata ?? - null, - connected_account_errors: array_map( - fn($c) => Event\ConnectedAccountErrors::from_json($c), - $json->connected_account_errors ?? [], + \Seam\Resources\Event\EventType::ACCESS_CODE_MUTATIONS_REQUESTED + => \Seam\Resources\Event\AccessCodeMutationsRequested::from_json( + $json, ), - connected_account_id: $json->connected_account_id ?? null, - connected_account_warnings: array_map( - fn($c) => Event\ConnectedAccountWarnings::from_json($c), - $json->connected_account_warnings ?? [], + \Seam\Resources\Event\EventType::ACCESS_CODE_SCHEDULED_ON_DEVICE + => \Seam\Resources\Event\AccessCodeScheduledOnDevice::from_json( + $json, ), - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? - null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - created_at: $json->created_at ?? null, - customer_key: $json->customer_key ?? null, - description: $json->description ?? null, - desired_temperature_celsius: $json->desired_temperature_celsius ?? - null, - desired_temperature_fahrenheit: $json->desired_temperature_fahrenheit ?? - null, - device_custom_metadata: $json->device_custom_metadata ?? null, - device_errors: array_map( - fn($d) => Event\DeviceErrors::from_json($d), - $json->device_errors ?? [], + \Seam\Resources\Event\EventType::ACCESS_CODE_SET_ON_DEVICE + => \Seam\Resources\Event\AccessCodeSetOnDevice::from_json( + $json, ), - device_id: $json->device_id ?? null, - device_ids: $json->device_ids ?? null, - device_name: $json->device_name ?? null, - device_warnings: array_map( - fn($d) => Event\DeviceWarnings::from_json($d), - $json->device_warnings ?? [], + \Seam\Resources\Event\EventType::ACCESS_CODE_REMOVED_FROM_DEVICE + => \Seam\Resources\Event\AccessCodeRemovedFromDevice::from_json( + $json, ), - ends_at: $json->ends_at ?? null, - error_code: $json->error_code ?? null, - error_message: $json->error_message ?? null, - event_description: $json->event_description ?? null, + \Seam\Resources\Event\EventType::ACCESS_CODE_DELAY_IN_SETTING_ON_DEVICE + => \Seam\Resources\Event\AccessCodeDelayInSettingOnDevice::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_FAILED_TO_SET_ON_DEVICE + => \Seam\Resources\Event\AccessCodeFailedToSetOnDevice::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_DELETED + => \Seam\Resources\Event\AccessCodeDeleted::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_DELAY_IN_REMOVING_FROM_DEVICE + => \Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_FAILED_TO_REMOVE_FROM_DEVICE + => \Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_MODIFIED_EXTERNAL_TO_SEAM + => \Seam\Resources\Event\AccessCodeModifiedExternalToSeam::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_DELETED_EXTERNAL_TO_SEAM + => \Seam\Resources\Event\AccessCodeDeletedExternalToSeam::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_BACKUP_ACCESS_CODE_PULLED + => \Seam\Resources\Event\AccessCodeBackupAccessCodePulled::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_UNMANAGED_CONVERTED_TO_MANAGED + => \Seam\Resources\Event\AccessCodeUnmanagedConvertedToManaged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_UNMANAGED_FAILED_TO_CONVERT_TO_MANAGED + => \Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_UNMANAGED_CREATED + => \Seam\Resources\Event\AccessCodeUnmanagedCreated::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_CODE_UNMANAGED_REMOVED + => \Seam\Resources\Event\AccessCodeUnmanagedRemoved::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_GRANT_CREATED + => \Seam\Resources\Event\AccessGrantCreated::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_GRANT_DELETED + => \Seam\Resources\Event\AccessGrantDeleted::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_GRANT_ACCESS_GRANTED_TO_ALL_DOORS + => \Seam\Resources\Event\AccessGrantAccessGrantedToAllDoors::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_GRANT_ACCESS_GRANTED_TO_DOOR + => \Seam\Resources\Event\AccessGrantAccessGrantedToDoor::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_GRANT_ACCESS_TO_DOOR_LOST + => \Seam\Resources\Event\AccessGrantAccessToDoorLost::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_GRANT_ACCESS_TIMES_CHANGED + => \Seam\Resources\Event\AccessGrantAccessTimesChanged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_GRANT_COULD_NOT_CREATE_REQUESTED_ACCESS_METHODS + => \Seam\Resources\Event\AccessGrantCouldNotCreateRequestedAccessMethods::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_METHOD_ISSUED + => \Seam\Resources\Event\AccessMethodIssued::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_METHOD_REVOKED + => \Seam\Resources\Event\AccessMethodRevoked::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_METHOD_CARD_ENCODING_REQUIRED + => \Seam\Resources\Event\AccessMethodCardEncodingRequired::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_METHOD_DELETED + => \Seam\Resources\Event\AccessMethodDeleted::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_METHOD_REISSUED + => \Seam\Resources\Event\AccessMethodReissued::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_METHOD_CREATED + => \Seam\Resources\Event\AccessMethodCreated::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_METHOD_DELAY_IN_ISSUING + => \Seam\Resources\Event\AccessMethodDelayInIssuing::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACCESS_METHOD_FAILED_TO_ISSUE + => \Seam\Resources\Event\AccessMethodFailedToIssue::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_SYSTEM_CONNECTED + => \Seam\Resources\Event\AcsSystemConnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_SYSTEM_ADDED + => \Seam\Resources\Event\AcsSystemAdded::from_json($json), + \Seam\Resources\Event\EventType::ACS_SYSTEM_DISCONNECTED + => \Seam\Resources\Event\AcsSystemDisconnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_CREDENTIAL_DELETED + => \Seam\Resources\Event\AcsCredentialDeleted::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_CREDENTIAL_ISSUED + => \Seam\Resources\Event\AcsCredentialIssued::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_CREDENTIAL_REISSUED + => \Seam\Resources\Event\AcsCredentialReissued::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_CREDENTIAL_INVALIDATED + => \Seam\Resources\Event\AcsCredentialInvalidated::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_USER_CREATED + => \Seam\Resources\Event\AcsUserCreated::from_json($json), + \Seam\Resources\Event\EventType::ACS_USER_DELETED + => \Seam\Resources\Event\AcsUserDeleted::from_json($json), + \Seam\Resources\Event\EventType::ACS_ENCODER_ADDED + => \Seam\Resources\Event\AcsEncoderAdded::from_json($json), + \Seam\Resources\Event\EventType::ACS_ENCODER_REMOVED + => \Seam\Resources\Event\AcsEncoderRemoved::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_ACCESS_GROUP_DELETED + => \Seam\Resources\Event\AcsAccessGroupDeleted::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACS_ENTRANCE_ADDED + => \Seam\Resources\Event\AcsEntranceAdded::from_json($json), + \Seam\Resources\Event\EventType::ACS_ENTRANCE_REMOVED + => \Seam\Resources\Event\AcsEntranceRemoved::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CLIENT_SESSION_DELETED + => \Seam\Resources\Event\ClientSessionDeleted::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECTED_ACCOUNT_CONNECTED + => \Seam\Resources\Event\ConnectedAccountConnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECTED_ACCOUNT_CREATED + => \Seam\Resources\Event\ConnectedAccountCreated::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECTED_ACCOUNT_SUCCESSFUL_LOGIN + => \Seam\Resources\Event\ConnectedAccountSuccessfulLogin::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECTED_ACCOUNT_DISCONNECTED + => \Seam\Resources\Event\ConnectedAccountDisconnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECTED_ACCOUNT_COMPLETED_FIRST_SYNC + => \Seam\Resources\Event\ConnectedAccountCompletedFirstSync::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECTED_ACCOUNT_DELETED + => \Seam\Resources\Event\ConnectedAccountDeleted::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECTED_ACCOUNT_COMPLETED_FIRST_SYNC_AFTER_RECONNECTION + => \Seam\Resources\Event\ConnectedAccountCompletedFirstSyncAfterReconnection::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECTED_ACCOUNT_REAUTHORIZATION_REQUESTED + => \Seam\Resources\Event\ConnectedAccountReauthorizationRequested::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACTION_ATTEMPT_LOCK_DOOR_SUCCEEDED + => \Seam\Resources\Event\ActionAttemptLockDoorSucceeded::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACTION_ATTEMPT_LOCK_DOOR_FAILED + => \Seam\Resources\Event\ActionAttemptLockDoorFailed::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACTION_ATTEMPT_UNLOCK_DOOR_SUCCEEDED + => \Seam\Resources\Event\ActionAttemptUnlockDoorSucceeded::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACTION_ATTEMPT_UNLOCK_DOOR_FAILED + => \Seam\Resources\Event\ActionAttemptUnlockDoorFailed::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACTION_ATTEMPT_SIMULATE_KEYPAD_CODE_ENTRY_SUCCEEDED + => \Seam\Resources\Event\ActionAttemptSimulateKeypadCodeEntrySucceeded::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACTION_ATTEMPT_SIMULATE_KEYPAD_CODE_ENTRY_FAILED + => \Seam\Resources\Event\ActionAttemptSimulateKeypadCodeEntryFailed::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACTION_ATTEMPT_SIMULATE_MANUAL_LOCK_VIA_KEYPAD_SUCCEEDED + => \Seam\Resources\Event\ActionAttemptSimulateManualLockViaKeypadSucceeded::from_json( + $json, + ), + \Seam\Resources\Event\EventType::ACTION_ATTEMPT_SIMULATE_MANUAL_LOCK_VIA_KEYPAD_FAILED + => \Seam\Resources\Event\ActionAttemptSimulateManualLockViaKeypadFailed::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECT_WEBVIEW_LOGIN_SUCCEEDED + => \Seam\Resources\Event\ConnectWebviewLoginSucceeded::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CONNECT_WEBVIEW_LOGIN_FAILED + => \Seam\Resources\Event\ConnectWebviewLoginFailed::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_CONNECTED + => \Seam\Resources\Event\DeviceConnected::from_json($json), + \Seam\Resources\Event\EventType::DEVICE_ADDED + => \Seam\Resources\Event\DeviceAdded::from_json($json), + \Seam\Resources\Event\EventType::DEVICE_CONVERTED_TO_UNMANAGED + => \Seam\Resources\Event\DeviceConvertedToUnmanaged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_UNMANAGED_CONVERTED_TO_MANAGED + => \Seam\Resources\Event\DeviceUnmanagedConvertedToManaged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_UNMANAGED_CONNECTED + => \Seam\Resources\Event\DeviceUnmanagedConnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_DISCONNECTED + => \Seam\Resources\Event\DeviceDisconnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_UNMANAGED_DISCONNECTED + => \Seam\Resources\Event\DeviceUnmanagedDisconnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_TAMPERED + => \Seam\Resources\Event\DeviceTampered::from_json($json), + \Seam\Resources\Event\EventType::DEVICE_LOW_BATTERY + => \Seam\Resources\Event\DeviceLowBattery::from_json($json), + \Seam\Resources\Event\EventType::DEVICE_BATTERY_STATUS_CHANGED + => \Seam\Resources\Event\DeviceBatteryStatusChanged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_REMOVED + => \Seam\Resources\Event\DeviceRemoved::from_json($json), + \Seam\Resources\Event\EventType::DEVICE_DELETED + => \Seam\Resources\Event\DeviceDeleted::from_json($json), + \Seam\Resources\Event\EventType::DEVICE_THIRD_PARTY_INTEGRATION_DETECTED + => \Seam\Resources\Event\DeviceThirdPartyIntegrationDetected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_THIRD_PARTY_INTEGRATION_NO_LONGER_DETECTED + => \Seam\Resources\Event\DeviceThirdPartyIntegrationNoLongerDetected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_SALTO_PRIVACY_MODE_ACTIVATED + => \Seam\Resources\Event\DeviceSaltoPrivacyModeActivated::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_SALTO_PRIVACY_MODE_DEACTIVATED + => \Seam\Resources\Event\DeviceSaltoPrivacyModeDeactivated::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_CONNECTION_BECAME_FLAKY + => \Seam\Resources\Event\DeviceConnectionBecameFlaky::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_CONNECTION_STABILIZED + => \Seam\Resources\Event\DeviceConnectionStabilized::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_ERROR_SUBSCRIPTION_REQUIRED + => \Seam\Resources\Event\DeviceErrorSubscriptionRequired::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_ERROR_SUBSCRIPTION_REQUIRED_RESOLVED + => \Seam\Resources\Event\DeviceErrorSubscriptionRequiredResolved::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_ACCESSORY_KEYPAD_CONNECTED + => \Seam\Resources\Event\DeviceAccessoryKeypadConnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_ACCESSORY_KEYPAD_DISCONNECTED + => \Seam\Resources\Event\DeviceAccessoryKeypadDisconnected::from_json( + $json, + ), + \Seam\Resources\Event\EventType::NOISE_SENSOR_NOISE_THRESHOLD_TRIGGERED + => \Seam\Resources\Event\NoiseSensorNoiseThresholdTriggered::from_json( + $json, + ), + \Seam\Resources\Event\EventType::LOCK_LOCKED + => \Seam\Resources\Event\LockLocked::from_json($json), + \Seam\Resources\Event\EventType::LOCK_UNLOCKED + => \Seam\Resources\Event\LockUnlocked::from_json($json), + \Seam\Resources\Event\EventType::LOCK_ACCESS_DENIED + => \Seam\Resources\Event\LockAccessDenied::from_json($json), + \Seam\Resources\Event\EventType::THERMOSTAT_CLIMATE_PRESET_ACTIVATED + => \Seam\Resources\Event\ThermostatClimatePresetActivated::from_json( + $json, + ), + \Seam\Resources\Event\EventType::THERMOSTAT_MANUALLY_ADJUSTED + => \Seam\Resources\Event\ThermostatManuallyAdjusted::from_json( + $json, + ), + \Seam\Resources\Event\EventType::THERMOSTAT_TEMPERATURE_THRESHOLD_EXCEEDED + => \Seam\Resources\Event\ThermostatTemperatureThresholdExceeded::from_json( + $json, + ), + \Seam\Resources\Event\EventType::THERMOSTAT_TEMPERATURE_THRESHOLD_NO_LONGER_EXCEEDED + => \Seam\Resources\Event\ThermostatTemperatureThresholdNoLongerExceeded::from_json( + $json, + ), + \Seam\Resources\Event\EventType::THERMOSTAT_TEMPERATURE_REACHED_SET_POINT + => \Seam\Resources\Event\ThermostatTemperatureReachedSetPoint::from_json( + $json, + ), + \Seam\Resources\Event\EventType::THERMOSTAT_TEMPERATURE_CHANGED + => \Seam\Resources\Event\ThermostatTemperatureChanged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::DEVICE_NAME_CHANGED + => \Seam\Resources\Event\DeviceNameChanged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::CAMERA_ACTIVATED + => \Seam\Resources\Event\CameraActivated::from_json($json), + \Seam\Resources\Event\EventType::DEVICE_DOORBELL_RANG + => \Seam\Resources\Event\DeviceDoorbellRang::from_json( + $json, + ), + \Seam\Resources\Event\EventType::PHONE_DEACTIVATED + => \Seam\Resources\Event\PhoneDeactivated::from_json($json), + \Seam\Resources\Event\EventType::SPACE_DEVICE_MEMBERSHIP_CHANGED + => \Seam\Resources\Event\SpaceDeviceMembershipChanged::from_json( + $json, + ), + \Seam\Resources\Event\EventType::SPACE_CREATED + => \Seam\Resources\Event\SpaceCreated::from_json($json), + \Seam\Resources\Event\EventType::SPACE_DELETED + => \Seam\Resources\Event\SpaceDeleted::from_json($json), + default => \Seam\Resources\Event\UnknownEvent::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which the event was created. + */ + public string|null $created_at, + /** + * ID of the event. + */ + public string|null $event_id, + public \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + public string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + public string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + public string|null $event_description = null, + ) {} + } +} + +namespace Seam\Resources\Event { + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was created. + */ + final class AccessCodeCreated extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessCodeCreated|null + { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: $json->event_type ?? null, - fan_mode_setting: $json->fan_mode_setting ?? null, - from: isset($json->from) - ? Event\From::from_json($json->from) + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type : null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? - null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - image_url: $json->image_url ?? null, - is_backup_code: $json->is_backup_code ?? null, - is_fallback_climate_preset: $json->is_fallback_climate_preset ?? - 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, - motion_sub_type: $json->motion_sub_type ?? null, - noise_level_decibels: $json->noise_level_decibels ?? null, - noise_level_nrs: $json->noise_level_nrs ?? null, - noise_threshold_id: $json->noise_threshold_id ?? null, - noise_threshold_name: $json->noise_threshold_name ?? null, - noiseaware_metadata: $json->noiseaware_metadata ?? null, occurred_at: $json->occurred_at ?? null, - reason: isset($json->reason) - ? Event\Reason::from_json($json->reason) - : null, - requested_mutations: array_map( - fn($r) => Event\RequestedMutations::from_json($r), - $json->requested_mutations ?? [], - ), - space_id: $json->space_id ?? null, - space_key: $json->space_key ?? null, - starts_at: $json->starts_at ?? 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) ? Event\To::from_json($json->to) : null, - upper_limit_celsius: $json->upper_limit_celsius ?? null, - upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null, - video_url: $json->video_url ?? null, workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, ); } public function __construct( /** - * Errors associated with the access code. + * ID of the affected access code. */ - public array $access_code_errors, public string|null $access_code_id, /** - * Warnings associated with the access code. + * ID of the connected account associated with the affected access code. */ - public array $access_code_warnings, + public string|null $connected_account_id, /** - * ID of the affected Access Grant. + * Date and time at which the event was created. */ - public string|null $access_grant_id, + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was changed. + */ + final class AccessCodeChanged extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessCodeChanged|null + { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + change_reason: $json->change_reason ?? null, + changed_properties: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeChanged\ChangedProperties::from_json( + $c, + ), + $json->changed_properties ?? [], + ), + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable reason for the change (e.g. `ongoing code auto-renewed`). + */ + public string|null $change_reason = null, + /** + * List of properties that changed on the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeChanged\ChangedProperties>|null + */ + public array|null $changed_properties = null, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The name of an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was changed on the device. + */ + final class AccessCodeNameChanged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeNameChanged|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + description: $json->description ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + from: isset($json->from) + ? \Seam\Resources\Event\AccessCodeNameChanged\From::from_json( + $json->from, + ) + : null, + occurred_at: $json->occurred_at ?? null, + to: isset($json->to) + ? \Seam\Resources\Event\AccessCodeNameChanged\To::from_json( + $json->to, + ) + : null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Human-readable description of the change and its source. + */ + public string|null $description, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Previous access code name configuration. + */ + public \Seam\Resources\Event\AccessCodeNameChanged\From|null $from, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * New access code name configuration. + */ + public \Seam\Resources\Event\AccessCodeNameChanged\To|null $to, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The pin code of an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was changed on the device. + */ + final class AccessCodeCodeChanged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeCodeChanged|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + description: $json->description ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + from: isset($json->from) + ? \Seam\Resources\Event\AccessCodeCodeChanged\From::from_json( + $json->from, + ) + : null, + occurred_at: $json->occurred_at ?? null, + to: isset($json->to) + ? \Seam\Resources\Event\AccessCodeCodeChanged\To::from_json( + $json->to, + ) + : null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Human-readable description of the change and its source. + */ + public string|null $description, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Previous pin code configuration. + */ + public \Seam\Resources\Event\AccessCodeCodeChanged\From|null $from, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * New pin code configuration. + */ + public \Seam\Resources\Event\AccessCodeCodeChanged\To|null $to, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The time frame of an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was changed on the device. + */ + final class AccessCodeTimeFrameChanged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeTimeFrameChanged|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + description: $json->description ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + from: isset($json->from) + ? \Seam\Resources\Event\AccessCodeTimeFrameChanged\From::from_json( + $json->from, + ) + : null, + occurred_at: $json->occurred_at ?? null, + to: isset($json->to) + ? \Seam\Resources\Event\AccessCodeTimeFrameChanged\To::from_json( + $json->to, + ) + : null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Human-readable description of the change and its source. + */ + public string|null $description, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Previous time frame configuration. + */ + public \Seam\Resources\Event\AccessCodeTimeFrameChanged\From|null $from, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * New time frame configuration. + */ + public \Seam\Resources\Event\AccessCodeTimeFrameChanged\To|null $to, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Mutations were requested on an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). This event fires at request time, before the change is confirmed on the device. + */ + final class AccessCodeMutationsRequested extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeMutationsRequested|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + requested_mutations: array_map( + fn( + $r, + ) => \Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations::from_json( + $r, + ), + $json->requested_mutations ?? [], + ), + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Array of mutations requested on the access code, each containing the mutation type and from/to values. + * + * @var list<\Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations> + */ + public array $requested_mutations, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was [scheduled natively](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) on a device. + */ + final class AccessCodeScheduledOnDevice extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeScheduledOnDevice|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + code: $json->code ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Code for the affected access code. + */ + public string|null $code, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was set on a device. + */ + final class AccessCodeSetOnDevice extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeSetOnDevice|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + code: $json->code ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Code for the affected access code. + */ + public string|null $code, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was removed from a device. + */ + final class AccessCodeRemovedFromDevice extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeRemovedFromDevice|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * There was an unusually long delay in setting an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) on a device. + */ + final class AccessCodeDelayInSettingOnDevice extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeDelayInSettingOnDevice|null { + if (!$json) { + return null; + } + return new self( + access_code_errors: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\AccessCodeErrors::from_json( + $a, + ), + $json->access_code_errors ?? [], + ), + access_code_id: $json->access_code_id ?? null, + access_code_warnings: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\AccessCodeWarnings::from_json( + $a, + ), + $json->access_code_warnings ?? [], + ), + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\AccessCodeErrors> + */ + public array $access_code_errors, + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Warnings associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\AccessCodeWarnings> + */ + public array $access_code_warnings, + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInSettingOnDevice\DeviceWarnings> + */ + public array $device_warnings, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) failed to be set on a device. + */ + final class AccessCodeFailedToSetOnDevice extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeFailedToSetOnDevice|null { + if (!$json) { + return null; + } + return new self( + access_code_errors: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeFailedToSetOnDevice\AccessCodeErrors::from_json( + $a, + ), + $json->access_code_errors ?? [], + ), + access_code_id: $json->access_code_id ?? null, + access_code_warnings: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeFailedToSetOnDevice\AccessCodeWarnings::from_json( + $a, + ), + $json->access_code_warnings ?? [], + ), + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeFailedToSetOnDevice\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeFailedToSetOnDevice\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeFailedToSetOnDevice\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeFailedToSetOnDevice\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToSetOnDevice\AccessCodeErrors> + */ + public array $access_code_errors, + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Warnings associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToSetOnDevice\AccessCodeWarnings> + */ + public array $access_code_warnings, + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToSetOnDevice\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToSetOnDevice\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToSetOnDevice\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToSetOnDevice\DeviceWarnings> + */ + public array $device_warnings, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was deleted. + */ + final class AccessCodeDeleted extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessCodeDeleted|null + { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + code: $json->code ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Code for the affected access code. + */ + public string|null $code, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * There was an unusually long delay in removing an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) from a device. + */ + final class AccessCodeDelayInRemovingFromDevice extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeDelayInRemovingFromDevice|null { + if (!$json) { + return null; + } + return new self( + access_code_errors: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\AccessCodeErrors::from_json( + $a, + ), + $json->access_code_errors ?? [], + ), + access_code_id: $json->access_code_id ?? null, + access_code_warnings: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\AccessCodeWarnings::from_json( + $a, + ), + $json->access_code_warnings ?? [], + ), + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\AccessCodeErrors> + */ + public array $access_code_errors, + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Warnings associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\AccessCodeWarnings> + */ + public array $access_code_warnings, + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice\DeviceWarnings> + */ + public array $device_warnings, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) failed to be removed from a device. + */ + final class AccessCodeFailedToRemoveFromDevice extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeFailedToRemoveFromDevice|null { + if (!$json) { + return null; + } + return new self( + access_code_errors: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\AccessCodeErrors::from_json( + $a, + ), + $json->access_code_errors ?? [], + ), + access_code_id: $json->access_code_id ?? null, + access_code_warnings: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\AccessCodeWarnings::from_json( + $a, + ), + $json->access_code_warnings ?? [], + ), + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\AccessCodeErrors> + */ + public array $access_code_errors, + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Warnings associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\AccessCodeWarnings> + */ + public array $access_code_warnings, + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice\DeviceWarnings> + */ + public array $device_warnings, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was modified outside of Seam. + */ + final class AccessCodeModifiedExternalToSeam extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeModifiedExternalToSeam|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was deleted outside of Seam. + */ + final class AccessCodeDeletedExternalToSeam extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeDeletedExternalToSeam|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [backup access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) was pulled from the backup access code pool and set on a device. + */ + final class AccessCodeBackupAccessCodePulled extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeBackupAccessCodePulled|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + backup_access_code_id: $json->backup_access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the backup access code that was pulled from the pool. + */ + public string|null $backup_access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) was converted successfully to a managed access code. + */ + final class AccessCodeUnmanagedConvertedToManaged extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeUnmanagedConvertedToManaged|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) failed to be converted to a managed access code. + */ + final class AccessCodeUnmanagedFailedToConvertToManaged extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeUnmanagedFailedToConvertToManaged|null { + if (!$json) { + return null; + } + return new self( + access_code_errors: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\AccessCodeErrors::from_json( + $a, + ), + $json->access_code_errors ?? [], + ), + access_code_id: $json->access_code_id ?? null, + access_code_warnings: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\AccessCodeWarnings::from_json( + $a, + ), + $json->access_code_warnings ?? [], + ), + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\AccessCodeErrors> + */ + public array $access_code_errors, + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Warnings associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\AccessCodeWarnings> + */ + public array $access_code_warnings, + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged\DeviceWarnings> + */ + public array $device_warnings, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) was created on a device. + */ + final class AccessCodeUnmanagedCreated extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeUnmanagedCreated|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) was removed from a device. + */ + final class AccessCodeUnmanagedRemoved extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeUnmanagedRemoved|null { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An Access Grant was created. + */ + final class AccessGrantCreated extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessGrantCreated|null + { + if (!$json) { + return null; + } + return new self( + access_grant_id: $json->access_grant_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Access Grant. + */ + public string|null $access_grant_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An Access Grant was deleted. + */ + final class AccessGrantDeleted extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessGrantDeleted|null + { + if (!$json) { + return null; + } + return new self( + access_grant_id: $json->access_grant_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Access Grant. + */ + public string|null $access_grant_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * All access requested for an Access Grant was successfully granted. + */ + final class AccessGrantAccessGrantedToAllDoors extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessGrantAccessGrantedToAllDoors|null { + if (!$json) { + return null; + } + return new self( + access_grant_id: $json->access_grant_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Access Grant. + */ + public string|null $access_grant_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Access requested as part of an Access Grant to a particular door was successfully granted. + */ + final class AccessGrantAccessGrantedToDoor extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessGrantAccessGrantedToDoor|null { + if (!$json) { + return null; + } + return new self( + access_grant_id: $json->access_grant_id ?? null, + acs_entrance_id: $json->acs_entrance_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Access Grant. + */ + public string|null $access_grant_id, + /** + * ID of the affected [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). + */ + public string|null $acs_entrance_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Access to a particular door that was requested as part of an Access Grant was lost. + */ + final class AccessGrantAccessToDoorLost extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessGrantAccessToDoorLost|null { + if (!$json) { + return null; + } + return new self( + access_grant_id: $json->access_grant_id ?? null, + acs_entrance_id: $json->acs_entrance_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Access Grant. + */ + public string|null $access_grant_id, + /** + * ID of the affected [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). + */ + public string|null $acs_entrance_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An Access Grant's start or end time was changed. + */ + final class AccessGrantAccessTimesChanged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessGrantAccessTimesChanged|null { + if (!$json) { + return null; + } + return new self( + access_grant_id: $json->access_grant_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_key: $json->access_grant_key ?? null, + ends_at: $json->ends_at ?? null, + event_description: $json->event_description ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Access Grant. + */ + public string|null $access_grant_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Key of the affected Access Grant (if present). + */ + public string|null $access_grant_key = null, + /** + * The new end time for the access grant. + */ + public string|null $ends_at = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * The new start time for the access grant. + */ + public string|null $starts_at = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * One or more requested access methods could not be created for an Access Grant. + */ + final class AccessGrantCouldNotCreateRequestedAccessMethods extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessGrantCouldNotCreateRequestedAccessMethods|null { + if (!$json) { + return null; + } + return new self( + access_grant_id: $json->access_grant_id ?? null, + created_at: $json->created_at ?? null, + error_message: $json->error_message ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + missing_device_ids: $json->missing_device_ids ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Access Grant. + */ + public string|null $access_grant_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Description of why the access methods could not be created. + */ + public string|null $error_message, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * IDs of the devices that did not receive a requested access method. Use these to identify which specific devices failed without having to fetch the Access Grant. + * + * @var list|null + */ + public array|null $missing_device_ids = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An access method was issued. + */ + final class AccessMethodIssued extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessMethodIssued|null + { + if (!$json) { + return null; + } + return new self( + access_grant_ids: $json->access_grant_ids ?? null, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_keys: $json->access_grant_keys ?? null, + code: $json->code ?? null, + event_description: $json->event_description ?? null, + is_backup_code: $json->is_backup_code ?? null, + ); + } + + public function __construct( + /** + * IDs of the access grants associated with this access method. + * + * @var list|null + */ + public array|null $access_grant_ids, + /** + * ID of the affected access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Keys of the access grants associated with this access method (if present). + * + * @var list|null + */ + public array|null $access_grant_keys = null, + /** + * The actual PIN code for code access methods (only present when mode is 'code'). + */ + public string|null $code = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Indicates whether the code is a backup code (only present when mode is 'code' and a backup code was used). + */ + public bool|null $is_backup_code = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An access method was revoked. + */ + final class AccessMethodRevoked extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessMethodRevoked|null + { + if (!$json) { + return null; + } + return new self( + access_grant_ids: $json->access_grant_ids ?? null, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_keys: $json->access_grant_keys ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * IDs of the access grants associated with this access method. + * + * @var list|null + */ + public array|null $access_grant_ids, + /** + * ID of the affected access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Keys of the access grants associated with this access method (if present). + * + * @var list|null + */ + public array|null $access_grant_keys = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An access method representing a physical card requires encoding. + */ + final class AccessMethodCardEncodingRequired extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessMethodCardEncodingRequired|null { + if (!$json) { + return null; + } + return new self( + access_grant_ids: $json->access_grant_ids ?? null, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_keys: $json->access_grant_keys ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * IDs of the access grants associated with this access method. + * + * @var list|null + */ + public array|null $access_grant_ids, + /** + * ID of the affected access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Keys of the access grants associated with this access method (if present). + * + * @var list|null + */ + public array|null $access_grant_keys = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An access method was deleted. + */ + final class AccessMethodDeleted extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessMethodDeleted|null + { + if (!$json) { + return null; + } + return new self( + access_grant_ids: $json->access_grant_ids ?? null, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_keys: $json->access_grant_keys ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * IDs of the access grants associated with this access method. + * + * @var list|null + */ + public array|null $access_grant_ids, + /** + * ID of the affected access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Keys of the access grants associated with this access method (if present). + * + * @var list|null + */ + public array|null $access_grant_keys = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An access method was reissued. + */ + final class AccessMethodReissued extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessMethodReissued|null + { + if (!$json) { + return null; + } + return new self( + access_grant_ids: $json->access_grant_ids ?? null, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_keys: $json->access_grant_keys ?? null, + code: $json->code ?? null, + event_description: $json->event_description ?? null, + is_backup_code: $json->is_backup_code ?? null, + ); + } + + public function __construct( + /** + * IDs of the access grants associated with this access method. + * + * @var list|null + */ + public array|null $access_grant_ids, + /** + * ID of the affected access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Keys of the access grants associated with this access method (if present). + * + * @var list|null + */ + public array|null $access_grant_keys = null, + /** + * The actual PIN code for code access methods (only present when mode is 'code'). + */ + public string|null $code = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Indicates whether the code is a backup code (only present when mode is 'code' and a backup code was used). + */ + public bool|null $is_backup_code = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An access method was created. + */ + final class AccessMethodCreated extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AccessMethodCreated|null + { + if (!$json) { + return null; + } + return new self( + access_grant_ids: $json->access_grant_ids ?? null, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_keys: $json->access_grant_keys ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * IDs of the access grants associated with this access method. + * + * @var list|null + */ + public array|null $access_grant_ids, + /** + * ID of the affected access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Keys of the access grants associated with this access method (if present). + * + * @var list|null + */ + public array|null $access_grant_keys = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Seam has not yet issued this access method, even though its access grant is about to begin, so access may not be ready when the recipient arrives. Seam is still attempting to issue it, and the accompanying `delay_in_issuing` warning clears automatically once issuance succeeds. + */ + final class AccessMethodDelayInIssuing extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessMethodDelayInIssuing|null { + if (!$json) { + return null; + } + return new self( + access_grant_ids: $json->access_grant_ids ?? null, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_keys: $json->access_grant_keys ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * IDs of the access grants associated with this access method. + * + * @var list|null + */ + public array|null $access_grant_ids, + /** + * ID of the affected access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Keys of the access grants associated with this access method (if present). + * + * @var list|null + */ + public array|null $access_grant_keys = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Seam was unable to issue this access method before its access grant started, so the recipient may be unable to access the space. This usually points to a problem that needs attention, such as an offline or disconnected device. Seam keeps retrying, and the accompanying `failed_to_issue` error clears automatically if the access method is eventually issued. + */ + final class AccessMethodFailedToIssue extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessMethodFailedToIssue|null { + if (!$json) { + return null; + } + return new self( + access_grant_ids: $json->access_grant_ids ?? null, + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_grant_keys: $json->access_grant_keys ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * IDs of the access grants associated with this access method. + * + * @var list|null + */ + public array|null $access_grant_ids, + /** + * ID of the affected access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Keys of the access grants associated with this access method (if present). + * + * @var list|null + */ + public array|null $access_grant_keys = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system](https://docs.seam.co/low-level-apis/access-systems) was connected. + */ + final class AcsSystemConnected extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsSystemConnected|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system](https://docs.seam.co/low-level-apis/access-systems) was added. + */ + final class AcsSystemAdded extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsSystemAdded|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system](https://docs.seam.co/low-level-apis/access-systems) was disconnected. + */ + final class AcsSystemDisconnected extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AcsSystemDisconnected|null { + if (!$json) { + return null; + } + return new self( + acs_system_errors: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AcsSystemDisconnected\AcsSystemErrors::from_json( + $a, + ), + $json->acs_system_errors ?? [], + ), + acs_system_id: $json->acs_system_id ?? null, + acs_system_warnings: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AcsSystemDisconnected\AcsSystemWarnings::from_json( + $a, + ), + $json->acs_system_warnings ?? [], + ), + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AcsSystemDisconnected\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AcsSystemDisconnected\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the access control system. + * + * @var list<\Seam\Resources\Event\AcsSystemDisconnected\AcsSystemErrors> + */ + public array $acs_system_errors, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Warnings associated with the access control system. + * + * @var list<\Seam\Resources\Event\AcsSystemDisconnected\AcsSystemWarnings> + */ + public array $acs_system_warnings, + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\AcsSystemDisconnected\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\AcsSystemDisconnected\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was deleted. + */ + final class AcsCredentialDeleted extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsCredentialDeleted|null + { + if (!$json) { + return null; + } + return new self( + acs_credential_id: $json->acs_credential_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected credential. + */ + public string|null $acs_credential_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was issued. + */ + final class AcsCredentialIssued extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsCredentialIssued|null + { + if (!$json) { + return null; + } + return new self( + acs_credential_id: $json->acs_credential_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected credential. + */ + public string|null $acs_credential_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was reissued. + */ + final class AcsCredentialReissued extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AcsCredentialReissued|null { + if (!$json) { + return null; + } + return new self( + acs_credential_id: $json->acs_credential_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected credential. + */ + public string|null $acs_credential_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was invalidated. That is, the credential cannot be used anymore. + */ + final class AcsCredentialInvalidated extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AcsCredentialInvalidated|null { + if (!$json) { + return null; + } + return new self( + acs_credential_id: $json->acs_credential_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected credential. + */ + public string|null $acs_credential_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was created. + */ + final class AcsUserCreated extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsUserCreated|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * ID of the affected access system user. + */ + public string|null $acs_user_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was deleted. + */ + final class AcsUserDeleted extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsUserDeleted|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * ID of the affected access system user. + */ + public string|null $acs_user_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system encoder](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners) was added. + */ + final class AcsEncoderAdded extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsEncoderAdded|null + { + if (!$json) { + return null; + } + return new self( + acs_encoder_id: $json->acs_encoder_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected encoder. + */ + public string|null $acs_encoder_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system encoder](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners) was removed. + */ + final class AcsEncoderRemoved extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsEncoderRemoved|null + { + if (!$json) { + return null; + } + return new self( + acs_encoder_id: $json->acs_encoder_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected encoder. + */ + public string|null $acs_encoder_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An ACS access group was deleted. + */ + final class AcsAccessGroupDeleted extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AcsAccessGroupDeleted|null { + if (!$json) { + return null; + } + return new self( + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected access group. + */ + public string|null $acs_access_group_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) was added. + */ + final class AcsEntranceAdded extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsEntranceAdded|null + { + if (!$json) { + return null; + } + return new self( + acs_entrance_id: $json->acs_entrance_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected entrance. + */ + public string|null $acs_entrance_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [access system entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) was removed. + */ + final class AcsEntranceRemoved extends \Seam\Resources\Event + { + public static function from_json(mixed $json): AcsEntranceRemoved|null + { + if (!$json) { + return null; + } + return new self( + acs_entrance_id: $json->acs_entrance_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected entrance. + */ + public string|null $acs_entrance_id, + /** + * ID of the access system. + */ + public string|null $acs_system_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account. + */ + public string|null $connected_account_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A client session was deleted. + */ + final class ClientSessionDeleted extends \Seam\Resources\Event + { + public static function from_json(mixed $json): ClientSessionDeleted|null + { + if (!$json) { + return null; + } + return new self( + client_session_id: $json->client_session_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected client session. + */ + public string|null $client_session_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A connected account was connected for the first time or was reconnected after being disconnected. + */ + final class ConnectedAccountConnected extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectedAccountConnected|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connect_webview_id: $json->connect_webview_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected connected account. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the Connect Webview associated with the event. + */ + public string|null $connect_webview_id = null, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with this connected account, if any. + */ + public string|null $customer_key = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A connected account was created. + */ + final class ConnectedAccountCreated extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectedAccountCreated|null { + if (!$json) { + return null; + } + return new self( + connect_webview_id: $json->connect_webview_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the Connect Webview associated with the event. + */ + public string|null $connect_webview_id, + /** + * ID of the affected connected account. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A connected account had a successful login using a Connect Webview. + */ + final class ConnectedAccountSuccessfulLogin extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectedAccountSuccessfulLogin|null { + if (!$json) { + return null; + } + return new self( + connect_webview_id: $json->connect_webview_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the Connect Webview associated with the event. + */ + public string|null $connect_webview_id, + /** + * ID of the affected connected account. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A connected account was disconnected. + */ + final class ConnectedAccountDisconnected extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectedAccountDisconnected|null { + if (!$json) { + return null; + } + return new self( + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\ConnectedAccountDisconnected\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\ConnectedAccountDisconnected\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\ConnectedAccountDisconnected\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the affected connected account. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\ConnectedAccountDisconnected\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A connected account completed the first sync with Seam, and the corresponding devices or systems are now available. + */ + final class ConnectedAccountCompletedFirstSync extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectedAccountCompletedFirstSync|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected connected account. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A connected account was deleted. + */ + final class ConnectedAccountDeleted extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectedAccountDeleted|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected connected account. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with this connected account, if any. + */ + public string|null $customer_key = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A connected account completed the first sync after reconnection with Seam, and the corresponding devices or systems are now available. + */ + final class ConnectedAccountCompletedFirstSyncAfterReconnection extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectedAccountCompletedFirstSyncAfterReconnection|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected connected account. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A connected account requires reauthorization using a new Connect Webview. The account is still connected, but cannot access new features. Delaying reauthorization too long will eventually cause the Connected Account to become disconnected. + */ + final class ConnectedAccountReauthorizationRequested extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectedAccountReauthorizationRequested|null { + if (!$json) { + return null; + } + return new self( + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\ConnectedAccountReauthorizationRequested\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\ConnectedAccountReauthorizationRequested\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\ConnectedAccountReauthorizationRequested\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the affected connected account. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\ConnectedAccountReauthorizationRequested\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A lock door action attempt succeeded. + */ + final class ActionAttemptLockDoorSucceeded extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ActionAttemptLockDoorSucceeded|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected action attempt. + */ + public string|null $action_attempt_id, + /** + * Type of the action. + */ + public string|null $action_type, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Status of the action. + */ + public string|null $status, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account associated with the action attempt, if applicable. + */ + public string|null $connected_account_id = null, + /** + * ID of the device associated with the action attempt, if applicable. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A lock door action attempt failed. + */ + final class ActionAttemptLockDoorFailed extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ActionAttemptLockDoorFailed|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected action attempt. + */ + public string|null $action_attempt_id, + /** + * Type of the action. + */ + public string|null $action_type, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Status of the action. + */ + public string|null $status, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account associated with the action attempt, if applicable. + */ + public string|null $connected_account_id = null, + /** + * ID of the device associated with the action attempt, if applicable. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An unlock door action attempt succeeded. + */ + final class ActionAttemptUnlockDoorSucceeded extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ActionAttemptUnlockDoorSucceeded|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected action attempt. + */ + public string|null $action_attempt_id, + /** + * Type of the action. + */ + public string|null $action_type, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Status of the action. + */ + public string|null $status, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account associated with the action attempt, if applicable. + */ + public string|null $connected_account_id = null, + /** + * ID of the device associated with the action attempt, if applicable. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An unlock door action attempt failed. + */ + final class ActionAttemptUnlockDoorFailed extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ActionAttemptUnlockDoorFailed|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected action attempt. + */ + public string|null $action_attempt_id, + /** + * Type of the action. + */ + public string|null $action_type, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Status of the action. + */ + public string|null $status, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account associated with the action attempt, if applicable. + */ + public string|null $connected_account_id = null, + /** + * ID of the device associated with the action attempt, if applicable. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A simulate keypad code entry action attempt succeeded. + */ + final class ActionAttemptSimulateKeypadCodeEntrySucceeded extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ActionAttemptSimulateKeypadCodeEntrySucceeded|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected action attempt. + */ + public string|null $action_attempt_id, + /** + * Type of the action. + */ + public string|null $action_type, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Status of the action. + */ + public string|null $status, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account associated with the action attempt, if applicable. + */ + public string|null $connected_account_id = null, + /** + * ID of the device associated with the action attempt, if applicable. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A simulate keypad code entry action attempt failed. + */ + final class ActionAttemptSimulateKeypadCodeEntryFailed extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ActionAttemptSimulateKeypadCodeEntryFailed|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected action attempt. + */ + public string|null $action_attempt_id, + /** + * Type of the action. + */ + public string|null $action_type, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Status of the action. + */ + public string|null $status, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account associated with the action attempt, if applicable. + */ + public string|null $connected_account_id = null, + /** + * ID of the device associated with the action attempt, if applicable. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A simulate manual lock via keypad action attempt succeeded. + */ + final class ActionAttemptSimulateManualLockViaKeypadSucceeded extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ActionAttemptSimulateManualLockViaKeypadSucceeded|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected action attempt. + */ + public string|null $action_attempt_id, + /** + * Type of the action. + */ + public string|null $action_type, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Status of the action. + */ + public string|null $status, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account associated with the action attempt, if applicable. + */ + public string|null $connected_account_id = null, + /** + * ID of the device associated with the action attempt, if applicable. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A simulate manual lock via keypad action attempt failed. + */ + final class ActionAttemptSimulateManualLockViaKeypadFailed extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ActionAttemptSimulateManualLockViaKeypadFailed|null { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected action attempt. + */ + public string|null $action_attempt_id, + /** + * Type of the action. + */ + public string|null $action_type, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Status of the action. + */ + public string|null $status, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the connected account associated with the action attempt, if applicable. + */ + public string|null $connected_account_id = null, + /** + * ID of the device associated with the action attempt, if applicable. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A Connect Webview login succeeded. + */ + final class ConnectWebviewLoginSucceeded extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectWebviewLoginSucceeded|null { + if (!$json) { + return null; + } + return new self( + connect_webview_id: $json->connect_webview_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Connect Webview. + */ + public string|null $connect_webview_id, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account; present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with this connect webview, if any. + */ + public string|null $customer_key = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A Connect Webview login failed. + */ + final class ConnectWebviewLoginFailed extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ConnectWebviewLoginFailed|null { + if (!$json) { + return null; + } + return new self( + connect_webview_id: $json->connect_webview_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the affected Connect Webview. + */ + public string|null $connect_webview_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The status of a device changed from offline to online. That is, the `device.properties.online` property changed from `false` to `true`. Note that some devices operate entirely in offline mode, so Seam never emits a `device.connected` event for these devices. + */ + final class DeviceConnected extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceConnected|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A device was added to Seam or was re-added to Seam after having been removed. + */ + final class DeviceAdded extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceAdded|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A managed device was successfully converted to an [unmanaged device](https://docs.seam.co/core-concepts/devices/managed-and-unmanaged-devices). + */ + final class DeviceConvertedToUnmanaged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceConvertedToUnmanaged|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An [unmanaged device](https://docs.seam.co/core-concepts/devices/managed-and-unmanaged-devices) was successfully converted to a managed device. + */ + final class DeviceUnmanagedConvertedToManaged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceUnmanagedConvertedToManaged|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The status of an [unmanaged device](https://docs.seam.co/core-concepts/devices/managed-and-unmanaged-devices) changed from offline to online. That is, the `device.properties.online` property changed from `false` to `true`. + */ + final class DeviceUnmanagedConnected extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceUnmanagedConnected|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The status of a device changed from online to offline. That is, the `device.properties.online` property changed from `true` to `false`. + */ + final class DeviceDisconnected extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceDisconnected|null + { + if (!$json) { + return null; + } + return new self( + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceDisconnected\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceDisconnected\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceDisconnected\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceDisconnected\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Event\DeviceDisconnected\ErrorCode::tryFrom( + $json->error_code, + ) + : null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceDisconnected\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceDisconnected\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceDisconnected\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceDisconnected\DeviceWarnings> + */ + public array $device_warnings, + /** + * Error code associated with the disconnection event, if any. + */ + public \Seam\Resources\Event\DeviceDisconnected\ErrorCode|null $error_code, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The status of an [unmanaged device](https://docs.seam.co/core-concepts/devices/managed-and-unmanaged-devices) changed from online to offline. That is, the `device.properties.online` property changed from `true` to `false`. + */ + final class DeviceUnmanagedDisconnected extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceUnmanagedDisconnected|null { + if (!$json) { + return null; + } + return new self( + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceUnmanagedDisconnected\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceUnmanagedDisconnected\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceUnmanagedDisconnected\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceUnmanagedDisconnected\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Event\DeviceUnmanagedDisconnected\ErrorCode::tryFrom( + $json->error_code, + ) + : null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceUnmanagedDisconnected\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceUnmanagedDisconnected\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceUnmanagedDisconnected\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceUnmanagedDisconnected\DeviceWarnings> + */ + public array $device_warnings, + /** + * Error code associated with the disconnection event, if any. + */ + public \Seam\Resources\Event\DeviceUnmanagedDisconnected\ErrorCode|null $error_code, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A device detected that it was tampered with, for example, opened or moved. + */ + final class DeviceTampered extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceTampered|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A device battery level dropped below the low threshold. + */ + final class DeviceLowBattery extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceLowBattery|null + { + if (!$json) { + return null; + } + return new self( + battery_level: $json->battery_level ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Number in the range 0 to 1.0 indicating the amount of battery in the affected device, as reported by the device. + */ + public float|null $battery_level, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A device battery status changed since the last `battery_status_changed` event. + */ + final class DeviceBatteryStatusChanged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceBatteryStatusChanged|null { + if (!$json) { + return null; + } + return new self( + battery_level: $json->battery_level ?? null, + battery_status: is_string($json->battery_status ?? null) + ? \Seam\Resources\Event\DeviceBatteryStatusChanged\BatteryStatus::tryFrom( + $json->battery_status, + ) + : null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Number in the range 0 to 1.0 indicating the amount of battery in the affected device, as reported by the device. + */ + public float|null $battery_level, + /** + * Battery status of the affected device, calculated from the numeric `battery_level` value. + */ + public \Seam\Resources\Event\DeviceBatteryStatusChanged\BatteryStatus|null $battery_status, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A device was removed externally from the connected account. + */ + final class DeviceRemoved extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceRemoved|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A device was deleted. + */ + final class DeviceDeleted extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceDeleted|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + device_name: $json->device_name ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Name of the deleted device, captured at deletion time. The device record no longer exists when this event fires, so the name is preserved here. Null when the device had no resolvable name. + */ + public string|null $device_name = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Seam detected that a device is using a third-party integration that will interfere with Seam device management. + */ + final class DeviceThirdPartyIntegrationDetected extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceThirdPartyIntegrationDetected|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Seam detected that a device is no longer using a third-party integration that was interfering with Seam device management. + */ + final class DeviceThirdPartyIntegrationNoLongerDetected extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceThirdPartyIntegrationNoLongerDetected|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [Salto device](https://docs.seam.co/device-and-system-integration-guides/salto-locks) activated privacy mode. + */ + final class DeviceSaltoPrivacyModeActivated extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceSaltoPrivacyModeActivated|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [Salto device](https://docs.seam.co/device-and-system-integration-guides/salto-locks) deactivated privacy mode. + */ + final class DeviceSaltoPrivacyModeDeactivated extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceSaltoPrivacyModeDeactivated|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Seam detected a flaky device connection. + */ + final class DeviceConnectionBecameFlaky extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceConnectionBecameFlaky|null { + if (!$json) { + return null; + } + return new self( + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceConnectionBecameFlaky\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceConnectionBecameFlaky\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceConnectionBecameFlaky\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceConnectionBecameFlaky\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceConnectionBecameFlaky\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceConnectionBecameFlaky\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceConnectionBecameFlaky\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceConnectionBecameFlaky\DeviceWarnings> + */ + public array $device_warnings, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Seam detected that a previously-flaky device connection stabilized. + */ + final class DeviceConnectionStabilized extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceConnectionStabilized|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A third-party subscription is required to use all device features. + */ + final class DeviceErrorSubscriptionRequired extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceErrorSubscriptionRequired|null { + if (!$json) { + return null; + } + return new self( + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceErrorSubscriptionRequired\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceErrorSubscriptionRequired\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceErrorSubscriptionRequired\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceErrorSubscriptionRequired\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceErrorSubscriptionRequired\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceErrorSubscriptionRequired\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceErrorSubscriptionRequired\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceErrorSubscriptionRequired\DeviceWarnings> + */ + public array $device_warnings, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A third-party subscription is active or no longer required to use all device features. + */ + final class DeviceErrorSubscriptionRequiredResolved extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceErrorSubscriptionRequiredResolved|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An accessory keypad was connected to a device. + */ + final class DeviceAccessoryKeypadConnected extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceAccessoryKeypadConnected|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * An accessory keypad was disconnected from a device. + */ + final class DeviceAccessoryKeypadDisconnected extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): DeviceAccessoryKeypadDisconnected|null { + if (!$json) { + return null; + } + return new self( + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceAccessoryKeypadDisconnected\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\DeviceAccessoryKeypadDisconnected\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceAccessoryKeypadDisconnected\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\DeviceAccessoryKeypadDisconnected\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceAccessoryKeypadDisconnected\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\DeviceAccessoryKeypadDisconnected\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceAccessoryKeypadDisconnected\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\DeviceAccessoryKeypadDisconnected\DeviceWarnings> + */ + public array $device_warnings, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Extended periods of noise or noise exceeding a [threshold](https://docs.seam.co/capability-guides/noise-sensors#what-is-a-threshold) were detected. + */ + final class NoiseSensorNoiseThresholdTriggered extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): NoiseSensorNoiseThresholdTriggered|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + minut_metadata: $json->minut_metadata ?? null, + noise_level_decibels: $json->noise_level_decibels ?? null, + noise_level_nrs: $json->noise_level_nrs ?? null, + noise_threshold_id: $json->noise_threshold_id ?? null, + noise_threshold_name: $json->noise_threshold_name ?? null, + noiseaware_metadata: $json->noiseaware_metadata ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Metadata from Minut. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $minut_metadata = null, + /** + * Detected noise level in decibels. + */ + public float|null $noise_level_decibels = null, + /** + * Detected noise level in Noiseaware Noise Risk Score (NRS). + */ + public float|null $noise_level_nrs = null, + /** + * ID of the noise threshold that was triggered. + */ + public string|null $noise_threshold_id = null, + /** + * Name of the noise threshold that was triggered. + */ + public string|null $noise_threshold_name = null, + /** + * Metadata from Noiseaware. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $noiseaware_metadata = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [lock](https://docs.seam.co/low-level-apis/smart-locks) was locked. + */ + final class LockLocked extends \Seam\Resources\Event + { + public static function from_json(mixed $json): LockLocked|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + method: is_string($json->method ?? null) + ? \Seam\Resources\Event\LockLocked\Method::tryFrom( + $json->method, + ) + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_code_id: $json->access_code_id ?? null, + access_code_is_managed: $json->access_code_is_managed ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + code: $json->code ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + is_via_bluetooth: $json->is_via_bluetooth ?? null, + is_via_nfc: $json->is_via_nfc ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Method by which the lock was locked. `keycode`: an access code was used (see `access_code_id`). `manual`: a physical action such as a thumbturn or button press. `remote`: a remote action via an app, Bluetooth, or the Seam API (see `action_attempt_id` if Seam-initiated; see `is_via_bluetooth` or `is_via_nfc` for the transport). `automatic`: triggered automatically, for example by an auto-relock timer. `unknown`: could not be determined. + */ + public \Seam\Resources\Event\LockLocked\Method|null $method, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the access code that was used to lock the device. + */ + public string|null $access_code_id = null, + /** + * Whether the access code is managed by Seam (true) or unmanaged (false). Only present when access_code_id is set. + */ + public bool|null $access_code_is_managed = null, + /** + * ID of the Seam action attempt that triggered this lock. Present only when the lock was initiated through Seam (via a `LOCK_DOOR` action attempt). + */ + public string|null $action_attempt_id = null, + /** + * Code (PIN) that was used to lock the device, if known. Taken from the matched managed or unmanaged access code, or from the code reported by the provider when no access code matched. + */ + public string|null $code = null, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Whether the lock action was performed over Bluetooth by a remote client (such as the provider's mobile app), rather than a direct physical interaction or a Seam-initiated remote action. + */ + public bool|null $is_via_bluetooth = null, + /** + * Whether the lock action was performed by an NFC credential tap (such as an Apple Home Key or an NFC key fob) presented to the lock, rather than a direct physical interaction or a Seam-initiated remote action. + */ + public bool|null $is_via_nfc = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [lock](https://docs.seam.co/low-level-apis/smart-locks) was unlocked. + */ + final class LockUnlocked extends \Seam\Resources\Event + { + public static function from_json(mixed $json): LockUnlocked|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + method: is_string($json->method ?? null) + ? \Seam\Resources\Event\LockUnlocked\Method::tryFrom( + $json->method, + ) + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_code_id: $json->access_code_id ?? null, + access_code_is_managed: $json->access_code_is_managed ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + code: $json->code ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + is_via_bluetooth: $json->is_via_bluetooth ?? null, + is_via_nfc: $json->is_via_nfc ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Method by which the lock was unlocked. `keycode`: an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was used (see `access_code_id`). `manual`: a physical action such as a thumbturn or handle press. `remote`: a remote action via an app, Bluetooth, or the Seam API (see `action_attempt_id` if Seam-initiated; see `is_via_bluetooth` or `is_via_nfc` for the transport). `automatic`: triggered automatically, for example by a time-based schedule. `unknown`: could not be determined. + */ + public \Seam\Resources\Event\LockUnlocked\Method|null $method, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the access code that was used to unlock the affected device. + */ + public string|null $access_code_id = null, + /** + * Whether the access code is managed by Seam (true) or unmanaged (false). Only present when access_code_id is set. + */ + public bool|null $access_code_is_managed = null, + /** + * ID of the Seam action attempt that triggered this unlock. Present only when the unlock was initiated through Seam (via an `UNLOCK_DOOR` action attempt). + */ + public string|null $action_attempt_id = null, + /** + * Code (PIN) that was used to unlock the affected device, if known. Taken from the matched managed or unmanaged access code, or from the code reported by the provider when no access code matched. + */ + public string|null $code = null, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * ID of the affected device. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Whether the unlock action was performed over Bluetooth by a remote client (such as the provider's mobile app), rather than a direct physical interaction or a Seam-initiated remote action. + */ + public bool|null $is_via_bluetooth = null, + /** + * Whether the unlock action was performed by an NFC credential tap (such as an Apple Home Key or an NFC key fob) presented to the lock, rather than a direct physical interaction or a Seam-initiated remote action. + */ + public bool|null $is_via_nfc = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The [lock](https://docs.seam.co/low-level-apis/smart-locks) denied access to a user after one or more consecutive invalid attempts to unlock the device. + */ + final class LockAccessDenied extends \Seam\Resources\Event + { + public static function from_json(mixed $json): LockAccessDenied|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + access_code_id: $json->access_code_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + device_id: $json->device_id ?? null, + event_description: $json->event_description ?? null, + reason: isset($json->reason) + ? \Seam\Resources\Event\LockAccessDenied\Reason::from_json( + $json->reason, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * ID of the access code that was used in the unlock attempts. + */ + public string|null $access_code_id = null, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * ID of the affected device. + */ + public string|null $device_id = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Why access was denied, when the provider reports a determinable cause. Omitted when unknown. + */ + public \Seam\Resources\Event\LockAccessDenied\Reason|null $reason = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A thermostat [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets) was activated. + */ + final class ThermostatClimatePresetActivated extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ThermostatClimatePresetActivated|null { + if (!$json) { + return null; + } + return new self( + climate_preset_key: $json->climate_preset_key ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + is_fallback_climate_preset: $json->is_fallback_climate_preset ?? + null, + occurred_at: $json->occurred_at ?? null, + thermostat_schedule_id: $json->thermostat_schedule_id ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Key of the climate preset that was activated. + */ + public string|null $climate_preset_key, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Indicates whether the climate preset that was activated is the fallback climate preset for the thermostat. + */ + public bool|null $is_fallback_climate_preset, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the thermostat schedule that prompted the affected climate preset to be activated. + */ + public string|null $thermostat_schedule_id, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [thermostat](https://docs.seam.co/capability-guides/thermostats) was adjusted manually. + */ + final class ThermostatManuallyAdjusted extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ThermostatManuallyAdjusted|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + method: is_string($json->method ?? null) + ? \Seam\Resources\Event\ThermostatManuallyAdjusted\Method::tryFrom( + $json->method, + ) + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? + null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + fan_mode_setting: is_string($json->fan_mode_setting ?? null) + ? \Seam\Resources\Event\ThermostatManuallyAdjusted\FanModeSetting::tryFrom( + $json->fan_mode_setting, + ) + : null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? + null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) + ? \Seam\Resources\Event\ThermostatManuallyAdjusted\HvacModeSetting::tryFrom( + $json->hvac_mode_setting, + ) + : null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Method used to adjust the affected thermostat manually. `seam` indicates that the Seam API, Seam CLI, or Seam Console was used to adjust the thermostat. + */ + public \Seam\Resources\Event\ThermostatManuallyAdjusted\Method|null $method, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $cooling_set_point_celsius = null, + /** + * Temperature to which the thermostat should cool (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $cooling_set_point_fahrenheit = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + */ + public \Seam\Resources\Event\ThermostatManuallyAdjusted\FanModeSetting|null $fan_mode_setting = null, + /** + * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $heating_set_point_celsius = null, + /** + * Temperature to which the thermostat should heat (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + public float|null $heating_set_point_fahrenheit = null, + /** + * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + */ + public \Seam\Resources\Event\ThermostatManuallyAdjusted\HvacModeSetting|null $hvac_mode_setting = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [thermostat's](https://docs.seam.co/capability-guides/thermostats) temperature reading exceeded the set [threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds). + */ + final class ThermostatTemperatureThresholdExceeded extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ThermostatTemperatureThresholdExceeded|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + lower_limit_celsius: $json->lower_limit_celsius ?? null, + lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, + occurred_at: $json->occurred_at ?? null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + upper_limit_celsius: $json->upper_limit_celsius ?? null, + upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Lower temperature limit, in °C, defined by the set threshold. + */ + public float|null $lower_limit_celsius, + /** + * Lower temperature limit, in °F, defined by the set threshold. + */ + public float|null $lower_limit_fahrenheit, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Temperature, in °C, reported by the affected thermostat. + */ + public float|null $temperature_celsius, + /** + * Temperature, in °F, reported by the affected thermostat. + */ + public float|null $temperature_fahrenheit, + /** + * Upper temperature limit, in °C, defined by the set threshold. + */ + public float|null $upper_limit_celsius, + /** + * Upper temperature limit, in °F, defined by the set threshold. + */ + public float|null $upper_limit_fahrenheit, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [thermostat's](https://docs.seam.co/capability-guides/thermostats) temperature reading no longer exceeds the set [threshold](https://docs.seam.co/capability-guides/thermostats/setting-and-monitoring-temperature-thresholds). + */ + final class ThermostatTemperatureThresholdNoLongerExceeded extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ThermostatTemperatureThresholdNoLongerExceeded|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + lower_limit_celsius: $json->lower_limit_celsius ?? null, + lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, + occurred_at: $json->occurred_at ?? null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + upper_limit_celsius: $json->upper_limit_celsius ?? null, + upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Lower temperature limit, in °C, defined by the set threshold. + */ + public float|null $lower_limit_celsius, + /** + * Lower temperature limit, in °F, defined by the set threshold. + */ + public float|null $lower_limit_fahrenheit, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Temperature, in °C, reported by the affected thermostat. + */ + public float|null $temperature_celsius, + /** + * Temperature, in °F, reported by the affected thermostat. + */ + public float|null $temperature_fahrenheit, + /** + * Upper temperature limit, in °C, defined by the set threshold. + */ + public float|null $upper_limit_celsius, + /** + * Upper temperature limit, in °F, defined by the set threshold. + */ + public float|null $upper_limit_fahrenheit, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [thermostat's](https://docs.seam.co/capability-guides/thermostats) temperature reading is within 1 °C of the configured cooling or heating [set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + */ + final class ThermostatTemperatureReachedSetPoint extends + \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ThermostatTemperatureReachedSetPoint|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + desired_temperature_celsius: $json->desired_temperature_celsius ?? + null, + desired_temperature_fahrenheit: $json->desired_temperature_fahrenheit ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Temperature, in °C, reported by the affected thermostat. + */ + public float|null $temperature_celsius, + /** + * Temperature, in °F, reported by the affected thermostat. + */ + public float|null $temperature_fahrenheit, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Desired temperature, in °C, defined by the affected thermostat's cooling or heating set point. + */ + public float|null $desired_temperature_celsius = null, + /** + * Desired temperature, in °F, defined by the affected thermostat's cooling or heating set point. + */ + public float|null $desired_temperature_fahrenheit = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A [thermostat's](https://docs.seam.co/capability-guides/thermostats) reported temperature changed by at least 1 °C. + */ + final class ThermostatTemperatureChanged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): ThermostatTemperatureChanged|null { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * Temperature, in °C, reported by the affected thermostat. + */ + public float|null $temperature_celsius, + /** + * Temperature, in °F, reported by the affected thermostat. + */ + public float|null $temperature_fahrenheit, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * The name of a device was changed. + */ + final class DeviceNameChanged extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceNameChanged|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + device_name: $json->device_name ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * The new name of the affected device. + */ + public string|null $device_name, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A camera was activated, for example, by motion detection. + */ + final class CameraActivated extends \Seam\Resources\Event + { + public static function from_json(mixed $json): CameraActivated|null + { + if (!$json) { + return null; + } + return new self( + activation_reason: is_string($json->activation_reason ?? null) + ? \Seam\Resources\Event\CameraActivated\ActivationReason::tryFrom( + $json->activation_reason, + ) + : null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + image_url: $json->image_url ?? null, + motion_sub_type: is_string($json->motion_sub_type ?? null) + ? \Seam\Resources\Event\CameraActivated\MotionSubType::tryFrom( + $json->motion_sub_type, + ) + : null, + video_url: $json->video_url ?? null, + ); + } + + public function __construct( + /** + * The reason the camera was activated. + */ + public \Seam\Resources\Event\CameraActivated\ActivationReason|null $activation_reason, + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * URL to a thumbnail image captured at the time of activation. + */ + public string|null $image_url = null, + /** + * Sub-type of motion detected, if available. + */ + public \Seam\Resources\Event\CameraActivated\MotionSubType|null $motion_sub_type = null, + /** + * URL to a short video clip captured at the time of activation. + */ + public string|null $video_url = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A doorbell button was pressed on a device. + */ + final class DeviceDoorbellRang extends \Seam\Resources\Event + { + public static function from_json(mixed $json): DeviceDoorbellRang|null + { + if (!$json) { + return null; + } + return new self( + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + customer_key: $json->customer_key ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + image_url: $json->image_url ?? null, + video_url: $json->video_url ?? null, + ); + } + + public function __construct( + /** + * ID of the connected account associated with the event. + */ + public string|null $connected_account_id, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * The customer key associated with the device, if any. + */ + public string|null $customer_key = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * URL to a thumbnail image captured at the time the doorbell was pressed. + */ + public string|null $image_url = null, + /** + * URL to a short video clip captured at the time the doorbell was pressed. + */ + public string|null $video_url = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A phone device was deactivated. + */ + final class PhoneDeactivated extends \Seam\Resources\Event + { + public static function from_json(mixed $json): PhoneDeactivated|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + device_custom_metadata: $json->device_custom_metadata ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the affected phone device. + */ + public string|null $device_id, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the device; present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A device was added or removed from a space. + */ + final class SpaceDeviceMembershipChanged extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): SpaceDeviceMembershipChanged|null { + if (!$json) { + return null; + } + return new self( + acs_entrance_ids: $json->acs_entrance_ids ?? null, + created_at: $json->created_at ?? null, + device_ids: $json->device_ids ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + space_id: $json->space_id ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + space_key: $json->space_key ?? null, + ); + } + + public function __construct( + /** + * IDs of all ACS entrances currently attached to the space. + * + * @var list|null + */ + public array|null $acs_entrance_ids, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * IDs of all devices currently attached to the space. + * + * @var list|null + */ + public array|null $device_ids, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the affected space. + */ + public string|null $space_id, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Unique key for the space within the workspace. + */ + public string|null $space_key = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A space was created. + */ + final class SpaceCreated extends \Seam\Resources\Event + { + public static function from_json(mixed $json): SpaceCreated|null + { + if (!$json) { + return null; + } + return new self( + acs_entrance_ids: $json->acs_entrance_ids ?? null, + created_at: $json->created_at ?? null, + device_ids: $json->device_ids ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + space_id: $json->space_id ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + space_key: $json->space_key ?? null, + ); + } + + public function __construct( + /** + * IDs of all ACS entrances attached to the space when it was created. + * + * @var list|null + */ + public array|null $acs_entrance_ids, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * IDs of all devices attached to the space when it was created. + * + * @var list|null + */ + public array|null $device_ids, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the affected space. + */ + public string|null $space_id, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Unique key for the space within the workspace. + */ + public string|null $space_key = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * A space was deleted. + */ + final class SpaceDeleted extends \Seam\Resources\Event + { + public static function from_json(mixed $json): SpaceDeleted|null + { + if (!$json) { + return null; + } + return new self( + acs_entrance_ids: $json->acs_entrance_ids ?? null, + created_at: $json->created_at ?? null, + device_ids: $json->device_ids ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + space_id: $json->space_id ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + space_key: $json->space_key ?? null, + ); + } + + public function __construct( + /** + * IDs of all ACS entrances currently attached to the space when it was deleted. + * + * @var list|null + */ + public array|null $acs_entrance_ids, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * IDs of all devices attached to the space when it was deleted. + * + * @var list|null + */ + public array|null $device_ids, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the affected space. + */ + public string|null $space_id, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + /** + * Unique key for the space within the workspace. + */ + public string|null $space_key = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + /** + * Fallback for event values introduced after this SDK version. + */ + final class UnknownEvent extends \Seam\Resources\Event + { + public static function from_json(mixed $json): UnknownEvent|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, + ); + } + + public function __construct( + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * ID of the event. + */ + string|null $event_id, + \Seam\Resources\Event\EventType|string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + + enum EventType: string + { + case ACCESS_CODE_CREATED = "access_code.created"; + case ACCESS_CODE_CHANGED = "access_code.changed"; + case ACCESS_CODE_NAME_CHANGED = "access_code.name_changed"; + case ACCESS_CODE_CODE_CHANGED = "access_code.code_changed"; + case ACCESS_CODE_TIME_FRAME_CHANGED = "access_code.time_frame_changed"; + case ACCESS_CODE_MUTATIONS_REQUESTED = "access_code.mutations_requested"; + case ACCESS_CODE_SCHEDULED_ON_DEVICE = "access_code.scheduled_on_device"; + case ACCESS_CODE_SET_ON_DEVICE = "access_code.set_on_device"; + case ACCESS_CODE_REMOVED_FROM_DEVICE = "access_code.removed_from_device"; + case ACCESS_CODE_DELAY_IN_SETTING_ON_DEVICE = "access_code.delay_in_setting_on_device"; + case ACCESS_CODE_FAILED_TO_SET_ON_DEVICE = "access_code.failed_to_set_on_device"; + case ACCESS_CODE_DELETED = "access_code.deleted"; + case ACCESS_CODE_DELAY_IN_REMOVING_FROM_DEVICE = "access_code.delay_in_removing_from_device"; + case ACCESS_CODE_FAILED_TO_REMOVE_FROM_DEVICE = "access_code.failed_to_remove_from_device"; + case ACCESS_CODE_MODIFIED_EXTERNAL_TO_SEAM = "access_code.modified_external_to_seam"; + case ACCESS_CODE_DELETED_EXTERNAL_TO_SEAM = "access_code.deleted_external_to_seam"; + case ACCESS_CODE_BACKUP_ACCESS_CODE_PULLED = "access_code.backup_access_code_pulled"; + case ACCESS_CODE_UNMANAGED_CONVERTED_TO_MANAGED = "access_code.unmanaged.converted_to_managed"; + case ACCESS_CODE_UNMANAGED_FAILED_TO_CONVERT_TO_MANAGED = "access_code.unmanaged.failed_to_convert_to_managed"; + case ACCESS_CODE_UNMANAGED_CREATED = "access_code.unmanaged.created"; + case ACCESS_CODE_UNMANAGED_REMOVED = "access_code.unmanaged.removed"; + case ACCESS_GRANT_CREATED = "access_grant.created"; + case ACCESS_GRANT_DELETED = "access_grant.deleted"; + case ACCESS_GRANT_ACCESS_GRANTED_TO_ALL_DOORS = "access_grant.access_granted_to_all_doors"; + case ACCESS_GRANT_ACCESS_GRANTED_TO_DOOR = "access_grant.access_granted_to_door"; + case ACCESS_GRANT_ACCESS_TO_DOOR_LOST = "access_grant.access_to_door_lost"; + case ACCESS_GRANT_ACCESS_TIMES_CHANGED = "access_grant.access_times_changed"; + case ACCESS_GRANT_COULD_NOT_CREATE_REQUESTED_ACCESS_METHODS = "access_grant.could_not_create_requested_access_methods"; + case ACCESS_METHOD_ISSUED = "access_method.issued"; + case ACCESS_METHOD_REVOKED = "access_method.revoked"; + case ACCESS_METHOD_CARD_ENCODING_REQUIRED = "access_method.card_encoding_required"; + case ACCESS_METHOD_DELETED = "access_method.deleted"; + case ACCESS_METHOD_REISSUED = "access_method.reissued"; + case ACCESS_METHOD_CREATED = "access_method.created"; + case ACCESS_METHOD_DELAY_IN_ISSUING = "access_method.delay_in_issuing"; + case ACCESS_METHOD_FAILED_TO_ISSUE = "access_method.failed_to_issue"; + case ACS_SYSTEM_CONNECTED = "acs_system.connected"; + case ACS_SYSTEM_ADDED = "acs_system.added"; + case ACS_SYSTEM_DISCONNECTED = "acs_system.disconnected"; + case ACS_CREDENTIAL_DELETED = "acs_credential.deleted"; + case ACS_CREDENTIAL_ISSUED = "acs_credential.issued"; + case ACS_CREDENTIAL_REISSUED = "acs_credential.reissued"; + case ACS_CREDENTIAL_INVALIDATED = "acs_credential.invalidated"; + case ACS_USER_CREATED = "acs_user.created"; + case ACS_USER_DELETED = "acs_user.deleted"; + case ACS_ENCODER_ADDED = "acs_encoder.added"; + case ACS_ENCODER_REMOVED = "acs_encoder.removed"; + case ACS_ACCESS_GROUP_DELETED = "acs_access_group.deleted"; + case ACS_ENTRANCE_ADDED = "acs_entrance.added"; + case ACS_ENTRANCE_REMOVED = "acs_entrance.removed"; + case CLIENT_SESSION_DELETED = "client_session.deleted"; + case CONNECTED_ACCOUNT_CONNECTED = "connected_account.connected"; + case CONNECTED_ACCOUNT_CREATED = "connected_account.created"; + case CONNECTED_ACCOUNT_SUCCESSFUL_LOGIN = "connected_account.successful_login"; + case CONNECTED_ACCOUNT_DISCONNECTED = "connected_account.disconnected"; + case CONNECTED_ACCOUNT_COMPLETED_FIRST_SYNC = "connected_account.completed_first_sync"; + case CONNECTED_ACCOUNT_DELETED = "connected_account.deleted"; + case CONNECTED_ACCOUNT_COMPLETED_FIRST_SYNC_AFTER_RECONNECTION = "connected_account.completed_first_sync_after_reconnection"; + case CONNECTED_ACCOUNT_REAUTHORIZATION_REQUESTED = "connected_account.reauthorization_requested"; + case ACTION_ATTEMPT_LOCK_DOOR_SUCCEEDED = "action_attempt.lock_door.succeeded"; + case ACTION_ATTEMPT_LOCK_DOOR_FAILED = "action_attempt.lock_door.failed"; + case ACTION_ATTEMPT_UNLOCK_DOOR_SUCCEEDED = "action_attempt.unlock_door.succeeded"; + case ACTION_ATTEMPT_UNLOCK_DOOR_FAILED = "action_attempt.unlock_door.failed"; + case ACTION_ATTEMPT_SIMULATE_KEYPAD_CODE_ENTRY_SUCCEEDED = "action_attempt.simulate_keypad_code_entry.succeeded"; + case ACTION_ATTEMPT_SIMULATE_KEYPAD_CODE_ENTRY_FAILED = "action_attempt.simulate_keypad_code_entry.failed"; + case ACTION_ATTEMPT_SIMULATE_MANUAL_LOCK_VIA_KEYPAD_SUCCEEDED = "action_attempt.simulate_manual_lock_via_keypad.succeeded"; + case ACTION_ATTEMPT_SIMULATE_MANUAL_LOCK_VIA_KEYPAD_FAILED = "action_attempt.simulate_manual_lock_via_keypad.failed"; + case CONNECT_WEBVIEW_LOGIN_SUCCEEDED = "connect_webview.login_succeeded"; + case CONNECT_WEBVIEW_LOGIN_FAILED = "connect_webview.login_failed"; + case DEVICE_CONNECTED = "device.connected"; + case DEVICE_ADDED = "device.added"; + case DEVICE_CONVERTED_TO_UNMANAGED = "device.converted_to_unmanaged"; + case DEVICE_UNMANAGED_CONVERTED_TO_MANAGED = "device.unmanaged.converted_to_managed"; + case DEVICE_UNMANAGED_CONNECTED = "device.unmanaged.connected"; + case DEVICE_DISCONNECTED = "device.disconnected"; + case DEVICE_UNMANAGED_DISCONNECTED = "device.unmanaged.disconnected"; + case DEVICE_TAMPERED = "device.tampered"; + case DEVICE_LOW_BATTERY = "device.low_battery"; + case DEVICE_BATTERY_STATUS_CHANGED = "device.battery_status_changed"; + case DEVICE_REMOVED = "device.removed"; + case DEVICE_DELETED = "device.deleted"; + case DEVICE_THIRD_PARTY_INTEGRATION_DETECTED = "device.third_party_integration_detected"; + case DEVICE_THIRD_PARTY_INTEGRATION_NO_LONGER_DETECTED = "device.third_party_integration_no_longer_detected"; + case DEVICE_SALTO_PRIVACY_MODE_ACTIVATED = "device.salto.privacy_mode_activated"; + case DEVICE_SALTO_PRIVACY_MODE_DEACTIVATED = "device.salto.privacy_mode_deactivated"; + case DEVICE_CONNECTION_BECAME_FLAKY = "device.connection_became_flaky"; + case DEVICE_CONNECTION_STABILIZED = "device.connection_stabilized"; + case DEVICE_ERROR_SUBSCRIPTION_REQUIRED = "device.error.subscription_required"; + case DEVICE_ERROR_SUBSCRIPTION_REQUIRED_RESOLVED = "device.error.subscription_required.resolved"; + case DEVICE_ACCESSORY_KEYPAD_CONNECTED = "device.accessory_keypad_connected"; + case DEVICE_ACCESSORY_KEYPAD_DISCONNECTED = "device.accessory_keypad_disconnected"; + case NOISE_SENSOR_NOISE_THRESHOLD_TRIGGERED = "noise_sensor.noise_threshold_triggered"; + case LOCK_LOCKED = "lock.locked"; + case LOCK_UNLOCKED = "lock.unlocked"; + case LOCK_ACCESS_DENIED = "lock.access_denied"; + case THERMOSTAT_CLIMATE_PRESET_ACTIVATED = "thermostat.climate_preset_activated"; + case THERMOSTAT_MANUALLY_ADJUSTED = "thermostat.manually_adjusted"; + case THERMOSTAT_TEMPERATURE_THRESHOLD_EXCEEDED = "thermostat.temperature_threshold_exceeded"; + case THERMOSTAT_TEMPERATURE_THRESHOLD_NO_LONGER_EXCEEDED = "thermostat.temperature_threshold_no_longer_exceeded"; + case THERMOSTAT_TEMPERATURE_REACHED_SET_POINT = "thermostat.temperature_reached_set_point"; + case THERMOSTAT_TEMPERATURE_CHANGED = "thermostat.temperature_changed"; + case DEVICE_NAME_CHANGED = "device.name_changed"; + case CAMERA_ACTIVATED = "camera.activated"; + case DEVICE_DOORBELL_RANG = "device.doorbell_rang"; + case PHONE_DEACTIVATED = "phone.deactivated"; + case SPACE_DEVICE_MEMBERSHIP_CHANGED = "space.device_membership_changed"; + case SPACE_CREATED = "space.created"; + case SPACE_DELETED = "space.deleted"; + } +} + +namespace Seam\Resources\Event\AccessCodeChanged { + /** + * List of properties that changed on the access code. + */ + class ChangedProperties + { + public static function from_json(mixed $json): ChangedProperties|null + { + if (!$json) { + return null; + } + return new self( + from: $json->from ?? null, + property: $json->property ?? null, + to: $json->to ?? null, + ); + } + + public function __construct( + /** + * Previous value of the property, or null if not set. + */ + public string|null $from, + /** + * Name of the property that changed (e.g. `code`). + */ + public string|null $property, + /** + * New value of the property, or null if cleared. + */ + public string|null $to, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeNameChanged { + /** + * Previous access code name configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(name: $json->name ?? null); + } + + public function __construct( + /** + * Previous name of the access code. + */ + public string|null $name, + ) {} + } + + /** + * New access code name configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(name: $json->name ?? null); + } + + public function __construct( + /** + * New name of the access code. + */ + public string|null $name, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeCodeChanged { + /** + * Previous pin code configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(code: $json->code ?? null); + } + + public function __construct( + /** + * Previous pin code. + */ + public string|null $code, + ) {} + } + + /** + * New pin code configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(code: $json->code ?? null); + } + + public function __construct( + /** + * New pin code. + */ + public string|null $code, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeTimeFrameChanged { + /** + * Previous time frame configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * Previous end time. + */ + public string|null $ends_at, + /** + * Previous start time. + */ + public string|null $starts_at, + ) {} + } + + /** + * New time frame configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * New end time. + */ + public string|null $ends_at, + /** + * New start time. + */ + public string|null $starts_at, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeMutationsRequested { + /** + * Array of mutations requested on the access code, each containing the mutation type and from/to values. + */ + class RequestedMutations + { + public static function from_json(mixed $json): RequestedMutations|null + { + if (!$json) { + return null; + } + return new self( + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null, + from: $json->from ?? null, + to: $json->to ?? null, + ); + } + + public function __construct( + /** + * Code identifying the type of mutation requested, such as `updating_name`, `updating_code`, `updating_time_frame`, or `deleting`. + */ + public \Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations\MutationCode|null $mutation_code, + /** + * Previous property values before the requested change. Keys depend on the mutation type. Absent for non-property mutations like `deleting`. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $from = null, + /** + * New property values after the requested change. Keys depend on the mutation type. Absent for non-property mutations like `deleting`. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $to = null, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations { + enum MutationCode: string + { + case UPDATING_NAME = "updating_name"; + case UPDATING_CODE = "updating_code"; + case UPDATING_TIME_FRAME = "updating_time_frame"; + case DELETING = "deleting"; + case CREATING = "creating"; + case DEFERRING_CREATION = "deferring_creation"; + } +} + +namespace Seam\Resources\Event\AccessCodeDelayInSettingOnDevice { + /** + * Errors associated with the access code. + */ + class AccessCodeErrors + { + public static function from_json(mixed $json): AccessCodeErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the access code. + */ + class AccessCodeWarnings + { + public static function from_json(mixed $json): AccessCodeWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the device. + */ + class DeviceErrors + { + public static function from_json(mixed $json): DeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the device. + */ + class DeviceWarnings + { + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeFailedToSetOnDevice { + /** + * Errors associated with the access code. + */ + class AccessCodeErrors + { + public static function from_json(mixed $json): AccessCodeErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the access code. + */ + class AccessCodeWarnings + { + public static function from_json(mixed $json): AccessCodeWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the device. + */ + class DeviceErrors + { + public static function from_json(mixed $json): DeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the device. + */ + class DeviceWarnings + { + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice { + /** + * Errors associated with the access code. + */ + class AccessCodeErrors + { + public static function from_json(mixed $json): AccessCodeErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the access code. + */ + class AccessCodeWarnings + { + public static function from_json(mixed $json): AccessCodeWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the device. + */ + class DeviceErrors + { + public static function from_json(mixed $json): DeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the device. + */ + class DeviceWarnings + { + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeFailedToRemoveFromDevice { + /** + * Errors associated with the access code. + */ + class AccessCodeErrors + { + public static function from_json(mixed $json): AccessCodeErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the access code. + */ + class AccessCodeWarnings + { + public static function from_json(mixed $json): AccessCodeWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * IDs of the access grants associated with this access method. + * Date and time at which Seam created the warning. */ - public array|null $access_grant_ids, + public string|null $created_at, /** - * ID of the affected access method. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $access_method_id, + public string|null $message, /** - * ID of the affected access group. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $acs_access_group_id, + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the device. + */ + class DeviceErrors + { + public static function from_json(mixed $json): DeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * ID of the affected credential. + * Date and time at which Seam created the error. */ - public string|null $acs_credential_id, + public string|null $created_at, /** - * ID of the affected encoder. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $acs_encoder_id, - public string|null $acs_entrance_id, - public array|null $acs_entrance_ids, + public string|null $error_code, /** - * Errors associated with the access control system. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public array $acs_system_errors, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the device. + */ + class DeviceWarnings + { + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * ID of the access system. + * Date and time at which Seam created the warning. */ - public string|null $acs_system_id, + public string|null $created_at, /** - * Warnings associated with the access control system. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public array $acs_system_warnings, + public string|null $message, /** - * ID of the affected access system user. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $acs_user_id, - public string|null $action_attempt_id, + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\AccessCodeUnmanagedFailedToConvertToManaged { + /** + * Errors associated with the access code. + */ + class AccessCodeErrors + { + public static function from_json(mixed $json): AccessCodeErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Type of the action. + * Date and time at which Seam created the error. */ - public string|null $action_type, + public string|null $created_at, /** - * The reason the camera was activated. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $activation_reason, + public string|null $error_code, /** - * ID of the backup access code that was pulled from the pool. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $backup_access_code_id, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the access code. + */ + class AccessCodeWarnings + { + public static function from_json(mixed $json): AccessCodeWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * Number in the range 0 to 1.0 indicating the amount of battery in the affected device, as reported by the device. + * Date and time at which Seam created the warning. */ - public float|null $battery_level, + public string|null $created_at, /** - * Battery status of the affected device, calculated from the numeric `battery_level` value. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $battery_status, + public string|null $message, /** - * ID of the affected client session. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $client_session_id, + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Key of the climate preset that was activated. + * Date and time at which Seam created the error. */ - public string|null $climate_preset_key, - public string|null $code, + public string|null $created_at, /** - * Errors associated with the connected account. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public array $connected_account_errors, - public string|null $connected_account_id, + public string|null $error_code, /** - * Warnings associated with the connected account. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public array $connected_account_warnings, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * Date and time at which the event was created. + * Date and time at which Seam created the warning. */ public string|null $created_at, /** - * Human-readable description of the change and its source. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $description, + public string|null $message, /** - * Errors associated with the device. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public array $device_errors, - public string|null $device_id, - public array|null $device_ids, + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the device. + */ + class DeviceErrors + { + public static function from_json(mixed $json): DeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Warnings associated with the device. + * Date and time at which Seam created the error. */ - public array $device_warnings, + public string|null $created_at, /** - * Error code associated with the disconnection event, if any. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ public string|null $error_code, /** - * Description of why the access methods could not be created. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the device. + */ + class DeviceWarnings + { + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. */ - public string|null $error_message, + public string|null $created_at, /** - * ID of the event. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $event_id, + public string|null $message, /** - * Type of the event. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $event_type, - public Event\From|null $from, + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\AcsSystemDisconnected { + /** + * Errors associated with the access control system. + */ + class AcsSystemErrors + { + public static function from_json(mixed $json): AcsSystemErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Indicates whether the climate preset that was activated is the fallback climate preset for the thermostat. + * Date and time at which Seam created the error. */ - public bool|null $is_fallback_climate_preset, + public string|null $created_at, /** - * Lower temperature limit, in °C, defined by the set threshold. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public float|null $lower_limit_celsius, + public string|null $error_code, /** - * Lower temperature limit, in °F, defined by the set threshold. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public float|null $lower_limit_fahrenheit, - public string|null $method, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the access control system. + */ + class AcsSystemWarnings + { + public static function from_json(mixed $json): AcsSystemWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * Date and time at which the event occurred. + * Date and time at which Seam created the warning. */ - public string|null $occurred_at, + public string|null $created_at, /** - * Array of mutations requested on the access code, each containing the mutation type and from/to values. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public array $requested_mutations, + public string|null $message, /** - * ID of the affected space. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $space_id, + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Status of the action. + * Date and time at which Seam created the error. */ - public string|null $status, + public string|null $created_at, /** - * Temperature, in °C, reported by the affected thermostat. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public float|null $temperature_celsius, + public string|null $error_code, /** - * Temperature, in °F, reported by the affected thermostat. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public float|null $temperature_fahrenheit, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * ID of the thermostat schedule that prompted the affected climate preset to be activated. + * Date and time at which Seam created the warning. */ - public string|null $thermostat_schedule_id, - public Event\To|null $to, + public string|null $created_at, /** - * Upper temperature limit, in °C, defined by the set threshold. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $upper_limit_celsius, + public string|null $message, /** - * Upper temperature limit, in °F, defined by the set threshold. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public float|null $upper_limit_fahrenheit, + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\ConnectedAccountDisconnected { + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * ID of the workspace associated with the event. + * Date and time at which Seam created the error. */ - public string|null $workspace_id, + public string|null $created_at, /** - * Whether the access code is managed by Seam (true) or unmanaged (false). Only present when access_code_id is set. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public bool|null $access_code_is_managed = null, + public string|null $error_code, /** - * Key of the affected Access Grant (if present). + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $access_grant_key = null, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * Keys of the access grants associated with this access method (if present). + * Date and time at which Seam created the warning. */ - public array|null $access_grant_keys = null, + public string|null $created_at, /** - * Human-readable reason for the change (e.g. `ongoing code auto-renewed`). + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $change_reason = null, + public string|null $message, /** - * List of properties that changed on the access code. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public array|null $changed_properties = null, - public string|null $connect_webview_id = null, + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\ConnectedAccountReauthorizationRequested { + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * @var array|\stdClass|null + * Date and time at which Seam created the error. */ - public array|\stdClass|null $connected_account_custom_metadata = null, + public string|null $created_at, /** - * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public float|null $cooling_set_point_celsius = null, + public string|null $error_code, /** - * Temperature to which the thermostat should cool (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public float|null $cooling_set_point_fahrenheit = null, - public string|null $customer_key = null, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * Desired temperature, in °C, defined by the affected thermostat's cooling or heating set point. + * Date and time at which Seam created the warning. */ - public float|null $desired_temperature_celsius = null, + public string|null $created_at, /** - * Desired temperature, in °F, defined by the affected thermostat's cooling or heating set point. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $desired_temperature_fahrenheit = null, + public string|null $message, /** - * @var array|\stdClass|null + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public array|\stdClass|null $device_custom_metadata = null, - public string|null $device_name = null, + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\DeviceDisconnected { + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * The new end time for the access grant. + * Date and time at which Seam created the error. */ - public string|null $ends_at = null, + public string|null $created_at, /** - * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $event_description = null, + public string|null $error_code, /** - * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $fan_mode_setting = null, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Date and time at which Seam created the warning. */ - public float|null $heating_set_point_celsius = null, + public string|null $created_at, /** - * Temperature to which the thermostat should heat (in °F). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $heating_set_point_fahrenheit = null, + public string|null $message, /** - * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $hvac_mode_setting = null, - public string|null $image_url = null, + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the device. + */ + class DeviceErrors + { + public static function from_json(mixed $json): DeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * Indicates whether the code is a backup code (only present when mode is 'code' and a backup code was used). + * Date and time at which Seam created the error. */ - public bool|null $is_backup_code = null, - public bool|null $is_via_bluetooth = null, - public bool|null $is_via_nfc = null, + public string|null $created_at, /** - * Metadata from Minut. - * - * @var array|\stdClass|null + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public array|\stdClass|null $minut_metadata = null, + public string|null $error_code, /** - * IDs of the devices that did not receive a requested access method. Use these to identify which specific devices failed without having to fetch the Access Grant. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public array|null $missing_device_ids = null, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the device. + */ + class DeviceWarnings + { + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * Sub-type of motion detected, if available. + * Date and time at which Seam created the warning. */ - public string|null $motion_sub_type = null, + public string|null $created_at, /** - * Detected noise level in decibels. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public float|null $noise_level_decibels = null, + public string|null $message, /** - * Detected noise level in Noiseaware Noise Risk Score (NRS). + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public float|null $noise_level_nrs = null, + public string|null $warning_code, + ) {} + } + + enum ErrorCode: string + { + case ACCOUNT_DISCONNECTED = "account_disconnected"; + case HUB_DISCONNECTED = "hub_disconnected"; + case DEVICE_DISCONNECTED = "device_disconnected"; + } +} + +namespace Seam\Resources\Event\DeviceUnmanagedDisconnected { + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( /** - * ID of the noise threshold that was triggered. + * Date and time at which Seam created the error. */ - public string|null $noise_threshold_id = null, + public string|null $created_at, /** - * Name of the noise threshold that was triggered. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $noise_threshold_name = null, + public string|null $error_code, /** - * Metadata from Noiseaware. - * - * @var array|\stdClass|null + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public array|\stdClass|null $noiseaware_metadata = null, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( /** - * Why access was denied, when the provider reports a determinable cause. Omitted when unknown. + * Date and time at which Seam created the warning. */ - public Event\Reason|null $reason = null, + public string|null $created_at, /** - * Unique key for the space within the workspace. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $space_key = null, + public string|null $message, /** - * The new start time for the access grant. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $starts_at = null, - public string|null $video_url = null, + public string|null $warning_code, ) {} } -} -namespace Seam\Resources\Event { /** - * Errors associated with the access code. + * Errors associated with the device. */ - class AccessCodeErrors + class DeviceErrors { - public static function from_json(mixed $json): AccessCodeErrors|null + public static function from_json(mixed $json): DeviceErrors|null { if (!$json) { return null; @@ -489,11 +12604,11 @@ public function __construct( } /** - * Warnings associated with the access code. + * Warnings associated with the device. */ - class AccessCodeWarnings + class DeviceWarnings { - public static function from_json(mixed $json): AccessCodeWarnings|null + public static function from_json(mixed $json): DeviceWarnings|null { if (!$json) { return null; @@ -521,13 +12636,33 @@ public function __construct( ) {} } + enum ErrorCode: string + { + case ACCOUNT_DISCONNECTED = "account_disconnected"; + case HUB_DISCONNECTED = "hub_disconnected"; + case DEVICE_DISCONNECTED = "device_disconnected"; + } +} + +namespace Seam\Resources\Event\DeviceBatteryStatusChanged { + enum BatteryStatus: string + { + case CRITICAL = "critical"; + case LOW = "low"; + case GOOD = "good"; + case FULL = "full"; + } +} + +namespace Seam\Resources\Event\DeviceConnectionBecameFlaky { /** - * Errors associated with the access control system. + * Errors associated with the connected account. */ - class AcsSystemErrors + class ConnectedAccountErrors { - public static function from_json(mixed $json): AcsSystemErrors|null - { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { if (!$json) { return null; } @@ -555,12 +12690,13 @@ public function __construct( } /** - * Warnings associated with the access control system. + * Warnings associated with the connected account. */ - class AcsSystemWarnings + class ConnectedAccountWarnings { - public static function from_json(mixed $json): AcsSystemWarnings|null - { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { if (!$json) { return null; } @@ -588,38 +12724,73 @@ public function __construct( } /** - * List of properties that changed on the access code. + * Errors associated with the device. */ - class ChangedProperties + class DeviceErrors { - public static function from_json(mixed $json): ChangedProperties|null + public static function from_json(mixed $json): DeviceErrors|null { if (!$json) { return null; } return new self( - from: $json->from ?? null, - property: $json->property ?? null, - to: $json->to ?? null, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Previous value of the property, or null if not set. + * Date and time at which Seam created the error. */ - public string|null $from, + public string|null $created_at, /** - * Name of the property that changed (e.g. `code`). + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $property, + public string|null $error_code, /** - * New value of the property, or null if cleared. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $to, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the device. + */ + class DeviceWarnings + { + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, ) {} } +} +namespace Seam\Resources\Event\DeviceErrorSubscriptionRequired { /** * Errors associated with the connected account. */ @@ -753,139 +12924,249 @@ public function __construct( public string|null $warning_code, ) {} } +} - class From +namespace Seam\Resources\Event\DeviceAccessoryKeypadDisconnected { + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors { - public static function from_json(mixed $json): From|null - { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { if (!$json) { 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, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Previous pin code. - */ - public string|null $code, - /** - * Previous end time. + * Date and time at which Seam created the error. */ - public string|null $ends_at, + public string|null $created_at, /** - * Previous name of the access code. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $name, + public string|null $error_code, /** - * Previous start time. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $starts_at, + public string|null $message, ) {} } /** - * Why access was denied, when the provider reports a determinable cause. Omitted when unknown. + * Warnings associated with the connected account. */ - class Reason + class ConnectedAccountWarnings { - public static function from_json(mixed $json): Reason|null - { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { if (!$json) { return null; } return new self( + created_at: $json->created_at ?? null, message: $json->message ?? null, - reason_code: $json->reason_code ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( /** - * Human-readable explanation of why access was denied. + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, /** - * Normalized reason a lock denied access. Provider-agnostic; not all providers report every value. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $reason_code, + public string|null $warning_code, ) {} } /** - * Array of mutations requested on the access code, each containing the mutation type and from/to values. + * Errors associated with the device. */ - class RequestedMutations + class DeviceErrors { - public static function from_json(mixed $json): RequestedMutations|null + public static function from_json(mixed $json): DeviceErrors|null { if (!$json) { return null; } return new self( - from: $json->from ?? null, - mutation_code: $json->mutation_code ?? null, - to: $json->to ?? null, + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, ); } public function __construct( /** - * Code identifying the type of mutation requested, such as `updating_name`, `updating_code`, `updating_time_frame`, or `deleting`. + * Date and time at which Seam created the error. */ - public string|null $mutation_code, + public string|null $created_at, /** - * Previous property values before the requested change. Keys depend on the mutation type. Absent for non-property mutations like `deleting`. - * - * @var array|\stdClass|null + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public array|\stdClass|null $from = null, + public string|null $error_code, /** - * New property values after the requested change. Keys depend on the mutation type. Absent for non-property mutations like `deleting`. - * - * @var array|\stdClass|null + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public array|\stdClass|null $to = null, + public string|null $message, ) {} } - class To + /** + * Warnings associated with the device. + */ + class DeviceWarnings { - public static function from_json(mixed $json): To|null + public static function from_json(mixed $json): DeviceWarnings|null { if (!$json) { 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, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, ); } public function __construct( /** - * New pin code. + * Date and time at which Seam created the warning. */ - public string|null $code, + public string|null $created_at, /** - * New end time. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $ends_at, + public string|null $message, /** - * New name of the access code. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $name, + public string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\Event\LockLocked { + enum Method: string + { + case KEYCODE = "keycode"; + case MANUAL = "manual"; + case AUTOMATIC = "automatic"; + case UNKNOWN = "unknown"; + case REMOTE = "remote"; + case CARD = "card"; + } +} + +namespace Seam\Resources\Event\LockUnlocked { + enum Method: string + { + case KEYCODE = "keycode"; + case MANUAL = "manual"; + case AUTOMATIC = "automatic"; + case UNKNOWN = "unknown"; + case REMOTE = "remote"; + case CARD = "card"; + } +} + +namespace Seam\Resources\Event\LockAccessDenied { + /** + * Why access was denied, when the provider reports a determinable cause. Omitted when unknown. + */ + class Reason + { + public static function from_json(mixed $json): Reason|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + reason_code: is_string($json->reason_code ?? null) + ? \Seam\Resources\Event\LockAccessDenied\Reason\ReasonCode::tryFrom( + $json->reason_code, + ) + : null, + ); + } + + public function __construct( /** - * New start time. + * Human-readable explanation of why access was denied. */ - public string|null $starts_at, + public string|null $message, + /** + * Normalized reason a lock denied access. Provider-agnostic; not all providers report every value. + */ + public \Seam\Resources\Event\LockAccessDenied\Reason\ReasonCode|null $reason_code, ) {} } } + +namespace Seam\Resources\Event\LockAccessDenied\Reason { + enum ReasonCode: string + { + case UNKNOWN_CODE = "unknown_code"; + case EXPIRED_CODE = "expired_code"; + case BLOCKLISTED_CODE = "blocklisted_code"; + case TOO_MANY_ATTEMPTS = "too_many_attempts"; + case BLOCKED_BY_PRIVACY_MODE = "blocked_by_privacy_mode"; + case CREDENTIAL_ERROR = "credential_error"; + } +} + +namespace Seam\Resources\Event\ThermostatManuallyAdjusted { + enum FanModeSetting: string + { + case AUTO = "auto"; + case ON = "on"; + case CIRCULATE = "circulate"; + } + + enum HvacModeSetting: string + { + case OFF = "off"; + case HEAT = "heat"; + case COOL = "cool"; + case HEAT_COOL = "heat_cool"; + case ECO = "eco"; + } + + enum Method: string + { + case SEAM = "seam"; + case EXTERNAL = "external"; + } +} + +namespace Seam\Resources\Event\CameraActivated { + enum ActivationReason: string + { + case MOTION_DETECTED = "motion_detected"; + } + + enum MotionSubType: string + { + case HUMAN = "human"; + case VEHICLE = "vehicle"; + case PACKAGE = "package"; + case OTHER = "other"; + } +} diff --git a/src/Resources/InstantKey.php b/src/Resources/InstantKey.php index f24095a0..b55c18a0 100644 --- a/src/Resources/InstantKey.php +++ b/src/Resources/InstantKey.php @@ -16,16 +16,18 @@ public static function from_json(mixed $json): InstantKey|null return new self( client_session_id: $json->client_session_id ?? null, created_at: $json->created_at ?? null, - customization: isset($json->customization) - ? InstantKey\Customization::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, + customization: isset($json->customization) + ? \Seam\Resources\InstantKey\Customization::from_json( + $json->customization, + ) + : null, + customization_profile_id: $json->customization_profile_id ?? + null, ); } @@ -61,7 +63,7 @@ public function __construct( /** * Customization applied to the Instant Key UI. */ - public InstantKey\Customization|null $customization = null, + public \Seam\Resources\InstantKey\Customization|null $customization = null, /** * ID of the customization profile associated with the Instant Key. */ diff --git a/src/Resources/NoiseThreshold.php b/src/Resources/NoiseThreshold.php index 24d7e7e0..94f75866 100644 --- a/src/Resources/NoiseThreshold.php +++ b/src/Resources/NoiseThreshold.php @@ -18,8 +18,8 @@ public static function from_json(mixed $json): NoiseThreshold|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, + noise_threshold_nrs: $json->noise_threshold_nrs ?? null, ); } diff --git a/src/Resources/Phone.php b/src/Resources/Phone.php index c56b8b5e..22e3a981 100644 --- a/src/Resources/Phone.php +++ b/src/Resources/Phone.php @@ -15,21 +15,27 @@ public static function from_json(mixed $json): Phone|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, + device_type: is_string($json->device_type ?? null) + ? \Seam\Resources\Phone\DeviceType::tryFrom( + $json->device_type, + ) + : null, display_name: $json->display_name ?? null, errors: array_map( - fn($e) => Phone\Errors::from_json($e), + fn($e) => \Seam\Resources\Phone\Errors::from_json($e), $json->errors ?? [], ), - nickname: $json->nickname ?? null, properties: isset($json->properties) - ? Phone\Properties::from_json($json->properties) + ? \Seam\Resources\Phone\Properties::from_json( + $json->properties, + ) : null, warnings: array_map( - fn($w) => Phone\Warnings::from_json($w), + fn($w) => \Seam\Resources\Phone\Warnings::from_json($w), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + nickname: $json->nickname ?? null, ); } @@ -51,21 +57,25 @@ public function __construct( /** * Type of the phone device, such as `ios_phone` or `android_phone`. */ - public string|null $device_type, + public \Seam\Resources\Phone\DeviceType|null $device_type, /** * Display name of the phone. Defaults to `nickname` (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the phone easily, especially when there are numerous phones. */ public string|null $display_name, /** * Errors associated with the phone. + * + * @var list<\Seam\Resources\Phone\Errors> */ public array $errors, /** * Properties of the phone. */ - public Phone\Properties|null $properties, + public \Seam\Resources\Phone\Properties|null $properties, /** * Warnings associated with the phone. + * + * @var list<\Seam\Resources\Phone\Warnings> */ public array $warnings, /** @@ -128,14 +138,14 @@ public static function from_json(mixed $json): Properties|null assa_abloy_credential_service_metadata: isset( $json->assa_abloy_credential_service_metadata, ) - ? Properties\AssaAbloyCredentialServiceMetadata::from_json( + ? \Seam\Resources\Phone\Properties\AssaAbloyCredentialServiceMetadata::from_json( $json->assa_abloy_credential_service_metadata, ) : null, salto_space_credential_service_metadata: isset( $json->salto_space_credential_service_metadata, ) - ? Properties\SaltoSpaceCredentialServiceMetadata::from_json( + ? \Seam\Resources\Phone\Properties\SaltoSpaceCredentialServiceMetadata::from_json( $json->salto_space_credential_service_metadata, ) : null, @@ -146,11 +156,11 @@ public function __construct( /** * ASSA ABLOY Credential Service metadata for the phone. */ - public Properties\AssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata = null, + public \Seam\Resources\Phone\Properties\AssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata = null, /** * Salto Space credential service metadata for the phone. */ - public Properties\SaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata = null, + public \Seam\Resources\Phone\Properties\SaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata = null, ) {} } @@ -186,6 +196,12 @@ public function __construct( public string|null $warning_code, ) {} } + + enum DeviceType: string + { + case IOS_PHONE = "ios_phone"; + case ANDROID_PHONE = "android_phone"; + } } namespace Seam\Resources\Phone\Properties { @@ -204,7 +220,7 @@ public static function from_json( endpoints: array_map( fn( $e, - ) => AssaAbloyCredentialServiceMetadata\Endpoints::from_json( + ) => \Seam\Resources\Phone\Properties\AssaAbloyCredentialServiceMetadata\Endpoints::from_json( $e, ), $json->endpoints ?? [], @@ -216,6 +232,8 @@ public static function from_json( public function __construct( /** * Endpoints associated with the phone. + * + * @var list<\Seam\Resources\Phone\Properties\AssaAbloyCredentialServiceMetadata\Endpoints>|null */ public array|null $endpoints = null, /** diff --git a/src/Resources/Space.php b/src/Resources/Space.php index f5d9a754..b93e0512 100644 --- a/src/Resources/Space.php +++ b/src/Resources/Space.php @@ -14,19 +14,23 @@ public static function from_json(mixed $json): Space|null return new self( acs_entrance_count: $json->acs_entrance_count ?? null, created_at: $json->created_at ?? null, + device_count: $json->device_count ?? null, + display_name: $json->display_name ?? null, + name: $json->name ?? null, + space_id: $json->space_id ?? null, + workspace_id: $json->workspace_id ?? null, customer_data: isset($json->customer_data) - ? Space\CustomerData::from_json($json->customer_data) + ? \Seam\Resources\Space\CustomerData::from_json( + $json->customer_data, + ) : null, customer_key: $json->customer_key ?? null, - device_count: $json->device_count ?? null, - display_name: $json->display_name ?? null, geolocation: isset($json->geolocation) - ? Space\Geolocation::from_json($json->geolocation) + ? \Seam\Resources\Space\Geolocation::from_json( + $json->geolocation, + ) : null, - name: $json->name ?? null, - space_id: $json->space_id ?? null, space_key: $json->space_key ?? null, - workspace_id: $json->workspace_id ?? null, ); } @@ -62,7 +66,7 @@ public function __construct( /** * Reservation/stay-related defaults for the space. Also carries the provider/PMS-supplied name under a `_name` key (e.g. `guesty_name`), which Seam preserves when you rename the space (read-only — managed by Seam). */ - public Space\CustomerData|null $customer_data = null, + public \Seam\Resources\Space\CustomerData|null $customer_data = null, /** * Customer key associated with the space. */ @@ -70,7 +74,7 @@ public function __construct( /** * Geographic coordinates (latitude and longitude) of the space. */ - public Space\Geolocation|null $geolocation = null, + public \Seam\Resources\Space\Geolocation|null $geolocation = null, /** * Unique key for the space within the workspace. */ diff --git a/src/Resources/ThermostatDailyProgram.php b/src/Resources/ThermostatDailyProgram.php index 1733a4dc..e19bb791 100644 --- a/src/Resources/ThermostatDailyProgram.php +++ b/src/Resources/ThermostatDailyProgram.php @@ -17,7 +17,11 @@ public static function from_json( device_id: $json->device_id ?? null, name: $json->name ?? null, periods: array_map( - fn($p) => ThermostatDailyProgram\Periods::from_json($p), + fn( + $p, + ) => \Seam\Resources\ThermostatDailyProgram\Periods::from_json( + $p, + ), $json->periods ?? [], ), thermostat_daily_program_id: $json->thermostat_daily_program_id ?? @@ -41,6 +45,8 @@ public function __construct( public string|null $name, /** * Array of thermostat daily program periods. + * + * @var list<\Seam\Resources\ThermostatDailyProgram\Periods> */ public array $periods, /** diff --git a/src/Resources/ThermostatSchedule.php b/src/Resources/ThermostatSchedule.php index 0ebf3370..225123db 100644 --- a/src/Resources/ThermostatSchedule.php +++ b/src/Resources/ThermostatSchedule.php @@ -17,16 +17,20 @@ public static function from_json(mixed $json): ThermostatSchedule|null device_id: $json->device_id ?? null, ends_at: $json->ends_at ?? null, errors: array_map( - fn($e) => ThermostatSchedule\Errors::from_json($e), + fn( + $e, + ) => \Seam\Resources\ThermostatSchedule\Errors::from_json( + $e, + ), $json->errors ?? [], ), - is_override_allowed: $json->is_override_allowed ?? 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, + is_override_allowed: $json->is_override_allowed ?? null, + max_override_period_minutes: $json->max_override_period_minutes ?? + null, ); } @@ -49,6 +53,8 @@ public function __construct( public string|null $ends_at, /** * Errors associated with the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules). + * + * @var list<\Seam\Resources\ThermostatSchedule\Errors> */ public array $errors, /** diff --git a/src/Resources/UnmanagedAccessCode.php b/src/Resources/UnmanagedAccessCode.php index 61863afe..38469560 100644 --- a/src/Resources/UnmanagedAccessCode.php +++ b/src/Resources/UnmanagedAccessCode.php @@ -23,34 +23,50 @@ public static function from_json(mixed $json): UnmanagedAccessCode|null } return new self( 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, created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, - dormakaba_oracode_metadata: isset( - $json->dormakaba_oracode_metadata, - ) - ? UnmanagedAccessCode\DormakabaOracodeMetadata::from_json( - $json->dormakaba_oracode_metadata, - ) - : null, - ends_at: $json->ends_at ?? null, errors: array_map( - fn($e) => UnmanagedAccessCode\Errors::from_json($e), + fn( + $e, + ) => \Seam\Resources\UnmanagedAccessCode\Errors::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, + status: is_string($json->status ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Status::tryFrom( + $json->status, + ) + : null, + type: is_string($json->type ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Type::tryFrom( + $json->type, + ) + : null, warnings: array_map( - fn($w) => UnmanagedAccessCode\Warnings::from_json($w), + fn( + $w, + ) => \Seam\Resources\UnmanagedAccessCode\Warnings::from_json( + $w, + ), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + cannot_be_managed: $json->cannot_be_managed ?? null, + cannot_delete_unmanaged_access_code: $json->cannot_delete_unmanaged_access_code ?? + null, + dormakaba_oracode_metadata: isset( + $json->dormakaba_oracode_metadata, + ) + ? \Seam\Resources\UnmanagedAccessCode\DormakabaOracodeMetadata::from_json( + $json->dormakaba_oracode_metadata, + ) + : null, + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, ); } @@ -73,6 +89,8 @@ public function __construct( public string|null $device_id, /** * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * + * @var list<\Seam\Resources\UnmanagedAccessCode\Errors> */ public array $errors, /** @@ -86,13 +104,15 @@ public function __construct( /** * Current status of the access code within the operational lifecycle. `set` indicates that the code is active and operational. `unset` indicates that the code exists on the provider but is not usable on the device. */ - public string|null $status, + public \Seam\Resources\UnmanagedAccessCode\Status|null $status, /** * Type of the access code. `ongoing` access codes are active continuously until deactivated manually. `time_bound` access codes have a specific duration. */ - public string|null $type, + public \Seam\Resources\UnmanagedAccessCode\Type|null $type, /** * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * + * @var list<\Seam\Resources\UnmanagedAccessCode\Warnings> */ public array $warnings, /** @@ -110,7 +130,7 @@ public function __construct( /** * Metadata for a dormakaba Oracode unmanaged access code. Only present for unmanaged access codes from dormakaba Oracode devices. */ - public UnmanagedAccessCode\DormakabaOracodeMetadata|null $dormakaba_oracode_metadata = null, + public \Seam\Resources\UnmanagedAccessCode\DormakabaOracodeMetadata|null $dormakaba_oracode_metadata = null, /** * Date and time after which the time-bound access code becomes inactive. */ @@ -186,188 +206,1952 @@ public function __construct( /** * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - 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) => Errors\ModifiedFields::from_json($m), - $json->modified_fields ?? [], + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::PROVIDER_ISSUE + => \Seam\Resources\UnmanagedAccessCode\Errors\ProviderIssue::from_json( + $json, ), - unmanaged_access_code_id: $json->unmanaged_access_code_id ?? - null, - ); + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::FAILED_TO_SET_ON_DEVICE + => \Seam\Resources\UnmanagedAccessCode\Errors\FailedToSetOnDevice::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::FAILED_TO_REMOVE_FROM_DEVICE + => \Seam\Resources\UnmanagedAccessCode\Errors\FailedToRemoveFromDevice::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::DUPLICATE_CODE_ON_DEVICE + => \Seam\Resources\UnmanagedAccessCode\Errors\DuplicateCodeOnDevice::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::NO_SPACE_FOR_ACCESS_CODE_ON_DEVICE + => \Seam\Resources\UnmanagedAccessCode\Errors\NoSpaceForAccessCodeOnDevice::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::CONFLICTING_EXTERNAL_MODIFICATION + => \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::ACCESS_CODE_INACTIVE + => \Seam\Resources\UnmanagedAccessCode\Errors\AccessCodeInactive::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::ACCOUNT_DISCONNECTED + => \Seam\Resources\UnmanagedAccessCode\Errors\AccountDisconnected::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED + => \Seam\Resources\UnmanagedAccessCode\Errors\SaltoKsSubscriptionLimitExceeded::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::INSUFFICIENT_PERMISSIONS + => \Seam\Resources\UnmanagedAccessCode\Errors\InsufficientPermissions::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::DORMAKABA_SITES_DISCONNECTED + => \Seam\Resources\UnmanagedAccessCode\Errors\DormakabaSitesDisconnected::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::DEVICE_OFFLINE + => \Seam\Resources\UnmanagedAccessCode\Errors\DeviceOffline::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::DEVICE_REMOVED + => \Seam\Resources\UnmanagedAccessCode\Errors\DeviceRemoved::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::HUB_DISCONNECTED + => \Seam\Resources\UnmanagedAccessCode\Errors\HubDisconnected::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::DEVICE_DISCONNECTED + => \Seam\Resources\UnmanagedAccessCode\Errors\DeviceDisconnected::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::EMPTY_BACKUP_ACCESS_CODE_POOL + => \Seam\Resources\UnmanagedAccessCode\Errors\EmptyBackupAccessCodePool::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::AUGUST_LOCK_NOT_AUTHORIZED + => \Seam\Resources\UnmanagedAccessCode\Errors\AugustLockNotAuthorized::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS + => \Seam\Resources\UnmanagedAccessCode\Errors\MissingDeviceCredentials::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::AUXILIARY_HEAT_RUNNING + => \Seam\Resources\UnmanagedAccessCode\Errors\AuxiliaryHeatRunning::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::SUBSCRIPTION_REQUIRED + => \Seam\Resources\UnmanagedAccessCode\Errors\SubscriptionRequired::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::BRIDGE_DISCONNECTED + => \Seam\Resources\UnmanagedAccessCode\Errors\BridgeDisconnected::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedAccessCode\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, /** - * Indicates that this is an access code error. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public true|null $is_access_code_error, - public bool|null $is_connected_account_error, - public bool|null $is_device_error, + public string|null $message, + ) {} + } + + /** + * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + */ + abstract class Warnings + { + public static function from_json(mixed $json): Warnings|null + { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::CODE_ROTATES_PERIODICALLY + => \Seam\Resources\UnmanagedAccessCode\Warnings\CodeRotatesPeriodically::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::TIME_FRAME_ADJUSTED_FOR_UNKNOWN_TIME_ZONE + => \Seam\Resources\UnmanagedAccessCode\Warnings\TimeFrameAdjustedForUnknownTimeZone::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::EXTERNAL_MODIFICATION_IN_EFFECT + => \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::DELAY_IN_SETTING_ON_DEVICE + => \Seam\Resources\UnmanagedAccessCode\Warnings\DelayInSettingOnDevice::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::DELAY_IN_REMOVING_FROM_DEVICE + => \Seam\Resources\UnmanagedAccessCode\Warnings\DelayInRemovingFromDevice::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::THIRD_PARTY_INTEGRATION_DETECTED + => \Seam\Resources\UnmanagedAccessCode\Warnings\ThirdPartyIntegrationDetected::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::IGLOO_ALGOPIN_MUST_BE_USED_WITHIN_24_HOURS + => \Seam\Resources\UnmanagedAccessCode\Warnings\IglooAlgopinMustBeUsedWithin_24Hours::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::MANAGEMENT_TRANSFERRED + => \Seam\Resources\UnmanagedAccessCode\Warnings\ManagementTransferred::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::USING_BACKUP_ACCESS_CODE + => \Seam\Resources\UnmanagedAccessCode\Warnings\UsingBackupAccessCode::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\UnmanagedAccessCode\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::UNKNOWN_ISSUE_WITH_ACCESS_CODE + => \Seam\Resources\UnmanagedAccessCode\Warnings\UnknownIssueWithAccessCode::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedAccessCode\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, /** - * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $change_type = null, + public \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, /** - * Date and time at which Seam created the error. + * Date and time at which Seam created the warning. */ public string|null $created_at = null, + ) {} + } + + enum Status: string + { + case SET = "set"; + case VALUE_UNSET = "unset"; + } + + enum Type: string + { + case TIME_BOUND = "time_bound"; + case ONGOING = "ongoing"; + } +} + +namespace Seam\Resources\UnmanagedAccessCode\Errors { + /** + * Indicates a provider-specific issue that prevents the access code from being set or managed. Check the error message for details. + */ + final class ProviderIssue extends \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): ProviderIssue|null + { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( /** - * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public bool|null $is_bridge_error = null, + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, /** - * ID of the managed access code that conflicts with this managed access code, when Seam can identify it. + * Indicates that this is an access code error. */ - public string|null $managed_access_code_id = null, + public true|null $is_access_code_error, /** - * List of fields that were changed externally, with their previous and new values. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public array|null $modified_fields = null, + string|null $message, /** - * ID of the unmanaged access code that conflicts with this managed access code, when Seam can identify it. + * Date and time at which Seam created the error. */ - public string|null $unmanaged_access_code_id = null, - ) {} + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } } /** - * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * Failed to set code on device. */ - class Warnings + final class FailedToSetOnDevice extends + \Seam\Resources\UnmanagedAccessCode\Errors { - public static function from_json(mixed $json): Warnings|null + public static function from_json(mixed $json): FailedToSetOnDevice|null { if (!$json) { return null; } return new self( - change_type: $json->change_type ?? null, - created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, - modified_fields: array_map( - fn($m) => Warnings\ModifiedFields::from_json($m), - $json->modified_fields ?? [], - ), - warning_code: $json->warning_code ?? null, + created_at: $json->created_at ?? null, ); } public function __construct( /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $message, + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * Indicates that this is an access code error. */ - public string|null $warning_code, + public true|null $is_access_code_error, /** - * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $change_type = null, + string|null $message, /** - * Date and time at which Seam created the warning. + * Date and time at which Seam created the error. */ public string|null $created_at = null, - /** - * List of fields that were changed externally, with their previous and new values. - */ - public array|null $modified_fields = null, - ) {} + ) { + parent::__construct(error_code: $error_code, message: $message); + } } -} -namespace Seam\Resources\UnmanagedAccessCode\Errors { /** - * List of fields that were changed externally, with their previous and new values. + * Failed to remove code from device. */ - class ModifiedFields + final class FailedToRemoveFromDevice extends + \Seam\Resources\UnmanagedAccessCode\Errors { - public static function from_json(mixed $json): ModifiedFields|null - { + public static function from_json( + mixed $json, + ): FailedToRemoveFromDevice|null { if (!$json) { return null; } return new self( - field: $json->field ?? null, - from: $json->from ?? null, - to: $json->to ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, ); } public function __construct( /** - * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $field, + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, /** - * The previous value of the field. + * Indicates that this is an access code error. */ - public string|null $from, + public true|null $is_access_code_error, /** - * The new value of the field. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $to, - ) {} + string|null $message, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } } -} -namespace Seam\Resources\UnmanagedAccessCode\Warnings { /** - * List of fields that were changed externally, with their previous and new values. + * Duplicate access code detected on device. */ - class ModifiedFields + final class DuplicateCodeOnDevice extends + \Seam\Resources\UnmanagedAccessCode\Errors { - public static function from_json(mixed $json): ModifiedFields|null - { + public static function from_json( + mixed $json, + ): DuplicateCodeOnDevice|null { if (!$json) { return null; } return new self( - field: $json->field ?? null, - from: $json->from ?? null, - to: $json->to ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, + managed_access_code_id: $json->managed_access_code_id ?? null, + unmanaged_access_code_id: $json->unmanaged_access_code_id ?? + null, ); } public function __construct( /** - * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $field, + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, /** - * The previous value of the field. + * Indicates that this is an access code error. */ - public string|null $from, + public true|null $is_access_code_error, /** - * The new value of the field. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $to, - ) {} + string|null $message, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + /** + * ID of the managed access code that conflicts with this managed access code, when Seam can identify it. + */ + public string|null $managed_access_code_id = null, + /** + * ID of the unmanaged access code that conflicts with this managed access code, when Seam can identify it. + */ + public string|null $unmanaged_access_code_id = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * No space for access code on device. + */ + final class NoSpaceForAccessCodeOnDevice extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json( + mixed $json, + ): NoSpaceForAccessCodeOnDevice|null { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that this is an access code error. + */ + public true|null $is_access_code_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Code was modified or removed externally after Seam successfully set it on the device. The external change conflicts with the state that Seam is trying to apply, so Seam will attempt to set the code on the device again. + */ + final class ConflictingExternalModification extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json( + mixed $json, + ): ConflictingExternalModification|null { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + change_type: is_string($json->change_type ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ChangeType::tryFrom( + $json->change_type, + ) + : null, + created_at: $json->created_at ?? null, + modified_fields: array_map( + fn( + $m, + ) => \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ModifiedFields::from_json( + $m, + ), + $json->modified_fields ?? [], + ), + ); + } + + public function __construct( + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that this is an access code error. + */ + public true|null $is_access_code_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + */ + public \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ChangeType|null $change_type = null, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + /** + * List of fields that were changed externally, with their previous and new values. + * + * @var list<\Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ModifiedFields>|null + */ + public array|null $modified_fields = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the access code is disabled or inactive on the device. The code exists but will not grant access until re-enabled. + */ + final class AccessCodeInactive extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): AccessCodeInactive|null + { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_access_code_error: $json->is_access_code_error ?? null, + message: $json->message ?? null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that this is an access code error. + */ + public true|null $is_access_code_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the account is disconnected. + */ + final class AccountDisconnected extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): AccountDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the Salto site user limit has been reached. + */ + final class SaltoKsSubscriptionLimitExceeded extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitExceeded|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that Seam's integration user does not have sufficient permissions on the provider's system to which this device belongs, so Seam cannot manage access codes or unlock the device. See the error message for specifics, then either reauthorize the connected account in Seam or grant the integration user the required permissions in the provider's system. + */ + final class InsufficientPermissions extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json( + mixed $json, + ): InsufficientPermissions|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that one or more dormakaba sites associated with the connected account could not be connected. Contact dormakaba support. + */ + final class DormakabaSitesDisconnected extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json( + mixed $json, + ): DormakabaSitesDisconnected|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the device is offline. + */ + final class DeviceOffline extends \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): DeviceOffline|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the device has been removed. + */ + final class DeviceRemoved extends \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): DeviceRemoved|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the hub is disconnected. + */ + final class HubDisconnected extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): HubDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the device is disconnected. + */ + final class DeviceDisconnected extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): DeviceDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) is empty. + */ + final class EmptyBackupAccessCodePool extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json( + mixed $json, + ): EmptyBackupAccessCodePool|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the user is not authorized to use the August lock. + */ + final class AugustLockNotAuthorized extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json( + mixed $json, + ): AugustLockNotAuthorized|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that device credentials are missing. + */ + final class MissingDeviceCredentials extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json( + mixed $json, + ): MissingDeviceCredentials|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the auxiliary heat is running. + */ + final class AuxiliaryHeatRunning extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): AuxiliaryHeatRunning|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that a subscription is required to connect. + */ + final class SubscriptionRequired extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): SubscriptionRequired|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Indicates that the Seam API cannot communicate with [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge), for example, if the Seam Bridge executable has stopped or if the computer running the Seam Bridge executable is offline. See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-seam_bridge_disconnected). + */ + final class BridgeDisconnected extends + \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): BridgeDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + public bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + public bool|null $is_connected_account_error = null, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + /** + * Fallback for unmanaged_access_code.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + + enum ErrorCode: string + { + case PROVIDER_ISSUE = "provider_issue"; + case FAILED_TO_SET_ON_DEVICE = "failed_to_set_on_device"; + case FAILED_TO_REMOVE_FROM_DEVICE = "failed_to_remove_from_device"; + case DUPLICATE_CODE_ON_DEVICE = "duplicate_code_on_device"; + case NO_SPACE_FOR_ACCESS_CODE_ON_DEVICE = "no_space_for_access_code_on_device"; + case CONFLICTING_EXTERNAL_MODIFICATION = "conflicting_external_modification"; + case ACCESS_CODE_INACTIVE = "access_code_inactive"; + case ACCOUNT_DISCONNECTED = "account_disconnected"; + case SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED = "salto_ks_subscription_limit_exceeded"; + case INSUFFICIENT_PERMISSIONS = "insufficient_permissions"; + case DORMAKABA_SITES_DISCONNECTED = "dormakaba_sites_disconnected"; + case DEVICE_OFFLINE = "device_offline"; + case DEVICE_REMOVED = "device_removed"; + case HUB_DISCONNECTED = "hub_disconnected"; + case DEVICE_DISCONNECTED = "device_disconnected"; + case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; + case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; + case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; + case SUBSCRIPTION_REQUIRED = "subscription_required"; + case BRIDGE_DISCONNECTED = "bridge_disconnected"; + } +} + +namespace Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification { + /** + * List of fields that were changed externally, with their previous and new values. + */ + class ModifiedFields + { + public static function from_json(mixed $json): ModifiedFields|null + { + if (!$json) { + return null; + } + return new self( + field: $json->field ?? null, + from: $json->from ?? null, + to: $json->to ?? null, + ); + } + + public function __construct( + /** + * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). + */ + public string|null $field, + /** + * The previous value of the field. + */ + public string|null $from, + /** + * The new value of the field. + */ + public string|null $to, + ) {} + } + + enum ChangeType: string + { + case MODIFIED = "modified"; + case REMOVED = "removed"; + } +} + +namespace Seam\Resources\UnmanagedAccessCode\Warnings { + /** + * The access code's PIN rotates periodically when the code is renewed. Retrieve the latest code before each use. + */ + final class CodeRotatesPeriodically extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): CodeRotatesPeriodically|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * The device's time zone is unknown and this code's time frame crosses a daylight-saving transition in at least one plausible time zone. A 1-hour safety buffer has been applied to the side of the time frame affected by the transition (`ends_at` for spring-forward, `starts_at` for fall-back) so the code stays active through the shift — the code may be usable up to 1 hour beyond your requested window. Set the device's time zone via `/devices/report_provider_metadata` to clear the buffer and guarantee exact handling. + */ + final class TimeFrameAdjustedForUnknownTimeZone extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): TimeFrameAdjustedForUnknownTimeZone|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Code was modified or removed externally after Seam successfully set it on the device. External modification is allowed for this code, so the externally modified state is being honored. + */ + final class ExternalModificationInEffect extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): ExternalModificationInEffect|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + change_type: is_string($json->change_type ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ChangeType::tryFrom( + $json->change_type, + ) + : null, + created_at: $json->created_at ?? null, + modified_fields: array_map( + fn( + $m, + ) => \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ModifiedFields::from_json( + $m, + ), + $json->modified_fields ?? [], + ), + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + */ + public \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ChangeType|null $change_type = null, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + /** + * List of fields that were changed externally, with their previous and new values. + * + * @var list<\Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ModifiedFields>|null + */ + public array|null $modified_fields = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Delay in setting code on device. + */ + final class DelayInSettingOnDevice extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): DelayInSettingOnDevice|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Delay in removing code from device. + */ + final class DelayInRemovingFromDevice extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): DelayInRemovingFromDevice|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Third-party integration detected that may cause access codes to fail. + */ + final class ThirdPartyIntegrationDetected extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): ThirdPartyIntegrationDetected|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Algopins must be used within 24 hours. + */ + final class IglooAlgopinMustBeUsedWithin_24Hours extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): IglooAlgopinMustBeUsedWithin_24Hours|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Management was transferred to another workspace. + */ + final class ManagementTransferred extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): ManagementTransferred|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * A backup access code has been pulled and is being used in place of this access code. + */ + final class UsingBackupAccessCode extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): UsingBackupAccessCode|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Access code is being deleted. + */ + final class BeingDeleted extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * An unknown issue occurred with the access code. + */ + final class UnknownIssueWithAccessCode extends + \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json( + mixed $json, + ): UnknownIssueWithAccessCode|null { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for unmanaged_access_code.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedAccessCode\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case CODE_ROTATES_PERIODICALLY = "code_rotates_periodically"; + case TIME_FRAME_ADJUSTED_FOR_UNKNOWN_TIME_ZONE = "time_frame_adjusted_for_unknown_time_zone"; + case EXTERNAL_MODIFICATION_IN_EFFECT = "external_modification_in_effect"; + case DELAY_IN_SETTING_ON_DEVICE = "delay_in_setting_on_device"; + case DELAY_IN_REMOVING_FROM_DEVICE = "delay_in_removing_from_device"; + case THIRD_PARTY_INTEGRATION_DETECTED = "third_party_integration_detected"; + case IGLOO_ALGOPIN_MUST_BE_USED_WITHIN_24_HOURS = "igloo_algopin_must_be_used_within_24_hours"; + case MANAGEMENT_TRANSFERRED = "management_transferred"; + case USING_BACKUP_ACCESS_CODE = "using_backup_access_code"; + case BEING_DELETED = "being_deleted"; + case UNKNOWN_ISSUE_WITH_ACCESS_CODE = "unknown_issue_with_access_code"; + } +} + +namespace Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect { + /** + * List of fields that were changed externally, with their previous and new values. + */ + class ModifiedFields + { + public static function from_json(mixed $json): ModifiedFields|null + { + if (!$json) { + return null; + } + return new self( + field: $json->field ?? null, + from: $json->from ?? null, + to: $json->to ?? null, + ); + } + + public function __construct( + /** + * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). + */ + public string|null $field, + /** + * The previous value of the field. + */ + public string|null $from, + /** + * The new value of the field. + */ + public string|null $to, + ) {} + } + + enum ChangeType: string + { + case MODIFIED = "modified"; + case REMOVED = "removed"; } } diff --git a/src/Resources/UnmanagedAccessGrant.php b/src/Resources/UnmanagedAccessGrant.php index 03726d3b..9d4fccb5 100644 --- a/src/Resources/UnmanagedAccessGrant.php +++ b/src/Resources/UnmanagedAccessGrant.php @@ -18,13 +18,19 @@ public static function from_json(mixed $json): UnmanagedAccessGrant|null display_name: $json->display_name ?? null, ends_at: $json->ends_at ?? null, errors: array_map( - fn($e) => UnmanagedAccessGrant\Errors::from_json($e), + fn( + $e, + ) => \Seam\Resources\UnmanagedAccessGrant\Errors::from_json( + $e, + ), $json->errors ?? [], ), location_ids: $json->location_ids ?? null, name: $json->name ?? null, pending_mutations: array_map( - fn($p) => UnmanagedAccessGrant\PendingMutations::from_json( + fn( + $p, + ) => \Seam\Resources\UnmanagedAccessGrant\PendingMutations::from_json( $p, ), $json->pending_mutations ?? [], @@ -32,20 +38,24 @@ public static function from_json(mixed $json): UnmanagedAccessGrant|null requested_access_methods: array_map( fn( $r, - ) => UnmanagedAccessGrant\RequestedAccessMethods::from_json( + ) => \Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods::from_json( $r, ), $json->requested_access_methods ?? [], ), - 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) => UnmanagedAccessGrant\Warnings::from_json($w), + fn( + $w, + ) => \Seam\Resources\UnmanagedAccessGrant\Warnings::from_json( + $w, + ), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + reservation_key: $json->reservation_key ?? null, + user_identity_id: $json->user_identity_id ?? null, ); } @@ -56,6 +66,8 @@ public function __construct( public string|null $access_grant_id, /** * IDs of the access methods created for the Access Grant. + * + * @var list|null */ public array|null $access_method_ids, /** @@ -72,9 +84,12 @@ public function __construct( public string|null $ends_at, /** * Errors associated with the [access grant](https://docs.seam.co/use-cases/granting-access). + * + * @var list<\Seam\Resources\UnmanagedAccessGrant\Errors> */ public array $errors, /** + * @var list|null * @deprecated Use `space_ids`. */ public array|null $location_ids, @@ -84,14 +99,20 @@ public function __construct( public string|null $name, /** * List of pending mutations for the access grant. This shows updates that are in progress. + * + * @var list<\Seam\Resources\UnmanagedAccessGrant\PendingMutations> */ public array $pending_mutations, /** * Access methods that the user requested for the Access Grant. + * + * @var list<\Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods> */ public array $requested_access_methods, /** * IDs of the spaces to which the Access Grant gives access. + * + * @var list|null */ public array|null $space_ids, /** @@ -100,6 +121,8 @@ public function __construct( public string|null $starts_at, /** * Warnings associated with the [access grant](https://docs.seam.co/use-cases/granting-access). + * + * @var list<\Seam\Resources\UnmanagedAccessGrant\Warnings> */ public array $warnings, /** @@ -122,19 +145,29 @@ public function __construct( /** * Errors associated with the [access grant](https://docs.seam.co/use-cases/granting-access). */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, - missing_device_ids: $json->missing_device_ids ?? null, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode::CANNOT_CREATE_REQUESTED_ACCESS_METHODS + => \Seam\Resources\UnmanagedAccessGrant\Errors\CannotCreateRequestedAccessMethods::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedAccessGrant\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -145,13 +178,15 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, /** * IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure. + * + * @var list|null */ public array|null $missing_device_ids = null, ) {} @@ -160,43 +195,48 @@ public function __construct( /** * List of pending mutations for the access grant. This shows updates that are in progress. */ - class PendingMutations + abstract class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { if (!$json) { return null; } - return new self( - access_method_ids: $json->access_method_ids ?? null, - created_at: $json->created_at ?? null, - from: isset($json->from) - ? PendingMutations\From::from_json($json->from) - : null, - message: $json->message ?? null, - mutation_code: $json->mutation_code ?? null, - to: isset($json->to) - ? PendingMutations\To::from_json($json->to) - : null, - ); + $discriminant = is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::UPDATING_SPACES + => \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingSpaces::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::UPDATING_ACCESS_TIMES + => \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingAccessTimes::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedAccessGrant\PendingMutations\Unknown::from_json( + $json, + ), + }; } public function __construct( - /** - * IDs of the access methods being updated. - */ - public array|null $access_method_ids, /** * Date and time at which the mutation was created. */ public string|null $created_at, - public PendingMutations\From|null $from, /** * Detailed description of the mutation. */ public string|null $message, - public string|null $mutation_code, - public PendingMutations\To|null $to, + /** + * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + */ + public \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode|string|null $mutation_code, ) {} } @@ -212,20 +252,26 @@ public static function from_json( return null; } return new self( - 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, + mode: is_string($json->mode ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods\Mode::tryFrom( + $json->mode, + ) + : null, + code: $json->code ?? null, instant_key_max_use_count: $json->instant_key_max_use_count ?? null, - mode: $json->mode ?? null, ); } public function __construct( /** * IDs of the access methods created for the requested access method. + * + * @var list|null */ public array|null $created_access_method_ids, /** @@ -239,7 +285,7 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public string|null $mode, + public \Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods\Mode|null $mode, /** * Specific PIN code to use for this access method. Only applicable when mode is 'code'. */ @@ -254,165 +300,953 @@ public function __construct( /** * Warnings associated with the [access grant](https://docs.seam.co/use-cases/granting-access). */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\UnmanagedAccessGrant\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::UNDERPROVISIONED_ACCESS + => \Seam\Resources\UnmanagedAccessGrant\Warnings\UnderprovisionedAccess::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::OVERPROVISIONED_ACCESS + => \Seam\Resources\UnmanagedAccessGrant\Warnings\OverprovisionedAccess::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::UPDATING_ACCESS_TIMES + => \Seam\Resources\UnmanagedAccessGrant\Warnings\UpdatingAccessTimes::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::REQUESTED_CODE_UNAVAILABLE + => \Seam\Resources\UnmanagedAccessGrant\Warnings\RequestedCodeUnavailable::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::DEVICE_DOES_NOT_SUPPORT_ACCESS_CODES + => \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceDoesNotSupportAccessCodes::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::DEVICE_TIME_CONSTRAINTS_VIOLATED + => \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedAccessGrant\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\UnmanagedAccessGrant\Errors { + /** + * Indicates that Seam could not create one or more of the requested access methods for the access grant. + */ + final class CannotCreateRequestedAccessMethods extends + \Seam\Resources\UnmanagedAccessGrant\Errors + { + public static function from_json( + mixed $json, + ): CannotCreateRequestedAccessMethods|null { if (!$json) { return null; } return new self( - 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) => Warnings\FailedDevices::from_json($f), - $json->failed_devices ?? [], - ), + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, 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, + missing_device_ids: $json->missing_device_ids ?? null, ); } public function __construct( /** - * IDs of the access methods being updated. + * Date and time at which Seam created the error. */ - public array|null $access_method_ids, + string|null $created_at, /** - * Date and time at which Seam created the warning. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $created_at, - public string|null $device_id, + \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode|string|null $error_code, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $message, + string|null $message, /** - * The new PIN code that was assigned instead. + * IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure. + * + * @var list|null */ - public string|null $new_code, + array|null $missing_device_ids = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + missing_device_ids: $missing_device_ids, + ); + } + } + + /** + * Fallback for unmanaged_access_grant.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedAccessGrant\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + missing_device_ids: $json->missing_device_ids ?? null, + ); + } + + public function __construct( /** - * The originally requested PIN code that was unavailable. + * Date and time at which Seam created the error. */ - public string|null $original_code, + string|null $created_at, /** - * Specific reason why the grant's times are not programmable on the device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $reason, + \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode|string|null $error_code, /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $warning_code, + string|null $message, /** - * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). + * IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure. + * + * @var list|null */ - public array|null $failed_devices = null, - ) {} + array|null $missing_device_ids = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + missing_device_ids: $missing_device_ids, + ); + } + } + + enum ErrorCode: string + { + case CANNOT_CREATE_REQUESTED_ACCESS_METHODS = "cannot_create_requested_access_methods"; } } namespace Seam\Resources\UnmanagedAccessGrant\PendingMutations { - class From + /** + * Seam is in the process of updating the devices/spaces associated with this access grant. + */ + final class UpdatingSpaces extends + \Seam\Resources\UnmanagedAccessGrant\PendingMutations { - public static function from_json(mixed $json): From|null + public static function from_json(mixed $json): UpdatingSpaces|null { if (!$json) { return null; } return new self( - device_ids: $json->device_ids ?? null, - ends_at: $json->ends_at ?? null, - starts_at: $json->starts_at ?? null, + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingSpaces\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingSpaces\To::from_json( + $json->to, + ) + : null, ); } public function __construct( /** - * Previous device IDs where access codes existed. + * Date and time at which the mutation was created. */ - public array|null $device_ids, + string|null $created_at, /** - * Previous end time for access. + * Previous location configuration. */ - public string|null $ends_at, + public \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingSpaces\From|null $from, /** - * Previous start time for access. + * Detailed description of the mutation. */ - public string|null $starts_at, - ) {} + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + */ + \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New location configuration. + */ + public \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingSpaces\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } } - class To + /** + * Seam is in the process of updating the access times for this access grant. + */ + final class UpdatingAccessTimes extends + \Seam\Resources\UnmanagedAccessGrant\PendingMutations { - public static function from_json(mixed $json): To|null + public static function from_json(mixed $json): UpdatingAccessTimes|null { if (!$json) { 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, + access_method_ids: $json->access_method_ids ?? null, + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingAccessTimes\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingAccessTimes\To::from_json( + $json->to, + ) + : null, ); } public function __construct( /** - * New device IDs where access codes should be created. + * IDs of the access methods being updated. + * + * @var list|null */ - public array|null $device_ids, + public array|null $access_method_ids, /** - * New end time for access. + * Date and time at which the mutation was created. */ - public string|null $ends_at, + string|null $created_at, /** - * New start time for access. + * Previous access time configuration. */ - public string|null $starts_at, + public \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingAccessTimes\From|null $from, /** - * Common code key to ensure PIN code reuse across devices. + * Detailed description of the mutation. */ - public string|null $common_code_key = null, - ) {} + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + */ + \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access time configuration. + */ + public \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingAccessTimes\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } } -} -namespace Seam\Resources\UnmanagedAccessGrant\Warnings { /** - * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). + * Fallback for unmanaged_access_grant.pending_mutations values introduced after this SDK version. */ - class FailedDevices + final class Unknown extends + \Seam\Resources\UnmanagedAccessGrant\PendingMutations { - public static function from_json(mixed $json): FailedDevices|null + public static function from_json(mixed $json): Unknown|null { if (!$json) { return null; } return new self( - device_id: $json->device_id ?? null, - error_code: $json->error_code ?? null, + created_at: $json->created_at ?? null, message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ); } public function __construct( /** - * Device whose access code could not be revoked. + * Date and time at which the mutation was created. */ - public string|null $device_id, + string|null $created_at, /** - * Reason the access code could not be revoked (e.g. `offline_access_code_not_revocable`). + * Detailed description of the mutation. */ - public string|null $error_code, + string|null $message, /** - * Human-readable description of why revocation failed. + * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. */ - public string|null $message, + \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + enum MutationCode: string + { + case UPDATING_SPACES = "updating_spaces"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + } +} + +namespace Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingSpaces { + /** + * Previous location configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * Previous device IDs where access codes existed. + * + * @var list|null + */ + public array|null $device_ids, ) {} } + + /** + * New location configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + device_ids: $json->device_ids ?? null, + common_code_key: $json->common_code_key ?? null, + ); + } + + public function __construct( + /** + * New device IDs where access codes should be created. + * + * @var list|null + */ + public array|null $device_ids, + /** + * Common code key to ensure PIN code reuse across devices. + */ + public string|null $common_code_key = null, + ) {} + } +} + +namespace Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingAccessTimes { + /** + * Previous access time configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * Previous end time for access. + */ + public string|null $ends_at, + /** + * Previous start time for access. + */ + public string|null $starts_at, + ) {} + } + + /** + * New access time configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self( + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null, + ); + } + + public function __construct( + /** + * New end time for access. + */ + public string|null $ends_at, + /** + * New start time for access. + */ + public string|null $starts_at, + ) {} + } +} + +namespace Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods { + enum Mode: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } +} + +namespace Seam\Resources\UnmanagedAccessGrant\Warnings { + /** + * Indicates that the [access grant](https://docs.seam.co/use-cases/granting-access) is being deleted. + */ + final class BeingDeleted extends + \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access grant should have access to more locations than it currently does. Access methods are being created for the missing locations. + */ + final class UnderprovisionedAccess extends + \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): UnderprovisionedAccess|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access grant has access to locations it should not have. Access methods are being removed from the extra locations. + */ + final class OverprovisionedAccess extends + \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): OverprovisionedAccess|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + failed_devices: array_map( + fn( + $f, + ) => \Seam\Resources\UnmanagedAccessGrant\Warnings\OverprovisionedAccess\FailedDevices::from_json( + $f, + ), + $json->failed_devices ?? [], + ), + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + /** + * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). + * + * @var list<\Seam\Resources\UnmanagedAccessGrant\Warnings\OverprovisionedAccess\FailedDevices>|null + */ + public array|null $failed_devices = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access times for this [access grant](https://docs.seam.co/use-cases/granting-access) are being updated. + */ + final class UpdatingAccessTimes extends + \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json(mixed $json): UpdatingAccessTimes|null + { + if (!$json) { + return null; + } + return new self( + access_method_ids: $json->access_method_ids ?? null, + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * IDs of the access methods being updated. + * + * @var list|null + */ + public array|null $access_method_ids, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the requested PIN code was already in use on a device, so a different code was assigned. + */ + final class RequestedCodeUnavailable extends + \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): RequestedCodeUnavailable|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + message: $json->message ?? null, + new_code: $json->new_code ?? null, + original_code: $json->original_code ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * ID of the device where the requested code was unavailable. + */ + public string|null $device_id, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * The new PIN code that was assigned instead. + */ + public string|null $new_code, + /** + * The originally requested PIN code that was unavailable. + */ + public string|null $original_code, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that a device in the access grant does not support access codes and was excluded from code materialization. + */ + final class DeviceDoesNotSupportAccessCodes extends + \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): DeviceDoesNotSupportAccessCodes|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * ID of the device that does not support access codes. + */ + public string|null $device_id, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that a device in the access grant cannot program an access code for the grant's time range because of device-specific time constraints. + */ + final class DeviceTimeConstraintsViolated extends + \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json( + mixed $json, + ): DeviceTimeConstraintsViolated|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + device_id: $json->device_id ?? null, + message: $json->message ?? null, + reason: is_string($json->reason ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason::tryFrom( + $json->reason, + ) + : null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * ID of the device whose time constraints the access grant violates. + */ + public string|null $device_id, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Specific reason why the grant's times are not programmable on the device. + */ + public \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason|null $reason, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for unmanaged_access_grant.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case BEING_DELETED = "being_deleted"; + case UNDERPROVISIONED_ACCESS = "underprovisioned_access"; + case OVERPROVISIONED_ACCESS = "overprovisioned_access"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + case REQUESTED_CODE_UNAVAILABLE = "requested_code_unavailable"; + case DEVICE_DOES_NOT_SUPPORT_ACCESS_CODES = "device_does_not_support_access_codes"; + case DEVICE_TIME_CONSTRAINTS_VIOLATED = "device_time_constraints_violated"; + } +} + +namespace Seam\Resources\UnmanagedAccessGrant\Warnings\OverprovisionedAccess { + /** + * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). + */ + class FailedDevices + { + public static function from_json(mixed $json): FailedDevices|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Device whose access code could not be revoked. + */ + public string|null $device_id, + /** + * Reason the access code could not be revoked (e.g. `offline_access_code_not_revocable`). + */ + public string|null $error_code, + /** + * Human-readable description of why revocation failed. + */ + public string|null $message, + ) {} + } +} + +namespace Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated { + enum Reason: string + { + case DURATION_EXCEEDS_MAX = "duration_exceeds_max"; + case TIMES_DO_NOT_MATCH_SLOTS = "times_do_not_match_slots"; + case ONGOING_NOT_SUPPORTED = "ongoing_not_supported"; + } } diff --git a/src/Resources/UnmanagedAccessMethod.php b/src/Resources/UnmanagedAccessMethod.php index b59d7248..3f60f4a9 100644 --- a/src/Resources/UnmanagedAccessMethod.php +++ b/src/Resources/UnmanagedAccessMethod.php @@ -14,31 +14,45 @@ public static function from_json( } return new self( access_method_id: $json->access_method_id ?? null, - code: $json->code ?? null, created_at: $json->created_at ?? null, display_name: $json->display_name ?? null, errors: array_map( - fn($e) => UnmanagedAccessMethod\Errors::from_json($e), + fn( + $e, + ) => \Seam\Resources\UnmanagedAccessMethod\Errors::from_json( + $e, + ), $json->errors ?? [], ), - 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, + mode: is_string($json->mode ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Mode::tryFrom( + $json->mode, + ) + : null, pending_mutations: array_map( - fn($p) => UnmanagedAccessMethod\PendingMutations::from_json( + fn( + $p, + ) => \Seam\Resources\UnmanagedAccessMethod\PendingMutations::from_json( $p, ), $json->pending_mutations ?? [], ), warnings: array_map( - fn($w) => UnmanagedAccessMethod\Warnings::from_json($w), + fn( + $w, + ) => \Seam\Resources\UnmanagedAccessMethod\Warnings::from_json( + $w, + ), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + code: $json->code ?? 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, ); } @@ -57,6 +71,8 @@ public function __construct( public string|null $display_name, /** * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * + * @var list<\Seam\Resources\UnmanagedAccessMethod\Errors> */ public array $errors, /** @@ -70,13 +86,17 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public string|null $mode, + public \Seam\Resources\UnmanagedAccessMethod\Mode|null $mode, /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. + * + * @var list<\Seam\Resources\UnmanagedAccessMethod\PendingMutations> */ public array $pending_mutations, /** * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * + * @var list<\Seam\Resources\UnmanagedAccessMethod\Warnings> */ public array $warnings, /** @@ -111,18 +131,29 @@ public function __construct( /** * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode::FAILED_TO_ISSUE + => \Seam\Resources\UnmanagedAccessMethod\Errors\FailedToIssue::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedAccessMethod\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -133,7 +164,7 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -144,9 +175,222 @@ public function __construct( /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. */ - class PendingMutations + abstract class PendingMutations { public static function from_json(mixed $json): PendingMutations|null + { + if (!$json) { + return null; + } + $discriminant = is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::PROVISIONING_ACCESS + => \Seam\Resources\UnmanagedAccessMethod\PendingMutations\ProvisioningAccess::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::REVOKING_ACCESS + => \Seam\Resources\UnmanagedAccessMethod\PendingMutations\RevokingAccess::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::UPDATING_ACCESS_TIMES + => \Seam\Resources\UnmanagedAccessMethod\PendingMutations\UpdatingAccessTimes::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedAccessMethod\PendingMutations\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + public string|null $created_at, + /** + * Detailed description of the mutation. + */ + public string|null $message, + /** + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + */ + public \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + ) {} + } + + /** + * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + */ + abstract class Warnings + { + public static function from_json(mixed $json): Warnings|null + { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\UnmanagedAccessMethod\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::UPDATING_ACCESS_TIMES + => \Seam\Resources\UnmanagedAccessMethod\Warnings\UpdatingAccessTimes::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::PULLED_BACKUP_ACCESS_CODE + => \Seam\Resources\UnmanagedAccessMethod\Warnings\PulledBackupAccessCode::from_json( + $json, + ), + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::DELAY_IN_ISSUING + => \Seam\Resources\UnmanagedAccessMethod\Warnings\DelayInIssuing::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedAccessMethod\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + ) {} + } + + enum Mode: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } +} + +namespace Seam\Resources\UnmanagedAccessMethod\Errors { + /** + * Indicates that Seam was unable to issue this [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant) before its access grant started, so the recipient may be unable to access the space. This usually points to a problem that needs attention, such as an offline or disconnected device. Seam keeps retrying, and this error clears automatically if the access method is eventually issued. + */ + final class FailedToIssue extends + \Seam\Resources\UnmanagedAccessMethod\Errors + { + public static function from_json(mixed $json): FailedToIssue|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Fallback for unmanaged_access_method.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedAccessMethod\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case FAILED_TO_ISSUE = "failed_to_issue"; + } +} + +namespace Seam\Resources\UnmanagedAccessMethod\PendingMutations { + /** + * Seam is in the process of provisioning access for this access method on new devices. + */ + final class ProvisioningAccess extends + \Seam\Resources\UnmanagedAccessMethod\PendingMutations + { + public static function from_json(mixed $json): ProvisioningAccess|null { if (!$json) { return null; @@ -154,12 +398,20 @@ public static function from_json(mixed $json): PendingMutations|null return new self( created_at: $json->created_at ?? null, from: isset($json->from) - ? PendingMutations\From::from_json($json->from) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\ProvisioningAccess\From::from_json( + $json->from, + ) : null, message: $json->message ?? null, - mutation_code: $json->mutation_code ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, to: isset($json->to) - ? PendingMutations\To::from_json($json->to) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\ProvisioningAccess\To::from_json( + $json->to, + ) : null, ); } @@ -168,58 +420,308 @@ public function __construct( /** * Date and time at which the mutation was created. */ - public string|null $created_at, - public PendingMutations\From|null $from, + string|null $created_at, + /** + * Previous device configuration. + */ + public \Seam\Resources\UnmanagedAccessMethod\PendingMutations\ProvisioningAccess\From|null $from, /** * Detailed description of the mutation. */ - public string|null $message, - public string|null $mutation_code, - public PendingMutations\To|null $to, - ) {} + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + */ + \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New device configuration. + */ + public \Seam\Resources\UnmanagedAccessMethod\PendingMutations\ProvisioningAccess\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } } /** - * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Seam is in the process of revoking access for this access method from devices. */ - class Warnings + final class RevokingAccess extends + \Seam\Resources\UnmanagedAccessMethod\PendingMutations { - public static function from_json(mixed $json): Warnings|null + public static function from_json(mixed $json): RevokingAccess|null { if (!$json) { return null; } return new self( created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\RevokingAccess\From::from_json( + $json->from, + ) + : null, message: $json->message ?? null, - original_access_method_id: $json->original_access_method_id ?? - null, - warning_code: $json->warning_code ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\RevokingAccess\To::from_json( + $json->to, + ) + : null, ); } public function __construct( /** - * Date and time at which Seam created the warning. + * Date and time at which the mutation was created. */ - public string|null $created_at, + string|null $created_at, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Previous device configuration. */ - public string|null $message, + public \Seam\Resources\UnmanagedAccessMethod\PendingMutations\RevokingAccess\From|null $from, /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * Detailed description of the mutation. */ - public string|null $warning_code, + string|null $message, /** - * ID of the original access method from which this backup access method was split, if applicable. + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. */ - public string|null $original_access_method_id = null, + \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New device configuration. + */ + public \Seam\Resources\UnmanagedAccessMethod\PendingMutations\RevokingAccess\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Seam is in the process of updating the access times for this access method. + */ + final class UpdatingAccessTimes extends + \Seam\Resources\UnmanagedAccessMethod\PendingMutations + { + public static function from_json(mixed $json): UpdatingAccessTimes|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + from: isset($json->from) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\UpdatingAccessTimes\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + to: isset($json->to) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\UpdatingAccessTimes\To::from_json( + $json->to, + ) + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Previous access time configuration. + */ + public \Seam\Resources\UnmanagedAccessMethod\PendingMutations\UpdatingAccessTimes\From|null $from, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + */ + \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + /** + * New access time configuration. + */ + public \Seam\Resources\UnmanagedAccessMethod\PendingMutations\UpdatingAccessTimes\To|null $to, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + /** + * Fallback for unmanaged_access_method.pending_mutations values introduced after this SDK version. + */ + final class Unknown extends + \Seam\Resources\UnmanagedAccessMethod\PendingMutations + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which the mutation was created. + */ + string|null $created_at, + /** + * Detailed description of the mutation. + */ + string|null $message, + /** + * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + */ + \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + mutation_code: $mutation_code, + ); + } + } + + enum MutationCode: string + { + case PROVISIONING_ACCESS = "provisioning_access"; + case REVOKING_ACCESS = "revoking_access"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + } +} + +namespace Seam\Resources\UnmanagedAccessMethod\PendingMutations\ProvisioningAccess { + /** + * Previous device configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * Previous device IDs where access was provisioned. + * + * @var list|null + */ + public array|null $device_ids, + ) {} + } + + /** + * New device configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * New device IDs where access is being provisioned. + * + * @var list|null + */ + public array|null $device_ids, ) {} } } -namespace Seam\Resources\UnmanagedAccessMethod\PendingMutations { +namespace Seam\Resources\UnmanagedAccessMethod\PendingMutations\RevokingAccess { + /** + * Previous device configuration. + */ + class From + { + public static function from_json(mixed $json): From|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * Previous device IDs where access existed. + * + * @var list|null + */ + public array|null $device_ids, + ) {} + } + + /** + * New device configuration. + */ + class To + { + public static function from_json(mixed $json): To|null + { + if (!$json) { + return null; + } + return new self(device_ids: $json->device_ids ?? null); + } + + public function __construct( + /** + * New device IDs where access should remain. + * + * @var list|null + */ + public array|null $device_ids, + ) {} + } +} + +namespace Seam\Resources\UnmanagedAccessMethod\PendingMutations\UpdatingAccessTimes { + /** + * Previous access time configuration. + */ class From { public static function from_json(mixed $json): From|null @@ -228,14 +730,12 @@ public static function from_json(mixed $json): From|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, /** * Previous end time for access. */ @@ -247,6 +747,9 @@ public function __construct( ) {} } + /** + * New access time configuration. + */ class To { public static function from_json(mixed $json): To|null @@ -255,14 +758,12 @@ public static function from_json(mixed $json): To|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, /** * New end time for access. */ @@ -274,3 +775,239 @@ public function __construct( ) {} } } + +namespace Seam\Resources\UnmanagedAccessMethod\Warnings { + /** + * Indicates that the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant) is being deleted. + */ + final class BeingDeleted extends + \Seam\Resources\UnmanagedAccessMethod\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the access times for this [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant) are being updated. + */ + final class UpdatingAccessTimes extends + \Seam\Resources\UnmanagedAccessMethod\Warnings + { + public static function from_json(mixed $json): UpdatingAccessTimes|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that all attempts to create an access code on this device before the start time failed and a backup access code was used to ensure access was provided in time. + */ + final class PulledBackupAccessCode extends + \Seam\Resources\UnmanagedAccessMethod\Warnings + { + public static function from_json( + mixed $json, + ): PulledBackupAccessCode|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + original_access_method_id: $json->original_access_method_id ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + /** + * ID of the original access method from which this backup access method was split, if applicable. + */ + public string|null $original_access_method_id = null, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that Seam has not yet issued this [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant), even though its access grant is about to begin, so access may not be ready when the recipient arrives. Seam is still attempting to issue it, and this warning clears automatically once issuance succeeds. + */ + final class DelayInIssuing extends + \Seam\Resources\UnmanagedAccessMethod\Warnings + { + public static function from_json(mixed $json): DelayInIssuing|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for unmanaged_access_method.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedAccessMethod\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case BEING_DELETED = "being_deleted"; + case UPDATING_ACCESS_TIMES = "updating_access_times"; + case PULLED_BACKUP_ACCESS_CODE = "pulled_backup_access_code"; + case DELAY_IN_ISSUING = "delay_in_issuing"; + } +} diff --git a/src/Resources/UnmanagedDevice.php b/src/Resources/UnmanagedDevice.php index 55727698..799d599f 100644 --- a/src/Resources/UnmanagedDevice.php +++ b/src/Resources/UnmanagedDevice.php @@ -12,6 +12,37 @@ public static function from_json(mixed $json): UnmanagedDevice|null return null; } return new self( + 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: is_string($json->device_type ?? null) + ? \Seam\Resources\UnmanagedDevice\DeviceType::tryFrom( + $json->device_type, + ) + : null, + errors: array_map( + fn($e) => \Seam\Resources\UnmanagedDevice\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + properties: isset($json->properties) + ? \Seam\Resources\UnmanagedDevice\Properties::from_json( + $json->properties, + ) + : null, + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\UnmanagedDevice\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + workspace_id: $json->workspace_id ?? null, 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, @@ -42,34 +73,19 @@ 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) => UnmanagedDevice\Errors::from_json($e), - $json->errors ?? [], - ), - is_managed: $json->is_managed ?? null, location: isset($json->location) - ? UnmanagedDevice\Location::from_json($json->location) - : null, - properties: isset($json->properties) - ? UnmanagedDevice\Properties::from_json($json->properties) + ? \Seam\Resources\UnmanagedDevice\Location::from_json( + $json->location, + ) : null, - warnings: array_map( - fn($w) => UnmanagedDevice\Warnings::from_json($w), - $json->warnings ?? [], - ), - workspace_id: $json->workspace_id ?? null, ); } public function __construct( /** * Collection of capabilities that the device supports when connected to Seam. Values are `access_code`, which indicates that the device can manage and utilize digital PIN codes for secure access; `lock`, which indicates that the device controls a door locking mechanism, enabling the remote opening and closing of doors and other entry points; `noise_detection`, which indicates that the device supports monitoring and responding to ambient noise levels; `thermostat`, which indicates that the device can regulate and adjust indoor temperatures; `battery`, which indicates that the device can manage battery life and health; and `phone`, which indicates that the device is a mobile device, such as a smartphone. **Important:** Superseded by [capability flags](https://docs.seam.co/capability-guides/device-and-system-capabilities#capability-flags). + * + * @var list|null */ public array|null $capabilities_supported, /** @@ -93,9 +109,11 @@ public function __construct( /** * Type of the device. */ - public string|null $device_type, + public \Seam\Resources\UnmanagedDevice\DeviceType|null $device_type, /** * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. + * + * @var list<\Seam\Resources\UnmanagedDevice\Errors> */ public array $errors, /** @@ -105,9 +123,11 @@ public function __construct( /** * properties of the device. */ - public UnmanagedDevice\Properties|null $properties, + public \Seam\Resources\UnmanagedDevice\Properties|null $properties, /** * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. + * + * @var list<\Seam\Resources\UnmanagedDevice\Warnings> */ public array $warnings, /** @@ -197,7 +217,7 @@ public function __construct( /** * Location information for the device. */ - public UnmanagedDevice\Location|null $location = null, + public \Seam\Resources\UnmanagedDevice\Location|null $location = null, ) {} } } @@ -206,22 +226,81 @@ public function __construct( /** * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - 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, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::ACCOUNT_DISCONNECTED + => \Seam\Resources\UnmanagedDevice\Errors\AccountDisconnected::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED + => \Seam\Resources\UnmanagedDevice\Errors\SaltoKsSubscriptionLimitExceeded::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::INSUFFICIENT_PERMISSIONS + => \Seam\Resources\UnmanagedDevice\Errors\InsufficientPermissions::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::DORMAKABA_SITES_DISCONNECTED + => \Seam\Resources\UnmanagedDevice\Errors\DormakabaSitesDisconnected::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::DEVICE_OFFLINE + => \Seam\Resources\UnmanagedDevice\Errors\DeviceOffline::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::DEVICE_REMOVED + => \Seam\Resources\UnmanagedDevice\Errors\DeviceRemoved::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::HUB_DISCONNECTED + => \Seam\Resources\UnmanagedDevice\Errors\HubDisconnected::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::DEVICE_DISCONNECTED + => \Seam\Resources\UnmanagedDevice\Errors\DeviceDisconnected::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::EMPTY_BACKUP_ACCESS_CODE_POOL + => \Seam\Resources\UnmanagedDevice\Errors\EmptyBackupAccessCodePool::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::AUGUST_LOCK_NOT_AUTHORIZED + => \Seam\Resources\UnmanagedDevice\Errors\AugustLockNotAuthorized::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS + => \Seam\Resources\UnmanagedDevice\Errors\MissingDeviceCredentials::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::AUXILIARY_HEAT_RUNNING + => \Seam\Resources\UnmanagedDevice\Errors\AuxiliaryHeatRunning::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::SUBSCRIPTION_REQUIRED + => \Seam\Resources\UnmanagedDevice\Errors\SubscriptionRequired::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::BRIDGE_DISCONNECTED + => \Seam\Resources\UnmanagedDevice\Errors\BridgeDisconnected::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedDevice\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -232,17 +311,11 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, - public bool|null $is_connected_account_error, - public bool|null $is_device_error, + public \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, - /** - * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). - */ - public bool|null $is_bridge_error = null, ) {} } @@ -297,25 +370,29 @@ public static function from_json(mixed $json): Properties|null return null; } return new self( + model: isset($json->model) + ? \Seam\Resources\UnmanagedDevice\Properties\Model::from_json( + $json->model, + ) + : null, + name: $json->name ?? null, + online: $json->online ?? null, accessory_keypad: isset($json->accessory_keypad) - ? Properties\AccessoryKeypad::from_json( + ? \Seam\Resources\UnmanagedDevice\Properties\AccessoryKeypad::from_json( $json->accessory_keypad, ) : null, battery: isset($json->battery) - ? Properties\Battery::from_json($json->battery) + ? \Seam\Resources\UnmanagedDevice\Properties\Battery::from_json( + $json->battery, + ) : null, battery_level: $json->battery_level ?? null, image_alt_text: $json->image_alt_text ?? null, image_url: $json->image_url ?? null, manufacturer: $json->manufacturer ?? null, - model: isset($json->model) - ? Properties\Model::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, ); @@ -325,7 +402,7 @@ public function __construct( /** * Device model-related properties. */ - public Properties\Model|null $model, + public \Seam\Resources\UnmanagedDevice\Properties\Model|null $model, /** * Name of the device. * @@ -339,11 +416,11 @@ public function __construct( /** * Accessory keypad properties and state. */ - public Properties\AccessoryKeypad|null $accessory_keypad = null, + public \Seam\Resources\UnmanagedDevice\Properties\AccessoryKeypad|null $accessory_keypad = null, /** * Represents the current status of the battery charge level. */ - public Properties\Battery|null $battery = null, + public \Seam\Resources\UnmanagedDevice\Properties\Battery|null $battery = null, /** * Indicates the battery level of the device as a decimal value between 0 and 1, inclusive. */ @@ -378,37 +455,140 @@ public function __construct( /** * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null { if (!$json) { return null; } - return new self( - 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, - ); + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::PARTIAL_BACKUP_ACCESS_CODE_POOL + => \Seam\Resources\UnmanagedDevice\Warnings\PartialBackupAccessCodePool::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::MANY_ACTIVE_BACKUP_CODES + => \Seam\Resources\UnmanagedDevice\Warnings\ManyActiveBackupCodes::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::THIRD_PARTY_INTEGRATION_DETECTED + => \Seam\Resources\UnmanagedDevice\Warnings\ThirdPartyIntegrationDetected::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::TTLOCK_LOCK_GATEWAY_UNLOCKING_NOT_ENABLED + => \Seam\Resources\UnmanagedDevice\Warnings\TtlockLockGatewayUnlockingNotEnabled::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::TTLOCK_WEAK_GATEWAY_SIGNAL + => \Seam\Resources\UnmanagedDevice\Warnings\TtlockWeakGatewaySignal::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::POWER_SAVING_MODE + => \Seam\Resources\UnmanagedDevice\Warnings\PowerSavingMode::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::TEMPERATURE_THRESHOLD_EXCEEDED + => \Seam\Resources\UnmanagedDevice\Warnings\TemperatureThresholdExceeded::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::DEVICE_COMMUNICATION_DEGRADED + => \Seam\Resources\UnmanagedDevice\Warnings\DeviceCommunicationDegraded::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::SCHEDULED_MAINTENANCE_WINDOW + => \Seam\Resources\UnmanagedDevice\Warnings\ScheduledMaintenanceWindow::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::DEVICE_HAS_FLAKY_CONNECTION + => \Seam\Resources\UnmanagedDevice\Warnings\DeviceHasFlakyConnection::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::SALTO_KS_OFFICE_MODE + => \Seam\Resources\UnmanagedDevice\Warnings\SaltoKsOfficeMode::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::SALTO_KS_PRIVACY_MODE + => \Seam\Resources\UnmanagedDevice\Warnings\SaltoKsPrivacyMode::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::PRIVACY_MODE + => \Seam\Resources\UnmanagedDevice\Warnings\PrivacyMode::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED + => \Seam\Resources\UnmanagedDevice\Warnings\SaltoKsSubscriptionLimitAlmostReached::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::SALTO_KS_LOCK_ACCESS_CODE_SUPPORT_REMOVED + => \Seam\Resources\UnmanagedDevice\Warnings\SaltoKsLockAccessCodeSupportRemoved::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::UNKNOWN_ISSUE_WITH_PHONE + => \Seam\Resources\UnmanagedDevice\Warnings\UnknownIssueWithPhone::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::LOCKLY_TIME_ZONE_NOT_CONFIGURED + => \Seam\Resources\UnmanagedDevice\Warnings\LocklyTimeZoneNotConfigured::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::ULTRALOQ_TIME_ZONE_UNKNOWN + => \Seam\Resources\UnmanagedDevice\Warnings\UltraloqTimeZoneUnknown::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::TIME_ZONE_UNKNOWN + => \Seam\Resources\UnmanagedDevice\Warnings\TimeZoneUnknown::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::TIME_ZONE_MISMATCH + => \Seam\Resources\UnmanagedDevice\Warnings\TimeZoneMismatch::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::TWO_N_DEVICE_MISSING_TIMEZONE + => \Seam\Resources\UnmanagedDevice\Warnings\TwoNDeviceMissingTimezone::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::HUB_REQUIRED_FOR_ADDITIONAL_CAPABILITIES + => \Seam\Resources\UnmanagedDevice\Warnings\HubRequiredForAdditionalCapabilities::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::PROVIDER_ISSUE + => \Seam\Resources\UnmanagedDevice\Warnings\ProviderIssue::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::KEYNEST_UNSUPPORTED_LOCKER + => \Seam\Resources\UnmanagedDevice\Warnings\KeynestUnsupportedLocker::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::ACCESSORY_KEYPAD_SETUP_REQUIRED + => \Seam\Resources\UnmanagedDevice\Warnings\AccessoryKeypadSetupRequired::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::UNRELIABLE_ONLINE_STATUS + => \Seam\Resources\UnmanagedDevice\Warnings\UnreliableOnlineStatus::from_json( + $json, + ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::MAX_ACCESS_CODES_REACHED + => \Seam\Resources\UnmanagedDevice\Warnings\MaxAccessCodesReached::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedDevice\Warnings\Unknown::from_json( + $json, + ), + }; } public function __construct( - /** - * Number of active access codes on the device when the warning was set. - */ - public int|null $active_access_code_count, /** * Date and time at which Seam created the warning. */ public string|null $created_at, - /** - * Maximum number of active access codes supported by the device. - */ - public int|null $max_active_access_code_count, /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ @@ -416,143 +596,2280 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, + public \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, ) {} } + + enum DeviceType: string + { + case AKUVOX_LOCK = "akuvox_lock"; + case AUGUST_LOCK = "august_lock"; + case BRIVO_ACCESS_POINT = "brivo_access_point"; + case BUTTERFLYMX_PANEL = "butterflymx_panel"; + case AVIGILON_ALTA_ENTRY = "avigilon_alta_entry"; + case DOORKING_LOCK = "doorking_lock"; + case GENIE_DOOR = "genie_door"; + case IGLOO_LOCK = "igloo_lock"; + case LINEAR_LOCK = "linear_lock"; + case LOCKLY_LOCK = "lockly_lock"; + case KWIKSET_LOCK = "kwikset_lock"; + case NUKI_LOCK = "nuki_lock"; + case SALTO_LOCK = "salto_lock"; + case SCHLAGE_LOCK = "schlage_lock"; + case SMARTTHINGS_LOCK = "smartthings_lock"; + case WYZE_LOCK = "wyze_lock"; + case YALE_LOCK = "yale_lock"; + case TWO_N_INTERCOM = "two_n_intercom"; + case CONTROLBYWEB_DEVICE = "controlbyweb_device"; + case TTLOCK_LOCK = "ttlock_lock"; + case IGLOOHOME_LOCK = "igloohome_lock"; + case FOUR_SUITES_DOOR = "four_suites_door"; + case DORMAKABA_ORACODE_DOOR = "dormakaba_oracode_door"; + case TEDEE_LOCK = "tedee_lock"; + case AKILES_LOCK = "akiles_lock"; + case ULTRALOQ_LOCK = "ultraloq_lock"; + case YACAN_LOCK = "yacan_lock"; + case KEYINCODE_LOCK = "keyincode_lock"; + case OMNITEC_LOCK = "omnitec_lock"; + case KISI_LOCK = "kisi_lock"; + case AQARA_LOCK = "aqara_lock"; + case KEYNEST_KEY = "keynest_key"; + case NOISEAWARE_ACTIVITY_ZONE = "noiseaware_activity_zone"; + case MINUT_SENSOR = "minut_sensor"; + case ECOBEE_THERMOSTAT = "ecobee_thermostat"; + case NEST_THERMOSTAT = "nest_thermostat"; + case HONEYWELL_RESIDEO_THERMOSTAT = "honeywell_resideo_thermostat"; + case TADO_THERMOSTAT = "tado_thermostat"; + case SENSI_THERMOSTAT = "sensi_thermostat"; + case SMARTTHINGS_THERMOSTAT = "smartthings_thermostat"; + case IOS_PHONE = "ios_phone"; + case ANDROID_PHONE = "android_phone"; + case RING_CAMERA = "ring_camera"; + } } -namespace Seam\Resources\UnmanagedDevice\Properties { +namespace Seam\Resources\UnmanagedDevice\Errors { /** - * Accessory keypad properties and state. + * Indicates that the account is disconnected. */ - class AccessoryKeypad + final class AccountDisconnected extends + \Seam\Resources\UnmanagedDevice\Errors { - public static function from_json(mixed $json): AccessoryKeypad|null + public static function from_json(mixed $json): AccountDisconnected|null { if (!$json) { return null; } return new self( - battery: isset($json->battery) - ? AccessoryKeypad\Battery::from_json($json->battery) + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code : null, - is_connected: $json->is_connected ?? 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( /** - * Indicates if an accessory keypad is connected to the device. + * Date and time at which Seam created the error. */ - public bool|null $is_connected, + string|null $created_at, /** - * Keypad battery properties. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public AccessoryKeypad\Battery|null $battery = null, - ) {} + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Represents the current status of the battery charge level. + * Indicates that the Salto site user limit has been reached. */ - class Battery + final class SaltoKsSubscriptionLimitExceeded extends + \Seam\Resources\UnmanagedDevice\Errors { - public static function from_json(mixed $json): Battery|null - { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitExceeded|null { if (!$json) { return null; } return new self( - level: $json->level ?? null, - status: $json->status ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( /** - * Battery charge level as a value between 0 and 1, inclusive. + * Date and time at which Seam created the error. */ - public float|null $level, + string|null $created_at, /** - * Represents the current status of the battery charge level. Values are `critical`, which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; `low`, which signifies that the battery is under the preferred threshold and should be charged soon; `good`, which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and `full`, which represents a battery that is fully charged, providing the maximum duration of usage. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $status, - ) {} + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } /** - * Device model-related properties. + * Indicates that Seam's integration user does not have sufficient permissions on the provider's system to which this device belongs, so Seam cannot manage access codes or unlock the device. See the error message for specifics, then either reauthorize the connected account in Seam or grant the integration user the required permissions in the provider's system. */ - class Model + final class InsufficientPermissions extends + \Seam\Resources\UnmanagedDevice\Errors { - public static function from_json(mixed $json): Model|null - { + public static function from_json( + mixed $json, + ): InsufficientPermissions|null { if (!$json) { return null; } return new self( - 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 ?? + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( /** - * Display name of the device model. + * Date and time at which Seam created the error. */ - public string|null $display_name, + string|null $created_at, /** - * Display name that corresponds to the manufacturer-specific terminology for the device. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $manufacturer_display_name, + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, /** - * @deprecated use device.properties.model.can_connect_accessory_keypad + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - public bool|null $accessory_keypad_supported = null, + public true|null $is_connected_account_error, /** - * Indicates whether the device can connect a accessory keypad. + * Indicates that the error is not a device error. */ - public bool|null $can_connect_accessory_keypad = null, + public false|null $is_device_error, /** - * Indicates whether the device has a built in accessory keypad. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $has_built_in_keypad = null, + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that one or more dormakaba sites associated with the connected account could not be connected. Contact dormakaba support. + */ + final class DormakabaSitesDisconnected extends + \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json( + mixed $json, + ): DormakabaSitesDisconnected|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : 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( /** - * @deprecated use device.can_program_offline_access_codes. + * Date and time at which Seam created the error. */ - public bool|null $offline_access_codes_supported = null, + string|null $created_at, /** - * @deprecated use device.can_program_online_access_codes. + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public bool|null $online_access_codes_supported = null, - ) {} + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. + */ + public true|null $is_connected_account_error, + /** + * Indicates that the error is not a device error. + */ + public false|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } } -} -namespace Seam\Resources\UnmanagedDevice\Properties\AccessoryKeypad { /** - * Keypad battery properties. + * Indicates that the device is offline. */ - class Battery + final class DeviceOffline extends \Seam\Resources\UnmanagedDevice\Errors { - public static function from_json(mixed $json): Battery|null + public static function from_json(mixed $json): DeviceOffline|null { if (!$json) { return null; } - return new self(level: $json->level ?? null); - } - - public function __construct(public float|null $level) {} + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the device has been removed. + */ + final class DeviceRemoved extends \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json(mixed $json): DeviceRemoved|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the hub is disconnected. + */ + final class HubDisconnected extends \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json(mixed $json): HubDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the device is disconnected. + */ + final class DeviceDisconnected extends + \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json(mixed $json): DeviceDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) is empty. + */ + final class EmptyBackupAccessCodePool extends + \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json( + mixed $json, + ): EmptyBackupAccessCodePool|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the user is not authorized to use the August lock. + */ + final class AugustLockNotAuthorized extends + \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json( + mixed $json, + ): AugustLockNotAuthorized|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that device credentials are missing. + */ + final class MissingDeviceCredentials extends + \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json( + mixed $json, + ): MissingDeviceCredentials|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the auxiliary heat is running. + */ + final class AuxiliaryHeatRunning extends + \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json(mixed $json): AuxiliaryHeatRunning|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that a subscription is required to connect. + */ + final class SubscriptionRequired extends + \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json(mixed $json): SubscriptionRequired|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Indicates that the Seam API cannot communicate with [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge), for example, if the Seam Bridge executable has stopped or if the computer running the Seam Bridge executable is offline. See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-seam_bridge_disconnected). + */ + final class BridgeDisconnected extends + \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json(mixed $json): BridgeDisconnected|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). + */ + public bool|null $is_bridge_error = null, + /** + * Indicates whether the error is related specifically to the connected account. + */ + public bool|null $is_connected_account_error = null, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Fallback for unmanaged_device.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case ACCOUNT_DISCONNECTED = "account_disconnected"; + case SALTO_KS_SUBSCRIPTION_LIMIT_EXCEEDED = "salto_ks_subscription_limit_exceeded"; + case INSUFFICIENT_PERMISSIONS = "insufficient_permissions"; + case DORMAKABA_SITES_DISCONNECTED = "dormakaba_sites_disconnected"; + case DEVICE_OFFLINE = "device_offline"; + case DEVICE_REMOVED = "device_removed"; + case HUB_DISCONNECTED = "hub_disconnected"; + case DEVICE_DISCONNECTED = "device_disconnected"; + case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; + case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; + case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; + case SUBSCRIPTION_REQUIRED = "subscription_required"; + case BRIDGE_DISCONNECTED = "bridge_disconnected"; + } +} + +namespace Seam\Resources\UnmanagedDevice\Properties { + /** + * Accessory keypad properties and state. + */ + class AccessoryKeypad + { + public static function from_json(mixed $json): AccessoryKeypad|null + { + if (!$json) { + return null; + } + return new self( + is_connected: $json->is_connected ?? null, + battery: isset($json->battery) + ? \Seam\Resources\UnmanagedDevice\Properties\AccessoryKeypad\Battery::from_json( + $json->battery, + ) + : null, + ); + } + + public function __construct( + /** + * Indicates if an accessory keypad is connected to the device. + */ + public bool|null $is_connected, + /** + * Keypad battery properties. + */ + public \Seam\Resources\UnmanagedDevice\Properties\AccessoryKeypad\Battery|null $battery = null, + ) {} + } + + /** + * Represents the current status of the battery charge level. + */ + class Battery + { + public static function from_json(mixed $json): Battery|null + { + if (!$json) { + return null; + } + return new self( + level: $json->level ?? null, + status: is_string($json->status ?? null) + ? \Seam\Resources\UnmanagedDevice\Properties\Battery\Status::tryFrom( + $json->status, + ) + : null, + ); + } + + public function __construct( + /** + * Battery charge level as a value between 0 and 1, inclusive. + */ + public float|null $level, + /** + * Represents the current status of the battery charge level. Values are `critical`, which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; `low`, which signifies that the battery is under the preferred threshold and should be charged soon; `good`, which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and `full`, which represents a battery that is fully charged, providing the maximum duration of usage. + */ + public \Seam\Resources\UnmanagedDevice\Properties\Battery\Status|null $status, + ) {} + } + + /** + * Device model-related properties. + */ + class Model + { + public static function from_json(mixed $json): Model|null + { + if (!$json) { + return null; + } + return new self( + display_name: $json->display_name ?? null, + manufacturer_display_name: $json->manufacturer_display_name ?? + null, + accessory_keypad_supported: $json->accessory_keypad_supported ?? + null, + can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? + null, + has_built_in_keypad: $json->has_built_in_keypad ?? null, + offline_access_codes_supported: $json->offline_access_codes_supported ?? + null, + online_access_codes_supported: $json->online_access_codes_supported ?? + null, + ); + } + + public function __construct( + /** + * Display name of the device model. + */ + public string|null $display_name, + /** + * Display name that corresponds to the manufacturer-specific terminology for the device. + */ + public string|null $manufacturer_display_name, + /** + * @deprecated use device.properties.model.can_connect_accessory_keypad + */ + public bool|null $accessory_keypad_supported = null, + /** + * Indicates whether the device can connect a accessory keypad. + */ + public bool|null $can_connect_accessory_keypad = null, + /** + * Indicates whether the device has a built in accessory keypad. + */ + public bool|null $has_built_in_keypad = null, + /** + * @deprecated use device.can_program_offline_access_codes. + */ + public bool|null $offline_access_codes_supported = null, + /** + * @deprecated use device.can_program_online_access_codes. + */ + public bool|null $online_access_codes_supported = null, + ) {} + } +} + +namespace Seam\Resources\UnmanagedDevice\Properties\AccessoryKeypad { + /** + * Keypad battery properties. + */ + class Battery + { + public static function from_json(mixed $json): Battery|null + { + if (!$json) { + return null; + } + return new self(level: $json->level ?? null); + } + + public function __construct(public float|null $level) {} + } +} + +namespace Seam\Resources\UnmanagedDevice\Properties\Battery { + enum Status: string + { + case CRITICAL = "critical"; + case LOW = "low"; + case GOOD = "good"; + case FULL = "full"; + } +} + +namespace Seam\Resources\UnmanagedDevice\Warnings { + /** + * Indicates that the backup access code is unhealthy. + */ + final class PartialBackupAccessCodePool extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): PartialBackupAccessCodePool|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that there are too many backup codes. + */ + final class ManyActiveBackupCodes extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): ManyActiveBackupCodes|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that a third-party integration has been detected. + */ + final class ThirdPartyIntegrationDetected extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): ThirdPartyIntegrationDetected|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the Remote Unlock feature is not enabled in the settings." + */ + final class TtlockLockGatewayUnlockingNotEnabled extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): TtlockLockGatewayUnlockingNotEnabled|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the gateway signal is weak. + */ + final class TtlockWeakGatewaySignal extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): TtlockWeakGatewaySignal|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the device is in power saving mode and may have limited functionality. + */ + final class PowerSavingMode extends \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json(mixed $json): PowerSavingMode|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the temperature threshold has been exceeded. + */ + final class TemperatureThresholdExceeded extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): TemperatureThresholdExceeded|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the device appears to be unresponsive. + */ + final class DeviceCommunicationDegraded extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): DeviceCommunicationDegraded|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that a scheduled maintenance window has been detected. + */ + final class ScheduledMaintenanceWindow extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): ScheduledMaintenanceWindow|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the device has a flaky connection. + */ + final class DeviceHasFlakyConnection extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): DeviceHasFlakyConnection|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the Salto KS lock is in Office Mode. Access Codes will not unlock doors. + */ + final class SaltoKsOfficeMode extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json(mixed $json): SaltoKsOfficeMode|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the Salto KS lock is in Privacy Mode. Access Codes will not unlock doors. + */ + final class SaltoKsPrivacyMode extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json(mixed $json): SaltoKsPrivacyMode|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the lock is in Privacy Mode. Access codes and remote unlock are blocked until Privacy Mode is disabled. + */ + final class PrivacyMode extends \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json(mixed $json): PrivacyMode|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the Salto KS site has exceeded 80% of the maximum number of allowed users. Increase your subscription limit or delete some users from your site. + */ + final class SaltoKsSubscriptionLimitAlmostReached extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): SaltoKsSubscriptionLimitAlmostReached|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that a change in the reported device model has been detected for this Salto KS lock, which may occur after an IQ hub reset. Access code support may be affected. See https://help.getseam.com/articles/5098842588-salto-ks-lock-loses-access-code-support for troubleshooting steps. + */ + final class SaltoKsLockAccessCodeSupportRemoved extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): SaltoKsLockAccessCodeSupportRemoved|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that an unknown issue occurred while syncing the state of the phone with the provider. This issue may affect the proper functioning of the phone. + */ + final class UnknownIssueWithPhone extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): UnknownIssueWithPhone|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that Seam detected that the Lockly device does not have a time zone configured. Time-bound codes may not work as expected. + */ + final class LocklyTimeZoneNotConfigured extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): LocklyTimeZoneNotConfigured|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that Seam does not know the time zone of the Ultraloq device. Set a time zone to enable time-bound access codes. + */ + final class UltraloqTimeZoneUnknown extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): UltraloqTimeZoneUnknown|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that Seam does not know the device's time zone. Set a time zone to enable time-bound access codes. + */ + final class TimeZoneUnknown extends \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json(mixed $json): TimeZoneUnknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the device's configured time zone does not match its hardware UTC offset. Time-bound access codes may activate at the wrong local time. + */ + final class TimeZoneMismatch extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json(mixed $json): TimeZoneMismatch|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the 2N device does not have a time zone configured. Configure a time zone on the device to enable access codes. + */ + final class TwoNDeviceMissingTimezone extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): TwoNDeviceMissingTimezone|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that a hub or relay must be connected to unlock additional capabilities such as remote unlock. + */ + final class HubRequiredForAdditionalCapabilities extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): HubRequiredForAdditionalCapabilities|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates a provider-specific issue that may affect device functionality. + */ + final class ProviderIssue extends \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json(mixed $json): ProviderIssue|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the key is in a locker that does not support the access codes API. + */ + final class KeynestUnsupportedLocker extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): KeynestUnsupportedLocker|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the accessory keypad exists, but is not linked to the Igloohome Bridge. Online access code programming will fail until the keypad is linked to the Igloohome Bridge in the Igloohome app. + */ + final class AccessoryKeypadSetupRequired extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): AccessoryKeypadSetupRequired|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the device may optimistically be reported as online because the provider does not reliably report its online status. + */ + final class UnreliableOnlineStatus extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): UnreliableOnlineStatus|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the device has reached its maximum number of active access codes. Delete existing codes before creating new ones. + */ + final class MaxAccessCodesReached extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): MaxAccessCodesReached|null { + if (!$json) { + return null; + } + return new self( + 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: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Number of active access codes on the device when the warning was set. + */ + public int|null $active_access_code_count, + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Maximum number of active access codes supported by the device. + */ + public int|null $max_active_access_code_count, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for unmanaged_device.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case PARTIAL_BACKUP_ACCESS_CODE_POOL = "partial_backup_access_code_pool"; + case MANY_ACTIVE_BACKUP_CODES = "many_active_backup_codes"; + case THIRD_PARTY_INTEGRATION_DETECTED = "third_party_integration_detected"; + case TTLOCK_LOCK_GATEWAY_UNLOCKING_NOT_ENABLED = "ttlock_lock_gateway_unlocking_not_enabled"; + case TTLOCK_WEAK_GATEWAY_SIGNAL = "ttlock_weak_gateway_signal"; + case POWER_SAVING_MODE = "power_saving_mode"; + case TEMPERATURE_THRESHOLD_EXCEEDED = "temperature_threshold_exceeded"; + case DEVICE_COMMUNICATION_DEGRADED = "device_communication_degraded"; + case SCHEDULED_MAINTENANCE_WINDOW = "scheduled_maintenance_window"; + case DEVICE_HAS_FLAKY_CONNECTION = "device_has_flaky_connection"; + case SALTO_KS_OFFICE_MODE = "salto_ks_office_mode"; + case SALTO_KS_PRIVACY_MODE = "salto_ks_privacy_mode"; + case PRIVACY_MODE = "privacy_mode"; + case SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED = "salto_ks_subscription_limit_almost_reached"; + case SALTO_KS_LOCK_ACCESS_CODE_SUPPORT_REMOVED = "salto_ks_lock_access_code_support_removed"; + case UNKNOWN_ISSUE_WITH_PHONE = "unknown_issue_with_phone"; + case LOCKLY_TIME_ZONE_NOT_CONFIGURED = "lockly_time_zone_not_configured"; + case ULTRALOQ_TIME_ZONE_UNKNOWN = "ultraloq_time_zone_unknown"; + case TIME_ZONE_UNKNOWN = "time_zone_unknown"; + case TIME_ZONE_MISMATCH = "time_zone_mismatch"; + case TWO_N_DEVICE_MISSING_TIMEZONE = "two_n_device_missing_timezone"; + case HUB_REQUIRED_FOR_ADDITIONAL_CAPABILITIES = "hub_required_for_additional_capabilities"; + case PROVIDER_ISSUE = "provider_issue"; + case KEYNEST_UNSUPPORTED_LOCKER = "keynest_unsupported_locker"; + case ACCESSORY_KEYPAD_SETUP_REQUIRED = "accessory_keypad_setup_required"; + case UNRELIABLE_ONLINE_STATUS = "unreliable_online_status"; + case MAX_ACCESS_CODES_REACHED = "max_access_codes_reached"; } } diff --git a/src/Resources/UnmanagedUserIdentity.php b/src/Resources/UnmanagedUserIdentity.php index a1da9a34..6fcc28ee 100644 --- a/src/Resources/UnmanagedUserIdentity.php +++ b/src/Resources/UnmanagedUserIdentity.php @@ -18,14 +18,22 @@ public static function from_json( display_name: $json->display_name ?? null, email_address: $json->email_address ?? null, errors: array_map( - fn($e) => UnmanagedUserIdentity\Errors::from_json($e), + fn( + $e, + ) => \Seam\Resources\UnmanagedUserIdentity\Errors::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, warnings: array_map( - fn($w) => UnmanagedUserIdentity\Warnings::from_json($w), + fn( + $w, + ) => \Seam\Resources\UnmanagedUserIdentity\Warnings::from_json( + $w, + ), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, @@ -35,6 +43,8 @@ public static function from_json( public function __construct( /** * Array of access system user IDs associated with the user identity. + * + * @var list|null */ public array|null $acs_user_ids, /** @@ -51,6 +61,8 @@ public function __construct( public string|null $email_address, /** * Array of errors associated with the user identity. Each error object within the array contains fields like "error_code" and "message." "error_code" is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. + * + * @var list<\Seam\Resources\UnmanagedUserIdentity\Errors> */ public array $errors, /** @@ -67,6 +79,8 @@ public function __construct( public string|null $user_identity_id, /** * Array of warnings associated with the user identity. Each warning object within the array contains two fields: "warning_code" and "message." "warning_code" is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. + * + * @var list<\Seam\Resources\UnmanagedUserIdentity\Warnings> */ public array $warnings, /** @@ -81,20 +95,29 @@ public function __construct( /** * Array of errors associated with the user identity. Each error object within the array contains fields like "error_code" and "message." "error_code" is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - 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, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode::ISSUE_WITH_ACS_USER + => \Seam\Resources\UnmanagedUserIdentity\Errors\IssueWithAcsUser::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedUserIdentity\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -113,7 +136,7 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -124,17 +147,190 @@ public function __construct( /** * Array of warnings associated with the user identity. Each warning object within the array contains two fields: "warning_code" and "message." "warning_code" is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null + { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\UnmanagedUserIdentity\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::ACS_USER_PROFILE_DOES_NOT_MATCH_USER_IDENTITY + => \Seam\Resources\UnmanagedUserIdentity\Warnings\AcsUserProfileDoesNotMatchUserIdentity::from_json( + $json, + ), + default + => \Seam\Resources\UnmanagedUserIdentity\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode|string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\UnmanagedUserIdentity\Errors { + /** + * Indicates that there is an issue with an access system user associated with this user identity. + */ + final class IssueWithAcsUser extends + \Seam\Resources\UnmanagedUserIdentity\Errors + { + public static function from_json(mixed $json): IssueWithAcsUser|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * ID of the access system that the user identity is associated with. + */ + string|null $acs_system_id, + /** + * ID of the access system user that has an issue. + */ + string|null $acs_user_id, + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + acs_system_id: $acs_system_id, + acs_user_id: $acs_user_id, + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Fallback for unmanaged_user_identity.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedUserIdentity\Errors + { + public static function from_json(mixed $json): Unknown|null { if (!$json) { return null; } return new self( + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, message: $json->message ?? null, - warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * ID of the access system that the user identity is associated with. + */ + string|null $acs_system_id, + /** + * ID of the access system user that has an issue. + */ + string|null $acs_user_id, + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + acs_system_id: $acs_system_id, + acs_user_id: $acs_user_id, + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case ISSUE_WITH_ACS_USER = "issue_with_acs_user"; + } +} + +namespace Seam\Resources\UnmanagedUserIdentity\Warnings { + /** + * Indicates that the user identity is currently being deleted. + */ + final class BeingDeleted extends + \Seam\Resources\UnmanagedUserIdentity\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } @@ -142,15 +338,115 @@ public function __construct( /** * Date and time at which Seam created the warning. */ - public string|null $created_at, + string|null $created_at, /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $message, + string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, - ) {} + \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the ACS user's profile does not match the user identity's profile + */ + final class AcsUserProfileDoesNotMatchUserIdentity extends + \Seam\Resources\UnmanagedUserIdentity\Warnings + { + public static function from_json( + mixed $json, + ): AcsUserProfileDoesNotMatchUserIdentity|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for unmanaged_user_identity.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UnmanagedUserIdentity\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case BEING_DELETED = "being_deleted"; + case ACS_USER_PROFILE_DOES_NOT_MATCH_USER_IDENTITY = "acs_user_profile_does_not_match_user_identity"; } } diff --git a/src/Resources/UserIdentity.php b/src/Resources/UserIdentity.php index ededd870..3077c24d 100644 --- a/src/Resources/UserIdentity.php +++ b/src/Resources/UserIdentity.php @@ -17,7 +17,9 @@ public static function from_json(mixed $json): UserIdentity|null display_name: $json->display_name ?? null, email_address: $json->email_address ?? null, errors: array_map( - fn($e) => UserIdentity\Errors::from_json($e), + fn($e) => \Seam\Resources\UserIdentity\Errors::from_json( + $e, + ), $json->errors ?? [], ), full_name: $json->full_name ?? null, @@ -25,7 +27,9 @@ public static function from_json(mixed $json): UserIdentity|null user_identity_id: $json->user_identity_id ?? null, user_identity_key: $json->user_identity_key ?? null, warnings: array_map( - fn($w) => UserIdentity\Warnings::from_json($w), + fn($w) => \Seam\Resources\UserIdentity\Warnings::from_json( + $w, + ), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, @@ -35,6 +39,8 @@ public static function from_json(mixed $json): UserIdentity|null public function __construct( /** * Array of access system user IDs associated with the user identity. + * + * @var list|null */ public array|null $acs_user_ids, /** @@ -51,6 +57,8 @@ public function __construct( public string|null $email_address, /** * Array of errors associated with the user identity. Each error object within the array contains fields like "error_code" and "message." "error_code" is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. + * + * @var list<\Seam\Resources\UserIdentity\Errors> */ public array $errors, /** @@ -71,6 +79,8 @@ public function __construct( public string|null $user_identity_key, /** * Array of warnings associated with the user identity. Each warning object within the array contains two fields: "warning_code" and "message." "warning_code" is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. + * + * @var list<\Seam\Resources\UserIdentity\Warnings> */ public array $warnings, /** @@ -85,20 +95,29 @@ public function __construct( /** * Array of errors associated with the user identity. Each error object within the array contains fields like "error_code" and "message." "error_code" is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. */ - class Errors + abstract class Errors { public static function from_json(mixed $json): Errors|null { if (!$json) { return null; } - return new self( - 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, - ); + $discriminant = is_string($json->error_code ?? null) + ? \Seam\Resources\UserIdentity\Errors\ErrorCode::tryFrom( + $json->error_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UserIdentity\Errors\ErrorCode::ISSUE_WITH_ACS_USER + => \Seam\Resources\UserIdentity\Errors\IssueWithAcsUser::from_json( + $json, + ), + default + => \Seam\Resources\UserIdentity\Errors\Unknown::from_json( + $json, + ), + }; } public function __construct( @@ -117,7 +136,7 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public string|null $error_code, + public \Seam\Resources\UserIdentity\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -128,17 +147,188 @@ public function __construct( /** * Array of warnings associated with the user identity. Each warning object within the array contains two fields: "warning_code" and "message." "warning_code" is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. */ - class Warnings + abstract class Warnings { public static function from_json(mixed $json): Warnings|null + { + if (!$json) { + return null; + } + $discriminant = is_string($json->warning_code ?? null) + ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) + : null; + + return match ($discriminant) { + \Seam\Resources\UserIdentity\Warnings\WarningCode::BEING_DELETED + => \Seam\Resources\UserIdentity\Warnings\BeingDeleted::from_json( + $json, + ), + \Seam\Resources\UserIdentity\Warnings\WarningCode::ACS_USER_PROFILE_DOES_NOT_MATCH_USER_IDENTITY + => \Seam\Resources\UserIdentity\Warnings\AcsUserProfileDoesNotMatchUserIdentity::from_json( + $json, + ), + default + => \Seam\Resources\UserIdentity\Warnings\Unknown::from_json( + $json, + ), + }; + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public \Seam\Resources\UserIdentity\Warnings\WarningCode|string|null $warning_code, + ) {} + } +} + +namespace Seam\Resources\UserIdentity\Errors { + /** + * Indicates that there is an issue with an access system user associated with this user identity. + */ + final class IssueWithAcsUser extends \Seam\Resources\UserIdentity\Errors + { + public static function from_json(mixed $json): IssueWithAcsUser|null { if (!$json) { return null; } return new self( + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UserIdentity\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, message: $json->message ?? null, - warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * ID of the access system that the user identity is associated with. + */ + string|null $acs_system_id, + /** + * ID of the access system user that has an issue. + */ + string|null $acs_user_id, + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UserIdentity\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + acs_system_id: $acs_system_id, + acs_user_id: $acs_user_id, + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + /** + * Fallback for user_identity.errors values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UserIdentity\Errors + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UserIdentity\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * ID of the access system that the user identity is associated with. + */ + string|null $acs_system_id, + /** + * ID of the access system user that has an issue. + */ + string|null $acs_user_id, + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UserIdentity\Errors\ErrorCode|string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + acs_system_id: $acs_system_id, + acs_user_id: $acs_user_id, + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + + enum ErrorCode: string + { + case ISSUE_WITH_ACS_USER = "issue_with_acs_user"; + } +} + +namespace Seam\Resources\UserIdentity\Warnings { + /** + * Indicates that the user identity is currently being deleted. + */ + final class BeingDeleted extends \Seam\Resources\UserIdentity\Warnings + { + public static function from_json(mixed $json): BeingDeleted|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ); } @@ -146,15 +336,115 @@ public function __construct( /** * Date and time at which Seam created the warning. */ - public string|null $created_at, + string|null $created_at, /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ - public string|null $message, + string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public string|null $warning_code, - ) {} + \Seam\Resources\UserIdentity\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Indicates that the ACS user's profile does not match the user identity's profile + */ + final class AcsUserProfileDoesNotMatchUserIdentity extends + \Seam\Resources\UserIdentity\Warnings + { + public static function from_json( + mixed $json, + ): AcsUserProfileDoesNotMatchUserIdentity|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UserIdentity\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + /** + * Fallback for user_identity.warnings values introduced after this SDK version. + */ + final class Unknown extends \Seam\Resources\UserIdentity\Warnings + { + public static function from_json(mixed $json): Unknown|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + \Seam\Resources\UserIdentity\Warnings\WarningCode|string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + + enum WarningCode: string + { + case BEING_DELETED = "being_deleted"; + case ACS_USER_PROFILE_DOES_NOT_MATCH_USER_IDENTITY = "acs_user_profile_does_not_match_user_identity"; } } diff --git a/src/Resources/Webhook.php b/src/Resources/Webhook.php index 69c17272..e1f4f04a 100644 --- a/src/Resources/Webhook.php +++ b/src/Resources/Webhook.php @@ -12,10 +12,10 @@ public static function from_json(mixed $json): Webhook|null return null; } return new self( - event_types: $json->event_types ?? null, - secret: $json->secret ?? null, url: $json->url ?? null, webhook_id: $json->webhook_id ?? null, + event_types: $json->event_types ?? null, + secret: $json->secret ?? null, ); } @@ -30,6 +30,8 @@ public function __construct( public string|null $webhook_id, /** * Types of events that the [webhook](https://docs.seam.co/developer-tools/webhooks) should receive. + * + * @var list|null */ public array|null $event_types = null, /** diff --git a/src/Resources/Workspace.php b/src/Resources/Workspace.php index 2fb45430..fde61b97 100644 --- a/src/Resources/Workspace.php +++ b/src/Resources/Workspace.php @@ -17,7 +17,7 @@ public static function from_json(mixed $json): Workspace|null connect_webview_customization: isset( $json->connect_webview_customization, ) - ? Workspace\ConnectWebviewCustomization::from_json( + ? \Seam\Resources\Workspace\ConnectWebviewCustomization::from_json( $json->connect_webview_customization, ) : null, @@ -27,8 +27,8 @@ public static function from_json(mixed $json): Workspace|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, + publishable_key: $json->publishable_key ?? null, ); } @@ -41,7 +41,7 @@ public function __construct( * @deprecated Use `company_name` instead. */ public string|null $connect_partner_name, - public Workspace\ConnectWebviewCustomization|null $connect_webview_customization, + public \Seam\Resources\Workspace\ConnectWebviewCustomization|null $connect_webview_customization, /** * Indicates whether publishable key authentication is enabled for this workspace. */ @@ -85,7 +85,11 @@ public static function from_json( } return new self( inviter_logo_url: $json->inviter_logo_url ?? null, - logo_shape: $json->logo_shape ?? null, + logo_shape: is_string($json->logo_shape ?? null) + ? \Seam\Resources\Workspace\ConnectWebviewCustomization\LogoShape::tryFrom( + $json->logo_shape, + ) + : null, primary_button_color: $json->primary_button_color ?? null, primary_button_text_color: $json->primary_button_text_color ?? null, @@ -101,7 +105,7 @@ public function __construct( /** * Logo shape for [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) in the workspace. See also [Customize the Look and Feel of Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-look-and-feel-of-your-connect-webviews). */ - public string|null $logo_shape = null, + public \Seam\Resources\Workspace\ConnectWebviewCustomization\LogoShape|null $logo_shape = null, /** * Primary button color for [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) in the workspace. See also [Customize the Look and Feel of Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-look-and-feel-of-your-connect-webviews). */ @@ -117,3 +121,11 @@ public function __construct( ) {} } } + +namespace Seam\Resources\Workspace\ConnectWebviewCustomization { + enum LogoShape: string + { + case CIRCLE = "circle"; + case SQUARE = "square"; + } +} diff --git a/src/Routes/AccessCodesClient.php b/src/Routes/AccessCodesClient.php index 9fb239cb..5a1bb240 100644 --- a/src/Routes/AccessCodesClient.php +++ b/src/Routes/AccessCodesClient.php @@ -160,7 +160,7 @@ public function create( * * For granting a person access to a space, [Access Grants](https://docs.seam.co/use-cases/granting-access) are the default and recommended approach and work across both standalone smart locks and access systems. Use the lower-level Access Codes API directly only when you specifically need to manage individual PIN codes. * - * @param array $device_ids IDs of the devices for which you want to create the new access codes. + * @param list $device_ids IDs of the devices for which you want to create the new access codes. * @param bool $allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`. * @param bool $attempt_for_offline_device * @param string $behavior_when_code_cannot_be_shared Desired behavior if any device cannot share a code. If `throw` (default), no access codes will be created if any device cannot share a code. If `create_random_code`, a random code will be created on devices that cannot share a code. @@ -353,7 +353,7 @@ public function get( * * Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`. * - * @param array $access_code_ids IDs of the access codes that you want to retrieve. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`. + * @param list $access_code_ids IDs of the access codes that you want to retrieve. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`. * @param string $access_grant_id ID of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`. * @param string $access_grant_key Key of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`. * @param string $access_method_id ID of the access method for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`. @@ -487,7 +487,7 @@ public function pull_backup_access_code(string $access_code_id): AccessCode * @param string $device_id ID of the device for which you want to report constraints. * @param int $max_code_length Maximum supported code length as an integer between 4 and 20, inclusive. You can specify either `min_code_length`/`max_code_length` or `supported_code_lengths`. * @param int $min_code_length Minimum supported code length as an integer between 4 and 20, inclusive. You can specify either `min_code_length`/`max_code_length` or `supported_code_lengths`. - * @param array $supported_code_lengths Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either `supported_code_lengths` or `min_code_length`/`max_code_length`. + * @param list $supported_code_lengths Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either `supported_code_lengths` or `min_code_length`/`max_code_length`. * @return void OK */ public function report_device_constraints( diff --git a/src/Routes/AccessGrantsClient.php b/src/Routes/AccessGrantsClient.php index 29e5df1c..8e391a66 100644 --- a/src/Routes/AccessGrantsClient.php +++ b/src/Routes/AccessGrantsClient.php @@ -30,20 +30,20 @@ public function __construct(ClientInterface $client, array $defaults) /** * Creates a new [Access Grant](https://docs.seam.co/use-cases/granting-access/access-grants). Access Grants are the default and recommended way to grant a user access to any physical space, irrespective of the locking hardware. They work with both standalone smart locks (using `device_ids`) and access control systems (using `acs_entrance_ids` or `space_ids`), and can issue PIN codes, key cards, and mobile keys through a single request. * - * @param array $requested_access_methods + * @param list|\stdClass> $requested_access_methods * @param string $user_identity_id ID of user identity for whom access is being granted. * @param mixed $user_identity When used, creates a new user identity with the given details, and grants them access. * @param string $access_grant_key Unique key for the access grant within the workspace. - * @param array $acs_entrance_ids Set of IDs of the [entrances](https://docs.seam.co/api/acs/systems/list) to which access is being granted. + * @param list $acs_entrance_ids Set of IDs of the [entrances](https://docs.seam.co/api/acs/systems/list) to which access is being granted. * @param string $customization_profile_id ID of the customization profile to apply to the Access Grant and its access methods. - * @param array $device_ids Set of IDs of the [devices](https://docs.seam.co/api/devices/list) to which access is being granted. + * @param list $device_ids Set of IDs of the [devices](https://docs.seam.co/api/devices/list) to which access is being granted. * @param string|NullValue $ends_at Date and time at which the validity of the new grant ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`. * @param mixed $location - * @param array $location_ids + * @param list $location_ids * @param string|NullValue $name Name for the access grant. * @param string $reservation_key Reservation key for the access grant. - * @param array $space_ids Set of IDs of existing spaces to which access is being granted. - * @param array $space_keys Set of keys of existing spaces to which access is being granted. + * @param list $space_ids Set of IDs of existing spaces to which access is being granted. + * @param list $space_keys Set of keys of existing spaces to which access is being granted. * @param string $starts_at Date and time at which the validity of the new grant starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. * @return AccessGrant OK */ @@ -181,10 +181,10 @@ public function get( /** * Gets all related resources for one or more Access Grants. * - * @param array $access_grant_ids IDs of the access grants that you want to get along with their related resources. - * @param array $access_grant_keys Keys of the access grants that you want to get along with their related resources. - * @param array $exclude - * @param array $include + * @param list $access_grant_ids IDs of the access grants that you want to get along with their related resources. + * @param list $access_grant_keys Keys of the access grants that you want to get along with their related resources. + * @param list $exclude + * @param list $include * @return Batch OK */ public function get_related( @@ -233,7 +233,7 @@ public function get_related( * Gets an Access Grant. * * @param string $access_code_id ID of the access code by which you want to filter the list of Access Grants. - * @param array $access_grant_ids IDs of the access grants to retrieve. + * @param list $access_grant_ids IDs of the access grants to retrieve. * @param string|NullValue $access_grant_key Filter Access Grants by access_grant_key. Use null to filter for Access Grants without an access_grant_key. * @param string $acs_entrance_id ID of the entrance by which you want to filter the list of Access Grants. * @param string $acs_system_id ID of the access system by which you want to filter the list of Access Grants. @@ -326,7 +326,7 @@ public function list( * Adds additional requested access methods to an existing Access Grant. * * @param string $access_grant_id ID of the Access Grant to add access methods to. - * @param array $requested_access_methods Array of requested access methods to add to the access grant. + * @param list|\stdClass> $requested_access_methods Array of requested access methods to add to the access grant. * @return AccessGrant OK */ public function request_access_methods( diff --git a/src/Routes/AccessMethodsClient.php b/src/Routes/AccessMethodsClient.php index 2e3210f6..0b296a17 100644 --- a/src/Routes/AccessMethodsClient.php +++ b/src/Routes/AccessMethodsClient.php @@ -166,9 +166,9 @@ public function get(string $access_method_id): AccessMethod /** * Gets all related resources for one or more Access Methods. * - * @param array $access_method_ids IDs of the access methods that you want to get along with their related resources. - * @param array $exclude - * @param array $include + * @param list $access_method_ids IDs of the access methods that you want to get along with their related resources. + * @param list $exclude + * @param list $include * @return Batch OK */ public function get_related( diff --git a/src/Routes/AcsCredentialsClient.php b/src/Routes/AcsCredentialsClient.php index b8a8774e..ab4826e3 100644 --- a/src/Routes/AcsCredentialsClient.php +++ b/src/Routes/AcsCredentialsClient.php @@ -60,7 +60,7 @@ public function assign( * @param string $access_method Access method for the new credential. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. * @param string $acs_system_id ID of the access system to which the new credential belongs. You must provide either `acs_user_id` or the combination of `user_identity_id` and `acs_system_id`. * @param string $acs_user_id ID of the access system user to whom the new credential belongs. You must provide either `acs_user_id` or the combination of `user_identity_id` and `acs_system_id`. - * @param array $allowed_acs_entrance_ids Set of IDs of the [entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) for which the new credential grants access. + * @param list $allowed_acs_entrance_ids Set of IDs of the [entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) for which the new credential grants access. * @param mixed $assa_abloy_vostio_metadata Vostio-specific metadata for the new credential. * @param string $code Access (PIN) code for the new credential. There may be manufacturer-specific code restrictions. For details, see the applicable [device or system integration guide](https://docs.seam.co/device-and-system-integration-guides). * @param string $credential_manager_acs_system_id ACS system ID of the credential manager for the new credential. diff --git a/src/Routes/AcsEncodersClient.php b/src/Routes/AcsEncodersClient.php index 91728f03..e5fec99b 100644 --- a/src/Routes/AcsEncodersClient.php +++ b/src/Routes/AcsEncodersClient.php @@ -100,8 +100,8 @@ public function get(string $acs_encoder_id): AcsEncoder * Returns a list of all [encoders](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners). * * @param string $acs_system_id ID of the access system for which you want to retrieve all encoders. - * @param array $acs_system_ids IDs of the access systems for which you want to retrieve all encoders. - * @param array $acs_encoder_ids IDs of the encoders that you want to retrieve. + * @param list $acs_system_ids IDs of the access systems for which you want to retrieve all encoders. + * @param list $acs_encoder_ids IDs of the encoders that you want to retrieve. * @param float $limit Number of encoders to return. * @param string|NullValue $page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`. * @param callable|null $on_response Called with the raw response envelope, used by the paginator to read the pagination metadata. diff --git a/src/Routes/AcsEntrancesClient.php b/src/Routes/AcsEntrancesClient.php index be84c517..85cc23fe 100644 --- a/src/Routes/AcsEntrancesClient.php +++ b/src/Routes/AcsEntrancesClient.php @@ -84,7 +84,7 @@ public function grant_access( * * @param string $access_method_id ID of the access method for which you want to retrieve all entrances to which it grants access. * @param string $acs_credential_id ID of the credential for which you want to retrieve all entrances. - * @param array $acs_entrance_ids IDs of the entrances for which you want to retrieve all entrances. + * @param list $acs_entrance_ids IDs of the entrances for which you want to retrieve all entrances. * @param string $acs_system_id ID of the access system for which you want to retrieve all entrances. * @param string $connected_account_id ID of the connected account for which you want to retrieve all entrances. * @param string $customer_key Customer key for which you want to list entrances. @@ -166,7 +166,7 @@ public function list( * Returns a list of all [credentials](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) with access to a specified [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). * * @param string $acs_entrance_id ID of the entrance for which you want to list all credentials that grant access. - * @param array $include_if Conditions that credentials must meet to be included in the returned list. + * @param list $include_if Conditions that credentials must meet to be included in the returned list. * @return array OK */ public function list_credentials_with_access( diff --git a/src/Routes/AcsSystemsClient.php b/src/Routes/AcsSystemsClient.php index b4b059db..c6093452 100644 --- a/src/Routes/AcsSystemsClient.php +++ b/src/Routes/AcsSystemsClient.php @@ -123,8 +123,8 @@ public function list_compatible_credential_manager_acs_systems( * Reports ACS system device status including encoders and entrances. * * @param string $acs_system_id ID of the ACS system to report resources for - * @param array $acs_encoders Array of ACS encoders to report - * @param array $acs_entrances Array of ACS entrances to report + * @param list|\stdClass> $acs_encoders Array of ACS encoders to report + * @param list|\stdClass> $acs_entrances Array of ACS entrances to report * @return void OK */ public function report_devices( diff --git a/src/Routes/AcsUsersClient.php b/src/Routes/AcsUsersClient.php index 64ce6cae..33551428 100644 --- a/src/Routes/AcsUsersClient.php +++ b/src/Routes/AcsUsersClient.php @@ -53,7 +53,7 @@ public function add_to_access_group( * @param string $acs_system_id ID of the access system to which you want to add the new access system user. * @param string $full_name Full name of the new access system user. * @param mixed $access_schedule `starts_at` and `ends_at` timestamps for the new access system user's access. If you specify an `access_schedule`, you may include both `starts_at` and `ends_at`. If you omit `starts_at`, it defaults to the current time. `ends_at` is optional and must be a time in the future and after `starts_at`. - * @param array $acs_access_group_ids Array of access group IDs to indicate the access groups to which you want to add the new access system user. + * @param list $acs_access_group_ids Array of access group IDs to indicate the access groups to which you want to add the new access system user. * @param string $email * @param string $email_address Email address of the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). * @param string $phone_number Phone number of the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) in E.164 format (for example, `+15555550100`). diff --git a/src/Routes/ActionAttemptsClient.php b/src/Routes/ActionAttemptsClient.php index 74acf26f..fe4fa397 100644 --- a/src/Routes/ActionAttemptsClient.php +++ b/src/Routes/ActionAttemptsClient.php @@ -60,7 +60,7 @@ public function get( /** * Returns a list of the [action attempts](https://docs.seam.co/core-concepts/action-attempts) that you specify as an array of `action_attempt_id`s. * - * @param array $action_attempt_ids IDs of the action attempts that you want to retrieve. + * @param list $action_attempt_ids IDs of the action attempts that you want to retrieve. * @param string $device_id ID of the device to filter action attempts by. * @param int $limit Maximum number of records to return per page. * @param string|NullValue $page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`. diff --git a/src/Routes/ClientSessionsClient.php b/src/Routes/ClientSessionsClient.php index 7146e7c8..cefeec04 100644 --- a/src/Routes/ClientSessionsClient.php +++ b/src/Routes/ClientSessionsClient.php @@ -27,14 +27,14 @@ public function __construct(ClientInterface $client, array $defaults) /** * Creates a new [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens). * - * @param array $connect_webview_ids IDs of the [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) for which you want to create a client session. - * @param array $connected_account_ids IDs of the [connected accounts](https://docs.seam.co/core-concepts/connected-accounts) for which you want to create a client session. + * @param list $connect_webview_ids IDs of the [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) for which you want to create a client session. + * @param list $connected_account_ids IDs of the [connected accounts](https://docs.seam.co/core-concepts/connected-accounts) for which you want to create a client session. * @param string $customer_id Customer ID that you want to associate with the new client session. * @param string $customer_key Customer key that you want to associate with the new client session. * @param string $expires_at Date and time at which the client session should expire, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. * @param string $user_identifier_key Your user ID for the user for whom you want to create a client session. * @param string $user_identity_id ID of the [user identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) for which you want to create a client session. - * @param array $user_identity_ids IDs of the [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) that you want to associate with the client session. + * @param list $user_identity_ids IDs of the [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) that you want to associate with the client session. * @return ClientSession OK */ public function create( @@ -136,12 +136,12 @@ public function get( /** * Returns a [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens) with specific characteristics or creates a new client session with these characteristics if it does not yet exist. * - * @param array $connect_webview_ids IDs of the [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) that you want to associate with the client session (or that are already associated with the existing client session). - * @param array $connected_account_ids IDs of the [connected accounts](https://docs.seam.co/api/connected_accounts) that you want to associate with the client session (or that are already associated with the existing client session). + * @param list $connect_webview_ids IDs of the [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) that you want to associate with the client session (or that are already associated with the existing client session). + * @param list $connected_account_ids IDs of the [connected accounts](https://docs.seam.co/api/connected_accounts) that you want to associate with the client session (or that are already associated with the existing client session). * @param string $expires_at Date and time at which the client session should expire in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. If the client session already exists, this will update the expiration before returning it. * @param string $user_identifier_key Your user ID for the user that you want to associate with the client session (or that is already associated with the existing client session). * @param string $user_identity_id ID of the [user identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) that you want to associate with the client session (or that are already associated with the existing client session). - * @param array $user_identity_ids IDs of the [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) that you want to associate with the client session. + * @param list $user_identity_ids IDs of the [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) that you want to associate with the client session. * @return ClientSession OK */ public function get_or_create( @@ -192,11 +192,11 @@ public function get_or_create( * Grants a [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens) access to one or more resources, such as [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews), [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity), and so on. * * @param string $client_session_id ID of the client session to which you want to grant access to resources. - * @param array $connect_webview_ids IDs of the [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) that you want to associate with the client session. - * @param array $connected_account_ids IDs of the [connected accounts](https://docs.seam.co/core-concepts/connected-accounts) that you want to associate with the client session. + * @param list $connect_webview_ids IDs of the [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) that you want to associate with the client session. + * @param list $connected_account_ids IDs of the [connected accounts](https://docs.seam.co/core-concepts/connected-accounts) that you want to associate with the client session. * @param string $user_identifier_key Your user ID for the user that you want to associate with the client session. * @param string $user_identity_id ID of the [user identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) that you want to associate with the client session. - * @param array $user_identity_ids IDs of the [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) that you want to associate with the client session. + * @param list $user_identity_ids IDs of the [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) that you want to associate with the client session. * @return void OK */ public function grant_access( diff --git a/src/Routes/ConnectWebviewsClient.php b/src/Routes/ConnectWebviewsClient.php index 5dc7b7e3..adacfc8f 100644 --- a/src/Routes/ConnectWebviewsClient.php +++ b/src/Routes/ConnectWebviewsClient.php @@ -34,14 +34,14 @@ public function __construct(ClientInterface $client, array $defaults) * * See also: [Connect Webview Process](https://docs.seam.co/core-concepts/connect-webviews/connect-webview-process). * - * @param array $accepted_capabilities List of accepted device capabilities that restrict the types of devices that can be connected through the Connect Webview. If not provided, defaults will be determined based on the accepted providers. - * @param array $accepted_providers Accepted device provider keys as an alternative to `provider_category`. Use this parameter to specify accepted providers explicitly. See [Customize the Brands to Display in Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-brands-to-display-in-your-connect-webviews). To list all provider keys, use [`/devices/list_device_providers`](https://docs.seam.co/api/devices/list_device_providers) with no filters. + * @param list $accepted_capabilities List of accepted device capabilities that restrict the types of devices that can be connected through the Connect Webview. If not provided, defaults will be determined based on the accepted providers. + * @param list $accepted_providers Accepted device provider keys as an alternative to `provider_category`. Use this parameter to specify accepted providers explicitly. See [Customize the Brands to Display in Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-brands-to-display-in-your-connect-webviews). To list all provider keys, use [`/devices/list_device_providers`](https://docs.seam.co/api/devices/list_device_providers) with no filters. * @param bool $automatically_manage_new_devices Indicates whether newly-added devices should appear as [managed devices](https://docs.seam.co/core-concepts/devices/managed-and-unmanaged-devices). See also: [Customize the Behavior Settings of Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-behavior-settings-of-your-connect-webviews). * @param array|\stdClass $custom_metadata Custom metadata that you want to associate with the Connect Webview. Supports up to 50 JSON key:value pairs. [Adding custom metadata to a Connect Webview](https://docs.seam.co/core-concepts/connect-webviews/attaching-custom-data-to-the-connect-webview) enables you to store custom information, like customer details or internal IDs from your application. The custom metadata is then transferred to any [connected accounts](https://docs.seam.co/core-concepts/connected-accounts) that were connected using the Connect Webview, making it easy to find and filter these resources in your [workspace](https://docs.seam.co/core-concepts/workspaces). You can also [filter Connect Webviews by custom metadata](https://docs.seam.co/core-concepts/connect-webviews/filtering-connect-webviews-by-custom-metadata). * @param string $custom_redirect_failure_url Alternative URL that you want to redirect the user to on an error. If you do not set this parameter, the Connect Webview falls back to the `custom_redirect_url`. * @param string $custom_redirect_url URL that you want to redirect the user to after the provider login is complete. * @param string $customer_key Associate the Connect Webview, the connected account, and all resources under the connected account with a customer. If the connected account already exists, it will be associated with the customer. If the connected account already exists, but is already associated with a customer, the Connect Webview will show an error. - * @param array $excluded_providers List of provider keys to exclude from the Connect Webview. These providers will not be shown when the user tries to connect an account. + * @param list $excluded_providers List of provider keys to exclude from the Connect Webview. These providers will not be shown when the user tries to connect an account. * @param string $provider_category Specifies the category of providers that you want to include. To list all providers within a category, use [`/devices/list_device_providers`](https://docs.seam.co/api/devices/list_device_providers) with the desired `provider_category` filter. * @param bool $wait_for_device_creation Indicates whether Seam should finish syncing all devices in a newly-connected account before completing the associated Connect Webview. See also: [Customize the Behavior Settings of Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-behavior-settings-of-your-connect-webviews). * @return ConnectWebview OK diff --git a/src/Routes/ConnectedAccountsClient.php b/src/Routes/ConnectedAccountsClient.php index 7dc68fef..1b311387 100644 --- a/src/Routes/ConnectedAccountsClient.php +++ b/src/Routes/ConnectedAccountsClient.php @@ -174,7 +174,7 @@ public function sync(string $connected_account_id): void * Updates a [connected account](https://docs.seam.co/core-concepts/connected-accounts). * * @param string $connected_account_id ID of the connected account that you want to update. - * @param array $accepted_capabilities List of accepted device capabilities that restrict the types of devices that can be connected through this connected account. Valid values are `lock`, `thermostat`, `noise_sensor`, and `access_control`. + * @param list $accepted_capabilities List of accepted device capabilities that restrict the types of devices that can be connected through this connected account. Valid values are `lock`, `thermostat`, `noise_sensor`, and `access_control`. * @param bool $automatically_manage_new_devices Indicates whether newly-added devices should appear as [managed devices](https://docs.seam.co/core-concepts/devices/managed-and-unmanaged-devices). * @param array|\stdClass $custom_metadata Custom metadata that you want to associate with the connected account. Entirely replaces the existing custom metadata object. If a new Connect Webview contains custom metadata and is used to reconnect a connected account, the custom metadata from the Connect Webview will entirely replace the entire custom metadata object on the connected account. Supports up to 50 JSON key:value pairs. [Adding custom metadata to a connected account](https://docs.seam.co/core-concepts/connected-accounts/adding-custom-metadata-to-a-connected-account) enables you to store custom information, like customer details or internal IDs from your application. Then, you can [filter connected accounts by the desired metadata](https://docs.seam.co/core-concepts/connected-accounts/filtering-connected-accounts-by-custom-metadata). * @param string $customer_key The customer key to associate with this connected account. If provided, the connected account and all resources under the connected account will be moved to this customer. May only be provided if the connected account is not already associated with a customer. diff --git a/src/Routes/CustomersClient.php b/src/Routes/CustomersClient.php index 7baced07..1ee55265 100644 --- a/src/Routes/CustomersClient.php +++ b/src/Routes/CustomersClient.php @@ -27,7 +27,7 @@ public function __construct(ClientInterface $client, array $defaults) /** * Creates a new customer portal magic link with configurable features. * - * @param array $customer_resources_filters Filter configuration for resources based on their custom_metadata. Each filter specifies a field, operation, and value to match against resource custom_metadata. + * @param list|\stdClass> $customer_resources_filters Filter configuration for resources based on their custom_metadata. Each filter specifies a field, operation, and value to match against resource custom_metadata. * @param string $customization_profile_id The ID of the customization profile to use for the portal. * @param mixed $deep_link Deep link target resource for initial redirect. When set, the portal will navigate directly to the specified resource. * @param bool $exclude_locale_picker Whether to exclude the option to select a locale within the portal UI. @@ -108,25 +108,25 @@ public function create_portal( * Deletes customer data including resources like spaces, properties, rooms, users, etc. * This will delete the partner resources and any related Seam resources (user identities, access grants, spaces). * - * @param array $access_grant_keys List of access grant keys to delete. - * @param array $booking_keys List of booking keys to delete. - * @param array $building_keys List of building keys to delete. - * @param array $common_area_keys List of common area keys to delete. - * @param array $customer_keys List of customer keys to delete all data for. - * @param array $facility_keys List of facility keys to delete. - * @param array $guest_keys List of guest keys to delete. - * @param array $listing_keys List of listing keys to delete. - * @param array $property_keys List of property keys to delete. - * @param array $property_listing_keys List of property listing keys to delete. - * @param array $reservation_keys List of reservation keys to delete. - * @param array $resident_keys List of resident keys to delete. - * @param array $room_keys List of room keys to delete. - * @param array $space_keys List of space keys to delete. - * @param array $staff_member_keys List of staff member keys to delete. - * @param array $tenant_keys List of tenant keys to delete. - * @param array $unit_keys List of unit keys to delete. - * @param array $user_identity_keys List of user identity keys to delete. - * @param array $user_keys List of user keys to delete. + * @param list $access_grant_keys List of access grant keys to delete. + * @param list $booking_keys List of booking keys to delete. + * @param list $building_keys List of building keys to delete. + * @param list $common_area_keys List of common area keys to delete. + * @param list $customer_keys List of customer keys to delete all data for. + * @param list $facility_keys List of facility keys to delete. + * @param list $guest_keys List of guest keys to delete. + * @param list $listing_keys List of listing keys to delete. + * @param list $property_keys List of property keys to delete. + * @param list $property_listing_keys List of property listing keys to delete. + * @param list $reservation_keys List of reservation keys to delete. + * @param list $resident_keys List of resident keys to delete. + * @param list $room_keys List of room keys to delete. + * @param list $space_keys List of space keys to delete. + * @param list $staff_member_keys List of staff member keys to delete. + * @param list $tenant_keys List of tenant keys to delete. + * @param list $unit_keys List of unit keys to delete. + * @param list $user_identity_keys List of user identity keys to delete. + * @param list $user_keys List of user keys to delete. * @return void OK */ public function delete_data( @@ -219,25 +219,25 @@ public function delete_data( * Pushes customer data including resources like spaces, properties, rooms, users, etc. * * @param string $customer_key Your unique identifier for the customer. - * @param array $access_grants List of access grants. - * @param array $bookings List of bookings. - * @param array $buildings List of buildings. - * @param array $common_areas List of shared common areas. - * @param array $facilities List of gym or fitness facilities. - * @param array $guests List of guests. - * @param array $listings List of property listings. - * @param array $properties List of short-term rental properties. - * @param array $property_listings List of property listings. - * @param array $reservations List of reservations. - * @param array $residents List of residents. - * @param array $rooms List of hotel or hospitality rooms. - * @param array $sites List of general sites or areas. - * @param array $spaces List of general spaces or areas. - * @param array $staff_members List of staff members. - * @param array $tenants List of tenants. - * @param array $units List of multi-family residential units. - * @param array $user_identities List of user identities. - * @param array $users List of users. + * @param list|\stdClass> $access_grants List of access grants. + * @param list|\stdClass> $bookings List of bookings. + * @param list|\stdClass> $buildings List of buildings. + * @param list|\stdClass> $common_areas List of shared common areas. + * @param list|\stdClass> $facilities List of gym or fitness facilities. + * @param list|\stdClass> $guests List of guests. + * @param list|\stdClass> $listings List of property listings. + * @param list|\stdClass> $properties List of short-term rental properties. + * @param list|\stdClass> $property_listings List of property listings. + * @param list|\stdClass> $reservations List of reservations. + * @param list|\stdClass> $residents List of residents. + * @param list|\stdClass> $rooms List of hotel or hospitality rooms. + * @param list|\stdClass> $sites List of general sites or areas. + * @param list|\stdClass> $spaces List of general spaces or areas. + * @param list|\stdClass> $staff_members List of staff members. + * @param list|\stdClass> $tenants List of tenants. + * @param list|\stdClass> $units List of multi-family residential units. + * @param list|\stdClass> $user_identities List of user identities. + * @param list|\stdClass> $users List of users. * @return void OK */ public function push_data( diff --git a/src/Routes/DevicesClient.php b/src/Routes/DevicesClient.php index 7cd98776..ab41c023 100644 --- a/src/Routes/DevicesClient.php +++ b/src/Routes/DevicesClient.php @@ -68,13 +68,13 @@ public function get(?string $device_id = null, ?string $name = null): Device * * @param string $connect_webview_id ID of the Connect Webview for which you want to list devices. * @param string $connected_account_id ID of the connected account for which you want to list devices. - * @param array $connected_account_ids Array of IDs of the connected accounts for which you want to list devices. + * @param list $connected_account_ids Array of IDs of the connected accounts for which you want to list devices. * @param string $created_before Timestamp by which to limit returned devices. Returns devices created before this timestamp. * @param array|\stdClass $custom_metadata_has Set of key:value [custom metadata](https://docs.seam.co/core-concepts/devices/adding-custom-metadata-to-a-device) pairs for which you want to list devices. * @param string $customer_key Customer key for which you want to list devices. - * @param array $device_ids Array of device IDs for which you want to list devices. + * @param list $device_ids Array of device IDs for which you want to list devices. * @param string $device_type Device type for which you want to list devices. - * @param array $device_types Array of device types for which you want to list devices. + * @param list $device_types Array of device types for which you want to list devices. * @param float $limit Numerical limit on the number of devices to return. * @param string $manufacturer Manufacturer for which you want to list devices. * @param string|NullValue $page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`. @@ -209,7 +209,7 @@ public function list_device_providers( /** * Updates provider-specific metadata for devices. * - * @param array $devices Array of devices with provider metadata to update + * @param list|\stdClass> $devices Array of devices with provider metadata to update * @return void OK */ public function report_provider_metadata(array $devices): void diff --git a/src/Routes/DevicesUnmanagedClient.php b/src/Routes/DevicesUnmanagedClient.php index 9ebb9e2f..2f70c9b2 100644 --- a/src/Routes/DevicesUnmanagedClient.php +++ b/src/Routes/DevicesUnmanagedClient.php @@ -72,12 +72,12 @@ public function get( * * @param string $connect_webview_id ID of the Connect Webview for which you want to list devices. * @param string $connected_account_id ID of the connected account for which you want to list devices. - * @param array $connected_account_ids Array of IDs of the connected accounts for which you want to list devices. + * @param list $connected_account_ids Array of IDs of the connected accounts for which you want to list devices. * @param string $created_before Timestamp by which to limit returned devices. Returns devices created before this timestamp. * @param string $customer_key Customer key for which you want to list devices. - * @param array $device_ids Array of device IDs for which you want to list devices. + * @param list $device_ids Array of device IDs for which you want to list devices. * @param string $device_type Device type for which you want to list devices. - * @param array $device_types Array of device types for which you want to list devices. + * @param list $device_types Array of device types for which you want to list devices. * @param float $limit Numerical limit on the number of devices to return. * @param string $manufacturer Manufacturer for which you want to list devices. * @param string|NullValue $page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`. diff --git a/src/Routes/EventsClient.php b/src/Routes/EventsClient.php index 671745be..6a4509ce 100644 --- a/src/Routes/EventsClient.php +++ b/src/Routes/EventsClient.php @@ -67,31 +67,31 @@ public function get( * Returns a list of all events. This endpoint returns the same events that would be sent to a [webhook](https://docs.seam.co/developer-tools/webhooks), but it enables you to filter or see events that already took place. * * @param string $access_code_id ID of the access code for which you want to list events. - * @param array $access_code_ids IDs of the access codes for which you want to list events. + * @param list $access_code_ids IDs of the access codes for which you want to list events. * @param string $access_grant_id ID of the access grant for which you want to list events. - * @param array $access_grant_ids IDs of the access grants for which you want to list events. + * @param list $access_grant_ids IDs of the access grants for which you want to list events. * @param string $access_method_id ID of the access method for which you want to list events. - * @param array $access_method_ids IDs of the access methods for which you want to list events. + * @param list $access_method_ids IDs of the access methods for which you want to list events. * @param string $acs_access_group_id ID of the ACS access group for which you want to list events. * @param string $acs_credential_id ID of the ACS credential for which you want to list events. * @param string $acs_encoder_id ID of the ACS encoder for which you want to list events. * @param string $acs_entrance_id ID of the ACS entrance for which you want to list events. * @param string $acs_system_id ID of the access system for which you want to list events. - * @param array $acs_system_ids IDs of the access systems for which you want to list events. + * @param list $acs_system_ids IDs of the access systems for which you want to list events. * @param string $acs_user_id ID of the ACS user for which you want to list events. - * @param array $between Lower and upper timestamps to define an exclusive interval containing the events that you want to list. You must include `since` or `between`. + * @param list $between Lower and upper timestamps to define an exclusive interval containing the events that you want to list. You must include `since` or `between`. * @param string $connect_webview_id ID of the Connect Webview for which you want to list events. * @param string $connected_account_id ID of the connected account for which you want to list events. * @param string $customer_key Customer key for which you want to list events. * @param string $device_id ID of the device for which you want to list events. - * @param array $device_ids IDs of the devices for which you want to list events. - * @param array $event_ids IDs of the events that you want to list. + * @param list $device_ids IDs of the devices for which you want to list events. + * @param list $event_ids IDs of the events that you want to list. * @param string $event_type Type of the events that you want to list. - * @param array $event_types Types of the events that you want to list. + * @param list $event_types Types of the events that you want to list. * @param float $limit Numerical limit on the number of events to return. * @param string $since Timestamp to indicate the beginning generation time for the events that you want to list. You must include `since` or `between`. * @param string $space_id ID of the space for which you want to list events. - * @param array $space_ids IDs of the spaces for which you want to list events. + * @param list $space_ids IDs of the spaces for which you want to list events. * @param float $unstable_offset Offset for the events that you want to list. * @param string $user_identity_id ID of the user identity for which you want to list events. * @return array OK diff --git a/src/Routes/LocksClient.php b/src/Routes/LocksClient.php index d02b6263..a1d64a7c 100644 --- a/src/Routes/LocksClient.php +++ b/src/Routes/LocksClient.php @@ -112,7 +112,7 @@ public function get(?string $device_id = null, ?string $name = null): Device * @param string $connected_account_id ID of the connected account for which you want to list devices. * @param string $customer_key Customer key for which you want to list devices. * @param string $device_type Device type of the locks that you want to list. - * @param array $device_types Device types of the locks that you want to list. + * @param list $device_types Device types of the locks that you want to list. * @param string $manufacturer Manufacturer of the locks that you want to list. * @return array OK */ diff --git a/src/Routes/NoiseSensorsClient.php b/src/Routes/NoiseSensorsClient.php index 4901eabb..05079f0e 100644 --- a/src/Routes/NoiseSensorsClient.php +++ b/src/Routes/NoiseSensorsClient.php @@ -37,7 +37,7 @@ public function __construct(ClientInterface $client, array $defaults) * @param string $connected_account_id ID of the connected account for which you want to list devices. * @param string $customer_key Customer key for which you want to list devices. * @param string $device_type Device type of the noise sensors that you want to list. - * @param array $device_types Device types of the noise sensors that you want to list. + * @param list $device_types Device types of the noise sensors that you want to list. * @param string $manufacturer Manufacturers of the noise sensors that you want to list. * @return array OK */ diff --git a/src/Routes/SpacesClient.php b/src/Routes/SpacesClient.php index e4e3f398..beb92404 100644 --- a/src/Routes/SpacesClient.php +++ b/src/Routes/SpacesClient.php @@ -29,7 +29,7 @@ public function __construct(ClientInterface $client, array $defaults) /** * Adds [entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) to a specific space. * - * @param array $acs_entrance_ids IDs of the entrances that you want to add to the space. + * @param list $acs_entrance_ids IDs of the entrances that you want to add to the space. * @param string $space_id ID of the space to which you want to add entrances. * @return void OK */ @@ -71,7 +71,7 @@ public function add_connected_account( /** * Adds devices to a specific space. * - * @param array $device_ids IDs of the devices that you want to add to the space. + * @param list $device_ids IDs of the devices that you want to add to the space. * @param string $space_id ID of the space to which you want to add devices. * @return void OK */ @@ -91,11 +91,11 @@ public function add_devices(array $device_ids, string $space_id): void * Creates a new space. * * @param string $name Name of the space that you want to create. - * @param array $acs_entrance_ids IDs of the entrances that you want to add to the new space. - * @param array $connected_account_ids IDs of connected accounts to associate with the new space. Persisted on seam.location_third_party_account so the UI can show which provider account(s) a space came from. + * @param list $acs_entrance_ids IDs of the entrances that you want to add to the new space. + * @param list $connected_account_ids IDs of connected accounts to associate with the new space. Persisted on seam.location_third_party_account so the UI can show which provider account(s) a space came from. * @param mixed $customer_data Reservation/stay-related defaults for the space. * @param string $customer_key Customer key for which you want to create the space. - * @param array $device_ids IDs of the devices that you want to add to the new space. + * @param list $device_ids IDs of the devices that you want to add to the new space. * @param string $space_key Unique key for the space within the workspace. * @return Space OK */ @@ -193,10 +193,10 @@ public function get( /** * Gets all related resources for one or more Spaces. * - * @param array $exclude - * @param array $include - * @param array $space_ids IDs of the spaces that you want to get along with their related resources. - * @param array $space_keys Keys of the spaces that you want to get along with their related resources. + * @param list $exclude + * @param list $include + * @param list $space_ids IDs of the spaces that you want to get along with their related resources. + * @param list $space_keys Keys of the spaces that you want to get along with their related resources. * @return Batch OK */ public function get_related( @@ -297,7 +297,7 @@ public function list( /** * Removes [entrances](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) from a specific space. * - * @param array $acs_entrance_ids IDs of the entrances that you want to remove from the space. + * @param list $acs_entrance_ids IDs of the entrances that you want to remove from the space. * @param string $space_id ID of the space from which you want to remove entrances. * @return void OK */ @@ -339,7 +339,7 @@ public function remove_connected_account( /** * Removes devices from a specific space. * - * @param array $device_ids IDs of the devices that you want to remove from the space. + * @param list $device_ids IDs of the devices that you want to remove from the space. * @param string $space_id ID of the space from which you want to remove devices. * @return void OK */ @@ -358,9 +358,9 @@ public function remove_devices(array $device_ids, string $space_id): void /** * Updates an existing space. * - * @param array $acs_entrance_ids IDs of the entrances that you want to set for the space. If specified, this will replace all existing entrances. + * @param list $acs_entrance_ids IDs of the entrances that you want to set for the space. If specified, this will replace all existing entrances. * @param mixed $customer_data Reservation/stay-related defaults for the space. Only the keys you provide are updated; omit a key to leave it unchanged. Pass null on a key to clear it. - * @param array $device_ids IDs of the devices that you want to set for the space. If specified, this will replace all existing devices. + * @param list $device_ids IDs of the devices that you want to set for the space. If specified, this will replace all existing devices. * @param string $name Name of the space. * @param string $space_id ID of the space that you want to update. * @param string $space_key Unique key of the space that you want to update. diff --git a/src/Routes/ThermostatsClient.php b/src/Routes/ThermostatsClient.php index a20245d3..bac9241b 100644 --- a/src/Routes/ThermostatsClient.php +++ b/src/Routes/ThermostatsClient.php @@ -333,7 +333,7 @@ public function heat_cool( * @param string $connected_account_id ID of the connected account for which you want to list devices. * @param string $customer_key Customer key for which you want to list devices. * @param string $device_type Device type by which you want to filter thermostat devices. - * @param array $device_types Array of device types by which you want to filter thermostat devices. + * @param list $device_types Array of device types by which you want to filter thermostat devices. * @param string $manufacturer Manufacturer by which you want to filter thermostat devices. * @return array OK */ diff --git a/src/Routes/ThermostatsDailyProgramsClient.php b/src/Routes/ThermostatsDailyProgramsClient.php index e6a71d7c..32458eca 100644 --- a/src/Routes/ThermostatsDailyProgramsClient.php +++ b/src/Routes/ThermostatsDailyProgramsClient.php @@ -31,7 +31,7 @@ public function __construct(ClientInterface $client, array $defaults) * * @param string $device_id ID of the thermostat device for which you want to create a daily program. * @param string $name Name of the thermostat daily program. - * @param array $periods Array of thermostat daily program periods. + * @param list|\stdClass> $periods Array of thermostat daily program periods. * @return ThermostatDailyProgram OK */ public function create( @@ -85,7 +85,7 @@ public function delete(string $thermostat_daily_program_id): void * Updates a specified thermostat daily program. The periods that you specify overwrite any existing periods for the daily program. * * @param string $name Name of the thermostat daily program that you want to update. - * @param array $periods Array of thermostat daily program periods. The periods that you specify overwrite any existing periods for the daily program. + * @param list|\stdClass> $periods Array of thermostat daily program periods. The periods that you specify overwrite any existing periods for the daily program. * @param string $thermostat_daily_program_id ID of the thermostat daily program that you want to update. * @param bool|array|null $wait_for_action_attempt Whether to wait for the action attempt to finish, optionally with timeout and polling_interval in seconds. Defaults to the value set on the client. * @return ActionAttempt OK diff --git a/src/Routes/UserIdentitiesClient.php b/src/Routes/UserIdentitiesClient.php index 390fc72b..3bb35ff6 100644 --- a/src/Routes/UserIdentitiesClient.php +++ b/src/Routes/UserIdentitiesClient.php @@ -69,7 +69,7 @@ public function add_acs_user( /** * Creates a new [user identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity). * - * @param array $acs_system_ids List of access system IDs to associate with the new user identity through access system users. If there's no user with the same email address or phone number in the specified access systems, a new access system user is created. If there is an existing user with the same email or phone number in the specified access systems, the user is linked to the user identity. + * @param list $acs_system_ids List of access system IDs to associate with the new user identity through access system users. If there's no user with the same email address or phone number in the specified access systems, a new access system user is created. If there is an existing user with the same email or phone number in the specified access systems, the user is linked to the user identity. * @param string|NullValue $email_address Unique email address for the new user identity. * @param string|NullValue $full_name Full name of the user associated with the new user identity. * @param string|NullValue $phone_number Unique phone number for the new user identity in E.164 format (for example, +15555550100). @@ -238,7 +238,7 @@ public function grant_access_to_device( * @param int $limit Maximum number of records to return per page. * @param string|NullValue $page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`. * @param string $search String for which to search. Filters returned user identities to include all records that satisfy a partial match using `full_name`, `phone_number`, `email_address` or `user_identity_id`. - * @param array $user_identity_ids Array of user identity IDs by which to filter the list of user identities. + * @param list $user_identity_ids Array of user identity IDs by which to filter the list of user identities. * @param callable|null $on_response Called with the raw response envelope, used by the paginator to read the pagination metadata. * @return array OK */ diff --git a/src/Routes/WebhooksClient.php b/src/Routes/WebhooksClient.php index 9d53b37e..042dda4e 100644 --- a/src/Routes/WebhooksClient.php +++ b/src/Routes/WebhooksClient.php @@ -28,7 +28,7 @@ public function __construct(ClientInterface $client, array $defaults) * Creates a new [webhook](https://docs.seam.co/developer-tools/webhooks). * * @param string $url URL for the new webhook. - * @param array $event_types Types of events that you want the new webhook to receive. + * @param list $event_types Types of events that you want the new webhook to receive. * @return Webhook OK */ public function create(string $url, ?array $event_types = null): Webhook @@ -107,7 +107,7 @@ public function list(): array /** * Updates a specified [webhook](https://docs.seam.co/developer-tools/webhooks). * - * @param array $event_types Types of events that you want the webhook to receive. + * @param list $event_types Types of events that you want the webhook to receive. * @param string $webhook_id ID of the webhook that you want to update. * @return void OK */ diff --git a/src/SeamWebhook.php b/src/SeamWebhook.php index e46d9ec5..f993d0fa 100644 --- a/src/SeamWebhook.php +++ b/src/SeamWebhook.php @@ -26,6 +26,16 @@ public function __construct(string $secret) /** * Verifies an incoming webhook request and returns the event it carries. + * Known event types are returned as concrete Event subclasses for + * instanceof or match-based dispatch; newer types use Event\UnknownEvent. + * + * ```php + * match (true) { + * $event instanceof Event\AccessCodeCreated => $event->access_code_id, + * $event instanceof Event\UnknownEvent => $event->event_type, + * default => null, + * }; + * ``` * * @param string $payload The raw HTTP request body. * @param array $headers The HTTP request headers. diff --git a/tests/LiteralBooleanTypesTest.php b/tests/LiteralBooleanTypesTest.php index d1e74e9f..d0f5fadc 100644 --- a/tests/LiteralBooleanTypesTest.php +++ b/tests/LiteralBooleanTypesTest.php @@ -32,7 +32,10 @@ public function testAccessCodeBooleanConstraintsArePreserved(): void ); foreach ( - [AccessCode\Errors::class, UnmanagedAccessCode\Errors::class] + [ + AccessCode\Errors\ProviderIssue::class, + UnmanagedAccessCode\Errors\ProviderIssue::class, + ] as $class ) { $this->assertSame( @@ -42,6 +45,15 @@ public function testAccessCodeBooleanConstraintsArePreserved(): void "is_access_code_error", ))->getType(), ); + } + + foreach ( + [ + AccessCode\Errors\BridgeDisconnected::class, + UnmanagedAccessCode\Errors\BridgeDisconnected::class, + ] + as $class + ) { $this->assertSame( "?bool", (string) (new ReflectionProperty( @@ -54,7 +66,7 @@ public function testAccessCodeBooleanConstraintsArePreserved(): void $this->assertSame( "?bool", (string) (new ReflectionProperty( - ActionAttempt\Result::class, + ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam::class, "is_managed", ))->getType(), ); diff --git a/tests/RecordTypesTest.php b/tests/RecordTypesTest.php index 9ee40b22..41a072a2 100644 --- a/tests/RecordTypesTest.php +++ b/tests/RecordTypesTest.php @@ -8,7 +8,8 @@ use ReflectionMethod; use ReflectionProperty; use Seam\Resources\Device; -use Seam\Resources\Event; +use Seam\Resources\Event\AccessCodeCreated; +use Seam\Resources\Event\NoiseSensorNoiseThresholdTriggered; use Seam\Routes\DevicesClient; final class RecordTypesTest extends TestCase @@ -32,14 +33,14 @@ public function testRecordValueTypesAreGenerated(): void $this->assertStringContainsString( "@var array|\\stdClass|null", (string) (new ReflectionProperty( - Event::class, + AccessCodeCreated::class, "connected_account_custom_metadata", ))->getDocComment(), ); $this->assertStringContainsString( "@var array|\\stdClass|null", (string) (new ReflectionProperty( - Event::class, + NoiseSensorNoiseThresholdTriggered::class, "minut_metadata", ))->getDocComment(), ); diff --git a/tests/ResourceTest.php b/tests/ResourceTest.php index 58d19ed7..9dfaaef0 100644 --- a/tests/ResourceTest.php +++ b/tests/ResourceTest.php @@ -6,6 +6,10 @@ use PHPUnit\Framework\TestCase; use Seam\Resources\Device; +use Seam\Resources\Device\Errors\DeviceOffline; +use Seam\Resources\Device\Errors\ErrorCode; +use Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner; +use Seam\Resources\Device\Properties\Battery\Status; /** * The generated resource classes nest a property's class inside the namespace @@ -73,7 +77,7 @@ public function testSameNamedPropertiesAtDifferentDepthsKeepTheirShapes(): void ); $this->assertSame(0.4, $device->properties->battery->level); - $this->assertSame("low", $device->properties->battery->status); + $this->assertSame(Status::LOW, $device->properties->battery->status); $this->assertSame( 0.25, @@ -97,22 +101,14 @@ class_exists("Seam\\Resources\\DeviceProperties"), ); } - /** - * A list of discriminated objects collapses into one class carrying the - * union of the variant properties, so a field only some variants declare is - * still readable. - */ - public function testDiscriminatedListMergesEveryVariantProperty(): void + public function testDiscriminatedListReturnsTheSpecificVariant(): void { - $device = $this->device(); - - $error = $device->errors[0]; + $error = $this->device()->errors[0]; - $this->assertInstanceOf(Device\Errors::class, $error); - $this->assertSame("device_offline", $error->error_code); + $this->assertInstanceOf(DeviceOffline::class, $error); + $this->assertSame(ErrorCode::DEVICE_OFFLINE, $error->error_code); $this->assertTrue($error->is_device_error); - $this->assertObjectHasProperty("is_bridge_error", $error); - $this->assertNull($error->is_bridge_error); + $this->assertObjectNotHasProperty("is_bridge_error", $error); } /** @@ -156,6 +152,6 @@ public function testClimatePresetMetadataKeepsItsOwnShape(): void $this->assertNotNull($preset); $this->assertSame("sleep", $preset->climate_ref); $this->assertTrue($preset->is_optimized); - $this->assertSame("user", $preset->owner); + $this->assertSame(Owner::USER, $preset->owner); } } diff --git a/tests/SeamWebhookTest.php b/tests/SeamWebhookTest.php index f60e96fc..a622d695 100644 --- a/tests/SeamWebhookTest.php +++ b/tests/SeamWebhookTest.php @@ -6,6 +6,11 @@ use PHPUnit\Framework\TestCase; use Seam\InvalidWebhookPayloadError; +use Seam\Resources\Event; +use Seam\Resources\Event\AccessCodeCreated; +use Seam\Resources\Event\DeviceConnected; +use Seam\Resources\Event\EventType; +use Seam\Resources\Event\UnknownEvent; use Seam\SeamException; use Seam\SeamWebhook; use Svix\Exception\WebhookVerificationException; @@ -57,7 +62,8 @@ public function testVerifyReturnsTheEvent(): void $this->signed_headers($payload), ); - $this->assertSame("device.connected", $event->event_type); + $this->assertInstanceOf(DeviceConnected::class, $event); + $this->assertSame(EventType::DEVICE_CONNECTED, $event->event_type); $this->assertSame( "8d7e0b26-5e6c-4a1f-9b3d-1b0f0e5a9c11", $event->event_id, @@ -75,7 +81,41 @@ public function testVerifyAcceptsHeadersInAnyCase(): void $event = (new SeamWebhook(self::SECRET))->verify($payload, $headers); - $this->assertSame("device.connected", $event->event_type); + $this->assertSame(EventType::DEVICE_CONNECTED, $event->event_type); + } + + public function testDecodesAnAccessCodeEventIntoItsSpecificClass(): void + { + $event = Event::from_json( + json_decode( + json_encode([ + "event_id" => "event_1", + "event_type" => "access_code.created", + "workspace_id" => "workspace_1", + "access_code_id" => "access_code_1", + "connected_account_id" => "connected_account_1", + "device_id" => "device_1", + "created_at" => "2024-01-01T00:00:00.000Z", + "occurred_at" => "2024-01-01T00:00:00.000Z", + ]), + ), + ); + + $this->assertInstanceOf(AccessCodeCreated::class, $event); + $this->assertSame("access_code_1", $event->access_code_id); + } + + public function testUnknownEventTypeUsesTheFallback(): void + { + $event = Event::from_json( + (object) [ + "event_id" => "event_1", + "event_type" => "device.future_event", + ], + ); + + $this->assertInstanceOf(UnknownEvent::class, $event); + $this->assertSame("device.future_event", $event->event_type); } public function testVerifyRejectsATamperedPayload(): void diff --git a/tests/WaitForActionAttemptTest.php b/tests/WaitForActionAttemptTest.php index 601433cf..dc864032 100644 --- a/tests/WaitForActionAttemptTest.php +++ b/tests/WaitForActionAttemptTest.php @@ -9,6 +9,8 @@ use Seam\ActionAttemptTimeoutError; use Seam\InvalidOptionsError; use Seam\Resources\ActionAttempt; +use Seam\Resources\ActionAttempt\Status; +use Seam\Resources\ActionAttempt\UnlockDoor; use Seam\Seam; use Tests\Support\FakeSeamConnectTestCase; use Tests\Support\RecordingClient; @@ -21,7 +23,10 @@ private function pending_action_attempt(Seam $seam): ActionAttempt $this->seed["august_device_1"], ); - $this->assertSame("pending", $action_attempt->status); + $this->assertInstanceOf(UnlockDoor::class, $action_attempt); + $this->assertSame(Status::PENDING, $action_attempt->status); + $this->assertNull($action_attempt->error); + $this->assertNull($action_attempt->result); $this->set_status($seam, $action_attempt, "pending"); @@ -47,7 +52,7 @@ public function testListReturnsActionAttemptsWithoutResolvingThem(): void $pending->action_attempt_id, $attempts[0]->action_attempt_id, ); - $this->assertSame("pending", $attempts[0]->status); + $this->assertSame(Status::PENDING, $attempts[0]->status); } private function set_status( @@ -71,7 +76,7 @@ public function testWaitsByDefault(): void $this->seed["august_device_1"], ); - $this->assertSame("success", $action_attempt->status); + $this->assertSame(Status::SUCCESS, $action_attempt->status); } public function testClientDefaultCanDisableWaiting(): void @@ -82,7 +87,7 @@ public function testClientDefaultCanDisableWaiting(): void $this->seed["august_device_1"], ); - $this->assertSame("pending", $action_attempt->status); + $this->assertSame(Status::PENDING, $action_attempt->status); } /** @@ -103,7 +108,7 @@ public function testClientDefaultCanBeAnOptionsArray(): void $this->seed["august_device_1"], ); - $this->assertSame("success", $action_attempt->status); + $this->assertSame(Status::SUCCESS, $action_attempt->status); } public function testPerCallOptionCanDisableWaiting(): void @@ -113,7 +118,7 @@ public function testPerCallOptionCanDisableWaiting(): void wait_for_action_attempt: false, ); - $this->assertSame("pending", $action_attempt->status); + $this->assertSame(Status::PENDING, $action_attempt->status); } public function testPerCallOptionCanEnableWaiting(): void @@ -125,7 +130,7 @@ public function testPerCallOptionCanEnableWaiting(): void wait_for_action_attempt: true, ); - $this->assertSame("success", $action_attempt->status); + $this->assertSame(Status::SUCCESS, $action_attempt->status); } public function testReturnsAnAlreadySuccessfulActionAttempt(): void @@ -142,7 +147,7 @@ public function testReturnsAnAlreadySuccessfulActionAttempt(): void wait_for_action_attempt: true, ); - $this->assertSame("success", $resolved->status); + $this->assertSame(Status::SUCCESS, $resolved->status); $this->assertSame( $action_attempt->action_attempt_id, $resolved->action_attempt_id, @@ -173,7 +178,7 @@ public function testWaitsForAnActionAttemptResolvedOutOfBand(): void ], ); - $this->assertSame("success", $resolved->status); + $this->assertSame(Status::SUCCESS, $resolved->status); } finally { proc_close($resolver); } @@ -243,7 +248,10 @@ public function testThrowsWhenTheActionAttemptFails(): void } catch (ActionAttemptFailedError $error) { $this->assertSame("Failed", $error->getMessage()); $this->assertSame("foo", $error->getErrorCode()); - $this->assertSame("error", $error->getActionAttempt()->status); + $this->assertSame( + Status::ERROR, + $error->getActionAttempt()->status, + ); $this->assertSame( $action_attempt->action_attempt_id, $error->getActionAttempt()->action_attempt_id, @@ -316,7 +324,7 @@ public function testResolvesWhenTheIntervalOutlastsTheTimeout(): void ], ); - $this->assertSame("success", $resolved->status); + $this->assertSame(Status::SUCCESS, $resolved->status); } /** @@ -390,7 +398,7 @@ public function testPollSendsTheIdAsAQueryNotABody(): void "polling_interval" => 0.01, ]); - $this->assertSame("success", $resolved->status); + $this->assertSame(Status::SUCCESS, $resolved->status); $poll = $recorder->request(1); @@ -420,6 +428,6 @@ public function testActionAttemptsGetDoesNotRecurse(): void ], ); - $this->assertSame("success", $resolved->status); + $this->assertSame(Status::SUCCESS, $resolved->status); } } From ef73faddf1b3c3a60b50221e744a4d9c7b1ff1f6 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Wed, 19 Aug 2026 17:48:31 -0700 Subject: [PATCH 2/4] fix: preserve unknown response values --- README.md | 2 +- codegen/layouts/resource.hbs | 8 +- codegen/lib/layouts/resource.ts | 3 - codegen/lib/resource-model.ts | 60 +---- src/Resources/AccessCode.php | 186 ++++---------- src/Resources/AccessGrant.php | 195 +++------------ src/Resources/AccessMethod.php | 179 +++----------- src/Resources/AcsAccessGroup.php | 140 +++-------- src/Resources/AcsCredential.php | 76 ++---- src/Resources/AcsEncoder.php | 6 +- src/Resources/AcsEntrance.php | 76 ++---- src/Resources/AcsSystem.php | 127 ++-------- src/Resources/AcsUser.php | 178 +++----------- src/Resources/ActionAttempt.php | 314 +++++++++++------------- src/Resources/ConnectWebview.php | 12 +- src/Resources/ConnectedAccount.php | 132 ++-------- src/Resources/Device.php | 222 ++++++----------- src/Resources/DeviceProvider.php | 6 +- src/Resources/Event.php | 147 ++++------- src/Resources/Phone.php | 6 +- src/Resources/UnmanagedAccessCode.php | 130 +++------- src/Resources/UnmanagedAccessGrant.php | 196 +++------------ src/Resources/UnmanagedAccessMethod.php | 181 +++----------- src/Resources/UnmanagedDevice.php | 128 ++-------- src/Resources/UnmanagedUserIdentity.php | 130 ++-------- src/Resources/UserIdentity.php | 130 ++-------- src/Resources/Workspace.php | 6 +- src/SeamWebhook.php | 4 +- tests/ResourceTest.php | 30 +++ tests/SeamWebhookTest.php | 5 +- tests/WaitForActionAttemptTest.php | 15 ++ 31 files changed, 779 insertions(+), 2251 deletions(-) diff --git a/README.md b/README.md index cf9dfcf7..31805cba 100644 --- a/README.md +++ b/README.md @@ -333,7 +333,7 @@ try { print match (true) { $event instanceof Seam\Resources\Event\AccessCodeCreated => "Created access code {$event->access_code_id}", - $event instanceof Seam\Resources\Event\UnknownEvent + $event::class === Seam\Resources\Event::class => "Unknown event type {$event->event_type}", default => "Received {$event->event_type->value}", }; diff --git a/codegen/layouts/resource.hbs b/codegen/layouts/resource.hbs index 98e89801..f7f3a95a 100644 --- a/codegen/layouts/resource.hbs +++ b/codegen/layouts/resource.hbs @@ -6,7 +6,7 @@ namespace {{namespace}} { {{#if (hasPhpDoc this)}} {{{resourcePhpDoc this}}} {{/if}} - {{#if isAbstract}}abstract {{else}}{{#if isFinal}}final {{/if}}{{/if}}class {{className}}{{#if extendsName}} extends {{extendsName}}{{/if}} + {{#if isFinal}}final {{/if}}class {{className}}{{#if extendsName}} extends {{extendsName}}{{/if}} { public static function from_json(mixed $json): {{className}}|null { @@ -22,7 +22,11 @@ namespace {{namespace}} { {{#each factory.variants}} {{enumCase}} => {{className}}::from_json($json), {{/each}} - default => {{factory.fallbackClass}}::from_json($json), + default => new self( +{{#each fromJsonProps}} + {{{this}}} +{{/each}} + ), }; {{else}} return new self( diff --git a/codegen/lib/layouts/resource.ts b/codegen/lib/layouts/resource.ts index a8d2d47b..0eaf469e 100644 --- a/codegen/lib/layouts/resource.ts +++ b/codegen/lib/layouts/resource.ts @@ -12,7 +12,6 @@ export interface ClassLayoutContext { description: string isDeprecated: boolean deprecationMessage: string - isAbstract: boolean isFinal: boolean extendsName: string factory?: FactoryLayoutContext @@ -24,7 +23,6 @@ export interface ClassLayoutContext { export interface FactoryLayoutContext { discriminant: string enumType: string - fallbackClass: string variants: Array<{ enumCase: string; className: string }> } @@ -131,7 +129,6 @@ const getClassLayoutContext = ( description: schema.description, isDeprecated: schema.isDeprecated, deprecationMessage: schema.deprecationMessage, - isAbstract: schema.isAbstract, isFinal: schema.isFinal, extendsName: schema.extendsName, ...(schema.factory == null ? {} : { factory: schema.factory }), diff --git a/codegen/lib/resource-model.ts b/codegen/lib/resource-model.ts index 5a4d5f85..3c6c0f93 100644 --- a/codegen/lib/resource-model.ts +++ b/codegen/lib/resource-model.ts @@ -53,7 +53,6 @@ export interface ResourceFactoryVariant { export interface ResourceFactory { discriminant: string enumType: string - fallbackClass: string variants: ResourceFactoryVariant[] } @@ -64,7 +63,6 @@ export interface ResourceClassSchema { description: string isDeprecated: boolean deprecationMessage: string - isAbstract: boolean isFinal: boolean extendsName: string properties: ResourceClassProperty[] @@ -231,7 +229,6 @@ export const createResourceModel = (blueprint: Blueprint): ResourceModel => { isDeprecated: false, deprecationMessage: '', }, - 'UnknownEvent', ) } else if (resourceType === 'action_attempt') { built = buildDiscriminatedClass( @@ -247,7 +244,6 @@ export const createResourceModel = (blueprint: Blueprint): ResourceModel => { isDeprecated: false, deprecationMessage: '', }, - 'UnknownActionAttempt', true, ) } else { @@ -285,12 +281,10 @@ const buildClass = ( depth: number, docs: ClassDocs, options: { - isAbstract?: boolean isFinal?: boolean extendsName?: string inheritedProperties?: ResourceClassProperty[] factory?: ResourceFactory - enumOverrides?: Map } = {}, ): BuiltDeclaration => { assertDepth(path, depth) @@ -305,18 +299,6 @@ const buildClass = ( const nestedClassName = pascalCase(property.name) if (property.format === 'enum') { - const override = options.enumOverrides?.get(property.name) - if (override != null) { - return { - ...metadata, - kind: 'value', - phpType: `${override.type}${override.preserveUnknown ? '|string' : ''}`, - phpDocType: '', - enumType: override.type, - ...(override.preserveUnknown ? { preserveUnknownEnum: true } : {}), - } - } - assertAvailableName( nestedClassName, nestedPath, @@ -330,9 +312,10 @@ const buildClass = ( return { ...metadata, kind: 'value', - phpType: enumType, + phpType: `${enumType}|string`, phpDocType: '', enumType, + preserveUnknownEnum: true, } } @@ -355,7 +338,6 @@ const buildClass = ( nestedPath, depth + 1, propertyDocs(property), - 'Unknown', ), ) return { @@ -412,7 +394,6 @@ const buildClass = ( name: className, namespace, ...docs, - isAbstract: options.isAbstract ?? false, isFinal: options.isFinal ?? false, extendsName: options.extendsName ?? '', properties, @@ -431,7 +412,6 @@ const buildDiscriminatedClass = ( path: string, depth: number, docs: ClassDocs, - fallbackName: string, actionAttempt = false, ): BuiltDeclaration => { assertDepth(path, depth) @@ -506,7 +486,6 @@ const buildDiscriminatedClass = ( const factory: ResourceFactory = { discriminant: discriminator, enumType, - fallbackClass: `\\${namespace}\\${className}\\${fallbackName}`, variants: variantInfo.map(({ value }) => ({ enumCase: `${enumType}::${enumCaseName(value)}`, className: `\\${namespace}\\${className}\\${pascalCase(value)}`, @@ -519,19 +498,14 @@ const buildDiscriminatedClass = ( commonProperties, path, depth, - docs, - { isAbstract: true, factory }, + { + ...docs, + description: `${docs.description}${docs.description === '' ? '' : ' '}Known ${discriminator} values use subclasses; unknown values use this base class and retain their raw discriminator.`, + }, + { factory }, ) const base = built.declaration if (base.kind !== 'class') throw new Error(`Cannot generate ${path}`) - const discriminant = base.properties.find( - ({ name }) => name === discriminator, - ) - if (discriminant?.kind === 'value') { - discriminant.phpType = `${discriminant.phpType}|string` - discriminant.preserveUnknownEnum = true - } - const baseName = `\\${namespace}\\${className}` for (const { variant, value } of variantInfo) { const ownProperties = variant.properties @@ -564,26 +538,6 @@ const buildDiscriminatedClass = ( ) } - built.nestedDeclarations.push( - buildClass( - fallbackName, - `${namespace}\\${className}`, - [], - `${path}.unknown`, - depth + 1, - { - description: `Fallback for ${path} values introduced after this SDK version.`, - isDeprecated: false, - deprecationMessage: '', - }, - { - isFinal: true, - extendsName: baseName, - inheritedProperties: base.properties, - }, - ), - ) - return built } diff --git a/src/Resources/AccessCode.php b/src/Resources/AccessCode.php index 5129e3a9..677ff902 100644 --- a/src/Resources/AccessCode.php +++ b/src/Resources/AccessCode.php @@ -46,10 +46,13 @@ public static function from_json(mixed $json): AccessCode|null $json->pending_mutations ?? [], ), status: is_string($json->status ?? null) - ? \Seam\Resources\AccessCode\Status::tryFrom($json->status) + ? \Seam\Resources\AccessCode\Status::tryFrom( + $json->status, + ) ?? $json->status : null, type: is_string($json->type ?? null) - ? \Seam\Resources\AccessCode\Type::tryFrom($json->type) + ? \Seam\Resources\AccessCode\Type::tryFrom($json->type) ?? + $json->type : null, warnings: array_map( fn($w) => \Seam\Resources\AccessCode\Warnings::from_json( @@ -136,11 +139,11 @@ public function __construct( /** * Current status of the access code within the operational lifecycle. Values are `setting`, a transitional phase that indicates that the code is being configured or activated; `set`, which indicates that the code is active and operational; `unset`, which indicates a deactivated or unused state, either before activation or after deliberate deactivation; `removing`, which indicates a transitional period in which the code is being deleted or made inactive; and `unknown`, which indicates an indeterminate state, due to reasons such as system errors or incomplete data, that highlights a potential need for system review or troubleshooting. See also [Lifecycle of Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/lifecycle-of-access-codes). */ - public \Seam\Resources\AccessCode\Status|null $status, + public \Seam\Resources\AccessCode\Status|string|null $status, /** * Type of the access code. `ongoing` access codes are active continuously until deactivated manually. `time_bound` access codes have a specific duration. */ - public \Seam\Resources\AccessCode\Type|null $type, + public \Seam\Resources\AccessCode\Type|string|null $type, /** * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). * @@ -244,9 +247,9 @@ public function __construct( } /** - * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -344,8 +347,13 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\AccessCode\Errors\BridgeDisconnected::from_json( $json, ), - default => \Seam\Resources\AccessCode\Errors\Unknown::from_json( - $json, + default => new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -363,9 +371,9 @@ public function __construct( } /** - * Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device. + * Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device. Known mutation_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class PendingMutations + class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { @@ -403,9 +411,14 @@ public static function from_json(mixed $json): PendingMutations|null => \Seam\Resources\AccessCode\PendingMutations\UpdatingTimeFrame::from_json( $json, ), - default - => \Seam\Resources\AccessCode\PendingMutations\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ), }; } @@ -427,9 +440,9 @@ public function __construct( } /** - * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -487,9 +500,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\AccessCode\Warnings\UnknownIssueWithAccessCode::from_json( $json, ), - default - => \Seam\Resources\AccessCode\Warnings\Unknown::from_json( - $json, + default => new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, ), }; } @@ -785,8 +803,8 @@ public static function from_json( message: $json->message ?? null, change_type: is_string($json->change_type ?? null) ? \Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ChangeType::tryFrom( - $json->change_type, - ) + $json->change_type, + ) ?? $json->change_type : null, created_at: $json->created_at ?? null, modified_fields: array_map( @@ -816,7 +834,7 @@ public function __construct( /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. */ - public \Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ChangeType|null $change_type = null, + public \Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ChangeType|string|null $change_type = null, /** * Date and time at which Seam created the error. */ @@ -1534,40 +1552,6 @@ public function __construct( } } - /** - * Fallback for access_code.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessCode\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct(error_code: $error_code, message: $message); - } - } - enum ErrorCode: string { case PROVIDER_ISSUE = "provider_issue"; @@ -1955,49 +1939,6 @@ public function __construct( } } - /** - * Fallback for access_code.pending_mutations values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessCode\PendingMutations - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which the mutation was created. - */ - string|null $created_at, - /** - * Detailed description of the mutation. - */ - string|null $message, - /** - * Mutation code to indicate that Seam is in the process of setting an access code on the device. - */ - \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - mutation_code: $mutation_code, - ); - } - } - enum MutationCode: string { case CREATING = "creating"; @@ -2267,8 +2208,8 @@ public static function from_json( : null, change_type: is_string($json->change_type ?? null) ? \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ChangeType::tryFrom( - $json->change_type, - ) + $json->change_type, + ) ?? $json->change_type : null, created_at: $json->created_at ?? null, modified_fields: array_map( @@ -2294,7 +2235,7 @@ public function __construct( /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. */ - public \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ChangeType|null $change_type = null, + public \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ChangeType|string|null $change_type = null, /** * Date and time at which Seam created the warning. */ @@ -2672,49 +2613,6 @@ public function __construct( } } - /** - * Fallback for access_code.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessCode\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - created_at: $json->created_at ?? null, - ); - } - - public function __construct( - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at = null, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case CODE_ROTATES_PERIODICALLY = "code_rotates_periodically"; diff --git a/src/Resources/AccessGrant.php b/src/Resources/AccessGrant.php index dd319717..40830d9f 100644 --- a/src/Resources/AccessGrant.php +++ b/src/Resources/AccessGrant.php @@ -158,9 +158,9 @@ public function __construct( namespace Seam\Resources\AccessGrant { /** - * Errors associated with the [access grant](https://docs.seam.co/use-cases/granting-access). + * Errors associated with the [access grant](https://docs.seam.co/use-cases/granting-access). Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -178,9 +178,15 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\AccessGrant\Errors\CannotCreateRequestedAccessMethods::from_json( $json, ), - default - => \Seam\Resources\AccessGrant\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessGrant\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + missing_device_ids: $json->missing_device_ids ?? null, ), }; } @@ -208,9 +214,9 @@ public function __construct( } /** - * List of pending mutations for the access grant. This shows updates that are in progress. + * List of pending mutations for the access grant. This shows updates that are in progress. Known mutation_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class PendingMutations + class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { @@ -232,9 +238,14 @@ public static function from_json(mixed $json): PendingMutations|null => \Seam\Resources\AccessGrant\PendingMutations\UpdatingAccessTimes::from_json( $json, ), - default - => \Seam\Resources\AccessGrant\PendingMutations\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ), }; } @@ -273,8 +284,8 @@ public static function from_json( display_name: $json->display_name ?? null, mode: is_string($json->mode ?? null) ? \Seam\Resources\AccessGrant\RequestedAccessMethods\Mode::tryFrom( - $json->mode, - ) + $json->mode, + ) ?? $json->mode : null, code: $json->code ?? null, instant_key_max_use_count: $json->instant_key_max_use_count ?? @@ -300,7 +311,7 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\AccessGrant\RequestedAccessMethods\Mode|null $mode, + public \Seam\Resources\AccessGrant\RequestedAccessMethods\Mode|string|null $mode, /** * Specific PIN code to use for this access method. Only applicable when mode is 'code'. */ @@ -313,9 +324,9 @@ public function __construct( } /** - * Warnings associated with the [access grant](https://docs.seam.co/use-cases/granting-access). + * Warnings associated with the [access grant](https://docs.seam.co/use-cases/granting-access). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -357,9 +368,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated::from_json( $json, ), - default - => \Seam\Resources\AccessGrant\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -435,57 +451,6 @@ public function __construct( } } - /** - * Fallback for access_grant.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessGrant\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessGrant\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - missing_device_ids: $json->missing_device_ids ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AccessGrant\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure. - * - * @var list|null - */ - array|null $missing_device_ids = null, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - missing_device_ids: $missing_device_ids, - ); - } - } - enum ErrorCode: string { case CANNOT_CREATE_REQUESTED_ACCESS_METHODS = "cannot_create_requested_access_methods"; @@ -624,49 +589,6 @@ public function __construct( } } - /** - * Fallback for access_grant.pending_mutations values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessGrant\PendingMutations - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which the mutation was created. - */ - string|null $created_at, - /** - * Detailed description of the mutation. - */ - string|null $message, - /** - * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. - */ - \Seam\Resources\AccessGrant\PendingMutations\MutationCode|string|null $mutation_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - mutation_code: $mutation_code, - ); - } - } - enum MutationCode: string { case UPDATING_SPACES = "updating_spaces"; @@ -1123,8 +1045,8 @@ public static function from_json( message: $json->message ?? null, reason: is_string($json->reason ?? null) ? \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason::tryFrom( - $json->reason, - ) + $json->reason, + ) ?? $json->reason : null, warning_code: is_string($json->warning_code ?? null) ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( @@ -1150,50 +1072,7 @@ public function __construct( /** * Specific reason why the grant's times are not programmable on the device. */ - public \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason|null $reason, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - - /** - * Fallback for access_grant.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessGrant\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, + public \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason|string|null $reason, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ diff --git a/src/Resources/AccessMethod.php b/src/Resources/AccessMethod.php index 2ce60df4..30c45a7b 100644 --- a/src/Resources/AccessMethod.php +++ b/src/Resources/AccessMethod.php @@ -24,7 +24,8 @@ public static function from_json(mixed $json): AccessMethod|null is_issued: $json->is_issued ?? null, issued_at: $json->issued_at ?? null, mode: is_string($json->mode ?? null) - ? \Seam\Resources\AccessMethod\Mode::tryFrom($json->mode) + ? \Seam\Resources\AccessMethod\Mode::tryFrom($json->mode) ?? + $json->mode : null, pending_mutations: array_map( fn( @@ -83,7 +84,7 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\AccessMethod\Mode|null $mode, + public \Seam\Resources\AccessMethod\Mode|string|null $mode, /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. * @@ -138,9 +139,9 @@ public function __construct( namespace Seam\Resources\AccessMethod { /** - * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -158,9 +159,14 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\AccessMethod\Errors\FailedToIssue::from_json( $json, ), - default - => \Seam\Resources\AccessMethod\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AccessMethod\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -182,9 +188,9 @@ public function __construct( } /** - * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. + * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. Known mutation_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class PendingMutations + class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { @@ -210,9 +216,14 @@ public static function from_json(mixed $json): PendingMutations|null => \Seam\Resources\AccessMethod\PendingMutations\UpdatingAccessTimes::from_json( $json, ), - default - => \Seam\Resources\AccessMethod\PendingMutations\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ), }; } @@ -234,9 +245,9 @@ public function __construct( } /** - * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -266,9 +277,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\AccessMethod\Warnings\DelayInIssuing::from_json( $json, ), - default - => \Seam\Resources\AccessMethod\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -342,49 +358,6 @@ public function __construct( } } - /** - * Fallback for access_method.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessMethod\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessMethod\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AccessMethod\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case FAILED_TO_ISSUE = "failed_to_issue"; @@ -578,49 +551,6 @@ public function __construct( } } - /** - * Fallback for access_method.pending_mutations values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessMethod\PendingMutations - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which the mutation was created. - */ - string|null $created_at, - /** - * Detailed description of the mutation. - */ - string|null $message, - /** - * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. - */ - \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - mutation_code: $mutation_code, - ); - } - } - enum MutationCode: string { case PROVISIONING_ACCESS = "provisioning_access"; @@ -965,49 +895,6 @@ public function __construct( } } - /** - * Fallback for access_method.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AccessMethod\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case BEING_DELETED = "being_deleted"; diff --git a/src/Resources/AcsAccessGroup.php b/src/Resources/AcsAccessGroup.php index 442795f2..ebcaea86 100644 --- a/src/Resources/AcsAccessGroup.php +++ b/src/Resources/AcsAccessGroup.php @@ -18,8 +18,8 @@ public static function from_json(mixed $json): AcsAccessGroup|null return new self( access_group_type: is_string($json->access_group_type ?? null) ? \Seam\Resources\AcsAccessGroup\AccessGroupType::tryFrom( - $json->access_group_type, - ) + $json->access_group_type, + ) ?? $json->access_group_type : null, access_group_type_display_name: $json->access_group_type_display_name ?? null, @@ -36,8 +36,8 @@ public static function from_json(mixed $json): AcsAccessGroup|null ), external_type: is_string($json->external_type ?? null) ? \Seam\Resources\AcsAccessGroup\ExternalType::tryFrom( - $json->external_type, - ) + $json->external_type, + ) ?? $json->external_type : null, external_type_display_name: $json->external_type_display_name ?? null, @@ -70,7 +70,7 @@ public function __construct( /** * @deprecated Use `external_type`. */ - public \Seam\Resources\AcsAccessGroup\AccessGroupType|null $access_group_type, + public \Seam\Resources\AcsAccessGroup\AccessGroupType|string|null $access_group_type, /** * @deprecated Use `external_type_display_name`. */ @@ -104,7 +104,7 @@ public function __construct( /** * Brand-specific terminology for the access group type. */ - public \Seam\Resources\AcsAccessGroup\ExternalType|null $external_type, + public \Seam\Resources\AcsAccessGroup\ExternalType|string|null $external_type, /** * Display name that corresponds to the brand-specific terminology for the access group type. */ @@ -171,9 +171,9 @@ public function __construct( } /** - * Errors associated with the `acs_access_group`. + * Errors associated with the `acs_access_group`. Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -191,9 +191,14 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\AcsAccessGroup\Errors\FailedToCreateOnAcsSystem::from_json( $json, ), - default - => \Seam\Resources\AcsAccessGroup\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsAccessGroup\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -215,9 +220,9 @@ public function __construct( } /** - * Collection of pending mutations for the access group. Represents operations that have been requested but not yet completed on the integrated access system. + * Collection of pending mutations for the access group. Represents operations that have been requested but not yet completed on the integrated access system. Known mutation_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class PendingMutations + class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { @@ -263,9 +268,14 @@ public static function from_json(mixed $json): PendingMutations|null => \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate::from_json( $json, ), - default - => \Seam\Resources\AcsAccessGroup\PendingMutations\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ), }; } @@ -301,8 +311,8 @@ public static function from_json(mixed $json): Warnings|null message: $json->message ?? null, warning_code: is_string($json->warning_code ?? null) ? \Seam\Resources\AcsAccessGroup\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) + $json->warning_code, + ) ?? $json->warning_code : null, ); } @@ -319,7 +329,7 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public \Seam\Resources\AcsAccessGroup\Warnings\WarningCode|null $warning_code, + public \Seam\Resources\AcsAccessGroup\Warnings\WarningCode|string|null $warning_code, ) {} } @@ -398,49 +408,6 @@ public function __construct( } } - /** - * Fallback for acs_access_group.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsAccessGroup\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsAccessGroup\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AcsAccessGroup\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case FAILED_TO_CREATE_ON_ACS_SYSTEM = "failed_to_create_on_acs_system"; @@ -853,8 +820,8 @@ public static function from_json( : null, variant: is_string($json->variant ?? null) ? \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate\Variant::tryFrom( - $json->variant, - ) + $json->variant, + ) ?? $json->variant : null, ); } @@ -879,50 +846,7 @@ public function __construct( /** * Whether the user is scheduled to be added to or removed from this access group. */ - public \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate\Variant|null $variant, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - mutation_code: $mutation_code, - ); - } - } - - /** - * Fallback for acs_access_group.pending_mutations values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsAccessGroup\PendingMutations - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which the mutation was created. - */ - string|null $created_at, - /** - * Detailed description of the mutation. - */ - string|null $message, - /** - * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. - */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + public \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate\Variant|string|null $variant, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/AcsCredential.php b/src/Resources/AcsCredential.php index cf2ca919..fbfe423e 100644 --- a/src/Resources/AcsCredential.php +++ b/src/Resources/AcsCredential.php @@ -20,8 +20,8 @@ public static function from_json(mixed $json): AcsCredential|null return new self( access_method: is_string($json->access_method ?? null) ? \Seam\Resources\AcsCredential\AccessMethod::tryFrom( - $json->access_method, - ) + $json->access_method, + ) ?? $json->access_method : null, acs_credential_id: $json->acs_credential_id ?? null, acs_system_id: $json->acs_system_id ?? null, @@ -61,8 +61,8 @@ public static function from_json(mixed $json): AcsCredential|null ends_at: $json->ends_at ?? null, external_type: is_string($json->external_type ?? null) ? \Seam\Resources\AcsCredential\ExternalType::tryFrom( - $json->external_type, - ) + $json->external_type, + ) ?? $json->external_type : null, external_type_display_name: $json->external_type_display_name ?? null, @@ -91,7 +91,7 @@ public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\AcsCredential\AccessMethod|null $access_method, + public \Seam\Resources\AcsCredential\AccessMethod|string|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -163,7 +163,7 @@ public function __construct( /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. */ - public \Seam\Resources\AcsCredential\ExternalType|null $external_type = null, + public \Seam\Resources\AcsCredential\ExternalType|string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -329,8 +329,8 @@ public static function from_json(mixed $json): VisionlineMetadata|null auto_join: $json->auto_join ?? null, card_function_type: is_string($json->card_function_type ?? null) ? \Seam\Resources\AcsCredential\VisionlineMetadata\CardFunctionType::tryFrom( - $json->card_function_type, - ) + $json->card_function_type, + ) ?? $json->card_function_type : null, card_id: $json->card_id ?? null, common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, @@ -350,7 +350,7 @@ public function __construct( /** * Card function type in the Visionline access system. */ - public \Seam\Resources\AcsCredential\VisionlineMetadata\CardFunctionType|null $card_function_type = null, + public \Seam\Resources\AcsCredential\VisionlineMetadata\CardFunctionType|string|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ @@ -385,9 +385,9 @@ public function __construct( } /** - * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -429,9 +429,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\AcsCredential\Warnings\RequestedCodeUnavailable::from_json( $json, ), - default - => \Seam\Resources\AcsCredential\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -805,49 +810,6 @@ public function __construct( } } - /** - * Fallback for acs_credential.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsCredential\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case WAITING_TO_BE_ISSUED = "waiting_to_be_issued"; diff --git a/src/Resources/AcsEncoder.php b/src/Resources/AcsEncoder.php index a2b3e8ed..b74fef28 100644 --- a/src/Resources/AcsEncoder.php +++ b/src/Resources/AcsEncoder.php @@ -88,8 +88,8 @@ public static function from_json(mixed $json): Errors|null created_at: $json->created_at ?? null, error_code: is_string($json->error_code ?? null) ? \Seam\Resources\AcsEncoder\Errors\ErrorCode::tryFrom( - $json->error_code, - ) + $json->error_code, + ) ?? $json->error_code : null, message: $json->message ?? null, ); @@ -103,7 +103,7 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public \Seam\Resources\AcsEncoder\Errors\ErrorCode|null $error_code, + public \Seam\Resources\AcsEncoder\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ diff --git a/src/Resources/AcsEntrance.php b/src/Resources/AcsEntrance.php index 48920438..2f260fc4 100644 --- a/src/Resources/AcsEntrance.php +++ b/src/Resources/AcsEntrance.php @@ -278,8 +278,8 @@ public static function from_json( door_number: $json->door_number ?? null, door_type: is_string($json->door_type ?? null) ? \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata\DoorType::tryFrom( - $json->door_type, - ) + $json->door_type, + ) ?? $json->door_type : null, pms_id: $json->pms_id ?? null, stand_open: $json->stand_open ?? null, @@ -298,7 +298,7 @@ public function __construct( /** * Type of the door in the Vostio access system. */ - public \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata\DoorType|null $door_type = null, + public \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata\DoorType|string|null $door_type = null, /** * PMS ID of the door in the Vostio access system. */ @@ -668,8 +668,8 @@ public static function from_json(mixed $json): VisionlineMetadata|null return new self( door_category: is_string($json->door_category ?? null) ? \Seam\Resources\AcsEntrance\VisionlineMetadata\DoorCategory::tryFrom( - $json->door_category, - ) + $json->door_category, + ) ?? $json->door_category : null, door_name: $json->door_name ?? null, profiles: array_map( @@ -687,7 +687,7 @@ public function __construct( /** * Category of the door in the Visionline access system. */ - public \Seam\Resources\AcsEntrance\VisionlineMetadata\DoorCategory|null $door_category = null, + public \Seam\Resources\AcsEntrance\VisionlineMetadata\DoorCategory|string|null $door_category = null, /** * Name of the door in the Visionline access system. */ @@ -702,9 +702,9 @@ public function __construct( } /** - * Warnings associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). + * Warnings associated with the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -738,9 +738,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\AcsEntrance\Warnings\PrivacyMode::from_json( $json, ), - default - => \Seam\Resources\AcsEntrance\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -817,8 +822,8 @@ public static function from_json(mixed $json): Profiles|null $json->visionline_door_profile_type ?? null, ) ? \Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles\VisionlineDoorProfileType::tryFrom( - $json->visionline_door_profile_type, - ) + $json->visionline_door_profile_type, + ) ?? $json->visionline_door_profile_type : null, ); } @@ -831,7 +836,7 @@ public function __construct( /** * Door profile type in the Visionline access system. */ - public \Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles\VisionlineDoorProfileType|null $visionline_door_profile_type = null, + public \Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles\VisionlineDoorProfileType|string|null $visionline_door_profile_type = null, ) {} } @@ -1074,49 +1079,6 @@ public function __construct( } } - /** - * Fallback for acs_entrance.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsEntrance\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case SALTO_KS_ENTRANCE_ACCESS_CODE_SUPPORT_REMOVED = "salto_ks_entrance_access_code_support_removed"; diff --git a/src/Resources/AcsSystem.php b/src/Resources/AcsSystem.php index dc18f090..e4db6c45 100644 --- a/src/Resources/AcsSystem.php +++ b/src/Resources/AcsSystem.php @@ -44,15 +44,15 @@ public static function from_json(mixed $json): AcsSystem|null null, external_type: is_string($json->external_type ?? null) ? \Seam\Resources\AcsSystem\ExternalType::tryFrom( - $json->external_type, - ) + $json->external_type, + ) ?? $json->external_type : null, external_type_display_name: $json->external_type_display_name ?? null, system_type: is_string($json->system_type ?? null) ? \Seam\Resources\AcsSystem\SystemType::tryFrom( - $json->system_type, - ) + $json->system_type, + ) ?? $json->system_type : null, system_type_display_name: $json->system_type_display_name ?? null, @@ -135,7 +135,7 @@ public function __construct( /** * Brand-specific terminology for the [access control system](https://docs.seam.co/low-level-apis/access-systems) type. */ - public \Seam\Resources\AcsSystem\ExternalType|null $external_type = null, + public \Seam\Resources\AcsSystem\ExternalType|string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [access control system](https://docs.seam.co/low-level-apis/access-systems) type. */ @@ -143,7 +143,7 @@ public function __construct( /** * @deprecated Use `external_type`. */ - public \Seam\Resources\AcsSystem\SystemType|null $system_type = null, + public \Seam\Resources\AcsSystem\SystemType|string|null $system_type = null, /** * @deprecated Use `external_type_display_name`. */ @@ -158,9 +158,9 @@ public function __construct( namespace Seam\Resources\AcsSystem { /** - * Errors associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). + * Errors associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -210,8 +210,14 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\AcsSystem\Errors\ProviderServiceUnavailable::from_json( $json, ), - default => \Seam\Resources\AcsSystem\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -287,9 +293,9 @@ public function __construct( } /** - * Warnings associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). + * Warnings associated with the [access control system](https://docs.seam.co/low-level-apis/access-systems). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -319,9 +325,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\AcsSystem\Warnings\UnknownIssueWithAcsSystem::from_json( $json, ), - default - => \Seam\Resources\AcsSystem\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -794,49 +805,6 @@ public function __construct( } } - /** - * Fallback for acs_system.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsSystem\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case SEAM_BRIDGE_DISCONNECTED = "seam_bridge_disconnected"; @@ -1037,49 +1005,6 @@ public function __construct( } } - /** - * Fallback for acs_system.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsSystem\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case SALTO_KS_SUBSCRIPTION_LIMIT_ALMOST_REACHED = "salto_ks_subscription_limit_almost_reached"; diff --git a/src/Resources/AcsUser.php b/src/Resources/AcsUser.php index 5619deb0..3124e7f3 100644 --- a/src/Resources/AcsUser.php +++ b/src/Resources/AcsUser.php @@ -40,8 +40,8 @@ public static function from_json(mixed $json): AcsUser|null email_address: $json->email_address ?? null, external_type: is_string($json->external_type ?? null) ? \Seam\Resources\AcsUser\ExternalType::tryFrom( - $json->external_type, - ) + $json->external_type, + ) ?? $json->external_type : null, external_type_display_name: $json->external_type_display_name ?? null, @@ -132,7 +132,7 @@ public function __construct( /** * Brand-specific terminology for the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) type. */ - public \Seam\Resources\AcsUser\ExternalType|null $external_type = null, + public \Seam\Resources\AcsUser\ExternalType|string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) type. */ @@ -217,9 +217,9 @@ public function __construct( } /** - * Errors associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). + * Errors associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -257,8 +257,14 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\AcsUser\Errors\LatchConflictWithResidentUser::from_json( $json, ), - default => \Seam\Resources\AcsUser\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -277,9 +283,9 @@ public function __construct( } /** - * Pending mutations associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). Seam is in the process of pushing these mutations to the integrated access system. + * Pending mutations associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). Seam is in the process of pushing these mutations to the integrated access system. Known mutation_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class PendingMutations + class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { @@ -329,9 +335,14 @@ public static function from_json(mixed $json): PendingMutations|null => \Seam\Resources\AcsUser\PendingMutations\UpdatingCredentialAssignment::from_json( $json, ), - default - => \Seam\Resources\AcsUser\PendingMutations\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ), }; } @@ -402,9 +413,9 @@ public function __construct( } /** - * Warnings associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). + * Warnings associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -438,8 +449,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\AcsUser\Warnings\LatchResidentUser::from_json( $json, ), - default => \Seam\Resources\AcsUser\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -719,46 +736,6 @@ public function __construct( } } - /** - * Fallback for acs_user.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsUser\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case DELETED_EXTERNALLY = "deleted_externally"; @@ -1178,8 +1155,8 @@ public static function from_json( : null, variant: is_string($json->variant ?? null) ? \Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate\Variant::tryFrom( - $json->variant, - ) + $json->variant, + ) ?? $json->variant : null, ); } @@ -1204,7 +1181,7 @@ public function __construct( /** * Whether the user is scheduled to be added to or removed from the access group. */ - public \Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate\Variant|null $variant, + public \Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate\Variant|string|null $variant, ) { parent::__construct( created_at: $created_at, @@ -1277,49 +1254,6 @@ public function __construct( } } - /** - * Fallback for acs_user.pending_mutations values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsUser\PendingMutations - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which the mutation was created. - */ - string|null $created_at, - /** - * Detailed description of the mutation. - */ - string|null $message, - /** - * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. - */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - mutation_code: $mutation_code, - ); - } - } - enum MutationCode: string { case CREATING = "creating"; @@ -1802,46 +1736,6 @@ public function __construct( } } - /** - * Fallback for acs_user.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\AcsUser\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case BEING_DELETED = "being_deleted"; diff --git a/src/Resources/ActionAttempt.php b/src/Resources/ActionAttempt.php index 4a20d00c..5814d7f6 100644 --- a/src/Resources/ActionAttempt.php +++ b/src/Resources/ActionAttempt.php @@ -2,9 +2,9 @@ namespace Seam\Resources { /** - * Base class for actions whose completion is tracked asynchronously. + * Base class for actions whose completion is tracked asynchronously. Known action_type values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class ActionAttempt + class ActionAttempt { public static function from_json(mixed $json): ActionAttempt|null { @@ -100,9 +100,23 @@ public static function from_json(mixed $json): ActionAttempt|null => \Seam\Resources\ActionAttempt\UpdateNoiseThreshold::from_json( $json, ), - default - => \Seam\Resources\ActionAttempt\UnknownActionAttempt::from_json( - $json, + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: is_string($json->action_type ?? null) + ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( + $json->action_type, + ) ?? $json->action_type + : null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\Error::from_json( + $json->error, + ) + : null, + status: is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom( + $json->status, + ) ?? $json->status + : null, ), }; } @@ -120,7 +134,7 @@ public function __construct( * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\Error|null $error, - public \Seam\Resources\ActionAttempt\Status|null $status, + public \Seam\Resources\ActionAttempt\Status|string|null $status, ) {} } } @@ -183,8 +197,8 @@ public static function from_json(mixed $json): LockDoor|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -206,7 +220,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\LockDoor\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -246,8 +260,8 @@ public static function from_json(mixed $json): UnlockDoor|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -269,7 +283,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\UnlockDoor\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -309,8 +323,8 @@ public static function from_json(mixed $json): ScanCredential|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -332,7 +346,7 @@ public function __construct( * Result of scanning a card. If the attempt was successful, includes a snapshot of credential data read from the physical encoder, the corresponding data stored on Seam and the access system, and any associated warnings. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\ScanCredential\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -372,8 +386,8 @@ public static function from_json(mixed $json): EncodeCredential|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -395,7 +409,7 @@ public function __construct( * Result of an encoding attempt. If the attempt was successful, includes the credential data that was encoded onto the card. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\EncodeCredential\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -436,8 +450,8 @@ public static function from_json( : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -459,7 +473,7 @@ public function __construct( * Result of a scan to assign attempt. If the attempt was successful, includes the credential data that was scanned and assigned. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -499,8 +513,8 @@ public static function from_json(mixed $json): AssignCredential|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -522,7 +536,7 @@ public function __construct( * Result of assigning a credential. If successful, includes the updated access method with the assigned credential. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\AssignCredential\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -559,8 +573,8 @@ public static function from_json( result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -582,7 +596,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -618,8 +632,8 @@ public static function from_json(mixed $json): SetFanMode|null result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -641,7 +655,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -677,8 +691,8 @@ public static function from_json(mixed $json): SetHvacMode|null result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -700,7 +714,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -737,8 +751,8 @@ public static function from_json( result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -760,7 +774,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -797,8 +811,8 @@ public static function from_json( result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -820,7 +834,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -858,8 +872,8 @@ public static function from_json( result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -881,7 +895,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -918,8 +932,8 @@ public static function from_json( result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -941,7 +955,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -977,8 +991,8 @@ public static function from_json(mixed $json): ConfigureAutoLock|null result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1000,7 +1014,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1033,8 +1047,8 @@ public static function from_json(mixed $json): SyncAccessCodes|null result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1056,7 +1070,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1093,8 +1107,8 @@ public static function from_json(mixed $json): CreateAccessCode|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1116,7 +1130,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\CreateAccessCode\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1149,8 +1163,8 @@ public static function from_json(mixed $json): DeleteAccessCode|null result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1172,7 +1186,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1209,8 +1223,8 @@ public static function from_json(mixed $json): UpdateAccessCode|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1232,7 +1246,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\UpdateAccessCode\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1269,8 +1283,8 @@ public static function from_json(mixed $json): CreateNoiseThreshold|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1292,7 +1306,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1325,8 +1339,8 @@ public static function from_json(mixed $json): DeleteNoiseThreshold|null result: $json->result ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1348,7 +1362,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1385,8 +1399,8 @@ public static function from_json(mixed $json): UpdateNoiseThreshold|null : null, status: is_string($json->status ?? null) ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1408,61 +1422,7 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Result|null $result, - \Seam\Resources\ActionAttempt\Status|null $status, - ) { - parent::__construct( - action_attempt_id: $action_attempt_id, - action_type: $action_type, - error: $error, - status: $status, - ); - } - } - - /** - * Fallback for action_attempt values introduced after this SDK version. - */ - final class UnknownActionAttempt extends \Seam\Resources\ActionAttempt - { - public static function from_json(mixed $json): UnknownActionAttempt|null - { - if (!$json) { - return null; - } - return new self( - action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, - error: isset($json->error) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) - : null, - ); - } - - public function __construct( - /** - * ID of the action attempt. - */ - string|null $action_attempt_id, - /** - * Action attempt to track the status of locking a door. - */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, - /** - * Error associated with the action. Null while the action attempt is pending or when this value does not apply. - */ - \Seam\Resources\ActionAttempt\Error|null $error, - \Seam\Resources\ActionAttempt\Status|null $status, + \Seam\Resources\ActionAttempt\Status|string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1677,8 +1637,8 @@ public static function from_json(mixed $json): AcsCredentialOnSeam|null return new self( access_method: is_string($json->access_method ?? null) ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AccessMethod::tryFrom( - $json->access_method, - ) + $json->access_method, + ) ?? $json->access_method : null, acs_credential_id: $json->acs_credential_id ?? null, acs_system_id: $json->acs_system_id ?? null, @@ -1722,8 +1682,8 @@ public static function from_json(mixed $json): AcsCredentialOnSeam|null ends_at: $json->ends_at ?? null, external_type: is_string($json->external_type ?? null) ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType::tryFrom( - $json->external_type, - ) + $json->external_type, + ) ?? $json->external_type : null, external_type_display_name: $json->external_type_display_name ?? null, @@ -1752,7 +1712,7 @@ public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AccessMethod|null $access_method, + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AccessMethod|string|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -1821,7 +1781,7 @@ public function __construct( /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType|null $external_type = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType|string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -1882,8 +1842,8 @@ public static function from_json(mixed $json): Warnings|null return new self( warning_code: is_string($json->warning_code ?? null) ? \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) + $json->warning_code, + ) ?? $json->warning_code : null, warning_message: $json->warning_message ?? null, ); @@ -1893,7 +1853,7 @@ public function __construct( /** * Indicates a warning related to scanning a credential. */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode|null $warning_code, + public \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode|string|null $warning_code, /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ @@ -1917,8 +1877,8 @@ public static function from_json(mixed $json): VisionlineMetadata|null cancelled: $json->cancelled ?? null, card_format: is_string($json->card_format ?? null) ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat::tryFrom( - $json->card_format, - ) + $json->card_format, + ) ?? $json->card_format : null, card_holder: $json->card_holder ?? null, card_id: $json->card_id ?? null, @@ -1941,7 +1901,7 @@ public function __construct( /** * Format of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat|null $card_format = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat|string|null $card_format = null, /** * Holder of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -2115,8 +2075,8 @@ public static function from_json(mixed $json): VisionlineMetadata|null auto_join: $json->auto_join ?? null, card_function_type: is_string($json->card_function_type ?? null) ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType::tryFrom( - $json->card_function_type, - ) + $json->card_function_type, + ) ?? $json->card_function_type : null, card_id: $json->card_id ?? null, common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, @@ -2136,7 +2096,7 @@ public function __construct( /** * Card function type in the Visionline access system. */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType|null $card_function_type = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType|string|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ @@ -2185,8 +2145,8 @@ public static function from_json(mixed $json): Warnings|null message: $json->message ?? null, warning_code: is_string($json->warning_code ?? null) ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) + $json->warning_code, + ) ?? $json->warning_code : null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, @@ -2205,7 +2165,7 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings\WarningCode|null $warning_code, + public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings\WarningCode|string|null $warning_code, /** * The PIN code that was assigned instead. */ @@ -2287,8 +2247,8 @@ public static function from_json(mixed $json): Result|null return new self( access_method: is_string($json->access_method ?? null) ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod::tryFrom( - $json->access_method, - ) + $json->access_method, + ) ?? $json->access_method : null, acs_credential_id: $json->acs_credential_id ?? null, acs_system_id: $json->acs_system_id ?? null, @@ -2332,8 +2292,8 @@ public static function from_json(mixed $json): Result|null ends_at: $json->ends_at ?? null, external_type: is_string($json->external_type ?? null) ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType::tryFrom( - $json->external_type, - ) + $json->external_type, + ) ?? $json->external_type : null, external_type_display_name: $json->external_type_display_name ?? null, @@ -2362,7 +2322,7 @@ public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod|null $access_method, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod|string|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -2431,7 +2391,7 @@ public function __construct( /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType|null $external_type = null, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType|string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -2597,8 +2557,8 @@ public static function from_json(mixed $json): VisionlineMetadata|null auto_join: $json->auto_join ?? null, card_function_type: is_string($json->card_function_type ?? null) ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType::tryFrom( - $json->card_function_type, - ) + $json->card_function_type, + ) ?? $json->card_function_type : null, card_id: $json->card_id ?? null, common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, @@ -2618,7 +2578,7 @@ public function __construct( /** * Card function type in the Visionline access system. */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType|null $card_function_type = null, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType|string|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ @@ -2667,8 +2627,8 @@ public static function from_json(mixed $json): Warnings|null message: $json->message ?? null, warning_code: is_string($json->warning_code ?? null) ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) + $json->warning_code, + ) ?? $json->warning_code : null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, @@ -2687,7 +2647,7 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings\WarningCode|null $warning_code, + public \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings\WarningCode|string|null $warning_code, /** * The PIN code that was assigned instead. */ @@ -2761,8 +2721,8 @@ public static function from_json(mixed $json): Result|null return new self( access_method: is_string($json->access_method ?? null) ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AccessMethod::tryFrom( - $json->access_method, - ) + $json->access_method, + ) ?? $json->access_method : null, acs_credential_id: $json->acs_credential_id ?? null, acs_system_id: $json->acs_system_id ?? null, @@ -2806,8 +2766,8 @@ public static function from_json(mixed $json): Result|null ends_at: $json->ends_at ?? null, external_type: is_string($json->external_type ?? null) ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType::tryFrom( - $json->external_type, - ) + $json->external_type, + ) ?? $json->external_type : null, external_type_display_name: $json->external_type_display_name ?? null, @@ -2836,7 +2796,7 @@ public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AccessMethod|null $access_method, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AccessMethod|string|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -2908,7 +2868,7 @@ public function __construct( /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType|null $external_type = null, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType|string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -3074,8 +3034,8 @@ public static function from_json(mixed $json): VisionlineMetadata|null auto_join: $json->auto_join ?? null, card_function_type: is_string($json->card_function_type ?? null) ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType::tryFrom( - $json->card_function_type, - ) + $json->card_function_type, + ) ?? $json->card_function_type : null, card_id: $json->card_id ?? null, common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, @@ -3095,7 +3055,7 @@ public function __construct( /** * Card function type in the Visionline access system. */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType|null $card_function_type = null, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType|string|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ @@ -3144,8 +3104,8 @@ public static function from_json(mixed $json): Warnings|null message: $json->message ?? null, warning_code: is_string($json->warning_code ?? null) ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) + $json->warning_code, + ) ?? $json->warning_code : null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, @@ -3164,7 +3124,7 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings\WarningCode|null $warning_code, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings\WarningCode|string|null $warning_code, /** * The PIN code that was assigned instead. */ @@ -3251,8 +3211,8 @@ public static function from_json(mixed $json): Result|null issued_at: $json->issued_at ?? null, mode: is_string($json->mode ?? null) ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Mode::tryFrom( - $json->mode, - ) + $json->mode, + ) ?? $json->mode : null, pending_mutations: array_map( fn( @@ -3313,7 +3273,7 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\Mode|null $mode, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\Mode|string|null $mode, /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. * @@ -3381,8 +3341,8 @@ public static function from_json(mixed $json): Errors|null created_at: $json->created_at ?? null, error_code: is_string($json->error_code ?? null) ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode::tryFrom( - $json->error_code, - ) + $json->error_code, + ) ?? $json->error_code : null, message: $json->message ?? null, ); @@ -3396,7 +3356,7 @@ public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode|null $error_code, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode|string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -3424,8 +3384,8 @@ public static function from_json(mixed $json): PendingMutations|null message: $json->message ?? null, mutation_code: is_string($json->mutation_code ?? null) ? \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) + $json->mutation_code, + ) ?? $json->mutation_code : null, to: isset($json->to) ? \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\To::from_json( @@ -3451,7 +3411,7 @@ public function __construct( /** * Mutation code to indicate that Seam is in the process of updating the access times for this access method. */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\MutationCode|null $mutation_code, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\MutationCode|string|null $mutation_code, /** * New access time configuration. */ @@ -3474,8 +3434,8 @@ public static function from_json(mixed $json): Warnings|null message: $json->message ?? null, warning_code: is_string($json->warning_code ?? null) ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) + $json->warning_code, + ) ?? $json->warning_code : null, original_access_method_id: $json->original_access_method_id ?? null, @@ -3494,7 +3454,7 @@ public function __construct( /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings\WarningCode|null $warning_code, + public \Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings\WarningCode|string|null $warning_code, /** * ID of the original access method from which this backup access method was split, if applicable. */ diff --git a/src/Resources/ConnectWebview.php b/src/Resources/ConnectWebview.php index 453af262..b41758ce 100644 --- a/src/Resources/ConnectWebview.php +++ b/src/Resources/ConnectWebview.php @@ -39,15 +39,15 @@ public static function from_json(mixed $json): ConnectWebview|null $json->device_selection_mode ?? null, ) ? \Seam\Resources\ConnectWebview\DeviceSelectionMode::tryFrom( - $json->device_selection_mode, - ) + $json->device_selection_mode, + ) ?? $json->device_selection_mode : null, login_successful: $json->login_successful ?? null, selected_provider: $json->selected_provider ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\ConnectWebview\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, url: $json->url ?? null, wait_for_device_creation: $json->wait_for_device_creation ?? @@ -111,7 +111,7 @@ public function __construct( /** * Device selection mode of the Connect Webview. Supported values: `none`, `single`, `multiple`. */ - public \Seam\Resources\ConnectWebview\DeviceSelectionMode|null $device_selection_mode, + public \Seam\Resources\ConnectWebview\DeviceSelectionMode|string|null $device_selection_mode, /** * Indicates whether the user logged in successfully using the Connect Webview. */ @@ -123,7 +123,7 @@ public function __construct( /** * Status of the Connect Webview. `authorized` indicates that the user has successfully logged into their device or system account, thereby completing the Connect Webview. */ - public \Seam\Resources\ConnectWebview\Status|null $status, + public \Seam\Resources\ConnectWebview\Status|string|null $status, /** * URL for the Connect Webview. You use the URL to display the Connect Webview flow to your user. */ diff --git a/src/Resources/ConnectedAccount.php b/src/Resources/ConnectedAccount.php index 8b7a5594..e732f8e4 100644 --- a/src/Resources/ConnectedAccount.php +++ b/src/Resources/ConnectedAccount.php @@ -140,9 +140,9 @@ public function __construct( namespace Seam\Resources\ConnectedAccount { /** - * Errors associated with the connected account. + * Errors associated with the connected account. Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -172,9 +172,17 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\ConnectedAccount\Errors\DormakabaSitesDisconnected::from_json( $json, ), - default - => \Seam\Resources\ConnectedAccount\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + is_bridge_error: $json->is_bridge_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, ), }; } @@ -249,9 +257,9 @@ public function __construct( } /** - * Warnings associated with the connected account. + * Warnings associated with the connected account. Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -297,9 +305,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\ConnectedAccount\Warnings\DormakabaSitesUnapproved::from_json( $json, ), - default - => \Seam\Resources\ConnectedAccount\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -561,62 +574,6 @@ public function __construct( } } - /** - * Fallback for connected_account.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\ConnectedAccount\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - is_bridge_error: $json->is_bridge_error ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). - */ - bool|null $is_bridge_error = null, - /** - * Indicates whether the error is related specifically to the connected account. - */ - bool|null $is_connected_account_error = null, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - is_bridge_error: $is_bridge_error, - is_connected_account_error: $is_connected_account_error, - message: $message, - ); - } - } - enum ErrorCode: string { case ACCOUNT_DISCONNECTED = "account_disconnected"; @@ -1068,49 +1025,6 @@ public function __construct( } } - /** - * Fallback for connected_account.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\ConnectedAccount\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case SCHEDULED_MAINTENANCE_WINDOW = "scheduled_maintenance_window"; diff --git a/src/Resources/Device.php b/src/Resources/Device.php index 73478dcc..ad53180b 100644 --- a/src/Resources/Device.php +++ b/src/Resources/Device.php @@ -19,8 +19,8 @@ public static function from_json(mixed $json): Device|null device_id: $json->device_id ?? null, device_type: is_string($json->device_type ?? null) ? \Seam\Resources\Device\DeviceType::tryFrom( - $json->device_type, - ) + $json->device_type, + ) ?? $json->device_type : null, display_name: $json->display_name ?? null, errors: array_map( @@ -116,7 +116,7 @@ public function __construct( /** * Type of the device. */ - public \Seam\Resources\Device\DeviceType|null $device_type, + public \Seam\Resources\Device\DeviceType|string|null $device_type, /** * Display name of the device, defaults to nickname (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the device easily, especially when there are numerous devices. */ @@ -324,9 +324,9 @@ public function __construct( } /** - * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. + * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -396,8 +396,14 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\Device\Errors\BridgeDisconnected::from_json( $json, ), - default => \Seam\Resources\Device\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -600,8 +606,8 @@ public static function from_json(mixed $json): Properties|null null, fan_mode_setting: is_string($json->fan_mode_setting ?? null) ? \Seam\Resources\Device\Properties\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) + $json->fan_mode_setting, + ) ?? $json->fan_mode_setting : null, four_suites_metadata: isset($json->four_suites_metadata) ? \Seam\Resources\Device\Properties\FourSuitesMetadata::from_json( @@ -1009,7 +1015,7 @@ public function __construct( /** * @deprecated Use `current_climate_setting.fan_mode_setting` instead. */ - public \Seam\Resources\Device\Properties\FanModeSetting|null $fan_mode_setting = null, + public \Seam\Resources\Device\Properties\FanModeSetting|string|null $fan_mode_setting = null, /** * Metadata for a 4SUITES device. */ @@ -1316,9 +1322,9 @@ public function __construct( } /** - * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. + * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -1440,8 +1446,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\Device\Warnings\MaxAccessCodesReached::from_json( $json, ), - default => \Seam\Resources\Device\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -2220,49 +2232,6 @@ public function __construct( } } - /** - * Fallback for device.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\Device\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case ACCOUNT_DISCONNECTED = "account_disconnected"; @@ -2350,8 +2319,8 @@ public static function from_json(mixed $json): Battery|null level: $json->level ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\Device\Properties\Battery\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -2364,7 +2333,7 @@ public function __construct( /** * Represents the current status of the battery charge level. Values are `critical`, which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; `low`, which signifies that the battery is under the preferred threshold and should be charged soon; `good`, which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and `full`, which represents a battery that is fully charged, providing the maximum duration of usage. */ - public \Seam\Resources\Device\Properties\Battery\Status|null $status, + public \Seam\Resources\Device\Properties\Battery\Status|string|null $status, ) {} } @@ -3425,8 +3394,8 @@ public static function from_json(mixed $json): NoiseawareMetadata|null device_id: $json->device_id ?? null, device_model: is_string($json->device_model ?? null) ? \Seam\Resources\Device\Properties\NoiseawareMetadata\DeviceModel::tryFrom( - $json->device_model, - ) + $json->device_model, + ) ?? $json->device_model : null, device_name: $json->device_name ?? null, noise_level_decibel: $json->noise_level_decibel ?? null, @@ -3442,7 +3411,7 @@ public function __construct( /** * Device model for a NoiseAware device. */ - public \Seam\Resources\Device\Properties\NoiseawareMetadata\DeviceModel|null $device_model = null, + public \Seam\Resources\Device\Properties\NoiseawareMetadata\DeviceModel|string|null $device_model = null, /** * Device name for a NoiseAware device. */ @@ -3754,8 +3723,8 @@ public static function from_json(mixed $json): SeamBridgeMetadata|null name: $json->name ?? null, unlock_method: is_string($json->unlock_method ?? null) ? \Seam\Resources\Device\Properties\SeamBridgeMetadata\UnlockMethod::tryFrom( - $json->unlock_method, - ) + $json->unlock_method, + ) ?? $json->unlock_method : null, ); } @@ -3772,7 +3741,7 @@ public function __construct( /** * Unlock method for Seam Bridge. */ - public \Seam\Resources\Device\Properties\SeamBridgeMetadata\UnlockMethod|null $unlock_method = null, + public \Seam\Resources\Device\Properties\SeamBridgeMetadata\UnlockMethod|string|null $unlock_method = null, ) {} } @@ -4204,8 +4173,8 @@ public static function from_json(mixed $json): CodeConstraints|null return new self( constraint_type: is_string($json->constraint_type ?? null) ? \Seam\Resources\Device\Properties\CodeConstraints\ConstraintType::tryFrom( - $json->constraint_type, - ) + $json->constraint_type, + ) ?? $json->constraint_type : null, max_length: $json->max_length ?? null, min_length: $json->min_length ?? null, @@ -4213,7 +4182,7 @@ public static function from_json(mixed $json): CodeConstraints|null } public function __construct( - public \Seam\Resources\Device\Properties\CodeConstraints\ConstraintType|null $constraint_type, + public \Seam\Resources\Device\Properties\CodeConstraints\ConstraintType|string|null $constraint_type, /** * Maximum name length constraint for access codes. */ @@ -4495,8 +4464,8 @@ public static function from_json( $json->climate_preset_mode ?? null, ) ? \Seam\Resources\Device\Properties\AvailableClimatePresets\ClimatePresetMode::tryFrom( - $json->climate_preset_mode, - ) + $json->climate_preset_mode, + ) ?? $json->climate_preset_mode : null, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, @@ -4509,8 +4478,8 @@ public static function from_json( : null, fan_mode_setting: is_string($json->fan_mode_setting ?? null) ? \Seam\Resources\Device\Properties\AvailableClimatePresets\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) + $json->fan_mode_setting, + ) ?? $json->fan_mode_setting : null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, @@ -4518,8 +4487,8 @@ public static function from_json( null, hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) ? \Seam\Resources\Device\Properties\AvailableClimatePresets\HvacModeSetting::tryFrom( - $json->hvac_mode_setting, - ) + $json->hvac_mode_setting, + ) ?? $json->hvac_mode_setting : null, name: $json->name ?? null, ); @@ -4555,7 +4524,7 @@ public function __construct( /** * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. */ - public \Seam\Resources\Device\Properties\AvailableClimatePresets\ClimatePresetMode|null $climate_preset_mode = null, + public \Seam\Resources\Device\Properties\AvailableClimatePresets\ClimatePresetMode|string|null $climate_preset_mode = null, /** * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4571,7 +4540,7 @@ public function __construct( /** * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. */ - public \Seam\Resources\Device\Properties\AvailableClimatePresets\FanModeSetting|null $fan_mode_setting = null, + public \Seam\Resources\Device\Properties\AvailableClimatePresets\FanModeSetting|string|null $fan_mode_setting = null, /** * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4583,7 +4552,7 @@ public function __construct( /** * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. */ - public \Seam\Resources\Device\Properties\AvailableClimatePresets\HvacModeSetting|null $hvac_mode_setting = null, + public \Seam\Resources\Device\Properties\AvailableClimatePresets\HvacModeSetting|string|null $hvac_mode_setting = null, /** * User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). */ @@ -4612,8 +4581,8 @@ public static function from_json( $json->climate_preset_mode ?? null, ) ? \Seam\Resources\Device\Properties\CurrentClimateSetting\ClimatePresetMode::tryFrom( - $json->climate_preset_mode, - ) + $json->climate_preset_mode, + ) ?? $json->climate_preset_mode : null, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, @@ -4627,8 +4596,8 @@ public static function from_json( : null, fan_mode_setting: is_string($json->fan_mode_setting ?? null) ? \Seam\Resources\Device\Properties\CurrentClimateSetting\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) + $json->fan_mode_setting, + ) ?? $json->fan_mode_setting : null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, @@ -4636,8 +4605,8 @@ public static function from_json( null, hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) ? \Seam\Resources\Device\Properties\CurrentClimateSetting\HvacModeSetting::tryFrom( - $json->hvac_mode_setting, - ) + $json->hvac_mode_setting, + ) ?? $json->hvac_mode_setting : null, manual_override_allowed: $json->manual_override_allowed ?? null, name: $json->name ?? null, @@ -4664,7 +4633,7 @@ public function __construct( /** * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. */ - public \Seam\Resources\Device\Properties\CurrentClimateSetting\ClimatePresetMode|null $climate_preset_mode = null, + public \Seam\Resources\Device\Properties\CurrentClimateSetting\ClimatePresetMode|string|null $climate_preset_mode = null, /** * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4684,7 +4653,7 @@ public function __construct( /** * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. */ - public \Seam\Resources\Device\Properties\CurrentClimateSetting\FanModeSetting|null $fan_mode_setting = null, + public \Seam\Resources\Device\Properties\CurrentClimateSetting\FanModeSetting|string|null $fan_mode_setting = null, /** * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4696,7 +4665,7 @@ public function __construct( /** * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. */ - public \Seam\Resources\Device\Properties\CurrentClimateSetting\HvacModeSetting|null $hvac_mode_setting = null, + public \Seam\Resources\Device\Properties\CurrentClimateSetting\HvacModeSetting|string|null $hvac_mode_setting = null, /** * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). * @@ -4731,8 +4700,8 @@ public static function from_json( $json->climate_preset_mode ?? null, ) ? \Seam\Resources\Device\Properties\DefaultClimateSetting\ClimatePresetMode::tryFrom( - $json->climate_preset_mode, - ) + $json->climate_preset_mode, + ) ?? $json->climate_preset_mode : null, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, @@ -4746,8 +4715,8 @@ public static function from_json( : null, fan_mode_setting: is_string($json->fan_mode_setting ?? null) ? \Seam\Resources\Device\Properties\DefaultClimateSetting\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) + $json->fan_mode_setting, + ) ?? $json->fan_mode_setting : null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, @@ -4755,8 +4724,8 @@ public static function from_json( null, hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) ? \Seam\Resources\Device\Properties\DefaultClimateSetting\HvacModeSetting::tryFrom( - $json->hvac_mode_setting, - ) + $json->hvac_mode_setting, + ) ?? $json->hvac_mode_setting : null, manual_override_allowed: $json->manual_override_allowed ?? null, name: $json->name ?? null, @@ -4783,7 +4752,7 @@ public function __construct( /** * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. */ - public \Seam\Resources\Device\Properties\DefaultClimateSetting\ClimatePresetMode|null $climate_preset_mode = null, + public \Seam\Resources\Device\Properties\DefaultClimateSetting\ClimatePresetMode|string|null $climate_preset_mode = null, /** * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4803,7 +4772,7 @@ public function __construct( /** * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. */ - public \Seam\Resources\Device\Properties\DefaultClimateSetting\FanModeSetting|null $fan_mode_setting = null, + public \Seam\Resources\Device\Properties\DefaultClimateSetting\FanModeSetting|string|null $fan_mode_setting = null, /** * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4815,7 +4784,7 @@ public function __construct( /** * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. */ - public \Seam\Resources\Device\Properties\DefaultClimateSetting\HvacModeSetting|null $hvac_mode_setting = null, + public \Seam\Resources\Device\Properties\DefaultClimateSetting\HvacModeSetting|string|null $hvac_mode_setting = null, /** * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). * @@ -5571,8 +5540,8 @@ public static function from_json(mixed $json): EcobeeMetadata|null is_optimized: $json->is_optimized ?? null, owner: is_string($json->owner ?? null) ? \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner::tryFrom( - $json->owner, - ) + $json->owner, + ) ?? $json->owner : null, ); } @@ -5589,7 +5558,7 @@ public function __construct( /** * Indicates whether the climate preset is owned by the user or the system. */ - public \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner|null $owner = null, + public \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner|string|null $owner = null, ) {} } @@ -5644,8 +5613,8 @@ public static function from_json(mixed $json): EcobeeMetadata|null is_optimized: $json->is_optimized ?? null, owner: is_string($json->owner ?? null) ? \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata\Owner::tryFrom( - $json->owner, - ) + $json->owner, + ) ?? $json->owner : null, ); } @@ -5662,7 +5631,7 @@ public function __construct( /** * Indicates whether the climate preset is owned by the user or the system. */ - public \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata\Owner|null $owner = null, + public \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata\Owner|string|null $owner = null, ) {} } @@ -5717,8 +5686,8 @@ public static function from_json(mixed $json): EcobeeMetadata|null is_optimized: $json->is_optimized ?? null, owner: is_string($json->owner ?? null) ? \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata\Owner::tryFrom( - $json->owner, - ) + $json->owner, + ) ?? $json->owner : null, ); } @@ -5735,7 +5704,7 @@ public function __construct( /** * Indicates whether the climate preset is owned by the user or the system. */ - public \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata\Owner|null $owner = null, + public \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata\Owner|string|null $owner = null, ) {} } @@ -7010,49 +6979,6 @@ public function __construct( } } - /** - * Fallback for device.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\Device\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case PARTIAL_BACKUP_ACCESS_CODE_POOL = "partial_backup_access_code_pool"; diff --git a/src/Resources/DeviceProvider.php b/src/Resources/DeviceProvider.php index 6b321d1a..c280272e 100644 --- a/src/Resources/DeviceProvider.php +++ b/src/Resources/DeviceProvider.php @@ -13,8 +13,8 @@ public static function from_json(mixed $json): DeviceProvider|null $json->device_provider_name ?? null, ) ? \Seam\Resources\DeviceProvider\DeviceProviderName::tryFrom( - $json->device_provider_name, - ) + $json->device_provider_name, + ) ?? $json->device_provider_name : null, display_name: $json->display_name ?? null, image_url: $json->image_url ?? null, @@ -56,7 +56,7 @@ public function __construct( /** * Name of the device provider. */ - public \Seam\Resources\DeviceProvider\DeviceProviderName|null $device_provider_name, + public \Seam\Resources\DeviceProvider\DeviceProviderName|string|null $device_provider_name, /** * Display name for the device provider. */ diff --git a/src/Resources/Event.php b/src/Resources/Event.php index d4c4054f..416d5c96 100644 --- a/src/Resources/Event.php +++ b/src/Resources/Event.php @@ -2,9 +2,9 @@ namespace Seam\Resources { /** - * Base class for events returned by the Seam API. + * Base class for events returned by the Seam API. Known event_type values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Event + class Event { public static function from_json(mixed $json): Event|null { @@ -412,8 +412,17 @@ public static function from_json(mixed $json): Event|null => \Seam\Resources\Event\SpaceCreated::from_json($json), \Seam\Resources\Event\EventType::SPACE_DELETED => \Seam\Resources\Event\SpaceDeleted::from_json($json), - default => \Seam\Resources\Event\UnknownEvent::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + event_id: $json->event_id ?? null, + event_type: is_string($json->event_type ?? null) + ? \Seam\Resources\Event\EventType::tryFrom( + $json->event_type, + ) ?? $json->event_type + : null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + event_description: $json->event_description ?? null, ), }; } @@ -7081,8 +7090,8 @@ public static function from_json(mixed $json): DeviceDisconnected|null ), error_code: is_string($json->error_code ?? null) ? \Seam\Resources\Event\DeviceDisconnected\ErrorCode::tryFrom( - $json->error_code, - ) + $json->error_code, + ) ?? $json->error_code : null, event_id: $json->event_id ?? null, event_type: is_string($json->event_type ?? null) @@ -7140,7 +7149,7 @@ public function __construct( /** * Error code associated with the disconnection event, if any. */ - public \Seam\Resources\Event\DeviceDisconnected\ErrorCode|null $error_code, + public \Seam\Resources\Event\DeviceDisconnected\ErrorCode|string|null $error_code, /** * ID of the event. */ @@ -7235,8 +7244,8 @@ public static function from_json( ), error_code: is_string($json->error_code ?? null) ? \Seam\Resources\Event\DeviceUnmanagedDisconnected\ErrorCode::tryFrom( - $json->error_code, - ) + $json->error_code, + ) ?? $json->error_code : null, event_id: $json->event_id ?? null, event_type: is_string($json->event_type ?? null) @@ -7294,7 +7303,7 @@ public function __construct( /** * Error code associated with the disconnection event, if any. */ - public \Seam\Resources\Event\DeviceUnmanagedDisconnected\ErrorCode|null $error_code, + public \Seam\Resources\Event\DeviceUnmanagedDisconnected\ErrorCode|string|null $error_code, /** * ID of the event. */ @@ -7536,8 +7545,8 @@ public static function from_json( battery_level: $json->battery_level ?? null, battery_status: is_string($json->battery_status ?? null) ? \Seam\Resources\Event\DeviceBatteryStatusChanged\BatteryStatus::tryFrom( - $json->battery_status, - ) + $json->battery_status, + ) ?? $json->battery_status : null, connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, @@ -7566,7 +7575,7 @@ public function __construct( /** * Battery status of the affected device, calculated from the numeric `battery_level` value. */ - public \Seam\Resources\Event\DeviceBatteryStatusChanged\BatteryStatus|null $battery_status, + public \Seam\Resources\Event\DeviceBatteryStatusChanged\BatteryStatus|string|null $battery_status, /** * ID of the connected account associated with the event. */ @@ -9011,8 +9020,8 @@ public static function from_json(mixed $json): LockLocked|null : null, method: is_string($json->method ?? null) ? \Seam\Resources\Event\LockLocked\Method::tryFrom( - $json->method, - ) + $json->method, + ) ?? $json->method : null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, @@ -9051,7 +9060,7 @@ public function __construct( /** * Method by which the lock was locked. `keycode`: an access code was used (see `access_code_id`). `manual`: a physical action such as a thumbturn or button press. `remote`: a remote action via an app, Bluetooth, or the Seam API (see `action_attempt_id` if Seam-initiated; see `is_via_bluetooth` or `is_via_nfc` for the transport). `automatic`: triggered automatically, for example by an auto-relock timer. `unknown`: could not be determined. */ - public \Seam\Resources\Event\LockLocked\Method|null $method, + public \Seam\Resources\Event\LockLocked\Method|string|null $method, /** * Date and time at which the event occurred. */ @@ -9137,8 +9146,8 @@ public static function from_json(mixed $json): LockUnlocked|null : null, method: is_string($json->method ?? null) ? \Seam\Resources\Event\LockUnlocked\Method::tryFrom( - $json->method, - ) + $json->method, + ) ?? $json->method : null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, @@ -9174,7 +9183,7 @@ public function __construct( /** * Method by which the lock was unlocked. `keycode`: an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was used (see `access_code_id`). `manual`: a physical action such as a thumbturn or handle press. `remote`: a remote action via an app, Bluetooth, or the Seam API (see `action_attempt_id` if Seam-initiated; see `is_via_bluetooth` or `is_via_nfc` for the transport). `automatic`: triggered automatically, for example by a time-based schedule. `unknown`: could not be determined. */ - public \Seam\Resources\Event\LockUnlocked\Method|null $method, + public \Seam\Resources\Event\LockUnlocked\Method|string|null $method, /** * Date and time at which the event occurred. */ @@ -9473,8 +9482,8 @@ public static function from_json( : null, method: is_string($json->method ?? null) ? \Seam\Resources\Event\ThermostatManuallyAdjusted\Method::tryFrom( - $json->method, - ) + $json->method, + ) ?? $json->method : null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, @@ -9489,8 +9498,8 @@ public static function from_json( event_description: $json->event_description ?? null, fan_mode_setting: is_string($json->fan_mode_setting ?? null) ? \Seam\Resources\Event\ThermostatManuallyAdjusted\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) + $json->fan_mode_setting, + ) ?? $json->fan_mode_setting : null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, @@ -9498,8 +9507,8 @@ public static function from_json( null, hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) ? \Seam\Resources\Event\ThermostatManuallyAdjusted\HvacModeSetting::tryFrom( - $json->hvac_mode_setting, - ) + $json->hvac_mode_setting, + ) ?? $json->hvac_mode_setting : null, ); } @@ -9525,7 +9534,7 @@ public function __construct( /** * Method used to adjust the affected thermostat manually. `seam` indicates that the Seam API, Seam CLI, or Seam Console was used to adjust the thermostat. */ - public \Seam\Resources\Event\ThermostatManuallyAdjusted\Method|null $method, + public \Seam\Resources\Event\ThermostatManuallyAdjusted\Method|string|null $method, /** * Date and time at which the event occurred. */ @@ -9565,7 +9574,7 @@ public function __construct( /** * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. */ - public \Seam\Resources\Event\ThermostatManuallyAdjusted\FanModeSetting|null $fan_mode_setting = null, + public \Seam\Resources\Event\ThermostatManuallyAdjusted\FanModeSetting|string|null $fan_mode_setting = null, /** * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -9577,7 +9586,7 @@ public function __construct( /** * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. */ - public \Seam\Resources\Event\ThermostatManuallyAdjusted\HvacModeSetting|null $hvac_mode_setting = null, + public \Seam\Resources\Event\ThermostatManuallyAdjusted\HvacModeSetting|string|null $hvac_mode_setting = null, ) { parent::__construct( created_at: $created_at, @@ -10147,8 +10156,8 @@ public static function from_json(mixed $json): CameraActivated|null return new self( activation_reason: is_string($json->activation_reason ?? null) ? \Seam\Resources\Event\CameraActivated\ActivationReason::tryFrom( - $json->activation_reason, - ) + $json->activation_reason, + ) ?? $json->activation_reason : null, connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, @@ -10169,8 +10178,8 @@ public static function from_json(mixed $json): CameraActivated|null image_url: $json->image_url ?? null, motion_sub_type: is_string($json->motion_sub_type ?? null) ? \Seam\Resources\Event\CameraActivated\MotionSubType::tryFrom( - $json->motion_sub_type, - ) + $json->motion_sub_type, + ) ?? $json->motion_sub_type : null, video_url: $json->video_url ?? null, ); @@ -10180,7 +10189,7 @@ public function __construct( /** * The reason the camera was activated. */ - public \Seam\Resources\Event\CameraActivated\ActivationReason|null $activation_reason, + public \Seam\Resources\Event\CameraActivated\ActivationReason|string|null $activation_reason, /** * ID of the connected account associated with the event. */ @@ -10233,7 +10242,7 @@ public function __construct( /** * Sub-type of motion detected, if available. */ - public \Seam\Resources\Event\CameraActivated\MotionSubType|null $motion_sub_type = null, + public \Seam\Resources\Event\CameraActivated\MotionSubType|string|null $motion_sub_type = null, /** * URL to a short video clip captured at the time of activation. */ @@ -10665,64 +10674,6 @@ public function __construct( } } - /** - * Fallback for event values introduced after this SDK version. - */ - final class UnknownEvent extends \Seam\Resources\Event - { - public static function from_json(mixed $json): UnknownEvent|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, - occurred_at: $json->occurred_at ?? null, - workspace_id: $json->workspace_id ?? null, - event_description: $json->event_description ?? null, - ); - } - - public function __construct( - /** - * Date and time at which the event was created. - */ - string|null $created_at, - /** - * ID of the event. - */ - string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, - /** - * Date and time at which the event occurred. - */ - string|null $occurred_at, - /** - * ID of the workspace associated with the event. - */ - string|null $workspace_id, - /** - * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. - */ - string|null $event_description = null, - ) { - parent::__construct( - created_at: $created_at, - event_description: $event_description, - event_id: $event_id, - event_type: $event_type, - occurred_at: $occurred_at, - workspace_id: $workspace_id, - ); - } - } - enum EventType: string { case ACCESS_CODE_CREATED = "access_code.created"; @@ -11031,8 +10982,8 @@ public static function from_json(mixed $json): RequestedMutations|null return new self( mutation_code: is_string($json->mutation_code ?? null) ? \Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations\MutationCode::tryFrom( - $json->mutation_code, - ) + $json->mutation_code, + ) ?? $json->mutation_code : null, from: $json->from ?? null, to: $json->to ?? null, @@ -11043,7 +10994,7 @@ public function __construct( /** * Code identifying the type of mutation requested, such as `updating_name`, `updating_code`, `updating_time_frame`, or `deleting`. */ - public \Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations\MutationCode|null $mutation_code, + public \Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations\MutationCode|string|null $mutation_code, /** * Previous property values before the requested change. Keys depend on the mutation type. Absent for non-property mutations like `deleting`. * @@ -13101,8 +13052,8 @@ public static function from_json(mixed $json): Reason|null message: $json->message ?? null, reason_code: is_string($json->reason_code ?? null) ? \Seam\Resources\Event\LockAccessDenied\Reason\ReasonCode::tryFrom( - $json->reason_code, - ) + $json->reason_code, + ) ?? $json->reason_code : null, ); } @@ -13115,7 +13066,7 @@ public function __construct( /** * Normalized reason a lock denied access. Provider-agnostic; not all providers report every value. */ - public \Seam\Resources\Event\LockAccessDenied\Reason\ReasonCode|null $reason_code, + public \Seam\Resources\Event\LockAccessDenied\Reason\ReasonCode|string|null $reason_code, ) {} } } diff --git a/src/Resources/Phone.php b/src/Resources/Phone.php index 22e3a981..61945cc9 100644 --- a/src/Resources/Phone.php +++ b/src/Resources/Phone.php @@ -17,8 +17,8 @@ public static function from_json(mixed $json): Phone|null device_id: $json->device_id ?? null, device_type: is_string($json->device_type ?? null) ? \Seam\Resources\Phone\DeviceType::tryFrom( - $json->device_type, - ) + $json->device_type, + ) ?? $json->device_type : null, display_name: $json->display_name ?? null, errors: array_map( @@ -57,7 +57,7 @@ public function __construct( /** * Type of the phone device, such as `ios_phone` or `android_phone`. */ - public \Seam\Resources\Phone\DeviceType|null $device_type, + public \Seam\Resources\Phone\DeviceType|string|null $device_type, /** * Display name of the phone. Defaults to `nickname` (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the phone easily, especially when there are numerous phones. */ diff --git a/src/Resources/UnmanagedAccessCode.php b/src/Resources/UnmanagedAccessCode.php index 38469560..12d75c09 100644 --- a/src/Resources/UnmanagedAccessCode.php +++ b/src/Resources/UnmanagedAccessCode.php @@ -38,13 +38,13 @@ public static function from_json(mixed $json): UnmanagedAccessCode|null name: $json->name ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\UnmanagedAccessCode\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, type: is_string($json->type ?? null) ? \Seam\Resources\UnmanagedAccessCode\Type::tryFrom( - $json->type, - ) + $json->type, + ) ?? $json->type : null, warnings: array_map( fn( @@ -104,11 +104,11 @@ public function __construct( /** * Current status of the access code within the operational lifecycle. `set` indicates that the code is active and operational. `unset` indicates that the code exists on the provider but is not usable on the device. */ - public \Seam\Resources\UnmanagedAccessCode\Status|null $status, + public \Seam\Resources\UnmanagedAccessCode\Status|string|null $status, /** * Type of the access code. `ongoing` access codes are active continuously until deactivated manually. `time_bound` access codes have a specific duration. */ - public \Seam\Resources\UnmanagedAccessCode\Type|null $type, + public \Seam\Resources\UnmanagedAccessCode\Type|string|null $type, /** * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). * @@ -204,9 +204,9 @@ public function __construct( } /** - * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -304,9 +304,13 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\UnmanagedAccessCode\Errors\BridgeDisconnected::from_json( $json, ), - default - => \Seam\Resources\UnmanagedAccessCode\Errors\Unknown::from_json( - $json, + default => new self( + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -324,9 +328,9 @@ public function __construct( } /** - * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). + * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -384,9 +388,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\UnmanagedAccessCode\Warnings\UnknownIssueWithAccessCode::from_json( $json, ), - default - => \Seam\Resources\UnmanagedAccessCode\Warnings\Unknown::from_json( - $json, + default => new self( + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, + created_at: $json->created_at ?? null, ), }; } @@ -681,8 +690,8 @@ public static function from_json( message: $json->message ?? null, change_type: is_string($json->change_type ?? null) ? \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ChangeType::tryFrom( - $json->change_type, - ) + $json->change_type, + ) ?? $json->change_type : null, created_at: $json->created_at ?? null, modified_fields: array_map( @@ -712,7 +721,7 @@ public function __construct( /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. */ - public \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ChangeType|null $change_type = null, + public \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ChangeType|string|null $change_type = null, /** * Date and time at which Seam created the error. */ @@ -1437,40 +1446,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_access_code.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedAccessCode\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct(error_code: $error_code, message: $message); - } - } - enum ErrorCode: string { case PROVIDER_ISSUE = "provider_issue"; @@ -1650,8 +1625,8 @@ public static function from_json( : null, change_type: is_string($json->change_type ?? null) ? \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ChangeType::tryFrom( - $json->change_type, - ) + $json->change_type, + ) ?? $json->change_type : null, created_at: $json->created_at ?? null, modified_fields: array_map( @@ -1677,7 +1652,7 @@ public function __construct( /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. */ - public \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ChangeType|null $change_type = null, + public \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ChangeType|string|null $change_type = null, /** * Date and time at which Seam created the warning. */ @@ -2056,49 +2031,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_access_code.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedAccessCode\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - created_at: $json->created_at ?? null, - ); - } - - public function __construct( - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at = null, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case CODE_ROTATES_PERIODICALLY = "code_rotates_periodically"; diff --git a/src/Resources/UnmanagedAccessGrant.php b/src/Resources/UnmanagedAccessGrant.php index 9d4fccb5..1663e36f 100644 --- a/src/Resources/UnmanagedAccessGrant.php +++ b/src/Resources/UnmanagedAccessGrant.php @@ -143,9 +143,9 @@ public function __construct( namespace Seam\Resources\UnmanagedAccessGrant { /** - * Errors associated with the [access grant](https://docs.seam.co/use-cases/granting-access). + * Errors associated with the [access grant](https://docs.seam.co/use-cases/granting-access). Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -163,9 +163,15 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\UnmanagedAccessGrant\Errors\CannotCreateRequestedAccessMethods::from_json( $json, ), - default - => \Seam\Resources\UnmanagedAccessGrant\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, + missing_device_ids: $json->missing_device_ids ?? null, ), }; } @@ -193,9 +199,9 @@ public function __construct( } /** - * List of pending mutations for the access grant. This shows updates that are in progress. + * List of pending mutations for the access grant. This shows updates that are in progress. Known mutation_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class PendingMutations + class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { @@ -217,9 +223,14 @@ public static function from_json(mixed $json): PendingMutations|null => \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingAccessTimes::from_json( $json, ), - default - => \Seam\Resources\UnmanagedAccessGrant\PendingMutations\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ), }; } @@ -258,8 +269,8 @@ public static function from_json( display_name: $json->display_name ?? null, mode: is_string($json->mode ?? null) ? \Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods\Mode::tryFrom( - $json->mode, - ) + $json->mode, + ) ?? $json->mode : null, code: $json->code ?? null, instant_key_max_use_count: $json->instant_key_max_use_count ?? @@ -285,7 +296,7 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods\Mode|null $mode, + public \Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods\Mode|string|null $mode, /** * Specific PIN code to use for this access method. Only applicable when mode is 'code'. */ @@ -298,9 +309,9 @@ public function __construct( } /** - * Warnings associated with the [access grant](https://docs.seam.co/use-cases/granting-access). + * Warnings associated with the [access grant](https://docs.seam.co/use-cases/granting-access). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -342,9 +353,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated::from_json( $json, ), - default - => \Seam\Resources\UnmanagedAccessGrant\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -420,57 +436,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_access_grant.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedAccessGrant\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - missing_device_ids: $json->missing_device_ids ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * IDs of the devices that did not receive an access code at grant creation. Use these to identify which specific devices failed when the message reports a partial failure. - * - * @var list|null - */ - array|null $missing_device_ids = null, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - missing_device_ids: $missing_device_ids, - ); - } - } - enum ErrorCode: string { case CANNOT_CREATE_REQUESTED_ACCESS_METHODS = "cannot_create_requested_access_methods"; @@ -609,50 +574,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_access_grant.pending_mutations values introduced after this SDK version. - */ - final class Unknown extends - \Seam\Resources\UnmanagedAccessGrant\PendingMutations - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which the mutation was created. - */ - string|null $created_at, - /** - * Detailed description of the mutation. - */ - string|null $message, - /** - * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. - */ - \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode|string|null $mutation_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - mutation_code: $mutation_code, - ); - } - } - enum MutationCode: string { case UPDATING_SPACES = "updating_spaces"; @@ -1111,8 +1032,8 @@ public static function from_json( message: $json->message ?? null, reason: is_string($json->reason ?? null) ? \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason::tryFrom( - $json->reason, - ) + $json->reason, + ) ?? $json->reason : null, warning_code: is_string($json->warning_code ?? null) ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( @@ -1138,50 +1059,7 @@ public function __construct( /** * Specific reason why the grant's times are not programmable on the device. */ - public \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason|null $reason, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - - /** - * Fallback for unmanaged_access_grant.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedAccessGrant\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, + public \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason|string|null $reason, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ diff --git a/src/Resources/UnmanagedAccessMethod.php b/src/Resources/UnmanagedAccessMethod.php index 3f60f4a9..287bd33d 100644 --- a/src/Resources/UnmanagedAccessMethod.php +++ b/src/Resources/UnmanagedAccessMethod.php @@ -28,8 +28,8 @@ public static function from_json( issued_at: $json->issued_at ?? null, mode: is_string($json->mode ?? null) ? \Seam\Resources\UnmanagedAccessMethod\Mode::tryFrom( - $json->mode, - ) + $json->mode, + ) ?? $json->mode : null, pending_mutations: array_map( fn( @@ -86,7 +86,7 @@ public function __construct( /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. */ - public \Seam\Resources\UnmanagedAccessMethod\Mode|null $mode, + public \Seam\Resources\UnmanagedAccessMethod\Mode|string|null $mode, /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. * @@ -129,9 +129,9 @@ public function __construct( namespace Seam\Resources\UnmanagedAccessMethod { /** - * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -149,9 +149,14 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\UnmanagedAccessMethod\Errors\FailedToIssue::from_json( $json, ), - default - => \Seam\Resources\UnmanagedAccessMethod\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -173,9 +178,9 @@ public function __construct( } /** - * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. + * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. Known mutation_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class PendingMutations + class PendingMutations { public static function from_json(mixed $json): PendingMutations|null { @@ -201,9 +206,14 @@ public static function from_json(mixed $json): PendingMutations|null => \Seam\Resources\UnmanagedAccessMethod\PendingMutations\UpdatingAccessTimes::from_json( $json, ), - default - => \Seam\Resources\UnmanagedAccessMethod\PendingMutations\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + mutation_code: is_string($json->mutation_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( + $json->mutation_code, + ) ?? $json->mutation_code + : null, ), }; } @@ -225,9 +235,9 @@ public function __construct( } /** - * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -257,9 +267,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\UnmanagedAccessMethod\Warnings\DelayInIssuing::from_json( $json, ), - default - => \Seam\Resources\UnmanagedAccessMethod\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -334,49 +349,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_access_method.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedAccessMethod\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case FAILED_TO_ISSUE = "failed_to_issue"; @@ -570,50 +542,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_access_method.pending_mutations values introduced after this SDK version. - */ - final class Unknown extends - \Seam\Resources\UnmanagedAccessMethod\PendingMutations - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which the mutation was created. - */ - string|null $created_at, - /** - * Detailed description of the mutation. - */ - string|null $message, - /** - * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. - */ - \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - mutation_code: $mutation_code, - ); - } - } - enum MutationCode: string { case PROVISIONING_ACCESS = "provisioning_access"; @@ -960,49 +888,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_access_method.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedAccessMethod\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case BEING_DELETED = "being_deleted"; diff --git a/src/Resources/UnmanagedDevice.php b/src/Resources/UnmanagedDevice.php index 799d599f..6afc82b8 100644 --- a/src/Resources/UnmanagedDevice.php +++ b/src/Resources/UnmanagedDevice.php @@ -19,8 +19,8 @@ public static function from_json(mixed $json): UnmanagedDevice|null device_id: $json->device_id ?? null, device_type: is_string($json->device_type ?? null) ? \Seam\Resources\UnmanagedDevice\DeviceType::tryFrom( - $json->device_type, - ) + $json->device_type, + ) ?? $json->device_type : null, errors: array_map( fn($e) => \Seam\Resources\UnmanagedDevice\Errors::from_json( @@ -109,7 +109,7 @@ public function __construct( /** * Type of the device. */ - public \Seam\Resources\UnmanagedDevice\DeviceType|null $device_type, + public \Seam\Resources\UnmanagedDevice\DeviceType|string|null $device_type, /** * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. * @@ -224,9 +224,9 @@ public function __construct( namespace Seam\Resources\UnmanagedDevice { /** - * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. + * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -296,9 +296,14 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\UnmanagedDevice\Errors\BridgeDisconnected::from_json( $json, ), - default - => \Seam\Resources\UnmanagedDevice\Errors\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -453,9 +458,9 @@ public function __construct( } /** - * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. + * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -577,9 +582,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\UnmanagedDevice\Warnings\MaxAccessCodesReached::from_json( $json, ), - default - => \Seam\Resources\UnmanagedDevice\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -1368,49 +1378,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_device.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedDevice\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case ACCOUNT_DISCONNECTED = "account_disconnected"; @@ -1477,8 +1444,8 @@ public static function from_json(mixed $json): Battery|null level: $json->level ?? null, status: is_string($json->status ?? null) ? \Seam\Resources\UnmanagedDevice\Properties\Battery\Status::tryFrom( - $json->status, - ) + $json->status, + ) ?? $json->status : null, ); } @@ -1491,7 +1458,7 @@ public function __construct( /** * Represents the current status of the battery charge level. Values are `critical`, which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; `low`, which signifies that the battery is under the preferred threshold and should be charged soon; `good`, which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and `full`, which represents a battery that is fully charged, providing the maximum duration of usage. */ - public \Seam\Resources\UnmanagedDevice\Properties\Battery\Status|null $status, + public \Seam\Resources\UnmanagedDevice\Properties\Battery\Status|string|null $status, ) {} } @@ -2799,49 +2766,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_device.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedDevice\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case PARTIAL_BACKUP_ACCESS_CODE_POOL = "partial_backup_access_code_pool"; diff --git a/src/Resources/UnmanagedUserIdentity.php b/src/Resources/UnmanagedUserIdentity.php index 6fcc28ee..81671135 100644 --- a/src/Resources/UnmanagedUserIdentity.php +++ b/src/Resources/UnmanagedUserIdentity.php @@ -93,9 +93,9 @@ public function __construct( namespace Seam\Resources\UnmanagedUserIdentity { /** - * Array of errors associated with the user identity. Each error object within the array contains fields like "error_code" and "message." "error_code" is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. + * Array of errors associated with the user identity. Each error object within the array contains fields like "error_code" and "message." "error_code" is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -113,9 +113,16 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\UnmanagedUserIdentity\Errors\IssueWithAcsUser::from_json( $json, ), - default - => \Seam\Resources\UnmanagedUserIdentity\Errors\Unknown::from_json( - $json, + default => new self( + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -145,9 +152,9 @@ public function __construct( } /** - * Array of warnings associated with the user identity. Each warning object within the array contains two fields: "warning_code" and "message." "warning_code" is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. + * Array of warnings associated with the user identity. Each warning object within the array contains two fields: "warning_code" and "message." "warning_code" is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -169,9 +176,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\UnmanagedUserIdentity\Warnings\AcsUserProfileDoesNotMatchUserIdentity::from_json( $json, ), - default - => \Seam\Resources\UnmanagedUserIdentity\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -250,61 +262,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_user_identity.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedUserIdentity\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - acs_system_id: $json->acs_system_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * ID of the access system that the user identity is associated with. - */ - string|null $acs_system_id, - /** - * ID of the access system user that has an issue. - */ - string|null $acs_user_id, - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - acs_system_id: $acs_system_id, - acs_user_id: $acs_user_id, - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case ISSUE_WITH_ACS_USER = "issue_with_acs_user"; @@ -401,49 +358,6 @@ public function __construct( } } - /** - * Fallback for unmanaged_user_identity.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UnmanagedUserIdentity\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case BEING_DELETED = "being_deleted"; diff --git a/src/Resources/UserIdentity.php b/src/Resources/UserIdentity.php index 3077c24d..7a8090d2 100644 --- a/src/Resources/UserIdentity.php +++ b/src/Resources/UserIdentity.php @@ -93,9 +93,9 @@ public function __construct( namespace Seam\Resources\UserIdentity { /** - * Array of errors associated with the user identity. Each error object within the array contains fields like "error_code" and "message." "error_code" is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. + * Array of errors associated with the user identity. Each error object within the array contains fields like "error_code" and "message." "error_code" is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. Known error_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Errors + class Errors { public static function from_json(mixed $json): Errors|null { @@ -113,9 +113,16 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\UserIdentity\Errors\IssueWithAcsUser::from_json( $json, ), - default - => \Seam\Resources\UserIdentity\Errors\Unknown::from_json( - $json, + default => new self( + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + created_at: $json->created_at ?? null, + error_code: is_string($json->error_code ?? null) + ? \Seam\Resources\UserIdentity\Errors\ErrorCode::tryFrom( + $json->error_code, + ) ?? $json->error_code + : null, + message: $json->message ?? null, ), }; } @@ -145,9 +152,9 @@ public function __construct( } /** - * Array of warnings associated with the user identity. Each warning object within the array contains two fields: "warning_code" and "message." "warning_code" is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. + * Array of warnings associated with the user identity. Each warning object within the array contains two fields: "warning_code" and "message." "warning_code" is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. "message" provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. Known warning_code values use subclasses; unknown values use this base class and retain their raw discriminator. */ - abstract class Warnings + class Warnings { public static function from_json(mixed $json): Warnings|null { @@ -169,9 +176,14 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\UserIdentity\Warnings\AcsUserProfileDoesNotMatchUserIdentity::from_json( $json, ), - default - => \Seam\Resources\UserIdentity\Warnings\Unknown::from_json( - $json, + default => new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: is_string($json->warning_code ?? null) + ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( + $json->warning_code, + ) ?? $json->warning_code + : null, ), }; } @@ -249,61 +261,6 @@ public function __construct( } } - /** - * Fallback for user_identity.errors values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UserIdentity\Errors - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - acs_system_id: $json->acs_system_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UserIdentity\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, - message: $json->message ?? null, - ); - } - - public function __construct( - /** - * ID of the access system that the user identity is associated with. - */ - string|null $acs_system_id, - /** - * ID of the access system user that has an issue. - */ - string|null $acs_user_id, - /** - * Date and time at which Seam created the error. - */ - string|null $created_at, - /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UserIdentity\Errors\ErrorCode|string|null $error_code, - /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - ) { - parent::__construct( - acs_system_id: $acs_system_id, - acs_user_id: $acs_user_id, - created_at: $created_at, - error_code: $error_code, - message: $message, - ); - } - } - enum ErrorCode: string { case ISSUE_WITH_ACS_USER = "issue_with_acs_user"; @@ -399,49 +356,6 @@ public function __construct( } } - /** - * Fallback for user_identity.warnings values introduced after this SDK version. - */ - final class Unknown extends \Seam\Resources\UserIdentity\Warnings - { - public static function from_json(mixed $json): Unknown|null - { - if (!$json) { - return null; - } - return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - ); - } - - public function __construct( - /** - * Date and time at which Seam created the warning. - */ - string|null $created_at, - /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. - */ - string|null $message, - /** - * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. - */ - \Seam\Resources\UserIdentity\Warnings\WarningCode|string|null $warning_code, - ) { - parent::__construct( - created_at: $created_at, - message: $message, - warning_code: $warning_code, - ); - } - } - enum WarningCode: string { case BEING_DELETED = "being_deleted"; diff --git a/src/Resources/Workspace.php b/src/Resources/Workspace.php index fde61b97..bae35ea0 100644 --- a/src/Resources/Workspace.php +++ b/src/Resources/Workspace.php @@ -87,8 +87,8 @@ public static function from_json( inviter_logo_url: $json->inviter_logo_url ?? null, logo_shape: is_string($json->logo_shape ?? null) ? \Seam\Resources\Workspace\ConnectWebviewCustomization\LogoShape::tryFrom( - $json->logo_shape, - ) + $json->logo_shape, + ) ?? $json->logo_shape : null, primary_button_color: $json->primary_button_color ?? null, primary_button_text_color: $json->primary_button_text_color ?? @@ -105,7 +105,7 @@ public function __construct( /** * Logo shape for [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) in the workspace. See also [Customize the Look and Feel of Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-look-and-feel-of-your-connect-webviews). */ - public \Seam\Resources\Workspace\ConnectWebviewCustomization\LogoShape|null $logo_shape = null, + public \Seam\Resources\Workspace\ConnectWebviewCustomization\LogoShape|string|null $logo_shape = null, /** * Primary button color for [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) in the workspace. See also [Customize the Look and Feel of Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-look-and-feel-of-your-connect-webviews). */ diff --git a/src/SeamWebhook.php b/src/SeamWebhook.php index f993d0fa..fb2ec5b2 100644 --- a/src/SeamWebhook.php +++ b/src/SeamWebhook.php @@ -27,12 +27,12 @@ public function __construct(string $secret) /** * Verifies an incoming webhook request and returns the event it carries. * Known event types are returned as concrete Event subclasses for - * instanceof or match-based dispatch; newer types use Event\UnknownEvent. + * instanceof or match-based dispatch; newer types use Event itself. * * ```php * match (true) { * $event instanceof Event\AccessCodeCreated => $event->access_code_id, - * $event instanceof Event\UnknownEvent => $event->event_type, + * $event::class === Event::class => $event->event_type, * default => null, * }; * ``` diff --git a/tests/ResourceTest.php b/tests/ResourceTest.php index 9dfaaef0..5cfd708e 100644 --- a/tests/ResourceTest.php +++ b/tests/ResourceTest.php @@ -43,6 +43,36 @@ private function device(): Device return $device; } + public function testUnknownEnumValuesRemainReadable(): void + { + $device = Device::from_json( + (object) [ + "device_type" => "future_device_type", + ], + ); + + $this->assertSame("future_device_type", $device->device_type); + } + + public function testUnknownDiscriminatedValuesUseTheBaseClass(): void + { + $device = Device::from_json( + (object) [ + "errors" => [ + (object) [ + "error_code" => "future_error", + "message" => "Future error", + ], + ], + ], + ); + $error = $device->errors[0]; + + $this->assertSame(Device\Errors::class, $error::class); + $this->assertSame("future_error", $error->error_code); + $this->assertSame("Future error", $error->message); + } + public function testNestedPropertyClassesAreNamespacedByTheirOwner(): void { $device = $this->device(); diff --git a/tests/SeamWebhookTest.php b/tests/SeamWebhookTest.php index a622d695..859304b2 100644 --- a/tests/SeamWebhookTest.php +++ b/tests/SeamWebhookTest.php @@ -10,7 +10,6 @@ use Seam\Resources\Event\AccessCodeCreated; use Seam\Resources\Event\DeviceConnected; use Seam\Resources\Event\EventType; -use Seam\Resources\Event\UnknownEvent; use Seam\SeamException; use Seam\SeamWebhook; use Svix\Exception\WebhookVerificationException; @@ -105,7 +104,7 @@ public function testDecodesAnAccessCodeEventIntoItsSpecificClass(): void $this->assertSame("access_code_1", $event->access_code_id); } - public function testUnknownEventTypeUsesTheFallback(): void + public function testUnknownEventTypeUsesTheBaseClass(): void { $event = Event::from_json( (object) [ @@ -114,7 +113,7 @@ public function testUnknownEventTypeUsesTheFallback(): void ], ); - $this->assertInstanceOf(UnknownEvent::class, $event); + $this->assertSame(Event::class, $event::class); $this->assertSame("device.future_event", $event->event_type); } diff --git a/tests/WaitForActionAttemptTest.php b/tests/WaitForActionAttemptTest.php index dc864032..a608fd4c 100644 --- a/tests/WaitForActionAttemptTest.php +++ b/tests/WaitForActionAttemptTest.php @@ -17,6 +17,21 @@ final class WaitForActionAttemptTest extends FakeSeamConnectTestCase { + public function testUnknownValuesUseTheBaseTypeAndRemainReadable(): void + { + $attempt = ActionAttempt::from_json( + (object) [ + "action_attempt_id" => "attempt_1", + "action_type" => "FUTURE_ACTION", + "status" => "future_status", + ], + ); + + $this->assertSame(ActionAttempt::class, $attempt::class); + $this->assertSame("FUTURE_ACTION", $attempt->action_type); + $this->assertSame("future_status", $attempt->status); + } + private function pending_action_attempt(Seam $seam): ActionAttempt { $action_attempt = $seam->locks->unlock_door( From 38021536e91547e6c47cda8fdefcf8aaab51bc61 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Wed, 19 Aug 2026 19:00:19 -0700 Subject: [PATCH 3/4] fix: keep response enum values as strings --- README.md | 14 +- codegen/lib/layouts/resource.ts | 5 +- codegen/lib/resource-model.ts | 8 +- src/Http/ResolveActionAttempt.php | 5 +- src/Resources/AccessCode.php | 449 ++++---- src/Resources/AccessGrant.php | 150 ++- src/Resources/AccessMethod.php | 119 +- src/Resources/AcsAccessGroup.php | 149 +-- src/Resources/AcsCredential.php | 110 +- src/Resources/AcsEncoder.php | 10 +- src/Resources/AcsEntrance.php | 93 +- src/Resources/AcsSystem.php | 169 ++- src/Resources/AcsUser.php | 263 ++--- src/Resources/ActionAttempt.php | 642 +++++------ src/Resources/ConnectWebview.php | 22 +- src/Resources/ConnectedAccount.php | 140 +-- src/Resources/Device.php | 616 +++++------ src/Resources/DeviceProvider.php | 12 +- src/Resources/Event.php | 1319 ++++++++++------------- src/Resources/Phone.php | 10 +- src/Resources/UnmanagedAccessCode.php | 380 +++---- src/Resources/UnmanagedAccessGrant.php | 150 ++- src/Resources/UnmanagedAccessMethod.php | 120 +-- src/Resources/UnmanagedDevice.php | 450 ++++---- src/Resources/UnmanagedUserIdentity.php | 50 +- src/Resources/UserIdentity.php | 50 +- src/Resources/Workspace.php | 10 +- tests/ResourceTest.php | 9 +- tests/SeamWebhookTest.php | 8 +- tests/WaitForActionAttemptTest.php | 33 +- 30 files changed, 2321 insertions(+), 3244 deletions(-) diff --git a/README.md b/README.md index 31805cba..d0f5ef3e 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,17 @@ Waiting may be disabled for the whole client: $seam = new Seam\Seam(wait_for_action_attempt: false); $action_attempt = $seam->locks->unlock_door(device_id: $device_id); -$action_attempt->status; // Seam\Resources\ActionAttempt\Status::PENDING +$action_attempt->status; // "pending" +``` + +Response enum values stay strings for straightforward comparisons. Generated +backed enums provide autocomplete and optional validation: + +```php +use Seam\Resources\ActionAttempt\Status; + +$action_attempt->status === Status::PENDING->value; +$status = Status::tryFrom($action_attempt->status); ``` or for a single request: @@ -335,7 +345,7 @@ try { => "Created access code {$event->access_code_id}", $event::class === Seam\Resources\Event::class => "Unknown event type {$event->event_type}", - default => "Received {$event->event_type->value}", + default => "Received {$event->event_type}", }; } catch (Svix\Exception\WebhookVerificationException $error) { http_response_code(401); diff --git a/codegen/lib/layouts/resource.ts b/codegen/lib/layouts/resource.ts index 0eaf469e..ee9d6284 100644 --- a/codegen/lib/layouts/resource.ts +++ b/codegen/lib/layouts/resource.ts @@ -63,10 +63,7 @@ const generateFromJsonProp = (property: ResourceClassProperty): string => { return `${name}: $json->${name} ?? null,` case 'value': - if (property.enumType == null) { - return `${name}: $json->${name} ?? null,` - } - return `${name}: is_string($json->${name} ?? null) ? ${property.enumType}::tryFrom($json->${name})${property.preserveUnknownEnum ? ` ?? $json->${name}` : ''} : null,` + return `${name}: $json->${name} ?? null,` } } diff --git a/codegen/lib/resource-model.ts b/codegen/lib/resource-model.ts index 3c6c0f93..e2e49899 100644 --- a/codegen/lib/resource-model.ts +++ b/codegen/lib/resource-model.ts @@ -19,8 +19,6 @@ export type ResourceClassProperty = kind: 'value' phpType: string phpDocType: string - enumType?: string - preserveUnknownEnum?: boolean } & ResourceClassPropertyMetadata) | ({ kind: 'record' @@ -312,10 +310,8 @@ const buildClass = ( return { ...metadata, kind: 'value', - phpType: `${enumType}|string`, - phpDocType: '', - enumType, - preserveUnknownEnum: true, + phpType: 'string', + phpDocType: `value-of<${enumType}>|string`, } } diff --git a/src/Http/ResolveActionAttempt.php b/src/Http/ResolveActionAttempt.php index 3d645c28..90c3db54 100644 --- a/src/Http/ResolveActionAttempt.php +++ b/src/Http/ResolveActionAttempt.php @@ -8,7 +8,6 @@ use Seam\InvalidOptionsError; use Seam\InvalidResponseError; use Seam\Resources\ActionAttempt; -use Seam\Resources\ActionAttempt\Status; /** * Waits for an action attempt to reach a terminal state. @@ -73,11 +72,11 @@ private static function poll( $deadline = self::now() + $timeout; while (true) { - if ($action_attempt->status === Status::SUCCESS) { + if ($action_attempt->status === "success") { return $action_attempt; } - if ($action_attempt->status === Status::ERROR) { + if ($action_attempt->status === "error") { throw new ActionAttemptFailedError($action_attempt); } diff --git a/src/Resources/AccessCode.php b/src/Resources/AccessCode.php index 677ff902..1188cccd 100644 --- a/src/Resources/AccessCode.php +++ b/src/Resources/AccessCode.php @@ -45,15 +45,8 @@ public static function from_json(mixed $json): AccessCode|null ), $json->pending_mutations ?? [], ), - status: is_string($json->status ?? null) - ? \Seam\Resources\AccessCode\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, - type: is_string($json->type ?? null) - ? \Seam\Resources\AccessCode\Type::tryFrom($json->type) ?? - $json->type - : null, + status: $json->status ?? null, + type: $json->type ?? null, warnings: array_map( fn($w) => \Seam\Resources\AccessCode\Warnings::from_json( $w, @@ -138,12 +131,16 @@ public function __construct( public array $pending_mutations, /** * Current status of the access code within the operational lifecycle. Values are `setting`, a transitional phase that indicates that the code is being configured or activated; `set`, which indicates that the code is active and operational; `unset`, which indicates a deactivated or unused state, either before activation or after deliberate deactivation; `removing`, which indicates a transitional period in which the code is being deleted or made inactive; and `unknown`, which indicates an indeterminate state, due to reasons such as system errors or incomplete data, that highlights a potential need for system review or troubleshooting. See also [Lifecycle of Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/lifecycle-of-access-codes). + * + * @var value-of<\Seam\Resources\AccessCode\Status>|string|null */ - public \Seam\Resources\AccessCode\Status|string|null $status, + public string|null $status, /** * Type of the access code. `ongoing` access codes are active continuously until deactivated manually. `time_bound` access codes have a specific duration. + * + * @var value-of<\Seam\Resources\AccessCode\Type>|string|null */ - public \Seam\Resources\AccessCode\Type|string|null $type, + public string|null $type, /** * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). * @@ -348,11 +345,7 @@ public static function from_json(mixed $json): Errors|null $json, ), default => new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -361,8 +354,10 @@ public static function from_json(mixed $json): Errors|null public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - public \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -414,11 +409,7 @@ public static function from_json(mixed $json): PendingMutations|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ), }; } @@ -434,8 +425,10 @@ public function __construct( public string|null $message, /** * Mutation code to indicate that Seam is in the process of setting an access code on the device. + * + * @var value-of<\Seam\Resources\AccessCode\PendingMutations\MutationCode>|string|null */ - public \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, ) {} } @@ -502,11 +495,7 @@ public static function from_json(mixed $json): Warnings|null ), default => new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ), }; @@ -519,8 +508,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - public \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -556,11 +547,7 @@ public static function from_json(mixed $json): ProviderIssue|null return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -570,8 +557,10 @@ public static function from_json(mixed $json): ProviderIssue|null public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -600,11 +589,7 @@ public static function from_json(mixed $json): FailedToSetOnDevice|null return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -614,8 +599,10 @@ public static function from_json(mixed $json): FailedToSetOnDevice|null public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -646,11 +633,7 @@ public static function from_json( return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -660,8 +643,10 @@ public static function from_json( public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -691,11 +676,7 @@ public static function from_json( return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -708,8 +689,10 @@ public static function from_json( public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -748,11 +731,7 @@ public static function from_json( return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -762,8 +741,10 @@ public static function from_json( public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -794,18 +775,10 @@ public static function from_json( return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, - change_type: is_string($json->change_type ?? null) - ? \Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ChangeType::tryFrom( - $json->change_type, - ) ?? $json->change_type - : null, + change_type: $json->change_type ?? null, created_at: $json->created_at ?? null, modified_fields: array_map( fn( @@ -821,8 +794,10 @@ public static function from_json( public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -833,8 +808,10 @@ public function __construct( string|null $message, /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ChangeType>|string|null */ - public \Seam\Resources\AccessCode\Errors\ConflictingExternalModification\ChangeType|string|null $change_type = null, + public string|null $change_type = null, /** * Date and time at which Seam created the error. */ @@ -861,11 +838,7 @@ public static function from_json(mixed $json): AccessCodeInactive|null return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -875,8 +848,10 @@ public static function from_json(mixed $json): AccessCodeInactive|null public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -906,11 +881,7 @@ public static function from_json(mixed $json): AccountDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -925,8 +896,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -958,11 +931,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -977,8 +946,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -1010,11 +981,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -1029,8 +996,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -1062,11 +1031,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -1081,8 +1046,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -1112,11 +1079,7 @@ public static function from_json(mixed $json): DeviceOffline|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1129,8 +1092,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1156,11 +1121,7 @@ public static function from_json(mixed $json): DeviceRemoved|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1173,8 +1134,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1200,11 +1163,7 @@ public static function from_json(mixed $json): HubDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1217,8 +1176,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1244,11 +1205,7 @@ public static function from_json(mixed $json): DeviceDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1261,8 +1218,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1290,11 +1249,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1307,8 +1262,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1336,11 +1293,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1353,8 +1306,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1382,11 +1337,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1399,8 +1350,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1426,11 +1379,7 @@ public static function from_json(mixed $json): AuxiliaryHeatRunning|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1443,8 +1392,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1470,11 +1421,7 @@ public static function from_json(mixed $json): SubscriptionRequired|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1487,8 +1434,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1514,11 +1463,7 @@ public static function from_json(mixed $json): BridgeDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? @@ -1533,8 +1478,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -1633,11 +1580,7 @@ public static function from_json(mixed $json): Creating|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ); } @@ -1652,8 +1595,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of setting an access code on the device. + * + * @var value-of<\Seam\Resources\AccessCode\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, ) { parent::__construct( created_at: $created_at, @@ -1677,11 +1622,7 @@ public static function from_json(mixed $json): DeferringCreation|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, scheduled_at: $json->scheduled_at ?? null, ); } @@ -1697,8 +1638,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of setting an access code on the device. + * + * @var value-of<\Seam\Resources\AccessCode\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * Date and time at which Seam will attempt to program this access code on the device. */ @@ -1725,11 +1668,7 @@ public static function from_json(mixed $json): Deleting|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ); } @@ -1744,8 +1683,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of setting an access code on the device. + * + * @var value-of<\Seam\Resources\AccessCode\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, ) { parent::__construct( created_at: $created_at, @@ -1773,11 +1714,7 @@ public static function from_json(mixed $json): UpdatingCode|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AccessCode\PendingMutations\UpdatingCode\To::from_json( $json->to, @@ -1801,8 +1738,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of setting an access code on the device. + * + * @var value-of<\Seam\Resources\AccessCode\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New code configuration. */ @@ -1834,11 +1773,7 @@ public static function from_json(mixed $json): UpdatingName|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AccessCode\PendingMutations\UpdatingName\To::from_json( $json->to, @@ -1862,8 +1797,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of setting an access code on the device. + * + * @var value-of<\Seam\Resources\AccessCode\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New name configuration. */ @@ -1896,11 +1833,7 @@ public static function from_json(mixed $json): UpdatingTimeFrame|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessCode\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AccessCode\PendingMutations\UpdatingTimeFrame\To::from_json( $json->to, @@ -1924,8 +1857,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of setting an access code on the device. + * + * @var value-of<\Seam\Resources\AccessCode\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessCode\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New time frame configuration. */ @@ -2111,11 +2046,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2127,8 +2058,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2156,11 +2089,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2172,8 +2101,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2201,16 +2132,8 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - change_type: is_string($json->change_type ?? null) - ? \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ChangeType::tryFrom( - $json->change_type, - ) ?? $json->change_type - : null, + warning_code: $json->warning_code ?? null, + change_type: $json->change_type ?? null, created_at: $json->created_at ?? null, modified_fields: array_map( fn( @@ -2230,12 +2153,16 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ChangeType>|string|null */ - public \Seam\Resources\AccessCode\Warnings\ExternalModificationInEffect\ChangeType|string|null $change_type = null, + public string|null $change_type = null, /** * Date and time at which Seam created the warning. */ @@ -2269,11 +2196,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2285,8 +2208,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2314,11 +2239,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2330,8 +2251,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2359,11 +2282,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2375,8 +2294,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2404,11 +2325,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2420,8 +2337,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2449,11 +2368,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2465,8 +2380,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2494,11 +2411,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2510,8 +2423,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2537,11 +2452,7 @@ public static function from_json(mixed $json): BeingDeleted|null } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2553,8 +2464,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2582,11 +2495,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2598,8 +2507,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ diff --git a/src/Resources/AccessGrant.php b/src/Resources/AccessGrant.php index 40830d9f..678b906e 100644 --- a/src/Resources/AccessGrant.php +++ b/src/Resources/AccessGrant.php @@ -180,11 +180,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessGrant\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, missing_device_ids: $json->missing_device_ids ?? null, ), @@ -198,8 +194,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Errors\ErrorCode>|string|null */ - public \Seam\Resources\AccessGrant\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -241,11 +239,7 @@ public static function from_json(mixed $json): PendingMutations|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ), }; } @@ -261,8 +255,10 @@ public function __construct( public string|null $message, /** * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + * + * @var value-of<\Seam\Resources\AccessGrant\PendingMutations\MutationCode>|string|null */ - public \Seam\Resources\AccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, ) {} } @@ -282,11 +278,7 @@ public static function from_json( null, created_at: $json->created_at ?? null, display_name: $json->display_name ?? null, - mode: is_string($json->mode ?? null) - ? \Seam\Resources\AccessGrant\RequestedAccessMethods\Mode::tryFrom( - $json->mode, - ) ?? $json->mode - : null, + mode: $json->mode ?? null, code: $json->code ?? null, instant_key_max_use_count: $json->instant_key_max_use_count ?? null, @@ -310,8 +302,10 @@ public function __construct( public string|null $display_name, /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\AccessGrant\RequestedAccessMethods\Mode>|string|null */ - public \Seam\Resources\AccessGrant\RequestedAccessMethods\Mode|string|null $mode, + public string|null $mode, /** * Specific PIN code to use for this access method. Only applicable when mode is 'code'. */ @@ -371,11 +365,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -391,8 +381,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null */ - public \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } } @@ -412,11 +404,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessGrant\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, missing_device_ids: $json->missing_device_ids ?? null, ); @@ -429,8 +417,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessGrant\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -477,11 +467,7 @@ public static function from_json(mixed $json): UpdatingSpaces|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AccessGrant\PendingMutations\UpdatingSpaces\To::from_json( $json->to, @@ -505,8 +491,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + * + * @var value-of<\Seam\Resources\AccessGrant\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New location configuration. */ @@ -540,11 +528,7 @@ public static function from_json(mixed $json): UpdatingAccessTimes|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessGrant\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AccessGrant\PendingMutations\UpdatingAccessTimes\To::from_json( $json->to, @@ -574,8 +558,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + * + * @var value-of<\Seam\Resources\AccessGrant\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access time configuration. */ @@ -733,11 +719,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -752,8 +734,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -778,11 +762,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -797,8 +777,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -823,11 +805,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, failed_devices: array_map( fn( $f, @@ -850,8 +828,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). * @@ -881,11 +861,7 @@ public static function from_json(mixed $json): UpdatingAccessTimes|null access_method_ids: $json->access_method_ids ?? null, created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -906,8 +882,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -935,11 +913,7 @@ public static function from_json( message: $json->message ?? null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -966,8 +940,10 @@ public function __construct( public string|null $original_code, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -993,11 +969,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1016,8 +988,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1043,16 +1017,8 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, message: $json->message ?? null, - reason: is_string($json->reason ?? null) - ? \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason::tryFrom( - $json->reason, - ) ?? $json->reason - : null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + reason: $json->reason ?? null, + warning_code: $json->warning_code ?? null, ); } @@ -1071,12 +1037,16 @@ public function __construct( string|null $message, /** * Specific reason why the grant's times are not programmable on the device. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason>|string|null */ - public \Seam\Resources\AccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason|string|null $reason, + public string|null $reason, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/AccessMethod.php b/src/Resources/AccessMethod.php index 30c45a7b..d331fb43 100644 --- a/src/Resources/AccessMethod.php +++ b/src/Resources/AccessMethod.php @@ -23,10 +23,7 @@ public static function from_json(mixed $json): AccessMethod|null ), is_issued: $json->is_issued ?? null, issued_at: $json->issued_at ?? null, - mode: is_string($json->mode ?? null) - ? \Seam\Resources\AccessMethod\Mode::tryFrom($json->mode) ?? - $json->mode - : null, + mode: $json->mode ?? null, pending_mutations: array_map( fn( $p, @@ -83,8 +80,10 @@ public function __construct( public string|null $issued_at, /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\AccessMethod\Mode>|string|null */ - public \Seam\Resources\AccessMethod\Mode|string|null $mode, + public string|null $mode, /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. * @@ -161,11 +160,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessMethod\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -178,8 +173,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessMethod\Errors\ErrorCode>|string|null */ - public \Seam\Resources\AccessMethod\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -219,11 +216,7 @@ public static function from_json(mixed $json): PendingMutations|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ), }; } @@ -239,8 +232,10 @@ public function __construct( public string|null $message, /** * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + * + * @var value-of<\Seam\Resources\AccessMethod\PendingMutations\MutationCode>|string|null */ - public \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, ) {} } @@ -280,11 +275,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -300,8 +291,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessMethod\Warnings\WarningCode>|string|null */ - public \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } @@ -327,11 +320,7 @@ public static function from_json(mixed $json): FailedToIssue|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AccessMethod\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -343,8 +332,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessMethod\Errors\ErrorCode>|string|null */ - \Seam\Resources\AccessMethod\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -384,11 +375,7 @@ public static function from_json(mixed $json): ProvisioningAccess|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AccessMethod\PendingMutations\ProvisioningAccess\To::from_json( $json->to, @@ -412,8 +399,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + * + * @var value-of<\Seam\Resources\AccessMethod\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New device configuration. */ @@ -446,11 +435,7 @@ public static function from_json(mixed $json): RevokingAccess|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AccessMethod\PendingMutations\RevokingAccess\To::from_json( $json->to, @@ -474,8 +459,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + * + * @var value-of<\Seam\Resources\AccessMethod\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New device configuration. */ @@ -508,11 +495,7 @@ public static function from_json(mixed $json): UpdatingAccessTimes|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AccessMethod\PendingMutations\UpdatingAccessTimes\To::from_json( $json->to, @@ -536,8 +519,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + * + * @var value-of<\Seam\Resources\AccessMethod\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access time configuration. */ @@ -727,11 +712,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -746,8 +727,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessMethod\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -771,11 +754,7 @@ public static function from_json(mixed $json): UpdatingAccessTimes|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -790,8 +769,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessMethod\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -816,11 +797,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, original_access_method_id: $json->original_access_method_id ?? null, ); @@ -837,8 +814,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessMethod\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * ID of the original access method from which this backup access method was split, if applicable. */ @@ -865,11 +844,7 @@ public static function from_json(mixed $json): DelayInIssuing|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -884,8 +859,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessMethod\Warnings\WarningCode>|string|null */ - \Seam\Resources\AccessMethod\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/AcsAccessGroup.php b/src/Resources/AcsAccessGroup.php index ebcaea86..463cd3d6 100644 --- a/src/Resources/AcsAccessGroup.php +++ b/src/Resources/AcsAccessGroup.php @@ -16,11 +16,7 @@ public static function from_json(mixed $json): AcsAccessGroup|null return null; } return new self( - access_group_type: is_string($json->access_group_type ?? null) - ? \Seam\Resources\AcsAccessGroup\AccessGroupType::tryFrom( - $json->access_group_type, - ) ?? $json->access_group_type - : null, + access_group_type: $json->access_group_type ?? null, access_group_type_display_name: $json->access_group_type_display_name ?? null, acs_access_group_id: $json->acs_access_group_id ?? null, @@ -34,11 +30,7 @@ public static function from_json(mixed $json): AcsAccessGroup|null ), $json->errors ?? [], ), - external_type: is_string($json->external_type ?? null) - ? \Seam\Resources\AcsAccessGroup\ExternalType::tryFrom( - $json->external_type, - ) ?? $json->external_type - : null, + external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, is_managed: $json->is_managed ?? null, @@ -68,9 +60,10 @@ public static function from_json(mixed $json): AcsAccessGroup|null public function __construct( /** + * @var value-of<\Seam\Resources\AcsAccessGroup\AccessGroupType>|string|null * @deprecated Use `external_type`. */ - public \Seam\Resources\AcsAccessGroup\AccessGroupType|string|null $access_group_type, + public string|null $access_group_type, /** * @deprecated Use `external_type_display_name`. */ @@ -103,8 +96,10 @@ public function __construct( public array $errors, /** * Brand-specific terminology for the access group type. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\ExternalType>|string|null */ - public \Seam\Resources\AcsAccessGroup\ExternalType|string|null $external_type, + public string|null $external_type, /** * Display name that corresponds to the brand-specific terminology for the access group type. */ @@ -193,11 +188,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsAccessGroup\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -210,8 +201,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\Errors\ErrorCode>|string|null */ - public \Seam\Resources\AcsAccessGroup\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -271,11 +264,7 @@ public static function from_json(mixed $json): PendingMutations|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ), }; } @@ -291,8 +280,10 @@ public function __construct( public string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - public \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, ) {} } @@ -309,11 +300,7 @@ public static function from_json(mixed $json): Warnings|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsAccessGroup\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -328,8 +315,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\Warnings\WarningCode>|string|null */ - public \Seam\Resources\AcsAccessGroup\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } @@ -377,11 +366,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsAccessGroup\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -393,8 +378,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsAccessGroup\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -428,11 +415,7 @@ public static function from_json(mixed $json): Creating|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ); } @@ -447,8 +430,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, ) { parent::__construct( created_at: $created_at, @@ -471,11 +456,7 @@ public static function from_json(mixed $json): Deleting|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ); } @@ -490,8 +471,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, ) { parent::__construct( created_at: $created_at, @@ -515,11 +498,7 @@ public static function from_json(mixed $json): DeferringDeletion|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ); } @@ -534,8 +513,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, ) { parent::__construct( created_at: $created_at, @@ -565,11 +546,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingGroupInformation\To::from_json( $json->to, @@ -593,8 +570,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access group information. */ @@ -628,11 +607,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingAccessSchedule\To::from_json( $json->to, @@ -656,8 +631,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access schedule information. */ @@ -691,11 +668,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingUserMembership\To::from_json( $json->to, @@ -719,8 +692,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New user membership. */ @@ -754,11 +729,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsAccessGroup\PendingMutations\UpdatingEntranceMembership\To::from_json( $json->to, @@ -782,8 +753,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New entrance membership. */ @@ -813,16 +786,8 @@ public static function from_json( acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - variant: is_string($json->variant ?? null) - ? \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate\Variant::tryFrom( - $json->variant, - ) ?? $json->variant - : null, + mutation_code: $json->mutation_code ?? null, + variant: $json->variant ?? null, ); } @@ -841,12 +806,16 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing an access group creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsAccessGroup\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * Whether the user is scheduled to be added to or removed from this access group. + * + * @var value-of<\Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate\Variant>|string|null */ - public \Seam\Resources\AcsAccessGroup\PendingMutations\DeferringUserMembershipUpdate\Variant|string|null $variant, + public string|null $variant, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/AcsCredential.php b/src/Resources/AcsCredential.php index fbfe423e..87f5c279 100644 --- a/src/Resources/AcsCredential.php +++ b/src/Resources/AcsCredential.php @@ -18,11 +18,7 @@ public static function from_json(mixed $json): AcsCredential|null return null; } return new self( - access_method: is_string($json->access_method ?? null) - ? \Seam\Resources\AcsCredential\AccessMethod::tryFrom( - $json->access_method, - ) ?? $json->access_method - : null, + access_method: $json->access_method ?? null, acs_credential_id: $json->acs_credential_id ?? null, acs_system_id: $json->acs_system_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -59,11 +55,7 @@ public static function from_json(mixed $json): AcsCredential|null card_number: $json->card_number ?? null, code: $json->code ?? null, ends_at: $json->ends_at ?? null, - external_type: is_string($json->external_type ?? null) - ? \Seam\Resources\AcsCredential\ExternalType::tryFrom( - $json->external_type, - ) ?? $json->external_type - : null, + external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, is_issued: $json->is_issued ?? null, @@ -90,8 +82,10 @@ public static function from_json(mixed $json): AcsCredential|null public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\AcsCredential\AccessMethod>|string|null */ - public \Seam\Resources\AcsCredential\AccessMethod|string|null $access_method, + public string|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -162,8 +156,10 @@ public function __construct( public string|null $ends_at = null, /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. + * + * @var value-of<\Seam\Resources\AcsCredential\ExternalType>|string|null */ - public \Seam\Resources\AcsCredential\ExternalType|string|null $external_type = null, + public string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -327,11 +323,7 @@ public static function from_json(mixed $json): VisionlineMetadata|null } return new self( auto_join: $json->auto_join ?? null, - card_function_type: is_string($json->card_function_type ?? null) - ? \Seam\Resources\AcsCredential\VisionlineMetadata\CardFunctionType::tryFrom( - $json->card_function_type, - ) ?? $json->card_function_type - : 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, @@ -349,8 +341,10 @@ public function __construct( public bool|null $auto_join = null, /** * Card function type in the Visionline access system. + * + * @var value-of<\Seam\Resources\AcsCredential\VisionlineMetadata\CardFunctionType>|string|null */ - public \Seam\Resources\AcsCredential\VisionlineMetadata\CardFunctionType|string|null $card_function_type = null, + public string|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ @@ -432,11 +426,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -452,8 +442,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsCredential\Warnings\WarningCode>|string|null */ - public \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } @@ -506,11 +498,7 @@ public static function from_json(mixed $json): WaitingToBeIssued|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -525,8 +513,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsCredential\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -551,11 +541,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -570,8 +556,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsCredential\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -594,11 +582,7 @@ public static function from_json(mixed $json): ScheduleModified|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -613,8 +597,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsCredential\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -637,11 +623,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -656,8 +638,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsCredential\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -682,11 +666,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -701,8 +681,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsCredential\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -725,11 +707,7 @@ public static function from_json(mixed $json): NeedsToBeReissued|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -744,8 +722,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsCredential\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -772,11 +752,7 @@ public static function from_json( message: $json->message ?? null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsCredential\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -799,8 +775,10 @@ public function __construct( public string|null $original_code, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsCredential\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsCredential\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/AcsEncoder.php b/src/Resources/AcsEncoder.php index b74fef28..16fe4738 100644 --- a/src/Resources/AcsEncoder.php +++ b/src/Resources/AcsEncoder.php @@ -86,11 +86,7 @@ public static function from_json(mixed $json): Errors|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsEncoder\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -102,8 +98,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsEncoder\Errors\ErrorCode>|string|null */ - public \Seam\Resources\AcsEncoder\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ diff --git a/src/Resources/AcsEntrance.php b/src/Resources/AcsEntrance.php index 2f260fc4..d12132df 100644 --- a/src/Resources/AcsEntrance.php +++ b/src/Resources/AcsEntrance.php @@ -276,11 +276,7 @@ public static function from_json( return new self( door_name: $json->door_name ?? null, door_number: $json->door_number ?? null, - door_type: is_string($json->door_type ?? null) - ? \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata\DoorType::tryFrom( - $json->door_type, - ) ?? $json->door_type - : null, + door_type: $json->door_type ?? null, pms_id: $json->pms_id ?? null, stand_open: $json->stand_open ?? null, ); @@ -297,8 +293,10 @@ public function __construct( public float|null $door_number = null, /** * Type of the door in the Vostio access system. + * + * @var value-of<\Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata\DoorType>|string|null */ - public \Seam\Resources\AcsEntrance\AssaAbloyVostioMetadata\DoorType|string|null $door_type = null, + public string|null $door_type = null, /** * PMS ID of the door in the Vostio access system. */ @@ -666,11 +664,7 @@ public static function from_json(mixed $json): VisionlineMetadata|null return null; } return new self( - door_category: is_string($json->door_category ?? null) - ? \Seam\Resources\AcsEntrance\VisionlineMetadata\DoorCategory::tryFrom( - $json->door_category, - ) ?? $json->door_category - : null, + door_category: $json->door_category ?? null, door_name: $json->door_name ?? null, profiles: array_map( fn( @@ -686,8 +680,10 @@ public static function from_json(mixed $json): VisionlineMetadata|null public function __construct( /** * Category of the door in the Visionline access system. + * + * @var value-of<\Seam\Resources\AcsEntrance\VisionlineMetadata\DoorCategory>|string|null */ - public \Seam\Resources\AcsEntrance\VisionlineMetadata\DoorCategory|string|null $door_category = null, + public string|null $door_category = null, /** * Name of the door in the Visionline access system. */ @@ -741,11 +737,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -761,8 +753,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsEntrance\Warnings\WarningCode>|string|null */ - public \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } } @@ -818,13 +812,8 @@ public static function from_json(mixed $json): Profiles|null return new self( visionline_door_profile_id: $json->visionline_door_profile_id ?? null, - visionline_door_profile_type: is_string( - $json->visionline_door_profile_type ?? null, - ) - ? \Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles\VisionlineDoorProfileType::tryFrom( - $json->visionline_door_profile_type, - ) ?? $json->visionline_door_profile_type - : null, + visionline_door_profile_type: $json->visionline_door_profile_type ?? + null, ); } @@ -835,8 +824,10 @@ public function __construct( public string|null $visionline_door_profile_id = null, /** * Door profile type in the Visionline access system. + * + * @var value-of<\Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles\VisionlineDoorProfileType>|string|null */ - public \Seam\Resources\AcsEntrance\VisionlineMetadata\Profiles\VisionlineDoorProfileType|string|null $visionline_door_profile_type = null, + public string|null $visionline_door_profile_type = null, ) {} } @@ -875,11 +866,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -894,8 +881,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsEntrance\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -918,11 +907,7 @@ public static function from_json(mixed $json): EntranceSharesZone|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -937,8 +922,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsEntrance\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -963,11 +950,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -982,8 +965,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsEntrance\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1006,11 +991,7 @@ public static function from_json(mixed $json): SaltoKsPrivacyMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1025,8 +1006,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsEntrance\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1049,11 +1032,7 @@ public static function from_json(mixed $json): PrivacyMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsEntrance\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1068,8 +1047,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsEntrance\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsEntrance\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/AcsSystem.php b/src/Resources/AcsSystem.php index e4db6c45..88a89b3c 100644 --- a/src/Resources/AcsSystem.php +++ b/src/Resources/AcsSystem.php @@ -42,18 +42,10 @@ public static function from_json(mixed $json): AcsSystem|null acs_user_count: $json->acs_user_count ?? null, default_credential_manager_acs_system_id: $json->default_credential_manager_acs_system_id ?? null, - external_type: is_string($json->external_type ?? null) - ? \Seam\Resources\AcsSystem\ExternalType::tryFrom( - $json->external_type, - ) ?? $json->external_type - : null, + external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, - system_type: is_string($json->system_type ?? null) - ? \Seam\Resources\AcsSystem\SystemType::tryFrom( - $json->system_type, - ) ?? $json->system_type - : null, + system_type: $json->system_type ?? null, system_type_display_name: $json->system_type_display_name ?? null, visionline_metadata: isset($json->visionline_metadata) @@ -134,16 +126,19 @@ public function __construct( public string|null $default_credential_manager_acs_system_id = null, /** * Brand-specific terminology for the [access control system](https://docs.seam.co/low-level-apis/access-systems) type. + * + * @var value-of<\Seam\Resources\AcsSystem\ExternalType>|string|null */ - public \Seam\Resources\AcsSystem\ExternalType|string|null $external_type = null, + public string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [access control system](https://docs.seam.co/low-level-apis/access-systems) type. */ public string|null $external_type_display_name = null, /** + * @var value-of<\Seam\Resources\AcsSystem\SystemType>|string|null * @deprecated Use `external_type`. */ - public \Seam\Resources\AcsSystem\SystemType|string|null $system_type = null, + public string|null $system_type = null, /** * @deprecated Use `external_type_display_name`. */ @@ -212,11 +207,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -229,8 +220,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - public \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -328,11 +321,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -348,8 +337,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Warnings\WarningCode>|string|null */ - public \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } @@ -412,11 +403,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -428,8 +415,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -456,11 +445,7 @@ public static function from_json(mixed $json): BridgeDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, ); @@ -473,8 +458,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -508,11 +495,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -524,8 +507,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -553,11 +538,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -569,8 +550,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -597,11 +580,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -613,8 +592,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -641,11 +622,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -657,8 +634,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -684,11 +663,7 @@ public static function from_json(mixed $json): AccountDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -700,8 +675,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -729,11 +706,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -745,8 +718,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -774,11 +749,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsSystem\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -790,8 +761,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Errors\ErrorCode>|string|null */ - \Seam\Resources\AcsSystem\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -835,11 +808,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -854,8 +823,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -880,11 +851,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, misconfigured_acs_entrance_ids: $json->misconfigured_acs_entrance_ids ?? null, ); @@ -901,8 +868,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * @var list|null * @deprecated this field is deprecated. @@ -930,11 +899,7 @@ public static function from_json(mixed $json): SetupRequired|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -949,8 +914,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -975,11 +942,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsSystem\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -994,8 +957,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AcsSystem\Warnings\WarningCode>|string|null */ - \Seam\Resources\AcsSystem\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/AcsUser.php b/src/Resources/AcsUser.php index 3124e7f3..c063569a 100644 --- a/src/Resources/AcsUser.php +++ b/src/Resources/AcsUser.php @@ -38,11 +38,7 @@ public static function from_json(mixed $json): AcsUser|null : null, email: $json->email ?? null, email_address: $json->email_address ?? null, - external_type: is_string($json->external_type ?? null) - ? \Seam\Resources\AcsUser\ExternalType::tryFrom( - $json->external_type, - ) ?? $json->external_type - : null, + external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, full_name: $json->full_name ?? null, @@ -131,8 +127,10 @@ public function __construct( public string|null $email_address = null, /** * Brand-specific terminology for the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) type. + * + * @var value-of<\Seam\Resources\AcsUser\ExternalType>|string|null */ - public \Seam\Resources\AcsUser\ExternalType|string|null $external_type = null, + public string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) type. */ @@ -259,11 +257,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -274,7 +268,10 @@ public function __construct( * Date and time at which Seam created the error. */ public string|null $created_at, - public \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Errors\ErrorCode>|string|null + */ + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -338,11 +335,7 @@ public static function from_json(mixed $json): PendingMutations|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ), }; } @@ -358,8 +351,10 @@ public function __construct( public string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - public \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, ) {} } @@ -452,11 +447,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -470,7 +461,10 @@ public function __construct( * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ public string|null $message, - public \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Warnings\WarningCode>|string|null + */ + public string|null $warning_code, ) {} } @@ -501,11 +495,7 @@ public static function from_json(mixed $json): DeletedExternally|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -515,7 +505,10 @@ public function __construct( * Date and time at which Seam created the error. */ string|null $created_at, - \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Errors\ErrorCode>|string|null + */ + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -543,11 +536,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -557,7 +546,10 @@ public function __construct( * Date and time at which Seam created the error. */ string|null $created_at, - \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Errors\ErrorCode>|string|null + */ + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -584,11 +576,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -598,7 +586,10 @@ public function __construct( * Date and time at which Seam created the error. */ string|null $created_at, - \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Errors\ErrorCode>|string|null + */ + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -625,11 +616,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -639,7 +626,10 @@ public function __construct( * Date and time at which Seam created the error. */ string|null $created_at, - \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Errors\ErrorCode>|string|null + */ + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -666,11 +656,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -680,7 +666,10 @@ public function __construct( * Date and time at which Seam created the error. */ string|null $created_at, - \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Errors\ErrorCode>|string|null + */ + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -708,11 +697,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\AcsUser\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -722,7 +707,10 @@ public function __construct( * Date and time at which Seam created the error. */ string|null $created_at, - \Seam\Resources\AcsUser\Errors\ErrorCode|string|null $error_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Errors\ErrorCode>|string|null + */ + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -761,11 +749,7 @@ public static function from_json(mixed $json): Creating|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ); } @@ -780,8 +764,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, ) { parent::__construct( created_at: $created_at, @@ -804,11 +790,7 @@ public static function from_json(mixed $json): Deleting|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ); } @@ -823,8 +805,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, ) { parent::__construct( created_at: $created_at, @@ -848,11 +832,7 @@ public static function from_json(mixed $json): DeferringCreation|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, scheduled_at: $json->scheduled_at ?? null, ); } @@ -868,8 +848,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * Optional: When the user creation is scheduled to occur. */ @@ -900,11 +882,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsUser\PendingMutations\UpdatingUserInformation\To::from_json( $json->to, @@ -928,8 +906,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access system user information. */ @@ -963,11 +943,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsUser\PendingMutations\UpdatingAccessSchedule\To::from_json( $json->to, @@ -991,8 +967,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access schedule information. */ @@ -1026,11 +1004,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsUser\PendingMutations\UpdatingSuspensionState\To::from_json( $json->to, @@ -1054,8 +1028,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New user suspension state information. */ @@ -1089,11 +1065,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsUser\PendingMutations\UpdatingGroupMembership\To::from_json( $json->to, @@ -1117,8 +1089,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access group membership. */ @@ -1148,16 +1122,8 @@ public static function from_json( acs_access_group_id: $json->acs_access_group_id ?? null, created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, - variant: is_string($json->variant ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate\Variant::tryFrom( - $json->variant, - ) ?? $json->variant - : null, + mutation_code: $json->mutation_code ?? null, + variant: $json->variant ?? null, ); } @@ -1176,12 +1142,16 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * Whether the user is scheduled to be added to or removed from the access group. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate\Variant>|string|null */ - public \Seam\Resources\AcsUser\PendingMutations\DeferringGroupMembershipUpdate\Variant|string|null $variant, + public string|null $variant, ) { parent::__construct( created_at: $created_at, @@ -1211,11 +1181,7 @@ public static function from_json( ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\AcsUser\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\AcsUser\PendingMutations\UpdatingCredentialAssignment\To::from_json( $json->to, @@ -1239,8 +1205,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of pushing a user creation to the integrated access system. + * + * @var value-of<\Seam\Resources\AcsUser\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\AcsUser\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New credential assignment. */ @@ -1546,11 +1514,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1563,7 +1527,10 @@ public function __construct( * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ string|null $message, - \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Warnings\WarningCode>|string|null + */ + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1588,11 +1555,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1605,7 +1568,10 @@ public function __construct( * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ string|null $message, - \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Warnings\WarningCode>|string|null + */ + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1628,11 +1594,7 @@ public static function from_json(mixed $json): AcsUserInactive|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1645,7 +1607,10 @@ public function __construct( * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ string|null $message, - \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Warnings\WarningCode>|string|null + */ + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1669,11 +1634,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1686,7 +1647,10 @@ public function __construct( * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ string|null $message, - \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Warnings\WarningCode>|string|null + */ + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1709,11 +1673,7 @@ public static function from_json(mixed $json): LatchResidentUser|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\AcsUser\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1726,7 +1686,10 @@ public function __construct( * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ string|null $message, - \Seam\Resources\AcsUser\Warnings\WarningCode|string|null $warning_code, + /** + * @var value-of<\Seam\Resources\AcsUser\Warnings\WarningCode>|string|null + */ + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/ActionAttempt.php b/src/Resources/ActionAttempt.php index 5814d7f6..7977ece8 100644 --- a/src/Resources/ActionAttempt.php +++ b/src/Resources/ActionAttempt.php @@ -102,21 +102,13 @@ public static function from_json(mixed $json): ActionAttempt|null ), default => new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ), }; } @@ -128,13 +120,18 @@ public function __construct( public string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + public string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\Error|null $error, - public \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + public string|null $status, ) {} } } @@ -180,11 +177,7 @@ public static function from_json(mixed $json): LockDoor|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -195,11 +188,7 @@ public static function from_json(mixed $json): LockDoor|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -210,8 +199,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -220,7 +211,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\LockDoor\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -243,11 +237,7 @@ public static function from_json(mixed $json): UnlockDoor|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -258,11 +248,7 @@ public static function from_json(mixed $json): UnlockDoor|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -273,8 +259,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -283,7 +271,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\UnlockDoor\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -306,11 +297,7 @@ public static function from_json(mixed $json): ScanCredential|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -321,11 +308,7 @@ public static function from_json(mixed $json): ScanCredential|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -336,8 +319,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -346,7 +331,10 @@ public function __construct( * Result of scanning a card. If the attempt was successful, includes a snapshot of credential data read from the physical encoder, the corresponding data stored on Seam and the access system, and any associated warnings. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\ScanCredential\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -369,11 +357,7 @@ public static function from_json(mixed $json): EncodeCredential|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -384,11 +368,7 @@ public static function from_json(mixed $json): EncodeCredential|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -399,8 +379,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -409,7 +391,10 @@ public function __construct( * Result of an encoding attempt. If the attempt was successful, includes the credential data that was encoded onto the card. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\EncodeCredential\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -433,11 +418,7 @@ public static function from_json( } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -448,11 +429,7 @@ public static function from_json( $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -463,8 +440,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -473,7 +452,10 @@ public function __construct( * Result of a scan to assign attempt. If the attempt was successful, includes the credential data that was scanned and assigned. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -496,11 +478,7 @@ public static function from_json(mixed $json): AssignCredential|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -511,11 +489,7 @@ public static function from_json(mixed $json): AssignCredential|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -526,8 +500,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -536,7 +512,10 @@ public function __construct( * Result of assigning a credential. If successful, includes the updated access method with the assigned credential. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\AssignCredential\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -560,22 +539,14 @@ public static function from_json( } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -586,8 +557,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -596,7 +569,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -619,22 +595,14 @@ public static function from_json(mixed $json): SetFanMode|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -645,8 +613,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -655,7 +625,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -678,22 +651,14 @@ public static function from_json(mixed $json): SetHvacMode|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -704,8 +669,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -714,7 +681,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -738,22 +708,14 @@ public static function from_json( } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -764,8 +726,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -774,7 +738,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -798,22 +765,14 @@ public static function from_json( } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -824,8 +783,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -834,7 +795,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -859,22 +823,14 @@ public static function from_json( } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -885,8 +841,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -895,7 +853,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -919,22 +880,14 @@ public static function from_json( } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -945,8 +898,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -955,7 +910,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -978,22 +936,14 @@ public static function from_json(mixed $json): ConfigureAutoLock|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1004,8 +954,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -1014,7 +966,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1034,22 +989,14 @@ public static function from_json(mixed $json): SyncAccessCodes|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1060,8 +1007,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -1070,7 +1019,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1090,11 +1042,7 @@ public static function from_json(mixed $json): CreateAccessCode|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -1105,11 +1053,7 @@ public static function from_json(mixed $json): CreateAccessCode|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1120,8 +1064,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -1130,7 +1076,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\CreateAccessCode\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1150,22 +1099,14 @@ public static function from_json(mixed $json): DeleteAccessCode|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1176,8 +1117,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -1186,7 +1129,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1206,11 +1152,7 @@ public static function from_json(mixed $json): UpdateAccessCode|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -1221,11 +1163,7 @@ public static function from_json(mixed $json): UpdateAccessCode|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1236,8 +1174,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -1246,7 +1186,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\UpdateAccessCode\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1266,11 +1209,7 @@ public static function from_json(mixed $json): CreateNoiseThreshold|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -1281,11 +1220,7 @@ public static function from_json(mixed $json): CreateNoiseThreshold|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1296,8 +1231,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -1306,7 +1243,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1326,22 +1266,14 @@ public static function from_json(mixed $json): DeleteNoiseThreshold|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, ) : null, result: $json->result ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1352,8 +1284,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -1362,7 +1296,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public mixed $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1382,11 +1319,7 @@ public static function from_json(mixed $json): UpdateNoiseThreshold|null } return new self( action_attempt_id: $json->action_attempt_id ?? null, - action_type: is_string($json->action_type ?? null) - ? \Seam\Resources\ActionAttempt\ActionType::tryFrom( - $json->action_type, - ) ?? $json->action_type - : null, + action_type: $json->action_type ?? null, error: isset($json->error) ? \Seam\Resources\ActionAttempt\Error::from_json( $json->error, @@ -1397,11 +1330,7 @@ public static function from_json(mixed $json): UpdateNoiseThreshold|null $json->result, ) : null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ActionAttempt\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1412,8 +1341,10 @@ public function __construct( string|null $action_attempt_id, /** * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - \Seam\Resources\ActionAttempt\ActionType|string|null $action_type, + string|null $action_type, /** * Error associated with the action. Null while the action attempt is pending or when this value does not apply. */ @@ -1422,7 +1353,10 @@ public function __construct( * Result of the action. Null while the action attempt is pending or when this value does not apply. */ public \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Result|null $result, - \Seam\Resources\ActionAttempt\Status|string|null $status, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, @@ -1635,11 +1569,7 @@ public static function from_json(mixed $json): AcsCredentialOnSeam|null return null; } return new self( - access_method: is_string($json->access_method ?? null) - ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AccessMethod::tryFrom( - $json->access_method, - ) ?? $json->access_method - : null, + access_method: $json->access_method ?? null, acs_credential_id: $json->acs_credential_id ?? null, acs_system_id: $json->acs_system_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -1680,11 +1610,7 @@ public static function from_json(mixed $json): AcsCredentialOnSeam|null card_number: $json->card_number ?? null, code: $json->code ?? null, ends_at: $json->ends_at ?? null, - external_type: is_string($json->external_type ?? null) - ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType::tryFrom( - $json->external_type, - ) ?? $json->external_type - : null, + external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, is_issued: $json->is_issued ?? null, @@ -1711,8 +1637,10 @@ public static function from_json(mixed $json): AcsCredentialOnSeam|null public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AccessMethod>|string|null */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\AccessMethod|string|null $access_method, + public string|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -1780,8 +1708,10 @@ public function __construct( public string|null $ends_at = null, /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType>|string|null */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType|string|null $external_type = null, + public string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -1840,11 +1770,7 @@ public static function from_json(mixed $json): Warnings|null return null; } return new self( - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, warning_message: $json->warning_message ?? null, ); } @@ -1852,8 +1778,10 @@ public static function from_json(mixed $json): Warnings|null public function __construct( /** * Indicates a warning related to scanning a credential. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode>|string|null */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ @@ -1875,11 +1803,7 @@ public static function from_json(mixed $json): VisionlineMetadata|null } return new self( cancelled: $json->cancelled ?? null, - card_format: is_string($json->card_format ?? null) - ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat::tryFrom( - $json->card_format, - ) ?? $json->card_format - : 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, @@ -1900,8 +1824,10 @@ public function __construct( public bool|null $cancelled = null, /** * Format of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat>|string|null */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat|string|null $card_format = null, + public string|null $card_format = null, /** * Holder of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -2073,11 +1999,7 @@ public static function from_json(mixed $json): VisionlineMetadata|null } return new self( auto_join: $json->auto_join ?? null, - card_function_type: is_string($json->card_function_type ?? null) - ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType::tryFrom( - $json->card_function_type, - ) ?? $json->card_function_type - : 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, @@ -2095,8 +2017,10 @@ public function __construct( public bool|null $auto_join = null, /** * Card function type in the Visionline access system. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType>|string|null */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType|string|null $card_function_type = null, + public string|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ @@ -2143,11 +2067,7 @@ public static function from_json(mixed $json): Warnings|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, ); @@ -2164,8 +2084,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings\WarningCode>|string|null */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, /** * The PIN code that was assigned instead. */ @@ -2245,11 +2167,7 @@ public static function from_json(mixed $json): Result|null return null; } return new self( - access_method: is_string($json->access_method ?? null) - ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod::tryFrom( - $json->access_method, - ) ?? $json->access_method - : null, + access_method: $json->access_method ?? null, acs_credential_id: $json->acs_credential_id ?? null, acs_system_id: $json->acs_system_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -2290,11 +2208,7 @@ public static function from_json(mixed $json): Result|null card_number: $json->card_number ?? null, code: $json->code ?? null, ends_at: $json->ends_at ?? null, - external_type: is_string($json->external_type ?? null) - ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType::tryFrom( - $json->external_type, - ) ?? $json->external_type - : null, + external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, is_issued: $json->is_issued ?? null, @@ -2321,8 +2235,10 @@ public static function from_json(mixed $json): Result|null public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod>|string|null */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod|string|null $access_method, + public string|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -2390,8 +2306,10 @@ public function __construct( public string|null $ends_at = null, /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType>|string|null */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType|string|null $external_type = null, + public string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -2555,11 +2473,7 @@ public static function from_json(mixed $json): VisionlineMetadata|null } return new self( auto_join: $json->auto_join ?? null, - card_function_type: is_string($json->card_function_type ?? null) - ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType::tryFrom( - $json->card_function_type, - ) ?? $json->card_function_type - : 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, @@ -2577,8 +2491,10 @@ public function __construct( public bool|null $auto_join = null, /** * Card function type in the Visionline access system. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType>|string|null */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType|string|null $card_function_type = null, + public string|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ @@ -2625,11 +2541,7 @@ public static function from_json(mixed $json): Warnings|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, ); @@ -2646,8 +2558,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings\WarningCode>|string|null */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, /** * The PIN code that was assigned instead. */ @@ -2719,11 +2633,7 @@ public static function from_json(mixed $json): Result|null return null; } return new self( - access_method: is_string($json->access_method ?? null) - ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AccessMethod::tryFrom( - $json->access_method, - ) ?? $json->access_method - : null, + access_method: $json->access_method ?? null, acs_credential_id: $json->acs_credential_id ?? null, acs_system_id: $json->acs_system_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -2764,11 +2674,7 @@ public static function from_json(mixed $json): Result|null card_number: $json->card_number ?? null, code: $json->code ?? null, ends_at: $json->ends_at ?? null, - external_type: is_string($json->external_type ?? null) - ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType::tryFrom( - $json->external_type, - ) ?? $json->external_type - : null, + external_type: $json->external_type ?? null, external_type_display_name: $json->external_type_display_name ?? null, is_issued: $json->is_issued ?? null, @@ -2795,8 +2701,10 @@ public static function from_json(mixed $json): Result|null public function __construct( /** * Access method for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AccessMethod>|string|null */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AccessMethod|string|null $access_method, + public string|null $access_method, /** * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -2867,8 +2775,10 @@ public function __construct( public string|null $ends_at = null, /** * Brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. Supported values: `pti_card`, `brivo_credential`, `hid_credential`, `visionline_card`. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType>|string|null */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType|string|null $external_type = null, + public string|null $external_type = null, /** * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. */ @@ -3032,11 +2942,7 @@ public static function from_json(mixed $json): VisionlineMetadata|null } return new self( auto_join: $json->auto_join ?? null, - card_function_type: is_string($json->card_function_type ?? null) - ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType::tryFrom( - $json->card_function_type, - ) ?? $json->card_function_type - : 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, @@ -3054,8 +2960,10 @@ public function __construct( public bool|null $auto_join = null, /** * Card function type in the Visionline access system. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType>|string|null */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType|string|null $card_function_type = null, + public string|null $card_function_type = null, /** * ID of the card in the Visionline access system. */ @@ -3102,11 +3010,7 @@ public static function from_json(mixed $json): Warnings|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, ); @@ -3123,8 +3027,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings\WarningCode>|string|null */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, /** * The PIN code that was assigned instead. */ @@ -3209,11 +3115,7 @@ public static function from_json(mixed $json): Result|null ), is_issued: $json->is_issued ?? null, issued_at: $json->issued_at ?? null, - mode: is_string($json->mode ?? null) - ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Mode::tryFrom( - $json->mode, - ) ?? $json->mode - : null, + mode: $json->mode ?? null, pending_mutations: array_map( fn( $p, @@ -3272,8 +3174,10 @@ public function __construct( public string|null $issued_at, /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Result\Mode>|string|null */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\Mode|string|null $mode, + public string|null $mode, /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. * @@ -3339,11 +3243,7 @@ public static function from_json(mixed $json): Errors|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -3355,8 +3255,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode>|string|null */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -3382,11 +3284,7 @@ public static function from_json(mixed $json): PendingMutations|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\To::from_json( $json->to, @@ -3410,8 +3308,10 @@ public function __construct( public string|null $message, /** * Mutation code to indicate that Seam is in the process of updating the access times for this access method. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\MutationCode>|string|null */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, /** * New access time configuration. */ @@ -3432,11 +3332,7 @@ public static function from_json(mixed $json): Warnings|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, original_access_method_id: $json->original_access_method_id ?? null, ); @@ -3453,8 +3349,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings\WarningCode>|string|null */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, /** * ID of the original access method from which this backup access method was split, if applicable. */ diff --git a/src/Resources/ConnectWebview.php b/src/Resources/ConnectWebview.php index b41758ce..82db3141 100644 --- a/src/Resources/ConnectWebview.php +++ b/src/Resources/ConnectWebview.php @@ -35,20 +35,10 @@ public static function from_json(mixed $json): ConnectWebview|null custom_redirect_failure_url: $json->custom_redirect_failure_url ?? null, custom_redirect_url: $json->custom_redirect_url ?? null, - device_selection_mode: is_string( - $json->device_selection_mode ?? null, - ) - ? \Seam\Resources\ConnectWebview\DeviceSelectionMode::tryFrom( - $json->device_selection_mode, - ) ?? $json->device_selection_mode - : null, + device_selection_mode: $json->device_selection_mode ?? null, login_successful: $json->login_successful ?? null, selected_provider: $json->selected_provider ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\ConnectWebview\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, url: $json->url ?? null, wait_for_device_creation: $json->wait_for_device_creation ?? null, @@ -110,8 +100,10 @@ public function __construct( public string|null $custom_redirect_url, /** * Device selection mode of the Connect Webview. Supported values: `none`, `single`, `multiple`. + * + * @var value-of<\Seam\Resources\ConnectWebview\DeviceSelectionMode>|string|null */ - public \Seam\Resources\ConnectWebview\DeviceSelectionMode|string|null $device_selection_mode, + public string|null $device_selection_mode, /** * Indicates whether the user logged in successfully using the Connect Webview. */ @@ -122,8 +114,10 @@ public function __construct( public string|null $selected_provider, /** * Status of the Connect Webview. `authorized` indicates that the user has successfully logged into their device or system account, thereby completing the Connect Webview. + * + * @var value-of<\Seam\Resources\ConnectWebview\Status>|string|null */ - public \Seam\Resources\ConnectWebview\Status|string|null $status, + public string|null $status, /** * URL for the Connect Webview. You use the URL to display the Connect Webview flow to your user. */ diff --git a/src/Resources/ConnectedAccount.php b/src/Resources/ConnectedAccount.php index e732f8e4..db0ceaf7 100644 --- a/src/Resources/ConnectedAccount.php +++ b/src/Resources/ConnectedAccount.php @@ -174,11 +174,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? @@ -194,8 +190,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Errors\ErrorCode>|string|null */ - public \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -308,11 +306,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -328,8 +322,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - public \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } } @@ -348,11 +344,7 @@ public static function from_json(mixed $json): AccountDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? @@ -367,8 +359,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Errors\ErrorCode>|string|null */ - \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -405,11 +399,7 @@ public static function from_json(mixed $json): BridgeDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? @@ -424,8 +414,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Errors\ErrorCode>|string|null */ - \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -463,11 +455,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, salto_ks_metadata: isset($json->salto_ks_metadata) ? \Seam\Resources\ConnectedAccount\Errors\SaltoKsSubscriptionLimitExceeded\SaltoKsMetadata::from_json( @@ -487,8 +475,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Errors\ErrorCode>|string|null */ - \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -530,11 +520,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\ConnectedAccount\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? @@ -549,8 +535,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Errors\ErrorCode>|string|null */ - \Seam\Resources\ConnectedAccount\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -675,11 +663,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -694,8 +678,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -720,11 +706,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -739,8 +721,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -770,11 +754,7 @@ public static function from_json( $json->salto_ks_metadata, ) : null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -793,8 +773,10 @@ public function __construct( public \Seam\Resources\ConnectedAccount\Warnings\SaltoKsSubscriptionLimitAlmostReached\SaltoKsMetadata|null $salto_ks_metadata, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -819,11 +801,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -838,8 +816,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -862,11 +842,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -881,8 +857,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -907,11 +885,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -926,8 +900,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -950,11 +926,7 @@ public static function from_json(mixed $json): SetupRequired|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -969,8 +941,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -995,11 +969,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\ConnectedAccount\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1014,8 +984,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\ConnectedAccount\Warnings\WarningCode>|string|null */ - \Seam\Resources\ConnectedAccount\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/Device.php b/src/Resources/Device.php index ad53180b..8e8da76f 100644 --- a/src/Resources/Device.php +++ b/src/Resources/Device.php @@ -17,11 +17,7 @@ public static function from_json(mixed $json): Device|null created_at: $json->created_at ?? null, custom_metadata: $json->custom_metadata ?? null, device_id: $json->device_id ?? null, - device_type: is_string($json->device_type ?? null) - ? \Seam\Resources\Device\DeviceType::tryFrom( - $json->device_type, - ) ?? $json->device_type - : null, + device_type: $json->device_type ?? null, display_name: $json->display_name ?? null, errors: array_map( fn($e) => \Seam\Resources\Device\Errors::from_json($e), @@ -115,8 +111,10 @@ public function __construct( public string|null $device_id, /** * Type of the device. + * + * @var value-of<\Seam\Resources\Device\DeviceType>|string|null */ - public \Seam\Resources\Device\DeviceType|string|null $device_type, + public string|null $device_type, /** * Display name of the device, defaults to nickname (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the device easily, especially when there are numerous devices. */ @@ -398,11 +396,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -415,8 +409,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - public \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -604,11 +600,7 @@ public static function from_json(mixed $json): Properties|null : null, fallback_climate_preset_key: $json->fallback_climate_preset_key ?? null, - fan_mode_setting: is_string($json->fan_mode_setting ?? null) - ? \Seam\Resources\Device\Properties\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) ?? $json->fan_mode_setting - : null, + fan_mode_setting: $json->fan_mode_setting ?? null, four_suites_metadata: isset($json->four_suites_metadata) ? \Seam\Resources\Device\Properties\FourSuitesMetadata::from_json( $json->four_suites_metadata, @@ -1013,9 +1005,10 @@ public function __construct( */ public string|null $fallback_climate_preset_key = null, /** + * @var value-of<\Seam\Resources\Device\Properties\FanModeSetting>|string|null * @deprecated Use `current_climate_setting.fan_mode_setting` instead. */ - public \Seam\Resources\Device\Properties\FanModeSetting|string|null $fan_mode_setting = null, + public string|null $fan_mode_setting = null, /** * Metadata for a 4SUITES device. */ @@ -1449,11 +1442,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -1469,8 +1458,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - public \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } @@ -1535,11 +1526,7 @@ public static function from_json(mixed $json): AccountDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -1554,8 +1541,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -1591,11 +1580,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -1610,8 +1595,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -1646,11 +1633,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -1665,8 +1648,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -1701,11 +1686,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -1720,8 +1701,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -1755,11 +1738,7 @@ public static function from_json(mixed $json): DeviceOffline|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1772,8 +1751,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1803,11 +1784,7 @@ public static function from_json(mixed $json): DeviceRemoved|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1820,8 +1797,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1851,11 +1830,7 @@ public static function from_json(mixed $json): HubDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1868,8 +1843,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1899,11 +1876,7 @@ public static function from_json(mixed $json): DeviceDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1916,8 +1889,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1948,11 +1923,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1965,8 +1936,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1997,11 +1970,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -2014,8 +1983,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -2046,11 +2017,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -2063,8 +2030,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -2094,11 +2063,7 @@ public static function from_json(mixed $json): AuxiliaryHeatRunning|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -2111,8 +2076,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -2142,11 +2109,7 @@ public static function from_json(mixed $json): SubscriptionRequired|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -2159,8 +2122,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -2190,11 +2155,7 @@ public static function from_json(mixed $json): BridgeDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Device\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? @@ -2209,8 +2170,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null */ - \Seam\Resources\Device\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -2317,11 +2280,7 @@ public static function from_json(mixed $json): Battery|null } return new self( level: $json->level ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\Device\Properties\Battery\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -2332,8 +2291,10 @@ public function __construct( public float|null $level, /** * Represents the current status of the battery charge level. Values are `critical`, which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; `low`, which signifies that the battery is under the preferred threshold and should be charged soon; `good`, which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and `full`, which represents a battery that is fully charged, providing the maximum duration of usage. + * + * @var value-of<\Seam\Resources\Device\Properties\Battery\Status>|string|null */ - public \Seam\Resources\Device\Properties\Battery\Status|string|null $status, + public string|null $status, ) {} } @@ -3392,11 +3353,7 @@ public static function from_json(mixed $json): NoiseawareMetadata|null } return new self( device_id: $json->device_id ?? null, - device_model: is_string($json->device_model ?? null) - ? \Seam\Resources\Device\Properties\NoiseawareMetadata\DeviceModel::tryFrom( - $json->device_model, - ) ?? $json->device_model - : null, + device_model: $json->device_model ?? null, device_name: $json->device_name ?? null, noise_level_decibel: $json->noise_level_decibel ?? null, noise_level_nrs: $json->noise_level_nrs ?? null, @@ -3410,8 +3367,10 @@ public function __construct( public string|null $device_id = null, /** * Device model for a NoiseAware device. + * + * @var value-of<\Seam\Resources\Device\Properties\NoiseawareMetadata\DeviceModel>|string|null */ - public \Seam\Resources\Device\Properties\NoiseawareMetadata\DeviceModel|string|null $device_model = null, + public string|null $device_model = null, /** * Device name for a NoiseAware device. */ @@ -3721,11 +3680,7 @@ public static function from_json(mixed $json): SeamBridgeMetadata|null return new self( device_num: $json->device_num ?? null, name: $json->name ?? null, - unlock_method: is_string($json->unlock_method ?? null) - ? \Seam\Resources\Device\Properties\SeamBridgeMetadata\UnlockMethod::tryFrom( - $json->unlock_method, - ) ?? $json->unlock_method - : null, + unlock_method: $json->unlock_method ?? null, ); } @@ -3740,8 +3695,10 @@ public function __construct( public string|null $name = null, /** * Unlock method for Seam Bridge. + * + * @var value-of<\Seam\Resources\Device\Properties\SeamBridgeMetadata\UnlockMethod>|string|null */ - public \Seam\Resources\Device\Properties\SeamBridgeMetadata\UnlockMethod|string|null $unlock_method = null, + public string|null $unlock_method = null, ) {} } @@ -4171,18 +4128,17 @@ public static function from_json(mixed $json): CodeConstraints|null return null; } return new self( - constraint_type: is_string($json->constraint_type ?? null) - ? \Seam\Resources\Device\Properties\CodeConstraints\ConstraintType::tryFrom( - $json->constraint_type, - ) ?? $json->constraint_type - : null, + constraint_type: $json->constraint_type ?? null, max_length: $json->max_length ?? null, min_length: $json->min_length ?? null, ); } public function __construct( - public \Seam\Resources\Device\Properties\CodeConstraints\ConstraintType|string|null $constraint_type, + /** + * @var value-of<\Seam\Resources\Device\Properties\CodeConstraints\ConstraintType>|string|null + */ + public string|null $constraint_type, /** * Maximum name length constraint for access codes. */ @@ -4460,13 +4416,7 @@ public static function from_json( climate_preset_key: $json->climate_preset_key ?? null, display_name: $json->display_name ?? null, manual_override_allowed: $json->manual_override_allowed ?? null, - climate_preset_mode: is_string( - $json->climate_preset_mode ?? null, - ) - ? \Seam\Resources\Device\Properties\AvailableClimatePresets\ClimatePresetMode::tryFrom( - $json->climate_preset_mode, - ) ?? $json->climate_preset_mode - : 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 ?? @@ -4476,20 +4426,12 @@ public static function from_json( $json->ecobee_metadata, ) : null, - fan_mode_setting: is_string($json->fan_mode_setting ?? null) - ? \Seam\Resources\Device\Properties\AvailableClimatePresets\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) ?? $json->fan_mode_setting - : null, + fan_mode_setting: $json->fan_mode_setting ?? null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, - hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) - ? \Seam\Resources\Device\Properties\AvailableClimatePresets\HvacModeSetting::tryFrom( - $json->hvac_mode_setting, - ) ?? $json->hvac_mode_setting - : null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, name: $json->name ?? null, ); } @@ -4523,8 +4465,10 @@ public function __construct( public bool|null $manual_override_allowed, /** * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. + * + * @var value-of<\Seam\Resources\Device\Properties\AvailableClimatePresets\ClimatePresetMode>|string|null */ - public \Seam\Resources\Device\Properties\AvailableClimatePresets\ClimatePresetMode|string|null $climate_preset_mode = null, + public string|null $climate_preset_mode = null, /** * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4539,8 +4483,10 @@ public function __construct( public \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata|null $ecobee_metadata = null, /** * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + * + * @var value-of<\Seam\Resources\Device\Properties\AvailableClimatePresets\FanModeSetting>|string|null */ - public \Seam\Resources\Device\Properties\AvailableClimatePresets\FanModeSetting|string|null $fan_mode_setting = null, + public string|null $fan_mode_setting = null, /** * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4551,8 +4497,10 @@ public function __construct( public float|null $heating_set_point_fahrenheit = null, /** * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + * + * @var value-of<\Seam\Resources\Device\Properties\AvailableClimatePresets\HvacModeSetting>|string|null */ - public \Seam\Resources\Device\Properties\AvailableClimatePresets\HvacModeSetting|string|null $hvac_mode_setting = null, + public string|null $hvac_mode_setting = null, /** * User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). */ @@ -4577,13 +4525,7 @@ public static function from_json( 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: is_string( - $json->climate_preset_mode ?? null, - ) - ? \Seam\Resources\Device\Properties\CurrentClimateSetting\ClimatePresetMode::tryFrom( - $json->climate_preset_mode, - ) ?? $json->climate_preset_mode - : 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 ?? @@ -4594,20 +4536,12 @@ public static function from_json( $json->ecobee_metadata, ) : null, - fan_mode_setting: is_string($json->fan_mode_setting ?? null) - ? \Seam\Resources\Device\Properties\CurrentClimateSetting\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) ?? $json->fan_mode_setting - : null, + fan_mode_setting: $json->fan_mode_setting ?? null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, - hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) - ? \Seam\Resources\Device\Properties\CurrentClimateSetting\HvacModeSetting::tryFrom( - $json->hvac_mode_setting, - ) ?? $json->hvac_mode_setting - : null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, manual_override_allowed: $json->manual_override_allowed ?? null, name: $json->name ?? null, ); @@ -4632,8 +4566,10 @@ public function __construct( public string|null $climate_preset_key = null, /** * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. + * + * @var value-of<\Seam\Resources\Device\Properties\CurrentClimateSetting\ClimatePresetMode>|string|null */ - public \Seam\Resources\Device\Properties\CurrentClimateSetting\ClimatePresetMode|string|null $climate_preset_mode = null, + public string|null $climate_preset_mode = null, /** * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4652,8 +4588,10 @@ public function __construct( public \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata|null $ecobee_metadata = null, /** * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + * + * @var value-of<\Seam\Resources\Device\Properties\CurrentClimateSetting\FanModeSetting>|string|null */ - public \Seam\Resources\Device\Properties\CurrentClimateSetting\FanModeSetting|string|null $fan_mode_setting = null, + public string|null $fan_mode_setting = null, /** * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4664,8 +4602,10 @@ public function __construct( public float|null $heating_set_point_fahrenheit = null, /** * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + * + * @var value-of<\Seam\Resources\Device\Properties\CurrentClimateSetting\HvacModeSetting>|string|null */ - public \Seam\Resources\Device\Properties\CurrentClimateSetting\HvacModeSetting|string|null $hvac_mode_setting = null, + public string|null $hvac_mode_setting = null, /** * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). * @@ -4696,13 +4636,7 @@ public static function from_json( 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: is_string( - $json->climate_preset_mode ?? null, - ) - ? \Seam\Resources\Device\Properties\DefaultClimateSetting\ClimatePresetMode::tryFrom( - $json->climate_preset_mode, - ) ?? $json->climate_preset_mode - : 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 ?? @@ -4713,20 +4647,12 @@ public static function from_json( $json->ecobee_metadata, ) : null, - fan_mode_setting: is_string($json->fan_mode_setting ?? null) - ? \Seam\Resources\Device\Properties\DefaultClimateSetting\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) ?? $json->fan_mode_setting - : null, + fan_mode_setting: $json->fan_mode_setting ?? null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, - hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) - ? \Seam\Resources\Device\Properties\DefaultClimateSetting\HvacModeSetting::tryFrom( - $json->hvac_mode_setting, - ) ?? $json->hvac_mode_setting - : null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, manual_override_allowed: $json->manual_override_allowed ?? null, name: $json->name ?? null, ); @@ -4751,8 +4677,10 @@ public function __construct( public string|null $climate_preset_key = null, /** * The climate preset mode for the thermostat, based on the available climate preset modes reported by the device. + * + * @var value-of<\Seam\Resources\Device\Properties\DefaultClimateSetting\ClimatePresetMode>|string|null */ - public \Seam\Resources\Device\Properties\DefaultClimateSetting\ClimatePresetMode|string|null $climate_preset_mode = null, + public string|null $climate_preset_mode = null, /** * Temperature to which the thermostat should cool (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4771,8 +4699,10 @@ public function __construct( public \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata|null $ecobee_metadata = null, /** * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + * + * @var value-of<\Seam\Resources\Device\Properties\DefaultClimateSetting\FanModeSetting>|string|null */ - public \Seam\Resources\Device\Properties\DefaultClimateSetting\FanModeSetting|string|null $fan_mode_setting = null, + public string|null $fan_mode_setting = null, /** * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -4783,8 +4713,10 @@ public function __construct( public float|null $heating_set_point_fahrenheit = null, /** * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + * + * @var value-of<\Seam\Resources\Device\Properties\DefaultClimateSetting\HvacModeSetting>|string|null */ - public \Seam\Resources\Device\Properties\DefaultClimateSetting\HvacModeSetting|string|null $hvac_mode_setting = null, + public string|null $hvac_mode_setting = null, /** * Indicates whether a person at the thermostat can change the thermostat's settings. See [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions). * @@ -5538,11 +5470,7 @@ public static function from_json(mixed $json): EcobeeMetadata|null return new self( climate_ref: $json->climate_ref ?? null, is_optimized: $json->is_optimized ?? null, - owner: is_string($json->owner ?? null) - ? \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner::tryFrom( - $json->owner, - ) ?? $json->owner - : null, + owner: $json->owner ?? null, ); } @@ -5557,8 +5485,10 @@ public function __construct( public bool|null $is_optimized = null, /** * Indicates whether the climate preset is owned by the user or the system. + * + * @var value-of<\Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner>|string|null */ - public \Seam\Resources\Device\Properties\AvailableClimatePresets\EcobeeMetadata\Owner|string|null $owner = null, + public string|null $owner = null, ) {} } @@ -5611,11 +5541,7 @@ public static function from_json(mixed $json): EcobeeMetadata|null return new self( climate_ref: $json->climate_ref ?? null, is_optimized: $json->is_optimized ?? null, - owner: is_string($json->owner ?? null) - ? \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata\Owner::tryFrom( - $json->owner, - ) ?? $json->owner - : null, + owner: $json->owner ?? null, ); } @@ -5630,8 +5556,10 @@ public function __construct( public bool|null $is_optimized = null, /** * Indicates whether the climate preset is owned by the user or the system. + * + * @var value-of<\Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata\Owner>|string|null */ - public \Seam\Resources\Device\Properties\CurrentClimateSetting\EcobeeMetadata\Owner|string|null $owner = null, + public string|null $owner = null, ) {} } @@ -5684,11 +5612,7 @@ public static function from_json(mixed $json): EcobeeMetadata|null return new self( climate_ref: $json->climate_ref ?? null, is_optimized: $json->is_optimized ?? null, - owner: is_string($json->owner ?? null) - ? \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata\Owner::tryFrom( - $json->owner, - ) ?? $json->owner - : null, + owner: $json->owner ?? null, ); } @@ -5703,8 +5627,10 @@ public function __construct( public bool|null $is_optimized = null, /** * Indicates whether the climate preset is owned by the user or the system. + * + * @var value-of<\Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata\Owner>|string|null */ - public \Seam\Resources\Device\Properties\DefaultClimateSetting\EcobeeMetadata\Owner|string|null $owner = null, + public string|null $owner = null, ) {} } @@ -5789,11 +5715,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -5808,8 +5730,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -5833,11 +5757,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -5852,8 +5772,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -5878,11 +5800,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -5897,8 +5815,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -5923,11 +5843,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -5942,8 +5858,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -5967,11 +5885,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -5986,8 +5900,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6010,11 +5926,7 @@ public static function from_json(mixed $json): PowerSavingMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6029,8 +5941,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6055,11 +5969,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6074,8 +5984,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6100,11 +6012,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6119,8 +6027,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6145,11 +6055,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6164,8 +6070,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6189,11 +6097,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6208,8 +6112,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6232,11 +6138,7 @@ public static function from_json(mixed $json): SaltoKsOfficeMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6251,8 +6153,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6275,11 +6179,7 @@ public static function from_json(mixed $json): SaltoKsPrivacyMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6294,8 +6194,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6318,11 +6220,7 @@ public static function from_json(mixed $json): PrivacyMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6337,8 +6235,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6363,11 +6263,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6382,8 +6278,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6408,11 +6306,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6427,8 +6321,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6452,11 +6348,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6471,8 +6363,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6497,11 +6391,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6516,8 +6406,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6541,11 +6433,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6560,8 +6448,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6584,11 +6474,7 @@ public static function from_json(mixed $json): TimeZoneUnknown|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6603,8 +6489,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6627,11 +6515,7 @@ public static function from_json(mixed $json): TimeZoneMismatch|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6646,8 +6530,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6672,11 +6558,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6691,8 +6573,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6717,11 +6601,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6736,8 +6616,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6760,11 +6642,7 @@ public static function from_json(mixed $json): ProviderIssue|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6779,8 +6657,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6804,11 +6684,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6823,8 +6699,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6849,11 +6727,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6868,8 +6742,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6893,11 +6769,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6912,8 +6784,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -6941,11 +6815,7 @@ public static function from_json( max_active_access_code_count: $json->max_active_access_code_count ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\Device\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -6968,8 +6838,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null */ - \Seam\Resources\Device\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/DeviceProvider.php b/src/Resources/DeviceProvider.php index c280272e..17529829 100644 --- a/src/Resources/DeviceProvider.php +++ b/src/Resources/DeviceProvider.php @@ -9,13 +9,7 @@ public static function from_json(mixed $json): DeviceProvider|null return null; } return new self( - device_provider_name: is_string( - $json->device_provider_name ?? null, - ) - ? \Seam\Resources\DeviceProvider\DeviceProviderName::tryFrom( - $json->device_provider_name, - ) ?? $json->device_provider_name - : 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, @@ -55,8 +49,10 @@ public static function from_json(mixed $json): DeviceProvider|null public function __construct( /** * Name of the device provider. + * + * @var value-of<\Seam\Resources\DeviceProvider\DeviceProviderName>|string|null */ - public \Seam\Resources\DeviceProvider\DeviceProviderName|string|null $device_provider_name, + public string|null $device_provider_name, /** * Display name for the device provider. */ diff --git a/src/Resources/Event.php b/src/Resources/Event.php index 416d5c96..24816fc4 100644 --- a/src/Resources/Event.php +++ b/src/Resources/Event.php @@ -415,11 +415,7 @@ public static function from_json(mixed $json): Event|null default => new self( created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -436,7 +432,10 @@ public function __construct( * ID of the event. */ public string|null $event_id, - public \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + public string|null $event_type, /** * Date and time at which the event occurred. */ @@ -470,11 +469,7 @@ public static function from_json(mixed $json): AccessCodeCreated|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -505,7 +500,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -558,11 +556,7 @@ public static function from_json(mixed $json): AccessCodeChanged|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, change_reason: $json->change_reason ?? null, @@ -602,7 +596,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -667,11 +664,7 @@ public static function from_json( description: $json->description ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, from: isset($json->from) ? \Seam\Resources\Event\AccessCodeNameChanged\From::from_json( $json->from, @@ -716,7 +709,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Previous access code name configuration. */ @@ -779,11 +775,7 @@ public static function from_json( description: $json->description ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, from: isset($json->from) ? \Seam\Resources\Event\AccessCodeCodeChanged\From::from_json( $json->from, @@ -828,7 +820,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Previous pin code configuration. */ @@ -891,11 +886,7 @@ public static function from_json( description: $json->description ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, from: isset($json->from) ? \Seam\Resources\Event\AccessCodeTimeFrameChanged\From::from_json( $json->from, @@ -940,7 +931,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Previous time frame configuration. */ @@ -1002,11 +996,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, requested_mutations: array_map( fn( @@ -1045,7 +1035,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -1106,11 +1099,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -1145,7 +1134,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -1200,11 +1192,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -1239,7 +1227,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -1293,11 +1284,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -1328,7 +1315,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -1430,11 +1420,7 @@ public static function from_json( $json->device_warnings ?? [], ), event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -1501,7 +1487,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -1603,11 +1592,7 @@ public static function from_json( $json->device_warnings ?? [], ), event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -1674,7 +1659,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -1728,11 +1716,7 @@ public static function from_json(mixed $json): AccessCodeDeleted|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -1767,7 +1751,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -1870,11 +1857,7 @@ public static function from_json( $json->device_warnings ?? [], ), event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -1941,7 +1924,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2043,11 +2029,7 @@ public static function from_json( $json->device_warnings ?? [], ), event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -2114,7 +2096,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2168,11 +2153,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -2203,7 +2184,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2257,11 +2241,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -2292,7 +2272,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2347,11 +2330,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -2386,7 +2365,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2441,11 +2423,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -2476,7 +2454,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2579,11 +2560,7 @@ public static function from_json( $json->device_warnings ?? [], ), event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -2650,7 +2627,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2704,11 +2684,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -2739,7 +2715,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2793,11 +2772,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -2828,7 +2803,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2879,11 +2857,7 @@ public static function from_json(mixed $json): AccessGrantCreated|null access_grant_id: $json->access_grant_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -2903,7 +2877,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -2942,11 +2919,7 @@ public static function from_json(mixed $json): AccessGrantDeleted|null access_grant_id: $json->access_grant_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -2966,7 +2939,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3006,11 +2982,7 @@ public static function from_json( access_grant_id: $json->access_grant_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -3030,7 +3002,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3071,11 +3046,7 @@ public static function from_json( acs_entrance_id: $json->acs_entrance_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -3099,7 +3070,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3140,11 +3114,7 @@ public static function from_json( acs_entrance_id: $json->acs_entrance_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -3168,7 +3138,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3208,11 +3181,7 @@ public static function from_json( access_grant_id: $json->access_grant_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_key: $json->access_grant_key ?? null, @@ -3235,7 +3204,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3289,11 +3261,7 @@ public static function from_json( created_at: $json->created_at ?? null, error_message: $json->error_message ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -3318,7 +3286,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3364,11 +3335,7 @@ public static function from_json(mixed $json): AccessMethodIssued|null access_method_id: $json->access_method_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_keys: $json->access_grant_keys ?? null, @@ -3397,7 +3364,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3451,11 +3421,7 @@ public static function from_json(mixed $json): AccessMethodRevoked|null access_method_id: $json->access_method_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_keys: $json->access_grant_keys ?? null, @@ -3482,7 +3448,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3529,11 +3498,7 @@ public static function from_json( access_method_id: $json->access_method_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_keys: $json->access_grant_keys ?? null, @@ -3560,7 +3525,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3606,11 +3574,7 @@ public static function from_json(mixed $json): AccessMethodDeleted|null access_method_id: $json->access_method_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_keys: $json->access_grant_keys ?? null, @@ -3637,7 +3601,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3683,11 +3650,7 @@ public static function from_json(mixed $json): AccessMethodReissued|null access_method_id: $json->access_method_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_keys: $json->access_grant_keys ?? null, @@ -3716,7 +3679,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3770,11 +3736,7 @@ public static function from_json(mixed $json): AccessMethodCreated|null access_method_id: $json->access_method_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_keys: $json->access_grant_keys ?? null, @@ -3801,7 +3763,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3848,11 +3813,7 @@ public static function from_json( access_method_id: $json->access_method_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_keys: $json->access_grant_keys ?? null, @@ -3879,7 +3840,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -3926,11 +3890,7 @@ public static function from_json( access_method_id: $json->access_method_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_grant_keys: $json->access_grant_keys ?? null, @@ -3957,7 +3917,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4002,11 +3965,7 @@ public static function from_json(mixed $json): AcsSystemConnected|null acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4027,7 +3986,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4070,11 +4032,7 @@ public static function from_json(mixed $json): AcsSystemAdded|null acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4095,7 +4053,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4171,11 +4132,7 @@ public static function from_json( ), created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4220,7 +4177,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4264,11 +4224,7 @@ public static function from_json(mixed $json): AcsCredentialDeleted|null acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4293,7 +4249,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4337,11 +4296,7 @@ public static function from_json(mixed $json): AcsCredentialIssued|null acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4366,7 +4321,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4411,11 +4369,7 @@ public static function from_json( acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4440,7 +4394,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4485,11 +4442,7 @@ public static function from_json( acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4514,7 +4467,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4558,11 +4514,7 @@ public static function from_json(mixed $json): AcsUserCreated|null acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4587,7 +4539,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4631,11 +4586,7 @@ public static function from_json(mixed $json): AcsUserDeleted|null acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4660,7 +4611,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4704,11 +4658,7 @@ public static function from_json(mixed $json): AcsEncoderAdded|null acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4733,7 +4683,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4777,11 +4730,7 @@ public static function from_json(mixed $json): AcsEncoderRemoved|null acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4806,7 +4755,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4851,11 +4803,7 @@ public static function from_json( acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4880,7 +4828,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4924,11 +4875,7 @@ public static function from_json(mixed $json): AcsEntranceAdded|null acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -4953,7 +4900,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -4997,11 +4947,7 @@ public static function from_json(mixed $json): AcsEntranceRemoved|null acs_system_id: $json->acs_system_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_id: $json->connected_account_id ?? null, @@ -5026,7 +4972,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5069,11 +5018,7 @@ public static function from_json(mixed $json): ClientSessionDeleted|null client_session_id: $json->client_session_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -5093,7 +5038,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5133,11 +5081,7 @@ public static function from_json( connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connect_webview_id: $json->connect_webview_id ?? null, @@ -5161,7 +5105,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5216,11 +5163,7 @@ public static function from_json( connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -5246,7 +5189,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5293,11 +5239,7 @@ public static function from_json( connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -5323,7 +5265,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5385,11 +5330,7 @@ public static function from_json( ), created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -5423,7 +5364,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5469,11 +5413,7 @@ public static function from_json( connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -5495,7 +5435,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5541,11 +5484,7 @@ public static function from_json( connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -5568,7 +5507,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5619,11 +5561,7 @@ public static function from_json( connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -5645,7 +5583,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5708,11 +5649,7 @@ public static function from_json( ), created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -5746,7 +5683,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5793,11 +5733,7 @@ public static function from_json( action_type: $json->action_type ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, status: $json->status ?? null, workspace_id: $json->workspace_id ?? null, @@ -5824,7 +5760,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5877,11 +5816,7 @@ public static function from_json( action_type: $json->action_type ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, status: $json->status ?? null, workspace_id: $json->workspace_id ?? null, @@ -5908,7 +5843,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -5961,11 +5899,7 @@ public static function from_json( action_type: $json->action_type ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, status: $json->status ?? null, workspace_id: $json->workspace_id ?? null, @@ -5992,7 +5926,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6045,11 +5982,7 @@ public static function from_json( action_type: $json->action_type ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, status: $json->status ?? null, workspace_id: $json->workspace_id ?? null, @@ -6076,7 +6009,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6130,11 +6066,7 @@ public static function from_json( action_type: $json->action_type ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, status: $json->status ?? null, workspace_id: $json->workspace_id ?? null, @@ -6161,7 +6093,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6215,11 +6150,7 @@ public static function from_json( action_type: $json->action_type ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, status: $json->status ?? null, workspace_id: $json->workspace_id ?? null, @@ -6246,7 +6177,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6300,11 +6234,7 @@ public static function from_json( action_type: $json->action_type ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, status: $json->status ?? null, workspace_id: $json->workspace_id ?? null, @@ -6331,7 +6261,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6385,11 +6318,7 @@ public static function from_json( action_type: $json->action_type ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, status: $json->status ?? null, workspace_id: $json->workspace_id ?? null, @@ -6416,7 +6345,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6469,11 +6401,7 @@ public static function from_json( connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -6500,7 +6428,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6550,11 +6481,7 @@ public static function from_json( connect_webview_id: $json->connect_webview_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, event_description: $json->event_description ?? null, @@ -6574,7 +6501,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6614,11 +6544,7 @@ public static function from_json(mixed $json): DeviceConnected|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -6646,7 +6572,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6702,11 +6631,7 @@ public static function from_json(mixed $json): DeviceAdded|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -6734,7 +6659,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6791,11 +6719,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -6823,7 +6747,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6880,11 +6807,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -6912,7 +6835,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -6969,11 +6895,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7001,7 +6923,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7088,17 +7013,9 @@ public static function from_json(mixed $json): DeviceDisconnected|null ), $json->device_warnings ?? [], ), - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Event\DeviceDisconnected\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7148,13 +7065,18 @@ public function __construct( public array $device_warnings, /** * Error code associated with the disconnection event, if any. + * + * @var value-of<\Seam\Resources\Event\DeviceDisconnected\ErrorCode>|string|null */ - public \Seam\Resources\Event\DeviceDisconnected\ErrorCode|string|null $error_code, + public string|null $error_code, /** * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7242,17 +7164,9 @@ public static function from_json( ), $json->device_warnings ?? [], ), - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\Event\DeviceUnmanagedDisconnected\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7302,13 +7216,18 @@ public function __construct( public array $device_warnings, /** * Error code associated with the disconnection event, if any. + * + * @var value-of<\Seam\Resources\Event\DeviceUnmanagedDisconnected\ErrorCode>|string|null */ - public \Seam\Resources\Event\DeviceUnmanagedDisconnected\ErrorCode|string|null $error_code, + public string|null $error_code, /** * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7364,11 +7283,7 @@ public static function from_json(mixed $json): DeviceTampered|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7396,7 +7311,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7453,11 +7371,7 @@ public static function from_json(mixed $json): DeviceLowBattery|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7489,7 +7403,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7543,20 +7460,12 @@ public static function from_json( } return new self( battery_level: $json->battery_level ?? null, - battery_status: is_string($json->battery_status ?? null) - ? \Seam\Resources\Event\DeviceBatteryStatusChanged\BatteryStatus::tryFrom( - $json->battery_status, - ) ?? $json->battery_status - : null, + battery_status: $json->battery_status ?? null, connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7574,8 +7483,10 @@ public function __construct( public float|null $battery_level, /** * Battery status of the affected device, calculated from the numeric `battery_level` value. + * + * @var value-of<\Seam\Resources\Event\DeviceBatteryStatusChanged\BatteryStatus>|string|null */ - public \Seam\Resources\Event\DeviceBatteryStatusChanged\BatteryStatus|string|null $battery_status, + public string|null $battery_status, /** * ID of the connected account associated with the event. */ @@ -7592,7 +7503,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7648,11 +7562,7 @@ public static function from_json(mixed $json): DeviceRemoved|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7680,7 +7590,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7736,11 +7649,7 @@ public static function from_json(mixed $json): DeviceDeleted|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7769,7 +7678,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7831,11 +7743,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7863,7 +7771,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -7921,11 +7832,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -7953,7 +7860,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8010,11 +7920,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8042,7 +7948,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8099,11 +8008,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8131,7 +8036,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8220,11 +8128,7 @@ public static function from_json( $json->device_warnings ?? [], ), event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8276,7 +8180,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8333,11 +8240,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8365,7 +8268,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8454,11 +8360,7 @@ public static function from_json( $json->device_warnings ?? [], ), event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8510,7 +8412,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8568,11 +8473,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8600,7 +8501,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8657,11 +8561,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8689,7 +8589,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8778,11 +8681,7 @@ public static function from_json( $json->device_warnings ?? [], ), event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8834,7 +8733,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -8891,11 +8793,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -8929,7 +8827,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -9013,16 +8914,8 @@ public static function from_json(mixed $json): LockLocked|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, - method: is_string($json->method ?? null) - ? \Seam\Resources\Event\LockLocked\Method::tryFrom( - $json->method, - ) ?? $json->method - : null, + event_type: $json->event_type ?? null, + method: $json->method ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_code_id: $json->access_code_id ?? null, @@ -9056,11 +8949,16 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Method by which the lock was locked. `keycode`: an access code was used (see `access_code_id`). `manual`: a physical action such as a thumbturn or button press. `remote`: a remote action via an app, Bluetooth, or the Seam API (see `action_attempt_id` if Seam-initiated; see `is_via_bluetooth` or `is_via_nfc` for the transport). `automatic`: triggered automatically, for example by an auto-relock timer. `unknown`: could not be determined. + * + * @var value-of<\Seam\Resources\Event\LockLocked\Method>|string|null */ - public \Seam\Resources\Event\LockLocked\Method|string|null $method, + public string|null $method, /** * Date and time at which the event occurred. */ @@ -9139,16 +9037,8 @@ public static function from_json(mixed $json): LockUnlocked|null connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, - method: is_string($json->method ?? null) - ? \Seam\Resources\Event\LockUnlocked\Method::tryFrom( - $json->method, - ) ?? $json->method - : null, + event_type: $json->event_type ?? null, + method: $json->method ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_code_id: $json->access_code_id ?? null, @@ -9179,11 +9069,16 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Method by which the lock was unlocked. `keycode`: an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was used (see `access_code_id`). `manual`: a physical action such as a thumbturn or handle press. `remote`: a remote action via an app, Bluetooth, or the Seam API (see `action_attempt_id` if Seam-initiated; see `is_via_bluetooth` or `is_via_nfc` for the transport). `automatic`: triggered automatically, for example by a time-based schedule. `unknown`: could not be determined. + * + * @var value-of<\Seam\Resources\Event\LockUnlocked\Method>|string|null */ - public \Seam\Resources\Event\LockUnlocked\Method|string|null $method, + public string|null $method, /** * Date and time at which the event occurred. */ @@ -9266,11 +9161,7 @@ public static function from_json(mixed $json): LockAccessDenied|null connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, access_code_id: $json->access_code_id ?? null, @@ -9301,7 +9192,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -9371,11 +9265,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, is_fallback_climate_preset: $json->is_fallback_climate_preset ?? null, occurred_at: $json->occurred_at ?? null, @@ -9410,7 +9300,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Indicates whether the climate preset that was activated is the fallback climate preset for the thermostat. */ @@ -9475,16 +9368,8 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, - method: is_string($json->method ?? null) - ? \Seam\Resources\Event\ThermostatManuallyAdjusted\Method::tryFrom( - $json->method, - ) ?? $json->method - : null, + event_type: $json->event_type ?? null, + method: $json->method ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -9496,20 +9381,12 @@ public static function from_json( customer_key: $json->customer_key ?? null, device_custom_metadata: $json->device_custom_metadata ?? null, event_description: $json->event_description ?? null, - fan_mode_setting: is_string($json->fan_mode_setting ?? null) - ? \Seam\Resources\Event\ThermostatManuallyAdjusted\FanModeSetting::tryFrom( - $json->fan_mode_setting, - ) ?? $json->fan_mode_setting - : null, + fan_mode_setting: $json->fan_mode_setting ?? null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, - hvac_mode_setting: is_string($json->hvac_mode_setting ?? null) - ? \Seam\Resources\Event\ThermostatManuallyAdjusted\HvacModeSetting::tryFrom( - $json->hvac_mode_setting, - ) ?? $json->hvac_mode_setting - : null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, ); } @@ -9530,11 +9407,16 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Method used to adjust the affected thermostat manually. `seam` indicates that the Seam API, Seam CLI, or Seam Console was used to adjust the thermostat. + * + * @var value-of<\Seam\Resources\Event\ThermostatManuallyAdjusted\Method>|string|null */ - public \Seam\Resources\Event\ThermostatManuallyAdjusted\Method|string|null $method, + public string|null $method, /** * Date and time at which the event occurred. */ @@ -9573,8 +9455,10 @@ public function __construct( string|null $event_description = null, /** * Desired [fan mode setting](https://docs.seam.co/capability-guides/thermostats/configure-current-climate-settings#fan-mode-settings), such as `on`, `auto`, or `circulate`. + * + * @var value-of<\Seam\Resources\Event\ThermostatManuallyAdjusted\FanModeSetting>|string|null */ - public \Seam\Resources\Event\ThermostatManuallyAdjusted\FanModeSetting|string|null $fan_mode_setting = null, + public string|null $fan_mode_setting = null, /** * Temperature to which the thermostat should heat (in °C). See also [Set Points](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points). */ @@ -9585,8 +9469,10 @@ public function __construct( public float|null $heating_set_point_fahrenheit = null, /** * Desired [HVAC mode](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/hvac-mode) setting, such as `heat`, `cool`, `heat_cool`, or `off`. + * + * @var value-of<\Seam\Resources\Event\ThermostatManuallyAdjusted\HvacModeSetting>|string|null */ - public \Seam\Resources\Event\ThermostatManuallyAdjusted\HvacModeSetting|string|null $hvac_mode_setting = null, + public string|null $hvac_mode_setting = null, ) { parent::__construct( created_at: $created_at, @@ -9616,11 +9502,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, lower_limit_celsius: $json->lower_limit_celsius ?? null, lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, occurred_at: $json->occurred_at ?? null, @@ -9654,7 +9536,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Lower temperature limit, in °C, defined by the set threshold. */ @@ -9736,11 +9621,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, lower_limit_celsius: $json->lower_limit_celsius ?? null, lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, occurred_at: $json->occurred_at ?? null, @@ -9774,7 +9655,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Lower temperature limit, in °C, defined by the set threshold. */ @@ -9856,11 +9740,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, temperature_celsius: $json->temperature_celsius ?? null, temperature_fahrenheit: $json->temperature_fahrenheit ?? null, @@ -9894,7 +9774,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -9967,11 +9850,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, temperature_celsius: $json->temperature_celsius ?? null, temperature_fahrenheit: $json->temperature_fahrenheit ?? null, @@ -10001,7 +9880,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -10066,11 +9948,7 @@ public static function from_json(mixed $json): DeviceNameChanged|null device_id: $json->device_id ?? null, device_name: $json->device_name ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -10102,7 +9980,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -10154,20 +10035,12 @@ public static function from_json(mixed $json): CameraActivated|null return null; } return new self( - activation_reason: is_string($json->activation_reason ?? null) - ? \Seam\Resources\Event\CameraActivated\ActivationReason::tryFrom( - $json->activation_reason, - ) ?? $json->activation_reason - : null, + activation_reason: $json->activation_reason ?? null, connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -10176,11 +10049,7 @@ public static function from_json(mixed $json): CameraActivated|null device_custom_metadata: $json->device_custom_metadata ?? null, event_description: $json->event_description ?? null, image_url: $json->image_url ?? null, - motion_sub_type: is_string($json->motion_sub_type ?? null) - ? \Seam\Resources\Event\CameraActivated\MotionSubType::tryFrom( - $json->motion_sub_type, - ) ?? $json->motion_sub_type - : null, + motion_sub_type: $json->motion_sub_type ?? null, video_url: $json->video_url ?? null, ); } @@ -10188,8 +10057,10 @@ public static function from_json(mixed $json): CameraActivated|null public function __construct( /** * The reason the camera was activated. + * + * @var value-of<\Seam\Resources\Event\CameraActivated\ActivationReason>|string|null */ - public \Seam\Resources\Event\CameraActivated\ActivationReason|string|null $activation_reason, + public string|null $activation_reason, /** * ID of the connected account associated with the event. */ @@ -10206,7 +10077,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -10241,8 +10115,10 @@ public function __construct( public string|null $image_url = null, /** * Sub-type of motion detected, if available. + * + * @var value-of<\Seam\Resources\Event\CameraActivated\MotionSubType>|string|null */ - public \Seam\Resources\Event\CameraActivated\MotionSubType|string|null $motion_sub_type = null, + public string|null $motion_sub_type = null, /** * URL to a short video clip captured at the time of activation. */ @@ -10274,11 +10150,7 @@ public static function from_json(mixed $json): DeviceDoorbellRang|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, connected_account_custom_metadata: $json->connected_account_custom_metadata ?? @@ -10308,7 +10180,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -10371,11 +10246,7 @@ public static function from_json(mixed $json): PhoneDeactivated|null created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, workspace_id: $json->workspace_id ?? null, device_custom_metadata: $json->device_custom_metadata ?? null, @@ -10396,7 +10267,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -10443,11 +10317,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_ids: $json->device_ids ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, space_id: $json->space_id ?? null, workspace_id: $json->workspace_id ?? null, @@ -10477,7 +10347,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -10525,11 +10398,7 @@ public static function from_json(mixed $json): SpaceCreated|null created_at: $json->created_at ?? null, device_ids: $json->device_ids ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, space_id: $json->space_id ?? null, workspace_id: $json->workspace_id ?? null, @@ -10559,7 +10428,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -10607,11 +10479,7 @@ public static function from_json(mixed $json): SpaceDeleted|null created_at: $json->created_at ?? null, device_ids: $json->device_ids ?? null, event_id: $json->event_id ?? null, - event_type: is_string($json->event_type ?? null) - ? \Seam\Resources\Event\EventType::tryFrom( - $json->event_type, - ) ?? $json->event_type - : null, + event_type: $json->event_type ?? null, occurred_at: $json->occurred_at ?? null, space_id: $json->space_id ?? null, workspace_id: $json->workspace_id ?? null, @@ -10641,7 +10509,10 @@ public function __construct( * ID of the event. */ string|null $event_id, - \Seam\Resources\Event\EventType|string|null $event_type, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, /** * Date and time at which the event occurred. */ @@ -10980,11 +10851,7 @@ public static function from_json(mixed $json): RequestedMutations|null return null; } return new self( - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, from: $json->from ?? null, to: $json->to ?? null, ); @@ -10993,8 +10860,10 @@ public static function from_json(mixed $json): RequestedMutations|null public function __construct( /** * Code identifying the type of mutation requested, such as `updating_name`, `updating_code`, `updating_time_frame`, or `deleting`. + * + * @var value-of<\Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations\MutationCode>|string|null */ - public \Seam\Resources\Event\AccessCodeMutationsRequested\RequestedMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, /** * Previous property values before the requested change. Keys depend on the mutation type. Absent for non-property mutations like `deleting`. * @@ -13050,11 +12919,7 @@ public static function from_json(mixed $json): Reason|null } return new self( message: $json->message ?? null, - reason_code: is_string($json->reason_code ?? null) - ? \Seam\Resources\Event\LockAccessDenied\Reason\ReasonCode::tryFrom( - $json->reason_code, - ) ?? $json->reason_code - : null, + reason_code: $json->reason_code ?? null, ); } @@ -13065,8 +12930,10 @@ public function __construct( public string|null $message, /** * Normalized reason a lock denied access. Provider-agnostic; not all providers report every value. + * + * @var value-of<\Seam\Resources\Event\LockAccessDenied\Reason\ReasonCode>|string|null */ - public \Seam\Resources\Event\LockAccessDenied\Reason\ReasonCode|string|null $reason_code, + public string|null $reason_code, ) {} } } diff --git a/src/Resources/Phone.php b/src/Resources/Phone.php index 61945cc9..1573cb51 100644 --- a/src/Resources/Phone.php +++ b/src/Resources/Phone.php @@ -15,11 +15,7 @@ public static function from_json(mixed $json): Phone|null created_at: $json->created_at ?? null, custom_metadata: $json->custom_metadata ?? null, device_id: $json->device_id ?? null, - device_type: is_string($json->device_type ?? null) - ? \Seam\Resources\Phone\DeviceType::tryFrom( - $json->device_type, - ) ?? $json->device_type - : null, + device_type: $json->device_type ?? null, display_name: $json->display_name ?? null, errors: array_map( fn($e) => \Seam\Resources\Phone\Errors::from_json($e), @@ -56,8 +52,10 @@ public function __construct( public string|null $device_id, /** * Type of the phone device, such as `ios_phone` or `android_phone`. + * + * @var value-of<\Seam\Resources\Phone\DeviceType>|string|null */ - public \Seam\Resources\Phone\DeviceType|string|null $device_type, + public string|null $device_type, /** * Display name of the phone. Defaults to `nickname` (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the phone easily, especially when there are numerous phones. */ diff --git a/src/Resources/UnmanagedAccessCode.php b/src/Resources/UnmanagedAccessCode.php index 12d75c09..35991da2 100644 --- a/src/Resources/UnmanagedAccessCode.php +++ b/src/Resources/UnmanagedAccessCode.php @@ -36,16 +36,8 @@ public static function from_json(mixed $json): UnmanagedAccessCode|null ), is_managed: $json->is_managed ?? null, name: $json->name ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, - type: is_string($json->type ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Type::tryFrom( - $json->type, - ) ?? $json->type - : null, + status: $json->status ?? null, + type: $json->type ?? null, warnings: array_map( fn( $w, @@ -103,12 +95,16 @@ public function __construct( public string|null $name, /** * Current status of the access code within the operational lifecycle. `set` indicates that the code is active and operational. `unset` indicates that the code exists on the provider but is not usable on the device. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Status>|string|null */ - public \Seam\Resources\UnmanagedAccessCode\Status|string|null $status, + public string|null $status, /** * Type of the access code. `ongoing` access codes are active continuously until deactivated manually. `time_bound` access codes have a specific duration. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Type>|string|null */ - public \Seam\Resources\UnmanagedAccessCode\Type|string|null $type, + public string|null $type, /** * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). * @@ -305,11 +301,7 @@ public static function from_json(mixed $json): Errors|null $json, ), default => new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -318,8 +310,10 @@ public static function from_json(mixed $json): Errors|null public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - public \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -390,11 +384,7 @@ public static function from_json(mixed $json): Warnings|null ), default => new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ), }; @@ -407,8 +397,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - public \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -441,11 +433,7 @@ public static function from_json(mixed $json): ProviderIssue|null return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -455,8 +443,10 @@ public static function from_json(mixed $json): ProviderIssue|null public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -486,11 +476,7 @@ public static function from_json(mixed $json): FailedToSetOnDevice|null return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -500,8 +486,10 @@ public static function from_json(mixed $json): FailedToSetOnDevice|null public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -532,11 +520,7 @@ public static function from_json( return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -546,8 +530,10 @@ public static function from_json( public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -578,11 +564,7 @@ public static function from_json( return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -595,8 +577,10 @@ public static function from_json( public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -635,11 +619,7 @@ public static function from_json( return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -649,8 +629,10 @@ public static function from_json( public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -681,18 +663,10 @@ public static function from_json( return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, - change_type: is_string($json->change_type ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ChangeType::tryFrom( - $json->change_type, - ) ?? $json->change_type - : null, + change_type: $json->change_type ?? null, created_at: $json->created_at ?? null, modified_fields: array_map( fn( @@ -708,8 +682,10 @@ public static function from_json( public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -720,8 +696,10 @@ public function __construct( string|null $message, /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ChangeType>|string|null */ - public \Seam\Resources\UnmanagedAccessCode\Errors\ConflictingExternalModification\ChangeType|string|null $change_type = null, + public string|null $change_type = null, /** * Date and time at which Seam created the error. */ @@ -749,11 +727,7 @@ public static function from_json(mixed $json): AccessCodeInactive|null return null; } return new self( - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_access_code_error: $json->is_access_code_error ?? null, message: $json->message ?? null, created_at: $json->created_at ?? null, @@ -763,8 +737,10 @@ public static function from_json(mixed $json): AccessCodeInactive|null public function __construct( /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that this is an access code error. */ @@ -795,11 +771,7 @@ public static function from_json(mixed $json): AccountDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -814,8 +786,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -847,11 +821,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -866,8 +836,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -899,11 +871,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -918,8 +886,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -951,11 +921,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -970,8 +936,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -1001,11 +969,7 @@ public static function from_json(mixed $json): DeviceOffline|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1018,8 +982,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1045,11 +1011,7 @@ public static function from_json(mixed $json): DeviceRemoved|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1062,8 +1024,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1090,11 +1054,7 @@ public static function from_json(mixed $json): HubDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1107,8 +1067,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1135,11 +1097,7 @@ public static function from_json(mixed $json): DeviceDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1152,8 +1110,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1181,11 +1141,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1198,8 +1154,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1227,11 +1185,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1244,8 +1198,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1273,11 +1229,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1290,8 +1242,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1318,11 +1272,7 @@ public static function from_json(mixed $json): AuxiliaryHeatRunning|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1335,8 +1285,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1363,11 +1315,7 @@ public static function from_json(mixed $json): SubscriptionRequired|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1380,8 +1328,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1408,11 +1358,7 @@ public static function from_json(mixed $json): BridgeDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? @@ -1427,8 +1373,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -1528,11 +1476,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1544,8 +1488,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -1573,11 +1519,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1589,8 +1531,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -1618,16 +1562,8 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, - change_type: is_string($json->change_type ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ChangeType::tryFrom( - $json->change_type, - ) ?? $json->change_type - : null, + warning_code: $json->warning_code ?? null, + change_type: $json->change_type ?? null, created_at: $json->created_at ?? null, modified_fields: array_map( fn( @@ -1647,12 +1583,16 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ChangeType>|string|null */ - public \Seam\Resources\UnmanagedAccessCode\Warnings\ExternalModificationInEffect\ChangeType|string|null $change_type = null, + public string|null $change_type = null, /** * Date and time at which Seam created the warning. */ @@ -1686,11 +1626,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1702,8 +1638,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -1731,11 +1669,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1747,8 +1681,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -1776,11 +1712,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1792,8 +1724,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -1821,11 +1755,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1837,8 +1767,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -1866,11 +1798,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1882,8 +1810,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -1911,11 +1841,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1927,8 +1853,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -1955,11 +1883,7 @@ public static function from_json(mixed $json): BeingDeleted|null } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -1971,8 +1895,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ @@ -2000,11 +1926,7 @@ public static function from_json( } return new self( message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, created_at: $json->created_at ?? null, ); } @@ -2016,8 +1938,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessCode\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Date and time at which Seam created the warning. */ diff --git a/src/Resources/UnmanagedAccessGrant.php b/src/Resources/UnmanagedAccessGrant.php index 1663e36f..dd1d7703 100644 --- a/src/Resources/UnmanagedAccessGrant.php +++ b/src/Resources/UnmanagedAccessGrant.php @@ -165,11 +165,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, missing_device_ids: $json->missing_device_ids ?? null, ), @@ -183,8 +179,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode>|string|null */ - public \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -226,11 +224,7 @@ public static function from_json(mixed $json): PendingMutations|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ), }; } @@ -246,8 +240,10 @@ public function __construct( public string|null $message, /** * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode>|string|null */ - public \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, ) {} } @@ -267,11 +263,7 @@ public static function from_json( null, created_at: $json->created_at ?? null, display_name: $json->display_name ?? null, - mode: is_string($json->mode ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods\Mode::tryFrom( - $json->mode, - ) ?? $json->mode - : null, + mode: $json->mode ?? null, code: $json->code ?? null, instant_key_max_use_count: $json->instant_key_max_use_count ?? null, @@ -295,8 +287,10 @@ public function __construct( public string|null $display_name, /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods\Mode>|string|null */ - public \Seam\Resources\UnmanagedAccessGrant\RequestedAccessMethods\Mode|string|null $mode, + public string|null $mode, /** * Specific PIN code to use for this access method. Only applicable when mode is 'code'. */ @@ -356,11 +350,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -376,8 +366,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null */ - public \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } } @@ -397,11 +389,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, missing_device_ids: $json->missing_device_ids ?? null, ); @@ -414,8 +402,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -462,11 +452,7 @@ public static function from_json(mixed $json): UpdatingSpaces|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingSpaces\To::from_json( $json->to, @@ -490,8 +476,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New location configuration. */ @@ -525,11 +513,7 @@ public static function from_json(mixed $json): UpdatingAccessTimes|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\UnmanagedAccessGrant\PendingMutations\UpdatingAccessTimes\To::from_json( $json->to, @@ -559,8 +543,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of updating the spaces (devices) associated with this access grant. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access time configuration. */ @@ -719,11 +705,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -738,8 +720,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -764,11 +748,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -783,8 +763,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -809,11 +791,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, failed_devices: array_map( fn( $f, @@ -836,8 +814,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * Devices whose access codes could not be revoked during reconciliation. Present when the provider does not support revoking an offline access code (e.g. Dormakaba oracode with exhausted override budget). * @@ -868,11 +848,7 @@ public static function from_json(mixed $json): UpdatingAccessTimes|null access_method_ids: $json->access_method_ids ?? null, created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -893,8 +869,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -922,11 +900,7 @@ public static function from_json( message: $json->message ?? null, new_code: $json->new_code ?? null, original_code: $json->original_code ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -953,8 +927,10 @@ public function __construct( public string|null $original_code, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -980,11 +956,7 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1003,8 +975,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1030,16 +1004,8 @@ public static function from_json( created_at: $json->created_at ?? null, device_id: $json->device_id ?? null, message: $json->message ?? null, - reason: is_string($json->reason ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason::tryFrom( - $json->reason, - ) ?? $json->reason - : null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + reason: $json->reason ?? null, + warning_code: $json->warning_code ?? null, ); } @@ -1058,12 +1024,16 @@ public function __construct( string|null $message, /** * Specific reason why the grant's times are not programmable on the device. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason>|string|null */ - public \Seam\Resources\UnmanagedAccessGrant\Warnings\DeviceTimeConstraintsViolated\Reason|string|null $reason, + public string|null $reason, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/UnmanagedAccessMethod.php b/src/Resources/UnmanagedAccessMethod.php index 287bd33d..f24a7e20 100644 --- a/src/Resources/UnmanagedAccessMethod.php +++ b/src/Resources/UnmanagedAccessMethod.php @@ -26,11 +26,7 @@ public static function from_json( ), is_issued: $json->is_issued ?? null, issued_at: $json->issued_at ?? null, - mode: is_string($json->mode ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Mode::tryFrom( - $json->mode, - ) ?? $json->mode - : null, + mode: $json->mode ?? null, pending_mutations: array_map( fn( $p, @@ -85,8 +81,10 @@ public function __construct( public string|null $issued_at, /** * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\Mode>|string|null */ - public \Seam\Resources\UnmanagedAccessMethod\Mode|string|null $mode, + public string|null $mode, /** * Pending mutations for the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). Indicates operations that are in progress. * @@ -151,11 +149,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -168,8 +162,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode>|string|null */ - public \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -209,11 +205,7 @@ public static function from_json(mixed $json): PendingMutations|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, ), }; } @@ -229,8 +221,10 @@ public function __construct( public string|null $message, /** * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode>|string|null */ - public \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + public string|null $mutation_code, ) {} } @@ -270,11 +264,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -290,8 +280,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode>|string|null */ - public \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } @@ -318,11 +310,7 @@ public static function from_json(mixed $json): FailedToIssue|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -334,8 +322,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedAccessMethod\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -375,11 +365,7 @@ public static function from_json(mixed $json): ProvisioningAccess|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\ProvisioningAccess\To::from_json( $json->to, @@ -403,8 +389,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New device configuration. */ @@ -437,11 +425,7 @@ public static function from_json(mixed $json): RevokingAccess|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\RevokingAccess\To::from_json( $json->to, @@ -465,8 +449,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New device configuration. */ @@ -499,11 +485,7 @@ public static function from_json(mixed $json): UpdatingAccessTimes|null ) : null, message: $json->message ?? null, - mutation_code: is_string($json->mutation_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode::tryFrom( - $json->mutation_code, - ) ?? $json->mutation_code - : null, + mutation_code: $json->mutation_code ?? null, to: isset($json->to) ? \Seam\Resources\UnmanagedAccessMethod\PendingMutations\UpdatingAccessTimes\To::from_json( $json->to, @@ -527,8 +509,10 @@ public function __construct( string|null $message, /** * Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode>|string|null */ - \Seam\Resources\UnmanagedAccessMethod\PendingMutations\MutationCode|string|null $mutation_code, + string|null $mutation_code, /** * New access time configuration. */ @@ -719,11 +703,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -738,8 +718,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -763,11 +745,7 @@ public static function from_json(mixed $json): UpdatingAccessTimes|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -782,8 +760,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -808,11 +788,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, original_access_method_id: $json->original_access_method_id ?? null, ); @@ -829,8 +805,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, /** * ID of the original access method from which this backup access method was split, if applicable. */ @@ -858,11 +836,7 @@ public static function from_json(mixed $json): DelayInIssuing|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -877,8 +851,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedAccessMethod\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/UnmanagedDevice.php b/src/Resources/UnmanagedDevice.php index 6afc82b8..615542e4 100644 --- a/src/Resources/UnmanagedDevice.php +++ b/src/Resources/UnmanagedDevice.php @@ -17,11 +17,7 @@ public static function from_json(mixed $json): UnmanagedDevice|null created_at: $json->created_at ?? null, custom_metadata: $json->custom_metadata ?? null, device_id: $json->device_id ?? null, - device_type: is_string($json->device_type ?? null) - ? \Seam\Resources\UnmanagedDevice\DeviceType::tryFrom( - $json->device_type, - ) ?? $json->device_type - : null, + device_type: $json->device_type ?? null, errors: array_map( fn($e) => \Seam\Resources\UnmanagedDevice\Errors::from_json( $e, @@ -108,8 +104,10 @@ public function __construct( public string|null $device_id, /** * Type of the device. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\DeviceType>|string|null */ - public \Seam\Resources\UnmanagedDevice\DeviceType|string|null $device_type, + public string|null $device_type, /** * Array of errors associated with the device. Each error object within the array contains two fields: `error_code` and `message`. `error_code` is a string that uniquely identifies the type of error, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the error, offering insights into the issue and potentially how to rectify it. * @@ -298,11 +296,7 @@ public static function from_json(mixed $json): Errors|null ), default => new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -315,8 +309,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - public \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -585,11 +581,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -605,8 +597,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - public \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } @@ -672,11 +666,7 @@ public static function from_json(mixed $json): AccountDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -691,8 +681,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -728,11 +720,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -747,8 +735,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -784,11 +774,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -803,8 +789,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -840,11 +828,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_connected_account_error: $json->is_connected_account_error ?? null, is_device_error: $json->is_device_error ?? null, @@ -859,8 +843,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ @@ -894,11 +880,7 @@ public static function from_json(mixed $json): DeviceOffline|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -911,8 +893,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -942,11 +926,7 @@ public static function from_json(mixed $json): DeviceRemoved|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -959,8 +939,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -990,11 +972,7 @@ public static function from_json(mixed $json): HubDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1007,8 +985,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1039,11 +1019,7 @@ public static function from_json(mixed $json): DeviceDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1056,8 +1032,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1089,11 +1067,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1106,8 +1080,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1139,11 +1115,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1156,8 +1128,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1189,11 +1163,7 @@ public static function from_json( } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1206,8 +1176,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1238,11 +1210,7 @@ public static function from_json(mixed $json): AuxiliaryHeatRunning|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1255,8 +1223,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1287,11 +1257,7 @@ public static function from_json(mixed $json): SubscriptionRequired|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, is_device_error: $json->is_device_error ?? null, message: $json->message ?? null, ); @@ -1304,8 +1270,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Indicates that the error is a device error. */ @@ -1336,11 +1304,7 @@ public static function from_json(mixed $json): BridgeDisconnected|null } return new self( created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, is_bridge_error: $json->is_bridge_error ?? null, is_connected_account_error: $json->is_connected_account_error ?? @@ -1355,8 +1319,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -1442,11 +1408,7 @@ public static function from_json(mixed $json): Battery|null } return new self( level: $json->level ?? null, - status: is_string($json->status ?? null) - ? \Seam\Resources\UnmanagedDevice\Properties\Battery\Status::tryFrom( - $json->status, - ) ?? $json->status - : null, + status: $json->status ?? null, ); } @@ -1457,8 +1419,10 @@ public function __construct( public float|null $level, /** * Represents the current status of the battery charge level. Values are `critical`, which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; `low`, which signifies that the battery is under the preferred threshold and should be charged soon; `good`, which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and `full`, which represents a battery that is fully charged, providing the maximum duration of usage. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Properties\Battery\Status>|string|null */ - public \Seam\Resources\UnmanagedDevice\Properties\Battery\Status|string|null $status, + public string|null $status, ) {} } @@ -1565,11 +1529,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1584,8 +1544,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1610,11 +1572,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1629,8 +1587,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1655,11 +1615,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1674,8 +1630,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1700,11 +1658,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1719,8 +1673,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1745,11 +1701,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1764,8 +1716,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1788,11 +1742,7 @@ public static function from_json(mixed $json): PowerSavingMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1807,8 +1757,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1833,11 +1785,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1852,8 +1800,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1878,11 +1828,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1897,8 +1843,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1923,11 +1871,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1942,8 +1886,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -1968,11 +1914,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -1987,8 +1929,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2012,11 +1956,7 @@ public static function from_json(mixed $json): SaltoKsOfficeMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2031,8 +1971,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2056,11 +1998,7 @@ public static function from_json(mixed $json): SaltoKsPrivacyMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2075,8 +2013,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2099,11 +2039,7 @@ public static function from_json(mixed $json): PrivacyMode|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2118,8 +2054,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2144,11 +2082,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2163,8 +2097,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2189,11 +2125,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2208,8 +2140,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2234,11 +2168,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2253,8 +2183,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2279,11 +2211,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2298,8 +2226,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2324,11 +2254,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2343,8 +2269,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2367,11 +2295,7 @@ public static function from_json(mixed $json): TimeZoneUnknown|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2386,8 +2310,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2411,11 +2337,7 @@ public static function from_json(mixed $json): TimeZoneMismatch|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2430,8 +2352,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2456,11 +2380,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2475,8 +2395,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2501,11 +2423,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2520,8 +2438,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2544,11 +2464,7 @@ public static function from_json(mixed $json): ProviderIssue|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2563,8 +2479,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2589,11 +2507,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2608,8 +2522,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2634,11 +2550,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2653,8 +2565,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2679,11 +2593,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2698,8 +2608,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -2728,11 +2640,7 @@ public static function from_json( max_active_access_code_count: $json->max_active_access_code_count ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -2755,8 +2663,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedDevice\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/UnmanagedUserIdentity.php b/src/Resources/UnmanagedUserIdentity.php index 81671135..c7b8cfeb 100644 --- a/src/Resources/UnmanagedUserIdentity.php +++ b/src/Resources/UnmanagedUserIdentity.php @@ -117,11 +117,7 @@ public static function from_json(mixed $json): Errors|null acs_system_id: $json->acs_system_id ?? null, acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -142,8 +138,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode>|string|null */ - public \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -179,11 +177,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -199,8 +193,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode>|string|null */ - public \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } } @@ -221,11 +217,7 @@ public static function from_json(mixed $json): IssueWithAcsUser|null acs_system_id: $json->acs_system_id ?? null, acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -245,8 +237,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode>|string|null */ - \Seam\Resources\UnmanagedUserIdentity\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -283,11 +277,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -302,8 +292,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -328,11 +320,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -347,8 +335,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode>|string|null */ - \Seam\Resources\UnmanagedUserIdentity\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/UserIdentity.php b/src/Resources/UserIdentity.php index 7a8090d2..3153515c 100644 --- a/src/Resources/UserIdentity.php +++ b/src/Resources/UserIdentity.php @@ -117,11 +117,7 @@ public static function from_json(mixed $json): Errors|null acs_system_id: $json->acs_system_id ?? null, acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UserIdentity\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ), }; @@ -142,8 +138,10 @@ public function __construct( public string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UserIdentity\Errors\ErrorCode>|string|null */ - public \Seam\Resources\UserIdentity\Errors\ErrorCode|string|null $error_code, + public string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -179,11 +177,7 @@ public static function from_json(mixed $json): Warnings|null default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ), }; } @@ -199,8 +193,10 @@ public function __construct( public string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UserIdentity\Warnings\WarningCode>|string|null */ - public \Seam\Resources\UserIdentity\Warnings\WarningCode|string|null $warning_code, + public string|null $warning_code, ) {} } } @@ -220,11 +216,7 @@ public static function from_json(mixed $json): IssueWithAcsUser|null acs_system_id: $json->acs_system_id ?? null, acs_user_id: $json->acs_user_id ?? null, created_at: $json->created_at ?? null, - error_code: is_string($json->error_code ?? null) - ? \Seam\Resources\UserIdentity\Errors\ErrorCode::tryFrom( - $json->error_code, - ) ?? $json->error_code - : null, + error_code: $json->error_code ?? null, message: $json->message ?? null, ); } @@ -244,8 +236,10 @@ public function __construct( string|null $created_at, /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UserIdentity\Errors\ErrorCode>|string|null */ - \Seam\Resources\UserIdentity\Errors\ErrorCode|string|null $error_code, + string|null $error_code, /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ @@ -281,11 +275,7 @@ public static function from_json(mixed $json): BeingDeleted|null return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -300,8 +290,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UserIdentity\Warnings\WarningCode>|string|null */ - \Seam\Resources\UserIdentity\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, @@ -326,11 +318,7 @@ public static function from_json( return new self( created_at: $json->created_at ?? null, message: $json->message ?? null, - warning_code: is_string($json->warning_code ?? null) - ? \Seam\Resources\UserIdentity\Warnings\WarningCode::tryFrom( - $json->warning_code, - ) ?? $json->warning_code - : null, + warning_code: $json->warning_code ?? null, ); } @@ -345,8 +333,10 @@ public function __construct( string|null $message, /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UserIdentity\Warnings\WarningCode>|string|null */ - \Seam\Resources\UserIdentity\Warnings\WarningCode|string|null $warning_code, + string|null $warning_code, ) { parent::__construct( created_at: $created_at, diff --git a/src/Resources/Workspace.php b/src/Resources/Workspace.php index bae35ea0..e68dbcd9 100644 --- a/src/Resources/Workspace.php +++ b/src/Resources/Workspace.php @@ -85,11 +85,7 @@ public static function from_json( } return new self( inviter_logo_url: $json->inviter_logo_url ?? null, - logo_shape: is_string($json->logo_shape ?? null) - ? \Seam\Resources\Workspace\ConnectWebviewCustomization\LogoShape::tryFrom( - $json->logo_shape, - ) ?? $json->logo_shape - : null, + logo_shape: $json->logo_shape ?? null, primary_button_color: $json->primary_button_color ?? null, primary_button_text_color: $json->primary_button_text_color ?? null, @@ -104,8 +100,10 @@ public function __construct( public string|null $inviter_logo_url = null, /** * Logo shape for [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) in the workspace. See also [Customize the Look and Feel of Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-look-and-feel-of-your-connect-webviews). + * + * @var value-of<\Seam\Resources\Workspace\ConnectWebviewCustomization\LogoShape>|string|null */ - public \Seam\Resources\Workspace\ConnectWebviewCustomization\LogoShape|string|null $logo_shape = null, + public string|null $logo_shape = null, /** * Primary button color for [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews) in the workspace. See also [Customize the Look and Feel of Your Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#customize-the-look-and-feel-of-your-connect-webviews). */ diff --git a/tests/ResourceTest.php b/tests/ResourceTest.php index 5cfd708e..582489b0 100644 --- a/tests/ResourceTest.php +++ b/tests/ResourceTest.php @@ -107,7 +107,8 @@ public function testSameNamedPropertiesAtDifferentDepthsKeepTheirShapes(): void ); $this->assertSame(0.4, $device->properties->battery->level); - $this->assertSame(Status::LOW, $device->properties->battery->status); + $this->assertSame("low", $device->properties->battery->status); + $this->assertSame("low", Status::LOW->value); $this->assertSame( 0.25, @@ -136,7 +137,8 @@ public function testDiscriminatedListReturnsTheSpecificVariant(): void $error = $this->device()->errors[0]; $this->assertInstanceOf(DeviceOffline::class, $error); - $this->assertSame(ErrorCode::DEVICE_OFFLINE, $error->error_code); + $this->assertSame("device_offline", $error->error_code); + $this->assertSame("device_offline", ErrorCode::DEVICE_OFFLINE->value); $this->assertTrue($error->is_device_error); $this->assertObjectNotHasProperty("is_bridge_error", $error); } @@ -182,6 +184,7 @@ public function testClimatePresetMetadataKeepsItsOwnShape(): void $this->assertNotNull($preset); $this->assertSame("sleep", $preset->climate_ref); $this->assertTrue($preset->is_optimized); - $this->assertSame(Owner::USER, $preset->owner); + $this->assertSame("user", $preset->owner); + $this->assertSame("user", Owner::USER->value); } } diff --git a/tests/SeamWebhookTest.php b/tests/SeamWebhookTest.php index 859304b2..37b9d888 100644 --- a/tests/SeamWebhookTest.php +++ b/tests/SeamWebhookTest.php @@ -62,7 +62,11 @@ public function testVerifyReturnsTheEvent(): void ); $this->assertInstanceOf(DeviceConnected::class, $event); - $this->assertSame(EventType::DEVICE_CONNECTED, $event->event_type); + $this->assertSame("device.connected", $event->event_type); + $this->assertSame( + "device.connected", + EventType::DEVICE_CONNECTED->value, + ); $this->assertSame( "8d7e0b26-5e6c-4a1f-9b3d-1b0f0e5a9c11", $event->event_id, @@ -80,7 +84,7 @@ public function testVerifyAcceptsHeadersInAnyCase(): void $event = (new SeamWebhook(self::SECRET))->verify($payload, $headers); - $this->assertSame(EventType::DEVICE_CONNECTED, $event->event_type); + $this->assertSame("device.connected", $event->event_type); } public function testDecodesAnAccessCodeEventIntoItsSpecificClass(): void diff --git a/tests/WaitForActionAttemptTest.php b/tests/WaitForActionAttemptTest.php index a608fd4c..00906988 100644 --- a/tests/WaitForActionAttemptTest.php +++ b/tests/WaitForActionAttemptTest.php @@ -39,7 +39,11 @@ private function pending_action_attempt(Seam $seam): ActionAttempt ); $this->assertInstanceOf(UnlockDoor::class, $action_attempt); - $this->assertSame(Status::PENDING, $action_attempt->status); + $this->assertSame("pending", $action_attempt->status); + $this->assertSame( + Status::PENDING, + Status::tryFrom($action_attempt->status), + ); $this->assertNull($action_attempt->error); $this->assertNull($action_attempt->result); @@ -67,7 +71,7 @@ public function testListReturnsActionAttemptsWithoutResolvingThem(): void $pending->action_attempt_id, $attempts[0]->action_attempt_id, ); - $this->assertSame(Status::PENDING, $attempts[0]->status); + $this->assertSame("pending", $attempts[0]->status); } private function set_status( @@ -91,7 +95,7 @@ public function testWaitsByDefault(): void $this->seed["august_device_1"], ); - $this->assertSame(Status::SUCCESS, $action_attempt->status); + $this->assertSame("success", $action_attempt->status); } public function testClientDefaultCanDisableWaiting(): void @@ -102,7 +106,7 @@ public function testClientDefaultCanDisableWaiting(): void $this->seed["august_device_1"], ); - $this->assertSame(Status::PENDING, $action_attempt->status); + $this->assertSame("pending", $action_attempt->status); } /** @@ -123,7 +127,7 @@ public function testClientDefaultCanBeAnOptionsArray(): void $this->seed["august_device_1"], ); - $this->assertSame(Status::SUCCESS, $action_attempt->status); + $this->assertSame("success", $action_attempt->status); } public function testPerCallOptionCanDisableWaiting(): void @@ -133,7 +137,7 @@ public function testPerCallOptionCanDisableWaiting(): void wait_for_action_attempt: false, ); - $this->assertSame(Status::PENDING, $action_attempt->status); + $this->assertSame("pending", $action_attempt->status); } public function testPerCallOptionCanEnableWaiting(): void @@ -145,7 +149,7 @@ public function testPerCallOptionCanEnableWaiting(): void wait_for_action_attempt: true, ); - $this->assertSame(Status::SUCCESS, $action_attempt->status); + $this->assertSame("success", $action_attempt->status); } public function testReturnsAnAlreadySuccessfulActionAttempt(): void @@ -162,7 +166,7 @@ public function testReturnsAnAlreadySuccessfulActionAttempt(): void wait_for_action_attempt: true, ); - $this->assertSame(Status::SUCCESS, $resolved->status); + $this->assertSame("success", $resolved->status); $this->assertSame( $action_attempt->action_attempt_id, $resolved->action_attempt_id, @@ -193,7 +197,7 @@ public function testWaitsForAnActionAttemptResolvedOutOfBand(): void ], ); - $this->assertSame(Status::SUCCESS, $resolved->status); + $this->assertSame("success", $resolved->status); } finally { proc_close($resolver); } @@ -263,10 +267,7 @@ public function testThrowsWhenTheActionAttemptFails(): void } catch (ActionAttemptFailedError $error) { $this->assertSame("Failed", $error->getMessage()); $this->assertSame("foo", $error->getErrorCode()); - $this->assertSame( - Status::ERROR, - $error->getActionAttempt()->status, - ); + $this->assertSame("error", $error->getActionAttempt()->status); $this->assertSame( $action_attempt->action_attempt_id, $error->getActionAttempt()->action_attempt_id, @@ -339,7 +340,7 @@ public function testResolvesWhenTheIntervalOutlastsTheTimeout(): void ], ); - $this->assertSame(Status::SUCCESS, $resolved->status); + $this->assertSame("success", $resolved->status); } /** @@ -413,7 +414,7 @@ public function testPollSendsTheIdAsAQueryNotABody(): void "polling_interval" => 0.01, ]); - $this->assertSame(Status::SUCCESS, $resolved->status); + $this->assertSame("success", $resolved->status); $poll = $recorder->request(1); @@ -443,6 +444,6 @@ public function testActionAttemptsGetDoesNotRecurse(): void ], ); - $this->assertSame(Status::SUCCESS, $resolved->status); + $this->assertSame("success", $resolved->status); } } From 0cf8b525c683256dae01ae573ac038a82a584856 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Wed, 19 Aug 2026 19:43:21 -0700 Subject: [PATCH 4/4] docs: explain optional response enums --- README.md | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d0f5ef3e..6b9816ff 100644 --- a/README.md +++ b/README.md @@ -151,16 +151,6 @@ $action_attempt = $seam->locks->unlock_door(device_id: $device_id); $action_attempt->status; // "pending" ``` -Response enum values stay strings for straightforward comparisons. Generated -backed enums provide autocomplete and optional validation: - -```php -use Seam\Resources\ActionAttempt\Status; - -$action_attempt->status === Status::PENDING->value; -$status = Status::tryFrom($action_attempt->status); -``` - or for a single request: ```php @@ -356,6 +346,38 @@ try { ### Advanced Usage +#### Enum values + +Enum-valued response properties are strings, so they work with ordinary string +comparisons and remain forward-compatible when the API adds a value: + +```php +if ($action_attempt->status === "pending") { + // The action is still running. +} +``` + +The SDK also generates backed enums for autocomplete, discovery of known +values, and optional validation. Use the enum's `value` when comparing, or +`tryFrom()` to convert a response value: + +```php +use Seam\Resources\ActionAttempt\Status; +use Seam\Resources\Event\EventType; + +if ($action_attempt->status === Status::PENDING->value) { + // The action is still running. +} + +$status = Status::tryFrom($action_attempt->status); +$event_type = EventType::tryFrom($event->event_type); +``` + +`tryFrom()` returns `null` for a value introduced after the installed SDK was +released; the original response property still contains the raw string. Enum +properties also reference their companion enum in PHPDoc for IDE and static +analysis hints. + #### Setting the endpoint The endpoint may be set with the `SEAM_ENDPOINT` environment variable, or