diff --git a/README.md b/README.md index 18aa0019..7e90977f 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,28 @@ try { } ``` +Each action attempt deserializes to a class for its `action_type` and `status` +pair, e.g., `Seam\Resources\ActionAttempt\UnlockDoor\Success`. The `error` and +`result` properties have the `null` type except on the status class that +populates them, so narrow with `instanceof` before reading them: + +```php +use Seam\Resources\ActionAttempt\UnlockDoor; + +$action_attempt = $seam->locks->unlock_door( + device_id: $device_id, + wait_for_action_attempt: false +); + +if ($action_attempt instanceof UnlockDoor\Success) { + var_dump($action_attempt->result); // The result is populated here. +} + +if ($action_attempt instanceof UnlockDoor\Error) { + print $action_attempt->error->message; // The error is populated here. +} +``` + Waiting may be disabled for the whole client: ```php diff --git a/codegen/lib/layouts/resource.ts b/codegen/lib/layouts/resource.ts index ee9d6284..e5e31b33 100644 --- a/codegen/lib/layouts/resource.ts +++ b/codegen/lib/layouts/resource.ts @@ -64,6 +64,8 @@ const generateFromJsonProp = (property: ResourceClassProperty): string => { case 'value': return `${name}: $json->${name} ?? null,` + case 'null': + return `${name}: null,` } } @@ -99,6 +101,9 @@ const generateConstructorParam = ( : `${property.phpDocType}|null` break } + case 'null': + type = 'null' + break } return { diff --git a/codegen/lib/resource-model.ts b/codegen/lib/resource-model.ts index e2e49899..dff11eb4 100644 --- a/codegen/lib/resource-model.ts +++ b/codegen/lib/resource-model.ts @@ -5,6 +5,7 @@ // one final class per variant, and an unknown-discriminant fallback. import type { + ActionAttemptStatus, Blueprint, EnumProperty, Property, @@ -20,6 +21,9 @@ export type ResourceClassProperty = phpType: string phpDocType: string } & ResourceClassPropertyMetadata) + | ({ + kind: 'null' + } & ResourceClassPropertyMetadata) | ({ kind: 'record' phpType: string @@ -242,7 +246,7 @@ export const createResourceModel = (blueprint: Blueprint): ResourceModel => { isDeprecated: false, deprecationMessage: '', }, - true, + { isActionAttempt: true }, ) } else { const resource = resources.get(resourceType) @@ -296,6 +300,10 @@ const buildClass = ( const nestedPath = `${path}.${property.name}` const nestedClassName = pascalCase(property.name) + if (isRenderedAsNull(property)) { + return { ...metadata, kind: 'null' } + } + if (property.format === 'enum') { assertAvailableName( nestedClassName, @@ -400,6 +408,13 @@ const buildClass = ( } } +interface DiscriminatedClassOptions { + isActionAttempt?: boolean + extendsName?: string + inheritedProperties?: ResourceClassProperty[] + discriminantEnumType?: string +} + const buildDiscriminatedClass = ( className: string, namespace: string, @@ -408,7 +423,7 @@ const buildDiscriminatedClass = ( path: string, depth: number, docs: ClassDocs, - actionAttempt = false, + options: DiscriminatedClassOptions = {}, ): BuiltDeclaration => { assertDepth(path, depth) if (variants.length === 0) { @@ -434,11 +449,16 @@ const buildDiscriminatedClass = ( const candidate = variant.properties.find( ({ name }) => name === property.name, ) + if (candidate == null) return false + if ( + (options.isActionAttempt ?? false) && + property.actionAttemptStatuses != null + ) { + return false + } return ( - candidate != null && - (property.name === discriminator || - (actionAttempt && property.name === 'error') || - propertyShape(candidate) === propertyShape(property)) + property.name === discriminator || + propertyShape(candidate) === propertyShape(property) ) }), ) @@ -460,15 +480,6 @@ const buildDiscriminatedClass = ( ) 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, @@ -477,8 +488,16 @@ const buildDiscriminatedClass = ( throw new Error(`Cannot generate ${path}: missing ${discriminator}`) } - const enumName = pascalCase(discriminator) - const enumType = `\\${namespace}\\${className}\\${enumName}` + const inheritedNames = new Set( + (options.inheritedProperties ?? []).map(({ name }) => name), + ) + const ownCommonProperties = commonProperties.filter( + ({ name }) => !inheritedNames.has(name), + ) + + const enumType = + options.discriminantEnumType ?? + `\\${namespace}\\${className}\\${pascalCase(discriminator)}` const factory: ResourceFactory = { discriminant: discriminator, enumType, @@ -491,28 +510,66 @@ const buildDiscriminatedClass = ( const built = buildClass( className, namespace, - commonProperties, + ownCommonProperties, path, depth, { ...docs, description: `${docs.description}${docs.description === '' ? '' : ' '}Known ${discriminator} values use subclasses; unknown values use this base class and retain their raw discriminator.`, }, - { factory }, + { + factory, + ...(options.extendsName == null + ? {} + : { extendsName: options.extendsName }), + ...(options.inheritedProperties == null + ? {} + : { inheritedProperties: options.inheritedProperties }), + }, ) const base = built.declaration if (base.kind !== 'class') throw new Error(`Cannot generate ${path}`) const baseName = `\\${namespace}\\${className}` + const variantInheritedProperties = [ + ...(options.inheritedProperties ?? []), + ...base.properties, + ] 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.`, - } - }) + const variantDocs = { + description: variant.description, + isDeprecated: false, + deprecationMessage: '', + } + const statusVariants = + (options.isActionAttempt ?? false) + ? expandActionAttemptByStatus(variant) + : undefined + if (statusVariants != null) { + built.nestedDeclarations.push( + buildDiscriminatedClass( + pascalCase(value), + `${namespace}\\${className}`, + statusVariants, + actionAttemptStatusName, + `${path}.${value}`, + depth + 1, + variantDocs, + { + extendsName: baseName, + inheritedProperties: variantInheritedProperties, + ...(commonNames.has(actionAttemptStatusName) + ? { + discriminantEnumType: `\\${namespace}\\${className}\\${pascalCase(actionAttemptStatusName)}`, + } + : {}), + }, + ), + ) + continue + } + const ownProperties = variant.properties.filter( + ({ name }) => !commonNames.has(name), + ) built.nestedDeclarations.push( buildClass( pascalCase(value), @@ -520,15 +577,11 @@ const buildDiscriminatedClass = ( ownProperties, `${path}.${value}`, depth + 1, - { - description: variant.description, - isDeprecated: false, - deprecationMessage: '', - }, + variantDocs, { isFinal: true, extendsName: baseName, - inheritedProperties: base.properties, + inheritedProperties: variantInheritedProperties, }, ), ) @@ -537,6 +590,49 @@ const buildDiscriminatedClass = ( return built } +const actionAttemptStatusName = 'status' + +const expandActionAttemptByStatus = ( + variant: VariantInput, +): VariantInput[] | undefined => { + const statusProperty = variant.properties.find( + (property): property is EnumProperty => + property.name === actionAttemptStatusName && property.format === 'enum', + ) + if (statusProperty == null) return undefined + + return statusProperty.values.map(({ name }) => { + const status = name as ActionAttemptStatus + return { + description: variant.description, + properties: variant.properties.map((property): Property => { + if (property === statusProperty) { + return { + ...statusProperty, + values: statusProperty.values.filter( + (value) => value.name === status, + ), + } + } + const { actionAttemptStatuses } = property + if (actionAttemptStatuses == null) return property + if (actionAttemptStatuses.includes(status)) return property + const nullRenderedProperty: NullRenderedProperty = { + ...property, + isNullable: false, + renderAsNull: true, + } + return nullRenderedProperty + }), + } + }) +} + +type NullRenderedProperty = Property & { renderAsNull: true } + +const isRenderedAsNull = (property: Property): boolean => + (property as Partial).renderAsNull === true + const buildEnum = ( name: string, namespace: string, diff --git a/package-lock.json b/package-lock.json index 0681c024..8be68c02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "devDependencies": { "@prettier/plugin-php": "^0.25.0", - "@seamapi/blueprint": "^1.9.1", + "@seamapi/blueprint": "^1.10.0", "@seamapi/fake-seam-connect": "2.0.5", "@seamapi/smith": "^1.1.0", "@seamapi/types": "1.1047.0", @@ -806,9 +806,9 @@ "license": "MIT" }, "node_modules/@seamapi/blueprint": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-1.9.1.tgz", - "integrity": "sha512-A9H3dZE9f+ZEEnOAlMl5jSlL5F/RIKkjOF8NDFbnuahAiu/trDz/RzHOGhbQd6sd0RErIyx3eG1p4HCOJDKDCA==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-1.10.0.tgz", + "integrity": "sha512-XyP6zvbhv5naWEa9T9utNLi3FVVmvUB1Htih/IjUqS3Uz0FrIIBWy7Myk5+s4uylEt+wTdtSBaA1fGOF/6ILmA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 0fe81e6f..b7c35382 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "packageManager": "npm@11.19.0", "devDependencies": { "@prettier/plugin-php": "^0.25.0", - "@seamapi/blueprint": "^1.9.1", + "@seamapi/blueprint": "^1.10.0", "@seamapi/fake-seam-connect": "2.0.5", "@seamapi/smith": "^1.1.0", "@seamapi/types": "1.1047.0", diff --git a/src/ActionAttemptFailedError.php b/src/ActionAttemptFailedError.php index a69311f5..9c43b4c9 100644 --- a/src/ActionAttemptFailedError.php +++ b/src/ActionAttemptFailedError.php @@ -13,11 +13,19 @@ class ActionAttemptFailedError extends ActionAttemptError public function __construct(ActionAttempt $actionAttempt) { + $error = get_object_vars($actionAttempt)["error"] ?? null; + $message = null; + $type = null; + if (is_object($error)) { + $errorProperties = get_object_vars($error); + $message = $errorProperties["message"] ?? null; + $type = $errorProperties["type"] ?? null; + } parent::__construct( - $actionAttempt->error->message ?? "Action attempt failed", + is_string($message) ? $message : "Action attempt failed", $actionAttempt, ); - $this->errorCode = $actionAttempt->error->type ?? "unknown_error"; + $this->errorCode = is_string($type) ? $type : "unknown_error"; } /** diff --git a/src/Resources/ActionAttempt.php b/src/Resources/ActionAttempt.php index 20a36c2f..7d401ba5 100644 --- a/src/Resources/ActionAttempt.php +++ b/src/Resources/ActionAttempt.php @@ -103,11 +103,6 @@ public static function from_json(mixed $json): ActionAttempt|null default => new self( action_attempt_id: $json->action_attempt_id ?? null, action_type: $json->action_type ?? null, - error: isset($json->error) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, status: $json->status ?? null, ), }; @@ -124,10 +119,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -138,58 +129,38 @@ public function __construct( namespace Seam\Resources\ActionAttempt { /** - * Error associated with the action. Null while the action attempt is pending or when this value does not apply. - */ - class Error - { - public static function from_json(mixed $json): Error|null - { - if (!$json) { - return null; - } - return new self( - message: $json->message ?? null, - type: $json->type ?? null, - ); - } - - 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, - ) {} - } - - /** - * Locking a door is pending. + * Locking a door is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class LockDoor extends \Seam\Resources\ActionAttempt + class LockDoor extends \Seam\Resources\ActionAttempt { public static function from_json(mixed $json): LockDoor|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) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: isset($json->result) - ? \Seam\Resources\ActionAttempt\LockDoor\Result::from_json( - $json->result, - ) - : null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\LockDoor\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\LockDoor\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\LockDoor\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -203,14 +174,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -219,37 +182,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } /** - * Unlocking a door is pending. + * Unlocking a door is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class UnlockDoor extends \Seam\Resources\ActionAttempt + 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: $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: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\UnlockDoor\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\UnlockDoor\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\UnlockDoor\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -263,14 +233,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -279,37 +241,44 @@ public function __construct( 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. + * Reading credential data from the physical encoder is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class ScanCredential extends \Seam\Resources\ActionAttempt + 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: $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: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\ScanCredential\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\ScanCredential\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\ScanCredential\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -323,14 +292,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -339,37 +300,44 @@ public function __construct( 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. + * Encoding credential data from the physical encoder onto a card is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class EncodeCredential extends \Seam\Resources\ActionAttempt + 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: $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: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\EncodeCredential\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\EncodeCredential\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\EncodeCredential\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -383,14 +351,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -399,16 +359,15 @@ public function __construct( 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. + * Scanning a physical card and assigning the credential is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class ScanToAssignCredential extends \Seam\Resources\ActionAttempt + class ScanToAssignCredential extends \Seam\Resources\ActionAttempt { public static function from_json( mixed $json, @@ -416,21 +375,29 @@ public static function from_json( 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) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: isset($json->result) - ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result::from_json( - $json->result, - ) - : null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\ScanToAssignCredential\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\ScanToAssignCredential\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\ScanToAssignCredential\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -444,14 +411,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -460,37 +419,44 @@ public function __construct( 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. + * Assigning a credential to an access method is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class AssignCredential extends \Seam\Resources\ActionAttempt + 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: $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: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\AssignCredential\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\AssignCredential\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\AssignCredential\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -504,14 +470,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -520,16 +478,15 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } /** - * Resetting a sandbox workspace is pending. + * Resetting a sandbox workspace is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class ResetSandboxWorkspace extends \Seam\Resources\ActionAttempt + class ResetSandboxWorkspace extends \Seam\Resources\ActionAttempt { public static function from_json( mixed $json, @@ -537,17 +494,29 @@ public static function from_json( 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) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\ResetSandboxWorkspace\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\ResetSandboxWorkspace\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\ResetSandboxWorkspace\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -562,48 +531,51 @@ public function __construct( */ 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, - /** - * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ string|null $status, ) { parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } /** - * Setting the fan mode is pending. + * Setting the fan mode is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class SetFanMode extends \Seam\Resources\ActionAttempt + 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: $json->action_type ?? null, - error: isset($json->error) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\SetFanMode\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\SetFanMode\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\SetFanMode\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -617,14 +589,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -633,33 +597,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } /** - * Setting the HVAC mode is pending. + * Setting the HVAC mode is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class SetHvacMode extends \Seam\Resources\ActionAttempt + 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: $json->action_type ?? null, - error: isset($json->error) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\SetHvacMode\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\SetHvacMode\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\SetHvacMode\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -673,14 +648,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -689,16 +656,15 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } /** - * Activating a climate preset is pending. + * Activating a climate preset is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class ActivateClimatePreset extends \Seam\Resources\ActionAttempt + class ActivateClimatePreset extends \Seam\Resources\ActionAttempt { public static function from_json( mixed $json, @@ -706,17 +672,29 @@ public static function from_json( 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) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\ActivateClimatePreset\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\ActivateClimatePreset\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\ActivateClimatePreset\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -730,14 +708,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -746,16 +716,15 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } /** - * Simulating a keypad code entry is pending. + * Simulating a keypad code entry is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class SimulateKeypadCodeEntry extends \Seam\Resources\ActionAttempt + class SimulateKeypadCodeEntry extends \Seam\Resources\ActionAttempt { public static function from_json( mixed $json, @@ -763,17 +732,29 @@ public static function from_json( 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) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -787,14 +768,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -803,17 +776,15 @@ public function __construct( 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. + * Simulating a manual lock action using a keypad is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class SimulateManualLockViaKeypad extends - \Seam\Resources\ActionAttempt + class SimulateManualLockViaKeypad extends \Seam\Resources\ActionAttempt { public static function from_json( mixed $json, @@ -821,17 +792,29 @@ public static function from_json( 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) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -845,14 +828,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -861,16 +836,15 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } /** - * Pushing thermostat weekly programs is pending. + * Pushing thermostat weekly programs is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class PushThermostatPrograms extends \Seam\Resources\ActionAttempt + class PushThermostatPrograms extends \Seam\Resources\ActionAttempt { public static function from_json( mixed $json, @@ -878,17 +852,29 @@ public static function from_json( 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) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\PushThermostatPrograms\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\PushThermostatPrograms\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\PushThermostatPrograms\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -902,14 +888,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -918,33 +896,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } /** - * Configuring the auto-lock is pending. + * Configuring the auto-lock is pending. Known status values use subclasses; unknown values use this base class and retain their raw discriminator. */ - final class ConfigureAutoLock extends \Seam\Resources\ActionAttempt + 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: $json->action_type ?? null, - error: isset($json->error) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\ConfigureAutoLock\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\ConfigureAutoLock\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\ConfigureAutoLock\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -958,14 +947,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -974,30 +955,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } - final class SyncAccessCodes extends \Seam\Resources\ActionAttempt + /** + * Known status values use subclasses; unknown values use this base class and retain their raw discriminator. + */ + 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: $json->action_type ?? null, - error: isset($json->error) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\SyncAccessCodes\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\SyncAccessCodes\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\SyncAccessCodes\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -1011,14 +1006,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -1027,34 +1014,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } - final class CreateAccessCode extends \Seam\Resources\ActionAttempt + /** + * Known status values use subclasses; unknown values use this base class and retain their raw discriminator. + */ + 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: $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: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\CreateAccessCode\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\CreateAccessCode\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\CreateAccessCode\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -1068,14 +1065,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -1084,30 +1073,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } - final class DeleteAccessCode extends \Seam\Resources\ActionAttempt + /** + * Known status values use subclasses; unknown values use this base class and retain their raw discriminator. + */ + 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: $json->action_type ?? null, - error: isset($json->error) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\DeleteAccessCode\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\DeleteAccessCode\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\DeleteAccessCode\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -1121,14 +1124,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -1137,34 +1132,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } - final class UpdateAccessCode extends \Seam\Resources\ActionAttempt + /** + * Known status values use subclasses; unknown values use this base class and retain their raw discriminator. + */ + 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: $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: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\UpdateAccessCode\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\UpdateAccessCode\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\UpdateAccessCode\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -1178,14 +1183,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -1194,34 +1191,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } - final class CreateNoiseThreshold extends \Seam\Resources\ActionAttempt + /** + * Known status values use subclasses; unknown values use this base class and retain their raw discriminator. + */ + 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: $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: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -1235,14 +1242,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -1251,30 +1250,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } - final class DeleteNoiseThreshold extends \Seam\Resources\ActionAttempt + /** + * Known status values use subclasses; unknown values use this base class and retain their raw discriminator. + */ + 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: $json->action_type ?? null, - error: isset($json->error) - ? \Seam\Resources\ActionAttempt\Error::from_json( - $json->error, - ) - : null, - result: $json->result ?? null, - status: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\DeleteNoiseThreshold\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\DeleteNoiseThreshold\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\DeleteNoiseThreshold\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -1288,14 +1301,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -1304,34 +1309,44 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } } - final class UpdateNoiseThreshold extends \Seam\Resources\ActionAttempt + /** + * Known status values use subclasses; unknown values use this base class and retain their raw discriminator. + */ + 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: $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: $json->status ?? null, - ); + $discriminant = is_string($json->status ?? null) + ? \Seam\Resources\ActionAttempt\Status::tryFrom($json->status) + : null; + + return match ($discriminant) { + \Seam\Resources\ActionAttempt\Status::SUCCESS + => \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Success::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::PENDING + => \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Pending::from_json( + $json, + ), + \Seam\Resources\ActionAttempt\Status::ERROR + => \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Error::from_json( + $json, + ), + default => new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + status: $json->status ?? null, + ), + }; } public function __construct( @@ -1345,14 +1360,6 @@ public function __construct( * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ 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, /** * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ @@ -1361,7 +1368,6 @@ public function __construct( parent::__construct( action_attempt_id: $action_attempt_id, action_type: $action_type, - error: $error, status: $status, ); } @@ -1402,766 +1408,708 @@ enum Status: string namespace Seam\Resources\ActionAttempt\LockDoor { /** - * Result of the action. Null while the action attempt is pending or when this value does not apply. + * Locking a door is pending. */ - class Result + final class Success extends \Seam\Resources\ActionAttempt\LockDoor { - public static function from_json(mixed $json): Result|null + public static function from_json(mixed $json): Success|null { if (!$json) { return null; } return new self( - was_confirmed_by_device: $json->was_confirmed_by_device ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\LockDoor\Success\Result::from_json( + $json->result, + ) + : null, + status: $json->status ?? null, ); } public function __construct( /** - * Indicates whether the device confirmed that the lock action occurred. + * ID of the action attempt. */ - public bool|null $was_confirmed_by_device = null, - ) {} + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public \Seam\Resources\ActionAttempt\LockDoor\Success\Result|null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } -} -namespace Seam\Resources\ActionAttempt\UnlockDoor { /** - * Result of the action. Null while the action attempt is pending or when this value does not apply. + * Locking a door is pending. */ - class Result + final class Pending extends \Seam\Resources\ActionAttempt\LockDoor { - public static function from_json(mixed $json): Result|null + public static function from_json(mixed $json): Pending|null { if (!$json) { return null; } return new self( - was_confirmed_by_device: $json->was_confirmed_by_device ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, ); } public function __construct( /** - * Indicates whether the device confirmed that the unlock action occurred. + * ID of the action attempt. */ - 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 + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Locking a door is pending. + */ + final class Error extends \Seam\Resources\ActionAttempt\LockDoor + { + public static function from_json(mixed $json): Error|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, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\LockDoor\Error\Error::from_json( + $json->error, ) : null, - warnings: array_map( - fn( - $w, - ) => \Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings::from_json( - $w, - ), - $json->warnings ?? [], - ), + result: null, + status: $json->status ?? null, ); } public function __construct( /** - * Snapshot of credential data read from the physical encoder. + * ID of the action attempt. */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder|null $acs_credential_on_encoder, + string|null $action_attempt_id, /** - * Corresponding credential data as stored on Seam and the access system. + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam|null $acs_credential_on_seam, + string|null $action_type, /** - * 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> + * Error associated with the action. */ - public array $warnings, - ) {} + public \Seam\Resources\ActionAttempt\LockDoor\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } } -namespace Seam\Resources\ActionAttempt\ScanCredential\Result { +namespace Seam\Resources\ActionAttempt\LockDoor\Success { /** - * Snapshot of credential data read from the physical encoder. + * Result of the action. */ - class AcsCredentialOnEncoder + class Result { - public static function from_json( - mixed $json, - ): AcsCredentialOnEncoder|null { + public static function from_json(mixed $json): Result|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, + was_confirmed_by_device: $json->was_confirmed_by_device ?? 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). + * Indicates whether the device confirmed that the lock action occurred. */ - public bool|null $is_issued, + public bool|null $was_confirmed_by_device = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\LockDoor\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + public function __construct( /** - * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) becomes usable. + * 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, /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Type of the error. */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata|null $visionline_metadata = null, + public string|null $type, ) {} } +} +namespace Seam\Resources\ActionAttempt\UnlockDoor { /** - * Corresponding credential data as stored on Seam and the access system. + * Unlocking a door is pending. */ - class AcsCredentialOnSeam + final class Success extends \Seam\Resources\ActionAttempt\UnlockDoor { - public static function from_json(mixed $json): AcsCredentialOnSeam|null + public static function from_json(mixed $json): Success|null { if (!$json) { return null; } return new self( - 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, - 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: $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, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\UnlockDoor\Success\Result::from_json( + $json->result, ) : null, + status: $json->status ?? 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 + * ID of the action attempt. */ - public string|null $access_method, + string|null $action_attempt_id, /** - * ID of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $acs_credential_id, + string|null $action_type, /** - * 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). + * Error associated with the action. */ - public string|null $acs_system_id, + public null $error, /** - * 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. + * Result of the action. */ - public string|null $connected_account_id, + public \Seam\Resources\ActionAttempt\UnlockDoor\Success\Result|null $result, /** - * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created. + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public string|null $created_at, + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Unlocking a door is pending. + */ + final class Pending extends \Seam\Resources\ActionAttempt\UnlockDoor + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, + ); + } + + public function __construct( /** - * Display name that corresponds to the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. + * ID of the action attempt. */ - public string|null $display_name, + string|null $action_attempt_id, /** - * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Action attempt to track the status of locking a door. * - * @var list<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\Errors> + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public array $errors, - public bool|null $is_managed, + string|null $action_type, /** - * 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`. - * - * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\ExternalType>|string|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. - */ - 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. + * Error associated with the action. */ - 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, + public null $error, /** - * 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. + * Result of the action. */ - public string|null $user_identity_id = null, + public null $result, /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public \Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata|null $visionline_metadata = null, - ) {} + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } /** - * 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. + * Unlocking a door is pending. */ - class Warnings + final class Error extends \Seam\Resources\ActionAttempt\UnlockDoor { - public static function from_json(mixed $json): Warnings|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } return new self( - warning_code: $json->warning_code ?? null, - warning_message: $json->warning_message ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\UnlockDoor\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $json->status ?? null, ); } public function __construct( /** - * Indicates a warning related to scanning a credential. + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. * - * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\Warnings\WarningCode>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $warning_code, + string|null $action_type, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Error associated with the action. */ - public string|null $warning_message, - ) {} + public \Seam\Resources\ActionAttempt\UnlockDoor\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } } -namespace Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder { +namespace Seam\Resources\ActionAttempt\UnlockDoor\Success { /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Result of the action. */ - 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, + was_confirmed_by_device: $json->was_confirmed_by_device ?? 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). - * - * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat>|string|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). - */ - 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. + * Indicates whether the device confirmed that the unlock action occurred. */ - public bool|null $pending_auto_update = null, + public bool|null $was_confirmed_by_device = 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 { +namespace Seam\Resources\ActionAttempt\UnlockDoor\Error { /** - * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Error associated with the action. */ - class AkilesMetadata + class Error { - public static function from_json(mixed $json): AkilesMetadata|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } - return new self(member_pin_id: $json->member_pin_id ?? null); + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); } public function __construct( /** - * ID of the Akiles member PIN. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $member_pin_id = null, + public string|null $message, + /** + * Type of the error. + */ + public string|null $type, ) {} } +} +namespace Seam\Resources\ActionAttempt\ScanCredential { /** - * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Reading credential data from the physical encoder is pending. */ - class AssaAbloyVostioMetadata + final class Success extends \Seam\Resources\ActionAttempt\ScanCredential { - public static function from_json( - mixed $json, - ): AssaAbloyVostioMetadata|null { + public static function from_json(mixed $json): Success|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, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\ScanCredential\Success\Result::from_json( + $json->result, + ) + : null, + status: $json->status ?? 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. + * ID of the action attempt. */ - public bool|null $auto_join = null, + string|null $action_attempt_id, /** - * Names of the doors to which to grant access in the Vostio access system. + * Action attempt to track the status of locking a door. * - * @var list|null + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public array|null $door_names = null, + string|null $action_type, + public null $error, /** - * Endpoint ID in the Vostio access system. + * 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. */ - public string|null $endpoint_id = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Success\Result|null $result, /** - * 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 + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public array|null $override_guest_acs_entrance_ids = null, - ) {} + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } /** - * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Reading credential data from the physical encoder is pending. */ - class Errors + final class Pending extends \Seam\Resources\ActionAttempt\ScanCredential { - public static function from_json(mixed $json): Errors|null + public static function from_json(mixed $json): Pending|null { if (!$json) { return null; } return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, - message: $json->message ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, ); } public function __construct( /** - * Date and time at which Seam created the error. + * ID of the action attempt. */ - public string|null $created_at, - public string|null $error_code, - public string|null $message, - ) {} + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public 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. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Reading credential data from the physical encoder is pending. */ - class VisionlineMetadata + final class Error extends \Seam\Resources\ActionAttempt\ScanCredential { - public static function from_json(mixed $json): VisionlineMetadata|null + public static function from_json(mixed $json): Error|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, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\ScanCredential\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $json->status ?? 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. + * ID of the action attempt. */ - public bool|null $auto_join = null, + string|null $action_attempt_id, /** - * Card function type in the Visionline access system. + * Action attempt to track the status of locking a door. * - * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType>|string|null - */ - public string|null $card_function_type = null, - /** - * ID of the card in the Visionline access system. + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $card_id = null, + string|null $action_type, + public \Seam\Resources\ActionAttempt\ScanCredential\Error\Error|null $error, /** - * Common entrance IDs in the Visionline access system. - * - * @var list|null + * 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. */ - public array|null $common_acs_entrance_ids = null, + public null $result, /** - * ID of the credential in the Visionline access system. + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public string|null $credential_id = null, + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Success { + /** + * 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. + */ + 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\Success\Result\AcsCredentialOnEncoder::from_json( + $json->acs_credential_on_encoder, + ) + : null, + acs_credential_on_seam: isset($json->acs_credential_on_seam) + ? \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam::from_json( + $json->acs_credential_on_seam, + ) + : null, + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\Warnings::from_json( + $w, + ), + $json->warnings ?? [], + ), + ); + } + + public function __construct( /** - * Guest entrance IDs in the Visionline access system. - * - * @var list|null + * Snapshot of credential data read from the physical encoder. */ - public array|null $guest_acs_entrance_ids = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnEncoder|null $acs_credential_on_encoder, /** - * Indicates whether the credential is valid. + * Corresponding credential data as stored on Seam and the access system. */ - public bool|null $is_valid = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam|null $acs_credential_on_seam, /** - * IDs of the credentials to which you want to join. + * 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|null + * @var list<\Seam\Resources\ActionAttempt\ScanCredential\Success\Result\Warnings> */ - public array|null $joiner_acs_credential_ids = null, + public array $warnings, ) {} } +} +namespace Seam\Resources\ActionAttempt\ScanCredential\Success\Result { /** - * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Snapshot of credential data read from the physical encoder. */ - class Warnings + class AcsCredentialOnEncoder { - public static function from_json(mixed $json): Warnings|null - { + 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, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - new_code: $json->new_code ?? null, - original_code: $json->original_code ?? 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\Success\Result\AcsCredentialOnEncoder\VisionlineMetadata::from_json( + $json->visionline_metadata, + ) + : null, ); } public function __construct( /** - * Date and time at which Seam created the warning. + * 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, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * 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 $message, + public string|null $ends_at, /** - * 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 + * Indicates whether the credential has been issued (encoded onto a card). */ - public string|null $warning_code, + public bool|null $is_issued, /** - * The PIN code that was assigned instead. + * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) becomes usable. */ - public string|null $new_code = null, + public string|null $starts_at, /** - * The originally requested PIN code that could not be used. + * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public string|null $original_code = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnEncoder\VisionlineMetadata|null $visionline_metadata = 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. + * Corresponding credential data as stored on Seam and the access system. */ - class Result + class AcsCredentialOnSeam { - public static function from_json(mixed $json): Result|null + public static function from_json(mixed $json): AcsCredentialOnSeam|null { if (!$json) { return null; @@ -2176,7 +2124,7 @@ public static function from_json(mixed $json): Result|null errors: array_map( fn( $e, - ) => \Seam\Resources\ActionAttempt\EncodeCredential\Result\Errors::from_json( + ) => \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\Errors::from_json( $e, ), $json->errors ?? [], @@ -2185,7 +2133,7 @@ public static function from_json(mixed $json): Result|null warnings: array_map( fn( $w, - ) => \Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings::from_json( + ) => \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\Warnings::from_json( $w, ), $json->warnings ?? [], @@ -2194,14 +2142,14 @@ public static function from_json(mixed $json): Result|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\EncodeCredential\Result\AkilesMetadata::from_json( + ? \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\AkilesMetadata::from_json( $json->akiles_metadata, ) : null, assa_abloy_vostio_metadata: isset( $json->assa_abloy_vostio_metadata, ) - ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\AssaAbloyVostioMetadata::from_json( + ? \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\AssaAbloyVostioMetadata::from_json( $json->assa_abloy_vostio_metadata, ) : null, @@ -2225,7 +2173,7 @@ public static function from_json(mixed $json): Result|null starts_at: $json->starts_at ?? null, user_identity_id: $json->user_identity_id ?? null, visionline_metadata: isset($json->visionline_metadata) - ? \Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata::from_json( + ? \Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\VisionlineMetadata::from_json( $json->visionline_metadata, ) : null, @@ -2236,7 +2184,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`. * - * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Result\AccessMethod>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\AccessMethod>|string|null */ public string|null $access_method, /** @@ -2262,14 +2210,14 @@ public function __construct( /** * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). * - * @var list<\Seam\Resources\ActionAttempt\EncodeCredential\Result\Errors> + * @var list<\Seam\Resources\ActionAttempt\ScanCredential\Success\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\EncodeCredential\Result\Warnings> + * @var list<\Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\Warnings> */ public array $warnings, /** @@ -2287,11 +2235,11 @@ public function __construct( /** * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ - public \Seam\Resources\ActionAttempt\EncodeCredential\Result\AkilesMetadata|null $akiles_metadata = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Success\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\EncodeCredential\Result\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, + public \Seam\Resources\ActionAttempt\ScanCredential\Success\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). */ @@ -2307,7 +2255,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`. * - * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Result\ExternalType>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\ExternalType>|string|null */ public string|null $external_type = null, /** @@ -2353,12 +2301,136 @@ public function __construct( /** * 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, + public \Seam\Resources\ActionAttempt\ScanCredential\Success\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: $json->warning_code ?? null, + warning_message: $json->warning_message ?? null, + ); + } + + public function __construct( + /** + * Indicates a warning related to scanning a credential. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Success\Result\Warnings\WarningCode>|string|null + */ + public string|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\Success\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: $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). + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnEncoder\VisionlineMetadata\CardFormat>|string|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). + */ + 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\EncodeCredential\Result { +namespace Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnEncoder\VisionlineMetadata { + enum CardFormat: string + { + case TL_CODE = "TLCode"; + case RFID48 = "rfid48"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam { /** * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). */ @@ -2492,7 +2564,7 @@ public function __construct( /** * Card function type in the Visionline access system. * - * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata\CardFunctionType>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\VisionlineMetadata\CardFunctionType>|string|null */ public string|null $card_function_type = null, /** @@ -2559,7 +2631,7 @@ public function __construct( /** * 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 + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\Warnings\WarningCode>|string|null */ public string|null $warning_code, /** @@ -2600,7 +2672,7 @@ enum ExternalType: string } } -namespace Seam\Resources\ActionAttempt\EncodeCredential\Result\VisionlineMetadata { +namespace Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\VisionlineMetadata { enum CardFunctionType: string { case GUEST = "guest"; @@ -2608,7 +2680,7 @@ enum CardFunctionType: string } } -namespace Seam\Resources\ActionAttempt\EncodeCredential\Result\Warnings { +namespace Seam\Resources\ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam\Warnings { enum WarningCode: string { case WAITING_TO_BE_ISSUED = "waiting_to_be_issued"; @@ -2621,124 +2693,324 @@ enum WarningCode: string } } -namespace Seam\Resources\ActionAttempt\ScanToAssignCredential { - /** - * 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 Result +namespace Seam\Resources\ActionAttempt\ScanCredential\Success\Result\Warnings { + enum WarningCode: string { - public static function from_json(mixed $json): Result|null + 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\ScanCredential\Error { + class Error + { + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } return new self( - 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, - 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) - ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AkilesMetadata::from_json( - $json->akiles_metadata, - ) - : null, - assa_abloy_vostio_metadata: isset( - $json->assa_abloy_vostio_metadata, - ) - ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\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: $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\ScanToAssignCredential\Result\VisionlineMetadata::from_json( - $json->visionline_metadata, - ) - : null, + message: $json->message ?? null, + type: $json->type ?? 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 string|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. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $connected_account_id, + public string|null $message, /** - * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created. + * Error type to indicate that the Seam Bridge is disconnected or cannot reach the access control system. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanCredential\Error\Error\Type>|string|null */ - public string|null $created_at, + public string|null $type, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ScanCredential\Error\Error { + enum Type: string + { + case UNCATEGORIZED_ERROR = "uncategorized_error"; + case ACTION_ATTEMPT_EXPIRED = "action_attempt_expired"; + case NO_CREDENTIAL_ON_ENCODER = "no_credential_on_encoder"; + case ENCODER_NOT_ONLINE = "encoder_not_online"; + case ENCODER_COMMUNICATION_TIMEOUT = "encoder_communication_timeout"; + case BRIDGE_DISCONNECTED = "bridge_disconnected"; + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential { + /** + * Encoding credential data from the physical encoder onto a card is pending. + */ + final class Success extends \Seam\Resources\ActionAttempt\EncodeCredential + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Success\Result::from_json( + $json->result, + ) + : null, + status: $json->status ?? null, + ); + } + + public function __construct( /** - * Display name that corresponds to the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. + * ID of the action attempt. */ - public string|null $display_name, + string|null $action_attempt_id, /** - * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Action attempt to track the status of locking a door. * - * @var list<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\Errors> + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public array $errors, + string|null $action_type, + public null $error, /** - * Indicates whether Seam manages the credential. + * Result of an encoding attempt. If the attempt was successful, includes the credential data that was encoded onto the card. */ - public true|null $is_managed, + public \Seam\Resources\ActionAttempt\EncodeCredential\Success\Result|null $result, /** - * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Encoding credential data from the physical encoder onto a card is pending. + */ + final class Pending extends \Seam\Resources\ActionAttempt\EncodeCredential + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public null $error, + /** + * Result of an encoding attempt. If the attempt was successful, includes the credential data that was encoded onto the card. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Encoding credential data from the physical encoder onto a card is pending. + */ + final class Error extends \Seam\Resources\ActionAttempt\EncodeCredential + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public \Seam\Resources\ActionAttempt\EncodeCredential\Error\Error|null $error, + /** + * Result of an encoding attempt. If the attempt was successful, includes the credential data that was encoded onto the card. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential\Success { + /** + * Result of an encoding attempt. If the attempt was successful, includes the credential data that was encoded onto the card. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self( + 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, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, + errors: array_map( + fn( + $e, + ) => \Seam\Resources\ActionAttempt\EncodeCredential\Success\Result\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\EncodeCredential\Success\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) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Success\Result\AkilesMetadata::from_json( + $json->akiles_metadata, + ) + : null, + assa_abloy_vostio_metadata: isset( + $json->assa_abloy_vostio_metadata, + ) + ? \Seam\Resources\ActionAttempt\EncodeCredential\Success\Result\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: $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\EncodeCredential\Success\Result\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`. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Success\Result\AccessMethod>|string|null + */ + public string|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\EncodeCredential\Success\Result\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\ScanToAssignCredential\Result\Warnings> + * @var list<\Seam\Resources\ActionAttempt\EncodeCredential\Success\Result\Warnings> */ public array $warnings, /** @@ -2750,765 +3022,4470 @@ public function __construct( */ 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. + * 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\EncodeCredential\Success\Result\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\EncodeCredential\Success\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, + /** + * 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`. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Success\Result\ExternalType>|string|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. + */ + 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\EncodeCredential\Success\Result\VisionlineMetadata|null $visionline_metadata = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential\Success\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: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Success\Result\VisionlineMetadata\CardFunctionType>|string|null + */ + 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. + * + * @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: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Success\Result\Warnings\WarningCode>|string|null + */ + public string|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\EncodeCredential\Success\Result\VisionlineMetadata { + enum CardFunctionType: string + { + case GUEST = "guest"; + case STAFF = "staff"; + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential\Success\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\EncodeCredential\Error { + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Error type to indicate that the credential was deleted and can no longer be encoded. + * + * @var value-of<\Seam\Resources\ActionAttempt\EncodeCredential\Error\Error\Type>|string|null + */ + public string|null $type, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\EncodeCredential\Error\Error { + enum Type: string + { + case UNCATEGORIZED_ERROR = "uncategorized_error"; + case ACTION_ATTEMPT_EXPIRED = "action_attempt_expired"; + case NO_CREDENTIAL_ON_ENCODER = "no_credential_on_encoder"; + case INCOMPATIBLE_CARD_FORMAT = "incompatible_card_format"; + case CREDENTIAL_CANNOT_BE_REISSUED = "credential_cannot_be_reissued"; + case ENCODER_NOT_ONLINE = "encoder_not_online"; + case ENCODER_COMMUNICATION_TIMEOUT = "encoder_communication_timeout"; + case BRIDGE_DISCONNECTED = "bridge_disconnected"; + case ENCODING_INTERRUPTED = "encoding_interrupted"; + case CREDENTIAL_DELETED = "credential_deleted"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential { + /** + * Scanning a physical card and assigning the credential is pending. + */ + final class Success extends + \Seam\Resources\ActionAttempt\ScanToAssignCredential + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result::from_json( + $json->result, + ) + : null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public null $error, + /** + * Result of a scan to assign attempt. If the attempt was successful, includes the credential data that was scanned and assigned. + */ + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result|null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Scanning a physical card and assigning the credential is pending. + */ + final class Pending extends + \Seam\Resources\ActionAttempt\ScanToAssignCredential + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public null $error, + /** + * Result of a scan to assign attempt. If the attempt was successful, includes the credential data that was scanned and assigned. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Scanning a physical card and assigning the credential is pending. + */ + final class Error extends + \Seam\Resources\ActionAttempt\ScanToAssignCredential + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Error\Error|null $error, + /** + * Result of a scan to assign attempt. If the attempt was successful, includes the credential data that was scanned and assigned. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Success { + /** + * Result of a scan to assign attempt. If the attempt was successful, includes the credential data that was scanned and assigned. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self( + 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, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, + errors: array_map( + fn( + $e, + ) => \Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_managed: $json->is_managed ?? null, + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\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) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result\AkilesMetadata::from_json( + $json->akiles_metadata, + ) + : null, + assa_abloy_vostio_metadata: isset( + $json->assa_abloy_vostio_metadata, + ) + ? \Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result\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: $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\ScanToAssignCredential\Success\Result\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`. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result\AccessMethod>|string|null + */ + public string|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\ScanToAssignCredential\Success\Result\Errors> + */ + public array $errors, + /** + * 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\Success\Result\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\ScanToAssignCredential\Success\Result\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\ScanToAssignCredential\Success\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, + /** + * 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`. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result\ExternalType>|string|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. + */ + 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\ScanToAssignCredential\Success\Result\VisionlineMetadata|null $visionline_metadata = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\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: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result\VisionlineMetadata\CardFunctionType>|string|null + */ + 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. + * + * @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: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\Result\Warnings\WarningCode>|string|null + */ + public string|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\ScanToAssignCredential\Success\Result\VisionlineMetadata { + enum CardFunctionType: string + { + case GUEST = "guest"; + case STAFF = "staff"; + } +} + +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Success\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\Error { + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Error type to indicate that there is no credential on the encoder. + * + * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Error\Error\Type>|string|null + */ + public string|null $type, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Error\Error { + enum Type: string + { + case UNCATEGORIZED_ERROR = "uncategorized_error"; + case ACTION_ATTEMPT_EXPIRED = "action_attempt_expired"; + case NO_CREDENTIAL_ON_ENCODER = "no_credential_on_encoder"; + } +} + +namespace Seam\Resources\ActionAttempt\AssignCredential { + /** + * Assigning a credential to an access method is pending. + */ + final class Success extends \Seam\Resources\ActionAttempt\AssignCredential + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\AssignCredential\Success\Result::from_json( + $json->result, + ) + : null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public null $error, + /** + * Result of assigning a credential. If successful, includes the updated access method with the assigned credential. + */ + public \Seam\Resources\ActionAttempt\AssignCredential\Success\Result|null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Assigning a credential to an access method is pending. + */ + final class Pending extends \Seam\Resources\ActionAttempt\AssignCredential + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public null $error, + /** + * Result of assigning a credential. If successful, includes the updated access method with the assigned credential. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Assigning a credential to an access method is pending. + */ + final class Error extends \Seam\Resources\ActionAttempt\AssignCredential + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\AssignCredential\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + public \Seam\Resources\ActionAttempt\AssignCredential\Error\Error|null $error, + /** + * Result of assigning a credential. If successful, includes the updated access method with the assigned credential. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\AssignCredential\Success { + /** + * Result of assigning a credential. If successful, includes the updated access method with the assigned credential. + */ + class Result + { + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self( + access_method_id: $json->access_method_id ?? null, + created_at: $json->created_at ?? null, + display_name: $json->display_name ?? null, + display_status: $json->display_status ?? null, + errors: array_map( + fn( + $e, + ) => \Seam\Resources\ActionAttempt\AssignCredential\Success\Result\Errors::from_json( + $e, + ), + $json->errors ?? [], + ), + is_issued: $json->is_issued ?? null, + issued_at: $json->issued_at ?? null, + mode: $json->mode ?? null, + pending_mutations: array_map( + fn( + $p, + ) => \Seam\Resources\ActionAttempt\AssignCredential\Success\Result\PendingMutations::from_json( + $p, + ), + $json->pending_mutations ?? [], + ), + warnings: array_map( + fn( + $w, + ) => \Seam\Resources\ActionAttempt\AssignCredential\Success\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( + /** + * ID of the access method. + */ + public string|null $access_method_id, + /** + * Date and time at which the access method was created. + */ + public string|null $created_at, + /** + * Display name of the access method. + */ + public string|null $display_name, + /** + * Human-readable sentence describing where the access method sits in its relationship with the device or access system, for example `Awaiting encoding`. For display only. The wording is not stable and is not an enumeration — it may change at any time, so never compare against or branch on it. To make decisions, read `is_issued`, `errors`, and `pending_mutations`. + */ + public string|null $display_status, + /** + * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * + * @var list<\Seam\Resources\ActionAttempt\AssignCredential\Success\Result\Errors> + */ + public array $errors, + /** + * Indicates whether the access method has been issued. + */ + public bool|null $is_issued, + /** + * Date and time at which the access method was issued. + */ + public string|null $issued_at, + /** + * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Success\Result\Mode>|string|null + */ + 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. + * + * @var list<\Seam\Resources\ActionAttempt\AssignCredential\Success\Result\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\ActionAttempt\AssignCredential\Success\Result\Warnings> + */ + public array $warnings, + /** + * ID of the Seam workspace associated with the access method. + */ + public string|null $workspace_id, + /** + * Token of the client session associated with the access method. + */ + public string|null $client_session_token = null, + /** + * The actual PIN code for code access methods. + */ + public string|null $code = null, + /** + * ID of the customization profile associated with the access method. + */ + public string|null $customization_profile_id = 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. + */ + public bool|null $is_encoding_required = 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. + */ + public bool|null $is_ready_for_encoding = null, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\AssignCredential\Success\Result { + /** + * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + */ + 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. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Success\Result\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. + */ + 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) + ? \Seam\Resources\ActionAttempt\AssignCredential\Success\Result\PendingMutations\From::from_json( + $json->from, + ) + : null, + message: $json->message ?? null, + mutation_code: $json->mutation_code ?? null, + to: isset($json->to) + ? \Seam\Resources\ActionAttempt\AssignCredential\Success\Result\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 \Seam\Resources\ActionAttempt\AssignCredential\Success\Result\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. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Success\Result\PendingMutations\MutationCode>|string|null + */ + public string|null $mutation_code, + /** + * New access time configuration. + */ + public \Seam\Resources\ActionAttempt\AssignCredential\Success\Result\PendingMutations\To|null $to, + ) {} + } + + /** + * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + */ + 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, + original_access_method_id: $json->original_access_method_id ?? + 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. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Success\Result\Warnings\WarningCode>|string|null + */ + public 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, + ) {} + } + + enum Mode: string + { + case CODE = "code"; + case CARD = "card"; + case MOBILE_KEY = "mobile_key"; + case CLOUD_KEY = "cloud_key"; + } +} + +namespace Seam\Resources\ActionAttempt\AssignCredential\Success\Result\Errors { + enum ErrorCode: string + { + case FAILED_TO_ISSUE = "failed_to_issue"; + } +} + +namespace Seam\Resources\ActionAttempt\AssignCredential\Success\Result\PendingMutations { + /** + * 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, + ) {} + } + + 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\Success\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\AssignCredential\Error { + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + public function __construct( + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Error type to indicate that no matching credential was found. + * + * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Error\Error\Type>|string|null + */ + public string|null $type, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\AssignCredential\Error\Error { + enum Type: string + { + case UNCATEGORIZED_ERROR = "uncategorized_error"; + case ACTION_ATTEMPT_EXPIRED = "action_attempt_expired"; + case CREDENTIAL_NOT_FOUND = "credential_not_found"; + } +} + +namespace Seam\Resources\ActionAttempt\ResetSandboxWorkspace { + /** + * Resetting a sandbox workspace is pending. + */ + final class Success extends + \Seam\Resources\ActionAttempt\ResetSandboxWorkspace + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Resetting a sandbox workspace is pending. + */ + final class Pending extends + \Seam\Resources\ActionAttempt\ResetSandboxWorkspace + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Resetting a sandbox workspace is pending. + */ + final class Error extends + \Seam\Resources\ActionAttempt\ResetSandboxWorkspace + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\ResetSandboxWorkspace\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\ResetSandboxWorkspace\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\ResetSandboxWorkspace\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\SetFanMode { + /** + * Setting the fan mode is pending. + */ + final class Success extends \Seam\Resources\ActionAttempt\SetFanMode + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Setting the fan mode is pending. + */ + final class Pending extends \Seam\Resources\ActionAttempt\SetFanMode + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Setting the fan mode is pending. + */ + final class Error extends \Seam\Resources\ActionAttempt\SetFanMode + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\SetFanMode\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\SetFanMode\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\SetFanMode\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\SetHvacMode { + /** + * Setting the HVAC mode is pending. + */ + final class Success extends \Seam\Resources\ActionAttempt\SetHvacMode + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Setting the HVAC mode is pending. + */ + final class Pending extends \Seam\Resources\ActionAttempt\SetHvacMode + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Setting the HVAC mode is pending. + */ + final class Error extends \Seam\Resources\ActionAttempt\SetHvacMode + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\SetHvacMode\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\SetHvacMode\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\SetHvacMode\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ActivateClimatePreset { + /** + * Activating a climate preset is pending. + */ + final class Success extends + \Seam\Resources\ActionAttempt\ActivateClimatePreset + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Activating a climate preset is pending. + */ + final class Pending extends + \Seam\Resources\ActionAttempt\ActivateClimatePreset + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Activating a climate preset is pending. + */ + final class Error extends + \Seam\Resources\ActionAttempt\ActivateClimatePreset + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\ActivateClimatePreset\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\ActivateClimatePreset\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\ActivateClimatePreset\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry { + /** + * Simulating a keypad code entry is pending. + */ + final class Success extends + \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Simulating a keypad code entry is pending. + */ + final class Pending extends + \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Simulating a keypad code entry is pending. + */ + final class Error extends + \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\SimulateKeypadCodeEntry\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad { + /** + * Simulating a manual lock action using a keypad is pending. + */ + final class Success extends + \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Simulating a manual lock action using a keypad is pending. + */ + final class Pending extends + \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Simulating a manual lock action using a keypad is pending. + */ + final class Error extends + \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\SimulateManualLockViaKeypad\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\PushThermostatPrograms { + /** + * Pushing thermostat weekly programs is pending. + */ + final class Success extends + \Seam\Resources\ActionAttempt\PushThermostatPrograms + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Pushing thermostat weekly programs is pending. + */ + final class Pending extends + \Seam\Resources\ActionAttempt\PushThermostatPrograms + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Pushing thermostat weekly programs is pending. + */ + final class Error extends + \Seam\Resources\ActionAttempt\PushThermostatPrograms + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\PushThermostatPrograms\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\PushThermostatPrograms\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\PushThermostatPrograms\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\ConfigureAutoLock { + /** + * Configuring the auto-lock is pending. + */ + final class Success extends \Seam\Resources\ActionAttempt\ConfigureAutoLock + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Configuring the auto-lock is pending. + */ + final class Pending extends \Seam\Resources\ActionAttempt\ConfigureAutoLock + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + /** + * Configuring the auto-lock is pending. + */ + final class Error extends \Seam\Resources\ActionAttempt\ConfigureAutoLock + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\ConfigureAutoLock\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\ConfigureAutoLock\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\ConfigureAutoLock\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\SyncAccessCodes { + final class Success extends \Seam\Resources\ActionAttempt\SyncAccessCodes + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + final class Pending extends \Seam\Resources\ActionAttempt\SyncAccessCodes + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + final class Error extends \Seam\Resources\ActionAttempt\SyncAccessCodes + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\SyncAccessCodes\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\SyncAccessCodes\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\SyncAccessCodes\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + 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, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\CreateAccessCode { + final class Success extends \Seam\Resources\ActionAttempt\CreateAccessCode + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\CreateAccessCode\Success\Result::from_json( + $json->result, + ) + : null, + status: $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. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public \Seam\Resources\ActionAttempt\CreateAccessCode\Success\Result|null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + final class Pending extends \Seam\Resources\ActionAttempt\CreateAccessCode + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, + ); + } + + public function __construct( + /** + * ID of the action attempt. */ - public string|null $acs_user_id = null, + string|null $action_attempt_id, /** - * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AkilesMetadata|null $akiles_metadata = null, + string|null $action_type, /** - * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Error associated with the action. */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\AssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata = null, + public null $error, /** - * Number of the card associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Result of the action. */ - public string|null $card_number = null, + public null $result, /** - * Access (PIN) code for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public string|null $code = null, + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + final class Error extends \Seam\Resources\ActionAttempt\CreateAccessCode + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\CreateAccessCode\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $json->status ?? null, + ); + } + + public function __construct( /** - * 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`. + * ID of the action attempt. */ - public string|null $ends_at = null, + string|null $action_attempt_id, /** - * 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`. + * Action attempt to track the status of locking a door. * - * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\ExternalType>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $external_type = null, + string|null $action_type, /** - * Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type. + * Error associated with the action. */ - public string|null $external_type_display_name = null, + public \Seam\Resources\ActionAttempt\CreateAccessCode\Error\Error|null $error, /** - * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) has been encoded onto a card. + * Result of the action. */ - public bool|null $is_issued = null, + public null $result, /** - * 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. + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public bool|null $is_latest_desired_state_synced_with_provider = null, + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\CreateAccessCode\Success { + /** + * Result of the action. + */ + 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( /** - * 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). + * Created access code. + * + * @var array|\stdClass|null */ - public bool|null $is_multi_phone_sync_credential = null, + public array|\stdClass|null $access_code, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\CreateAccessCode\Error { + /** + * Error associated with the action. + */ + class Error + { + public static function from_json(mixed $json): Error|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); + } + + public function __construct( /** - * 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. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public bool|null $is_one_time_use = null, + public string|null $message, /** - * Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was encoded onto a card. + * Type of the error. */ - public string|null $issued_at = null, + public string|null $type, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\DeleteAccessCode { + final class Success extends \Seam\Resources\ActionAttempt\DeleteAccessCode + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $json->status ?? null, + ); + } + + public function __construct( /** - * 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. + * ID of the action attempt. */ - public string|null $latest_desired_state_synced_with_provider_at = null, + string|null $action_attempt_id, /** - * ID of the parent [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $parent_acs_credential_id = null, + string|null $action_type, /** - * 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. + * Error associated with the action. */ - public string|null $starts_at = null, + public null $error, /** - * 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. + * Result of the action. */ - public string|null $user_identity_id = null, + public mixed $result, /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public \Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata|null $visionline_metadata = null, - ) {} + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } -} -namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Result { - /** - * Akiles-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). - */ - class AkilesMetadata + final class Pending extends \Seam\Resources\ActionAttempt\DeleteAccessCode { - public static function from_json(mixed $json): AkilesMetadata|null + public static function from_json(mixed $json): Pending|null { if (!$json) { return null; } - return new self(member_pin_id: $json->member_pin_id ?? null); + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, + ); } public function __construct( /** - * ID of the Akiles member PIN. + * ID of the action attempt. */ - public string|null $member_pin_id = null, - ) {} + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null + */ + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } - /** - * Vostio-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). - */ - class AssaAbloyVostioMetadata + final class Error extends \Seam\Resources\ActionAttempt\DeleteAccessCode { - public static function from_json( - mixed $json, - ): AssaAbloyVostioMetadata|null { + public static function from_json(mixed $json): Error|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, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\DeleteAccessCode\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $json->status ?? 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. + * ID of the action attempt. */ - public bool|null $auto_join = null, + string|null $action_attempt_id, /** - * Names of the doors to which to grant access in the Vostio access system. + * Action attempt to track the status of locking a door. * - * @var list|null - */ - public array|null $door_names = null, - /** - * Endpoint ID in the Vostio access system. + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $endpoint_id = null, + string|null $action_type, /** - * Key ID in the Vostio access system. + * Error associated with the action. */ - public string|null $key_id = null, + public \Seam\Resources\ActionAttempt\DeleteAccessCode\Error\Error|null $error, /** - * Key issuing request ID in the Vostio access system. + * Result of the action. */ - public string|null $key_issuing_request_id = null, + public null $result, /** - * IDs of the guest entrances to override in the Vostio access system. - * - * @var list|null + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public array|null $override_guest_acs_entrance_ids = null, - ) {} + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } +} +namespace Seam\Resources\ActionAttempt\DeleteAccessCode\Error { /** - * Errors associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). + * Error associated with the action. */ - class Errors + class Error { - public static function from_json(mixed $json): Errors|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, message: $json->message ?? null, + type: $json->type ?? null, ); } public function __construct( /** - * Date and time at which Seam created the error. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $created_at, - public string|null $error_code, public string|null $message, + /** + * Type of the error. + */ + public string|null $type, ) {} } +} - /** - * Visionline-specific metadata for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). - */ - class VisionlineMetadata +namespace Seam\Resources\ActionAttempt\UpdateAccessCode { + final class Success extends \Seam\Resources\ActionAttempt\UpdateAccessCode { - public static function from_json(mixed $json): VisionlineMetadata|null + public static function from_json(mixed $json): Success|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, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\UpdateAccessCode\Success\Result::from_json( + $json->result, + ) + : null, + status: $json->status ?? 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. + * ID of the action attempt. */ - public bool|null $auto_join = null, + string|null $action_attempt_id, /** - * Card function type in the Visionline access system. + * Action attempt to track the status of locking a door. * - * @var value-of<\Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata\CardFunctionType>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $card_function_type = null, + string|null $action_type, /** - * ID of the card in the Visionline access system. + * Error associated with the action. */ - public string|null $card_id = null, + public null $error, /** - * Common entrance IDs in the Visionline access system. - * - * @var list|null + * Result of the action. */ - public array|null $common_acs_entrance_ids = null, + public \Seam\Resources\ActionAttempt\UpdateAccessCode\Success\Result|null $result, /** - * ID of the credential in the Visionline access system. + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public string|null $credential_id = null, + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + final class Pending extends \Seam\Resources\ActionAttempt\UpdateAccessCode + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, + ); + } + + public function __construct( /** - * Guest entrance IDs in the Visionline access system. + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. * - * @var list|null + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public array|null $guest_acs_entrance_ids = null, + string|null $action_type, /** - * Indicates whether the credential is valid. + * Error associated with the action. */ - public bool|null $is_valid = null, + public null $error, /** - * IDs of the credentials to which you want to join. - * - * @var list|null + * Result of the action. */ - public array|null $joiner_acs_credential_ids = null, - ) {} + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } - /** - * Warnings associated with the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials). - */ - class Warnings + final class Error extends \Seam\Resources\ActionAttempt\UpdateAccessCode { - public static function from_json(mixed $json): Warnings|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - new_code: $json->new_code ?? null, - original_code: $json->original_code ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\UpdateAccessCode\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $json->status ?? null, ); } public function __construct( /** - * Date and time at which Seam created the warning. + * ID of the action attempt. */ - public string|null $created_at, + string|null $action_attempt_id, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $message, + string|null $action_type, /** - * 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 + * Error associated with the action. */ - public string|null $warning_code, + public \Seam\Resources\ActionAttempt\UpdateAccessCode\Error\Error|null $error, /** - * The PIN code that was assigned instead. + * Result of the action. */ - public string|null $new_code = null, + public null $result, /** - * The originally requested PIN code that could not be used. + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|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"; + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } } -namespace Seam\Resources\ActionAttempt\ScanToAssignCredential\Result\VisionlineMetadata { - enum CardFunctionType: string +namespace Seam\Resources\ActionAttempt\UpdateAccessCode\Success { + /** + * Result of the action. + */ + class Result { - case GUEST = "guest"; - case STAFF = "staff"; - } -} + public static function from_json(mixed $json): Result|null + { + if (!$json) { + return null; + } + return new self(access_code: $json->access_code ?? null); + } -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"; + public function __construct( + /** + * Updated access code. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $access_code = null, + ) {} } } -namespace Seam\Resources\ActionAttempt\AssignCredential { +namespace Seam\Resources\ActionAttempt\UpdateAccessCode\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. + * Error associated with the action. */ - class Result + class Error { - public static function from_json(mixed $json): Result|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; - } - return new self( - access_method_id: $json->access_method_id ?? null, - created_at: $json->created_at ?? null, - display_name: $json->display_name ?? null, - display_status: $json->display_status ?? 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: $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, + } + return new self( + message: $json->message ?? null, + type: $json->type ?? null, ); } public function __construct( /** - * ID of the access method. - */ - public string|null $access_method_id, - /** - * Date and time at which the access method was created. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $created_at, + public string|null $message, /** - * Display name of the access method. + * Type of the error. */ - public string|null $display_name, + public string|null $type, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\CreateNoiseThreshold { + final class Success extends + \Seam\Resources\ActionAttempt\CreateNoiseThreshold + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Success\Result::from_json( + $json->result, + ) + : null, + status: $json->status ?? null, + ); + } + + public function __construct( /** - * Human-readable sentence describing where the access method sits in its relationship with the device or access system, for example `Awaiting encoding`. For display only. The wording is not stable and is not an enumeration — it may change at any time, so never compare against or branch on it. To make decisions, read `is_issued`, `errors`, and `pending_mutations`. + * ID of the action attempt. */ - public string|null $display_status, + string|null $action_attempt_id, /** - * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Action attempt to track the status of locking a door. * - * @var list<\Seam\Resources\ActionAttempt\AssignCredential\Result\Errors> + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public array $errors, + string|null $action_type, /** - * Indicates whether the access method has been issued. + * Error associated with the action. */ - public bool|null $is_issued, + public null $error, /** - * Date and time at which the access method was issued. + * Result of the action. */ - public string|null $issued_at, + public \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Success\Result|null $result, /** - * Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`. - * - * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Result\Mode>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public string|null $mode, + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + final class Pending extends + \Seam\Resources\ActionAttempt\CreateNoiseThreshold + { + public static function from_json(mixed $json): Pending|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, + ); + } + + 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. - * - * @var list<\Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations> + * ID of the action attempt. */ - public array $pending_mutations, + string|null $action_attempt_id, /** - * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Action attempt to track the status of locking a door. * - * @var list<\Seam\Resources\ActionAttempt\AssignCredential\Result\Warnings> + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public array $warnings, + string|null $action_type, /** - * ID of the Seam workspace associated with the access method. + * Error associated with the action. */ - public string|null $workspace_id, + public null $error, /** - * Token of the client session associated with the access method. + * Result of the action. */ - public string|null $client_session_token = null, + public null $result, /** - * The actual PIN code for code access methods. + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public string|null $code = null, + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } + + final class Error extends \Seam\Resources\ActionAttempt\CreateNoiseThreshold + { + public static function from_json(mixed $json): Error|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) + ? \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $json->status ?? null, + ); + } + + public function __construct( /** - * ID of the customization profile associated with the access method. + * ID of the action attempt. */ - public string|null $customization_profile_id = null, + string|null $action_attempt_id, /** - * URL of the Instant Key for mobile key access methods. + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $instant_key_url = null, + string|null $action_type, /** - * 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. + * Error associated with the action. */ - public bool|null $is_assignment_required = null, + public \Seam\Resources\ActionAttempt\CreateNoiseThreshold\Error\Error|null $error, /** - * Indicates whether encoding with an card encoder is required to issue or reissue the plastic card associated with the access method. + * Result of the action. */ - public bool|null $is_encoding_required = null, + public null $result, /** - * 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. + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public bool|null $is_ready_for_assignment = null, + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } + } +} + +namespace Seam\Resources\ActionAttempt\CreateNoiseThreshold\Success { + /** + * Result of the action. + */ + 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( /** - * 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. + * Created noise threshold. + * + * @var array|\stdClass|null */ - public bool|null $is_ready_for_encoding = null, + public array|\stdClass|null $noise_threshold, ) {} } } -namespace Seam\Resources\ActionAttempt\AssignCredential\Result { +namespace Seam\Resources\ActionAttempt\CreateNoiseThreshold\Error { /** - * Errors associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). + * Error associated with the action. */ - class Errors + class Error { - public static function from_json(mixed $json): Errors|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } return new self( - created_at: $json->created_at ?? null, - error_code: $json->error_code ?? null, message: $json->message ?? null, + type: $json->type ?? null, ); } public function __construct( /** - * Date and time at which Seam created the error. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $created_at, + public string|null $message, /** - * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * Type of the error. + */ + public string|null $type, + ) {} + } +} + +namespace Seam\Resources\ActionAttempt\DeleteNoiseThreshold { + final class Success extends + \Seam\Resources\ActionAttempt\DeleteNoiseThreshold + { + public static function from_json(mixed $json): Success|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: $json->result ?? null, + status: $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. * - * @var value-of<\Seam\Resources\ActionAttempt\AssignCredential\Result\Errors\ErrorCode>|string|null + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $error_code, + string|null $action_type, /** - * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + * Error associated with the action. */ - public string|null $message, - ) {} + public null $error, + /** + * Result of the action. + */ + public mixed $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } - /** - * 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 + final class Pending extends + \Seam\Resources\ActionAttempt\DeleteNoiseThreshold { - public static function from_json(mixed $json): PendingMutations|null + public static function from_json(mixed $json): Pending|null { if (!$json) { return null; } return new self( - 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: $json->mutation_code ?? null, - to: isset($json->to) - ? \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\To::from_json( - $json->to, - ) - : null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, ); } public function __construct( /** - * Date and time at which the mutation was created. + * ID of the action attempt. */ - public string|null $created_at, + string|null $action_attempt_id, /** - * Previous access time configuration. + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\From|null $from, + string|null $action_type, /** - * Detailed description of the mutation. + * Error associated with the action. */ - public string|null $message, + public null $error, /** - * 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 + * Result of the action. */ - public string|null $mutation_code, + public null $result, /** - * New access time configuration. + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null */ - public \Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations\To|null $to, - ) {} + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } - /** - * Warnings associated with the [access method](https://docs.seam.co/use-cases/granting-access/creating-an-access-grant). - */ - class Warnings + final class Error extends \Seam\Resources\ActionAttempt\DeleteNoiseThreshold { - public static function from_json(mixed $json): Warnings|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } return new self( - created_at: $json->created_at ?? null, - message: $json->message ?? null, - warning_code: $json->warning_code ?? null, - original_access_method_id: $json->original_access_method_id ?? - null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\DeleteNoiseThreshold\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $json->status ?? null, ); } public function __construct( /** - * Date and time at which Seam created the warning. + * ID of the action attempt. */ - public string|null $created_at, + string|null $action_attempt_id, /** - * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public string|null $message, + string|null $action_type, /** - * 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 + * Error associated with the action. */ - public string|null $warning_code, + public \Seam\Resources\ActionAttempt\DeleteNoiseThreshold\Error\Error|null $error, /** - * ID of the original access method from which this backup access method was split, if applicable. + * Result of the action. */ - 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"; + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } } -namespace Seam\Resources\ActionAttempt\AssignCredential\Result\PendingMutations { +namespace Seam\Resources\ActionAttempt\DeleteNoiseThreshold\Error { /** - * Previous access time configuration. + * Error associated with the action. */ - class From + class Error { - public static function from_json(mixed $json): From|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } return new self( - ends_at: $json->ends_at ?? null, - starts_at: $json->starts_at ?? null, + message: $json->message ?? null, + type: $json->type ?? null, ); } public function __construct( /** - * Previous end time for access. + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public string|null $ends_at, + public string|null $message, /** - * Previous start time for access. + * Type of the error. */ - public string|null $starts_at, + public string|null $type, ) {} } +} - /** - * New access time configuration. - */ - class To +namespace Seam\Resources\ActionAttempt\UpdateNoiseThreshold { + final class Success extends + \Seam\Resources\ActionAttempt\UpdateNoiseThreshold { - public static function from_json(mixed $json): To|null + public static function from_json(mixed $json): Success|null { if (!$json) { return null; } return new self( - ends_at: $json->ends_at ?? null, - starts_at: $json->starts_at ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: isset($json->result) + ? \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Success\Result::from_json( + $json->result, + ) + : null, + status: $json->status ?? null, ); } public function __construct( /** - * New end time for access. + * ID of the action attempt. */ - public string|null $ends_at, + string|null $action_attempt_id, /** - * New start time for access. + * Action attempt to track the status of locking a door. + * + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - 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"; + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Success\Result|null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } -} -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 + final class Pending extends + \Seam\Resources\ActionAttempt\UpdateNoiseThreshold { - public static function from_json(mixed $json): Result|null + public static function from_json(mixed $json): Pending|null { if (!$json) { return null; } - return new self(access_code: $json->access_code ?? null); + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: null, + result: null, + status: $json->status ?? null, + ); } public function __construct( /** - * Created access code. + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. * - * @var array|\stdClass|null + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public array|\stdClass|null $access_code, - ) {} + string|null $action_type, + /** + * Error associated with the action. + */ + public null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } -} -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 + final class Error extends \Seam\Resources\ActionAttempt\UpdateNoiseThreshold { - public static function from_json(mixed $json): Result|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } - return new self(access_code: $json->access_code ?? null); + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Error\Error::from_json( + $json->error, + ) + : null, + result: null, + status: $json->status ?? null, + ); } public function __construct( /** - * Updated access code. + * ID of the action attempt. + */ + string|null $action_attempt_id, + /** + * Action attempt to track the status of locking a door. * - * @var array|\stdClass|null + * @var value-of<\Seam\Resources\ActionAttempt\ActionType>|string|null */ - public array|\stdClass|null $access_code = null, - ) {} + string|null $action_type, + /** + * Error associated with the action. + */ + public \Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Error\Error|null $error, + /** + * Result of the action. + */ + public null $result, + /** + * @var value-of<\Seam\Resources\ActionAttempt\Status>|string|null + */ + string|null $status, + ) { + parent::__construct( + action_attempt_id: $action_attempt_id, + action_type: $action_type, + status: $status, + ); + } } } -namespace Seam\Resources\ActionAttempt\CreateNoiseThreshold { +namespace Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Success { /** - * Result of the action. Null while the action attempt is pending or when this value does not apply. + * Result of the action. */ class Result { @@ -3522,7 +7499,7 @@ public static function from_json(mixed $json): Result|null public function __construct( /** - * Created noise threshold. + * Updated noise threshold. * * @var array|\stdClass|null */ @@ -3531,27 +7508,32 @@ public function __construct( } } -namespace Seam\Resources\ActionAttempt\UpdateNoiseThreshold { +namespace Seam\Resources\ActionAttempt\UpdateNoiseThreshold\Error { /** - * Result of the action. Null while the action attempt is pending or when this value does not apply. + * Error associated with the action. */ - class Result + class Error { - public static function from_json(mixed $json): Result|null + public static function from_json(mixed $json): Error|null { if (!$json) { return null; } - return new self(noise_threshold: $json->noise_threshold ?? null); + return new self( + message: $json->message ?? null, + type: $json->type ?? null, + ); } public function __construct( /** - * Updated noise threshold. - * - * @var array|\stdClass|null + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ - public array|\stdClass|null $noise_threshold, + public string|null $message, + /** + * Type of the error. + */ + public string|null $type, ) {} } } diff --git a/tests/ActionAttemptTest.php b/tests/ActionAttemptTest.php new file mode 100644 index 00000000..e12be62a --- /dev/null +++ b/tests/ActionAttemptTest.php @@ -0,0 +1,196 @@ + "attempt_1", + "action_type" => "LOCK_DOOR", + ], + $payload, + ), + ), + ), + ); + + $this->assertNotNull($attempt); + + return $attempt; + } + + public function testSuccessExposesANonNullResult(): void + { + $attempt = $this->attempt([ + "status" => "success", + "result" => ["was_confirmed_by_device" => true], + ]); + + $this->assertInstanceOf(LockDoor\Success::class, $attempt); + $this->assertInstanceOf(LockDoor::class, $attempt); + $this->assertSame("success", $attempt->status); + $this->assertInstanceOf( + LockDoor\Success\Result::class, + $attempt->result, + ); + $this->assertTrue($attempt->result->was_confirmed_by_device); + $this->assertNull($attempt->error); + } + + public function testErrorExposesANonNullError(): void + { + $attempt = $this->attempt([ + "status" => "error", + "error" => ["type" => "device_offline", "message" => "Offline"], + ]); + + $this->assertInstanceOf(LockDoor\Error::class, $attempt); + $this->assertSame("error", $attempt->status); + $this->assertInstanceOf(LockDoor\Error\Error::class, $attempt->error); + $this->assertSame("Offline", $attempt->error->message); + $this->assertSame("device_offline", $attempt->error->type); + $this->assertNull($attempt->result); + } + + public function testPendingHasANullResultAndError(): void + { + $attempt = $this->attempt(["status" => "pending"]); + + $this->assertInstanceOf(LockDoor\Pending::class, $attempt); + $this->assertSame("pending", $attempt->status); + $this->assertNull($attempt->result); + $this->assertNull($attempt->error); + } + + public function testResultSentWhilePendingIsStillNull(): void + { + $attempt = $this->attempt([ + "status" => "pending", + "result" => ["was_confirmed_by_device" => true], + "error" => ["type" => "foo", "message" => "bar"], + ]); + + $this->assertInstanceOf(LockDoor\Pending::class, $attempt); + $this->assertNull($attempt->result); + $this->assertNull($attempt->error); + } + + public function testInapplicablePropertiesAreDeclaredWithTheNullType(): void + { + foreach ( + [ + [LockDoor\Pending::class, "result"], + [LockDoor\Pending::class, "error"], + [LockDoor\Success::class, "error"], + [LockDoor\Error::class, "result"], + ] + as [$className, $propertyName] + ) { + $type = (new ReflectionProperty( + $className, + $propertyName, + ))->getType(); + + $this->assertInstanceOf(ReflectionNamedType::class, $type); + $this->assertSame( + "null", + $type->getName(), + "{$className}::\${$propertyName} should have the null type", + ); + } + + $successResult = (new ReflectionProperty( + LockDoor\Success::class, + "result", + ))->getType(); + + $this->assertInstanceOf(ReflectionNamedType::class, $successResult); + $this->assertSame( + LockDoor\Success\Result::class, + $successResult->getName(), + ); + } + + public function testInapplicablePropertiesRejectNonNullValues(): void + { + $this->expectException(TypeError::class); + + new LockDoor\Success( + action_attempt_id: "attempt_1", + action_type: "LOCK_DOOR", + error: new LockDoor\Error\Error( + message: "Offline", + type: "device_offline", + ), + result: null, + status: "success", + ); + } + + public function testUnknownActionTypeUsesTheBaseClass(): void + { + $attempt = $this->attempt([ + "action_type" => "FUTURE_ACTION", + "status" => "success", + ]); + + $this->assertSame(ActionAttempt::class, $attempt::class); + $this->assertSame("FUTURE_ACTION", $attempt->action_type); + $this->assertSame("success", $attempt->status); + } + + public function testUnknownStatusUsesTheActionTypeClass(): void + { + $attempt = $this->attempt(["status" => "future_status"]); + + $this->assertSame(LockDoor::class, $attempt::class); + $this->assertSame("LOCK_DOOR", $attempt->action_type); + $this->assertSame("future_status", $attempt->status); + } + + public function testFailedErrorReadsTheErrorFromTheStatusSubclass(): void + { + $attempt = $this->attempt([ + "status" => "error", + "error" => ["type" => "device_offline", "message" => "Offline"], + ]); + + $error = new ActionAttemptFailedError($attempt); + + $this->assertSame("Offline", $error->getMessage()); + $this->assertSame("device_offline", $error->getErrorCode()); + $this->assertSame($attempt, $error->getActionAttempt()); + } + + public function testFailedErrorFallsBackWithoutAnErrorProperty(): void + { + $attempt = $this->attempt([ + "action_type" => "FUTURE_ACTION", + "status" => "error", + "error" => ["type" => "foo", "message" => "bar"], + ]); + + $this->assertSame(ActionAttempt::class, $attempt::class); + + $error = new ActionAttemptFailedError($attempt); + + $this->assertSame("Action attempt failed", $error->getMessage()); + $this->assertSame("unknown_error", $error->getErrorCode()); + } +} diff --git a/tests/LiteralBooleanTypesTest.php b/tests/LiteralBooleanTypesTest.php index d0f5fadc..95f370c1 100644 --- a/tests/LiteralBooleanTypesTest.php +++ b/tests/LiteralBooleanTypesTest.php @@ -66,7 +66,7 @@ public function testAccessCodeBooleanConstraintsArePreserved(): void $this->assertSame( "?bool", (string) (new ReflectionProperty( - ActionAttempt\ScanCredential\Result\AcsCredentialOnSeam::class, + ActionAttempt\ScanCredential\Success\Result\AcsCredentialOnSeam::class, "is_managed", ))->getType(), );