diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..61ea5dd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[*.php] +indent_size = 4 + +[Makefile] +indent_style = tab diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 02e9280..977019b 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -5,7 +5,7 @@ inputs: node_version: description: The Node.js version. required: false - default: "20" + default: '20' registry_url: description: The Node.js package registry URL. required: false @@ -13,7 +13,7 @@ inputs: install_dependencies: description: Install dependencies. required: false - default: "true" + default: 'true' runs: using: composite diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a0b1f29 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,24 @@ +--- +version: 2 +updates: + - package-ecosystem: npm + directory: '/' + schedule: + interval: daily + commit-message: + prefix: feat + include: scope + allow: + - dependency-type: development + ignore: + - dependency-name: '*' + update-types: + - 'version-update:semver-major' + groups: + seam: + dependency-type: development + patterns: + - '@seamapi/*' + update-types: + - patch + - minor diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000..2e9062b --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,62 @@ +--- +name: Automerge + +on: + pull_request: + branches: + - main + +jobs: + changes: + name: Get changes + runs-on: ubuntu-latest + timeout-minutes: 30 + if: github.actor == 'dependabot[bot]' + permissions: + checks: read + outputs: + has_changes: ${{ steps.changed.outputs.any_changed == 'true' }} + is_generation_successful: ${{ steps.checks.outputs.conclusion == 'success' }} + steps: + - name: Wait for checks + uses: fountainhead/action-wait-for-check@v1.2.0 + id: checks + with: + checkName: Generate code + ref: ${{ github.event.pull_request.head.sha }} + token: ${{ secrets.GITHUB_TOKEN }} + - name: Get changed generated files + id: changed + uses: tj-actions/changed-files@v44 + with: + files: | + src/** + merge: + name: Merge + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: changes + if: needs.changes.outputs.has_changes == 'true' + steps: + - name: Approve pull request + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Merge pull request + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + close: + name: Close + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: changes + if: needs.changes.outputs.has_changes == 'false' && needs.changes.outputs.is_generation_successful == 'true' + steps: + - name: Close pull request + run: gh pr close "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 2c02903..9826974 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -30,7 +30,7 @@ jobs: - name: Setup uses: ./.github/actions/setup with: - install_dependencies: "false" + install_dependencies: 'false' - name: Normalize package-lock.json run: npm install - name: Generate SDK @@ -38,7 +38,7 @@ jobs: - name: Commit uses: stefanzweifel/git-auto-commit-action@v5 with: - commit_message: "ci: Generate code" + commit_message: 'ci: Generate code' commit_user_name: ${{ secrets.GIT_USER_NAME }} commit_user_email: ${{ secrets.GIT_USER_EMAIL }} commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7958347..8ae5119 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,5 +32,5 @@ jobs: with: token: ${{ secrets.GH_TOKEN }} prerelease: ${{ contains(github.ref_name, '-') }} - files: "" + files: '' body_path: ${{ github.workspace }}/${{ steps.changelog.outputs.outfile }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e51426b..996d9db 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,5 @@ name: PHP Test -on: ["pull_request"] +on: ['pull_request'] jobs: test: if: "!contains(github.event.head_commit.message, 'skip ci')" @@ -11,7 +11,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.0" + php-version: '8.0' - run: composer install - run: composer exec phpunit tests env: diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 109a78d..0000000 --- a/.prettierrc +++ /dev/null @@ -1 +0,0 @@ -{ "semi": false } diff --git a/.prettierrc.json b/.prettierrc.json index 16003a1..38ef1f6 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,4 +1,16 @@ { - "semi": false, - "endOfLine": "lf" + "plugins": ["@prettier/plugin-php"], + "parser": "php", + + "overrides": [ + { + "files": "**/*.{js,json,yml,md}", + "options": { + "semi": false, + "singleQuote": true, + "jsxSingleQuote": true, + "endOfLine": "lf" + } + } + ] } diff --git a/generate-routes.js b/generate-routes.js new file mode 100644 index 0000000..be3e9bd --- /dev/null +++ b/generate-routes.js @@ -0,0 +1,26 @@ +import { dirname, resolve } from 'node:path' +import { fileURLToPath } from 'node:url' + +import { + generatePhpSDK as generateSdk, + writeFs, +} from '@seamapi/nextlove-sdk-generator' +import { openapi } from '@seamapi/types/connect' +import { deleteAsync } from 'del' + +const libDirName = 'src' + +const rootPath = dirname(fileURLToPath(import.meta.url)) +const outputPath = resolve(rootPath, libDirName) + +await deleteAsync(outputPath) + +const fileSystem = await generateSdk({ + openApiSpecObject: openapi, +}) + +const files = Object.entries(fileSystem).filter(([fileName]) => + fileName.startsWith(`${libDirName}/`), +) + +writeFs(rootPath, Object.fromEntries(files)) diff --git a/package.json b/package.json index 66e0325..6853d44 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,9 @@ "license": "MIT", "scripts": { "postversion": "git push --follow-tags", - "generate": "node ./scripts/generate.js", - "postgenerate": "prettier --write --ignore-path .gitignore ." + "generate": "node generate-routes.js", + "postgenerate": "npm run format", + "format": "prettier --write --ignore-path .gitignore ." }, "devDependencies": { "@prettier/plugin-php": "^0.22.1", diff --git a/scripts/generate.js b/scripts/generate.js deleted file mode 100644 index 69ab231..0000000 --- a/scripts/generate.js +++ /dev/null @@ -1,37 +0,0 @@ -import { generatePhpSDK, writeFs } from "@seamapi/nextlove-sdk-generator" -import { openapi } from "@seamapi/types/connect" -import path from "node:path" -import { fileURLToPath } from "node:url" -import { deleteAsync } from "del" - -const PHP_SDK_DIRECTORY_PREFIX = "src/" -const PROJECT_ROOT_PATH = path.resolve( - path.dirname(fileURLToPath(import.meta.url)), - "../", -) -const MAIN_SEAM_DIR_PATH = path.resolve( - PROJECT_ROOT_PATH, - PHP_SDK_DIRECTORY_PREFIX, -) - -const main = async () => { - try { - await deleteAsync(MAIN_SEAM_DIR_PATH) - - const pythonSdkFileSystem = await generatePhpSDK({ - openApiSpecObject: openapi, - }) - - const seamFiles = Object.entries(pythonSdkFileSystem).filter(([fileName]) => - fileName.startsWith(PHP_SDK_DIRECTORY_PREFIX), - ) - - writeFs(PROJECT_ROOT_PATH, Object.fromEntries(seamFiles)) - - console.log("PHP SDK generated successfully!") - } catch (error) { - console.error("Failed to generate SDK:", error) - } -} - -await main() diff --git a/src/Objects/AccessCode.php b/src/Objects/AccessCode.php index c63c6da..077b5b8 100644 --- a/src/Objects/AccessCode.php +++ b/src/Objects/AccessCode.php @@ -4,7 +4,6 @@ class AccessCode { - public static function from_json(mixed $json): AccessCode|null { if (!$json) { @@ -25,41 +24,40 @@ public static function from_json(mixed $json): AccessCode|null is_offline_access_code: $json->is_offline_access_code, is_one_time_use: $json->is_one_time_use, is_scheduled_on_device: $json->is_scheduled_on_device ?? null, - is_waiting_for_code_assignment: $json->is_waiting_for_code_assignment ?? null, + is_waiting_for_code_assignment: $json->is_waiting_for_code_assignment ?? + null, name: $json->name ?? null, - pulled_backup_access_code_id: $json->pulled_backup_access_code_id ?? null, + pulled_backup_access_code_id: $json->pulled_backup_access_code_id ?? + null, starts_at: $json->starts_at ?? null, status: $json->status, type: $json->type, - warnings: $json->warnings ?? null, + warnings: $json->warnings ?? null ); } - - public function __construct( public string $access_code_id, - public string | null $code, - public string | null $common_code_key, + public string|null $code, + public string|null $common_code_key, public string $created_at, public string $device_id, - public string | null $ends_at, + public string|null $ends_at, public mixed $errors, - public bool | null $is_backup, + public bool|null $is_backup, public bool $is_backup_access_code_available, public bool $is_external_modification_allowed, public bool $is_managed, public bool $is_offline_access_code, public bool $is_one_time_use, - public bool | null $is_scheduled_on_device, - public bool | null $is_waiting_for_code_assignment, - public string | null $name, - public string | null $pulled_backup_access_code_id, - public string | null $starts_at, + public bool|null $is_scheduled_on_device, + public bool|null $is_waiting_for_code_assignment, + public string|null $name, + public string|null $pulled_backup_access_code_id, + public string|null $starts_at, public string $status, public string $type, - public mixed $warnings, + public mixed $warnings ) { } - } diff --git a/src/Objects/AcsAccessGroup.php b/src/Objects/AcsAccessGroup.php index 361f43d..05c2dc8 100644 --- a/src/Objects/AcsAccessGroup.php +++ b/src/Objects/AcsAccessGroup.php @@ -4,7 +4,6 @@ class AcsAccessGroup { - public static function from_json(mixed $json): AcsAccessGroup|null { if (!$json) { @@ -19,12 +18,10 @@ public static function from_json(mixed $json): AcsAccessGroup|null external_type: $json->external_type, external_type_display_name: $json->external_type_display_name, name: $json->name, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $access_group_type, public string $access_group_type_display_name, @@ -34,8 +31,7 @@ public function __construct( public string $external_type, public string $external_type_display_name, public string $name, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/AcsCredential.php b/src/Objects/AcsCredential.php index 5363d1c..9f71852 100644 --- a/src/Objects/AcsCredential.php +++ b/src/Objects/AcsCredential.php @@ -4,7 +4,6 @@ class AcsCredential { - public static function from_json(mixed $json): AcsCredential|null { if (!$json) { @@ -21,45 +20,48 @@ public static function from_json(mixed $json): AcsCredential|null display_name: $json->display_name, ends_at: $json->ends_at ?? null, errors: array_map( - fn ($e) => AcsCredentialErrors::from_json($e), - $json->errors ?? [] - ), + fn($e) => AcsCredentialErrors::from_json($e), + $json->errors ?? [] + ), external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? null, - is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? + null, parent_acs_credential_id: $json->parent_acs_credential_id ?? null, starts_at: $json->starts_at ?? null, - visionline_metadata: isset($json->visionline_metadata) ? AcsCredentialVisionlineMetadata::from_json($json->visionline_metadata) : null, + visionline_metadata: isset($json->visionline_metadata) + ? AcsCredentialVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, warnings: array_map( - fn ($w) => AcsCredentialWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, + fn($w) => AcsCredentialWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id ); } - - public function __construct( public string $access_method, public string $acs_credential_id, - public string | null $acs_credential_pool_id, + public string|null $acs_credential_pool_id, public string $acs_system_id, - public string | null $acs_user_id, - public string | null $code, + public string|null $acs_user_id, + public string|null $code, public string $created_at, public string $display_name, - public string | null $ends_at, + public string|null $ends_at, public array $errors, - public string | null $external_type, - public string | null $external_type_display_name, - public bool | null $is_multi_phone_sync_credential, - public string | null $parent_acs_credential_id, - public string | null $starts_at, - public AcsCredentialVisionlineMetadata | null $visionline_metadata, + public string|null $external_type, + public string|null $external_type_display_name, + public bool|null $is_multi_phone_sync_credential, + public string|null $parent_acs_credential_id, + public string|null $starts_at, + public AcsCredentialVisionlineMetadata|null $visionline_metadata, public array $warnings, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/AcsCredentialErrors.php b/src/Objects/AcsCredentialErrors.php index daece48..b6c34f3 100644 --- a/src/Objects/AcsCredentialErrors.php +++ b/src/Objects/AcsCredentialErrors.php @@ -4,7 +4,6 @@ class AcsCredentialErrors { - public static function from_json(mixed $json): AcsCredentialErrors|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): AcsCredentialErrors|null return new self( error_code: $json->error_code, message: $json->message, - created_at: $json->created_at ?? null, + created_at: $json->created_at ?? null ); } - - public function __construct( public string $error_code, public string $message, - public string | null $created_at, + public string|null $created_at ) { } - } diff --git a/src/Objects/AcsCredentialPool.php b/src/Objects/AcsCredentialPool.php index 0b783b5..84e790d 100644 --- a/src/Objects/AcsCredentialPool.php +++ b/src/Objects/AcsCredentialPool.php @@ -4,7 +4,6 @@ class AcsCredentialPool { - public static function from_json(mixed $json): AcsCredentialPool|null { if (!$json) { @@ -17,12 +16,10 @@ public static function from_json(mixed $json): AcsCredentialPool|null display_name: $json->display_name, external_type: $json->external_type, external_type_display_name: $json->external_type_display_name, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $acs_credential_pool_id, public string $acs_system_id, @@ -30,8 +27,7 @@ public function __construct( public string $display_name, public string $external_type, public string $external_type_display_name, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/AcsCredentialProvisioningAutomation.php b/src/Objects/AcsCredentialProvisioningAutomation.php index 49880ab..fc2e775 100644 --- a/src/Objects/AcsCredentialProvisioningAutomation.php +++ b/src/Objects/AcsCredentialProvisioningAutomation.php @@ -4,9 +4,9 @@ class AcsCredentialProvisioningAutomation { - - public static function from_json(mixed $json): AcsCredentialProvisioningAutomation|null - { + public static function from_json( + mixed $json + ): AcsCredentialProvisioningAutomation|null { if (!$json) { return null; } @@ -15,19 +15,16 @@ public static function from_json(mixed $json): AcsCredentialProvisioningAutomati created_at: $json->created_at, credential_manager_acs_system_id: $json->credential_manager_acs_system_id, user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $acs_credential_provisioning_automation_id, public string $created_at, public string $credential_manager_acs_system_id, public string $user_identity_id, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/AcsCredentialVisionlineMetadata.php b/src/Objects/AcsCredentialVisionlineMetadata.php index 6066146..0534afc 100644 --- a/src/Objects/AcsCredentialVisionlineMetadata.php +++ b/src/Objects/AcsCredentialVisionlineMetadata.php @@ -4,26 +4,23 @@ class AcsCredentialVisionlineMetadata { - - public static function from_json(mixed $json): AcsCredentialVisionlineMetadata|null - { + public static function from_json( + mixed $json + ): AcsCredentialVisionlineMetadata|null { if (!$json) { return null; } return new self( common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, - joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null, + joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null ); } - - public function __construct( - public array | null $common_acs_entrance_ids, - public array | null $guest_acs_entrance_ids, - public array | null $joiner_acs_credential_ids, + public array|null $common_acs_entrance_ids, + public array|null $guest_acs_entrance_ids, + public array|null $joiner_acs_credential_ids ) { } - } diff --git a/src/Objects/AcsCredentialWarnings.php b/src/Objects/AcsCredentialWarnings.php index 3146f05..3c0cc1a 100644 --- a/src/Objects/AcsCredentialWarnings.php +++ b/src/Objects/AcsCredentialWarnings.php @@ -4,7 +4,6 @@ class AcsCredentialWarnings { - public static function from_json(mixed $json): AcsCredentialWarnings|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): AcsCredentialWarnings|null return new self( message: $json->message, warning_code: $json->warning_code, - created_at: $json->created_at ?? null, + created_at: $json->created_at ?? null ); } - - public function __construct( public string $message, public string $warning_code, - public string | null $created_at, + public string|null $created_at ) { } - } diff --git a/src/Objects/AcsEntrance.php b/src/Objects/AcsEntrance.php index b66cf53..c837039 100644 --- a/src/Objects/AcsEntrance.php +++ b/src/Objects/AcsEntrance.php @@ -4,7 +4,6 @@ class AcsEntrance { - public static function from_json(mixed $json): AcsEntrance|null { if (!$json) { @@ -15,21 +14,24 @@ public static function from_json(mixed $json): AcsEntrance|null acs_system_id: $json->acs_system_id, created_at: $json->created_at, display_name: $json->display_name, - latch_metadata: isset($json->latch_metadata) ? AcsEntranceLatchMetadata::from_json($json->latch_metadata) : null, - visionline_metadata: isset($json->visionline_metadata) ? AcsEntranceVisionlineMetadata::from_json($json->visionline_metadata) : null, + latch_metadata: isset($json->latch_metadata) + ? AcsEntranceLatchMetadata::from_json($json->latch_metadata) + : null, + visionline_metadata: isset($json->visionline_metadata) + ? AcsEntranceVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null ); } - - public function __construct( public string $acs_entrance_id, public string $acs_system_id, public string $created_at, public string $display_name, - public AcsEntranceLatchMetadata | null $latch_metadata, - public AcsEntranceVisionlineMetadata | null $visionline_metadata, + public AcsEntranceLatchMetadata|null $latch_metadata, + public AcsEntranceVisionlineMetadata|null $visionline_metadata ) { } - } diff --git a/src/Objects/AcsEntranceLatchMetadata.php b/src/Objects/AcsEntranceLatchMetadata.php index fab928c..b656285 100644 --- a/src/Objects/AcsEntranceLatchMetadata.php +++ b/src/Objects/AcsEntranceLatchMetadata.php @@ -4,7 +4,6 @@ class AcsEntranceLatchMetadata { - public static function from_json(mixed $json): AcsEntranceLatchMetadata|null { if (!$json) { @@ -14,18 +13,15 @@ public static function from_json(mixed $json): AcsEntranceLatchMetadata|null accessibility_type: $json->accessibility_type, door_name: $json->door_name, door_type: $json->door_type, - is_connected: $json->is_connected, + is_connected: $json->is_connected ); } - - public function __construct( public string $accessibility_type, public string $door_name, public string $door_type, - public bool $is_connected, + public bool $is_connected ) { } - } diff --git a/src/Objects/AcsEntranceProfiles.php b/src/Objects/AcsEntranceProfiles.php index b9e0d5e..c94d918 100644 --- a/src/Objects/AcsEntranceProfiles.php +++ b/src/Objects/AcsEntranceProfiles.php @@ -4,7 +4,6 @@ class AcsEntranceProfiles { - public static function from_json(mixed $json): AcsEntranceProfiles|null { if (!$json) { @@ -12,16 +11,13 @@ public static function from_json(mixed $json): AcsEntranceProfiles|null } return new self( visionline_door_profile_id: $json->visionline_door_profile_id, - visionline_door_profile_type: $json->visionline_door_profile_type, + visionline_door_profile_type: $json->visionline_door_profile_type ); } - - public function __construct( public string $visionline_door_profile_id, - public string $visionline_door_profile_type, + public string $visionline_door_profile_type ) { } - } diff --git a/src/Objects/AcsEntranceVisionlineMetadata.php b/src/Objects/AcsEntranceVisionlineMetadata.php index df146da..eb024d9 100644 --- a/src/Objects/AcsEntranceVisionlineMetadata.php +++ b/src/Objects/AcsEntranceVisionlineMetadata.php @@ -4,9 +4,9 @@ class AcsEntranceVisionlineMetadata { - - public static function from_json(mixed $json): AcsEntranceVisionlineMetadata|null - { + public static function from_json( + mixed $json + ): AcsEntranceVisionlineMetadata|null { if (!$json) { return null; } @@ -14,19 +14,16 @@ public static function from_json(mixed $json): AcsEntranceVisionlineMetadata|nul door_category: $json->door_category, door_name: $json->door_name, profiles: array_map( - fn ($p) => AcsEntranceProfiles::from_json($p), - $json->profiles ?? [] - ), + fn($p) => AcsEntranceProfiles::from_json($p), + $json->profiles ?? [] + ) ); } - - public function __construct( public string $door_category, public string $door_name, - public array | null $profiles, + public array|null $profiles ) { } - } diff --git a/src/Objects/AcsSystem.php b/src/Objects/AcsSystem.php index 6d51d37..c9285e7 100644 --- a/src/Objects/AcsSystem.php +++ b/src/Objects/AcsSystem.php @@ -4,7 +4,6 @@ class AcsSystem { - public static function from_json(mixed $json): AcsSystem|null { if (!$json) { @@ -16,32 +15,30 @@ public static function from_json(mixed $json): AcsSystem|null connected_account_ids: $json->connected_account_ids, created_at: $json->created_at, external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, image_alt_text: $json->image_alt_text, image_url: $json->image_url, name: $json->name, system_type: $json->system_type ?? null, system_type_display_name: $json->system_type_display_name ?? null, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $acs_system_id, - public bool | null $can_automate_enrollment, + public bool|null $can_automate_enrollment, public array $connected_account_ids, public string $created_at, - public string | null $external_type, - public string | null $external_type_display_name, + public string|null $external_type, + public string|null $external_type_display_name, public string $image_alt_text, public string $image_url, public string $name, - public string | null $system_type, - public string | null $system_type_display_name, - public string $workspace_id, + public string|null $system_type, + public string|null $system_type_display_name, + public string $workspace_id ) { } - } diff --git a/src/Objects/AcsUser.php b/src/Objects/AcsUser.php index 6734976..af38ef9 100644 --- a/src/Objects/AcsUser.php +++ b/src/Objects/AcsUser.php @@ -4,14 +4,15 @@ class AcsUser { - public static function from_json(mixed $json): AcsUser|null { if (!$json) { return null; } return new self( - access_schedule: isset($json->access_schedule) ? AcsUserAccessSchedule::from_json($json->access_schedule) : null, + access_schedule: isset($json->access_schedule) + ? AcsUserAccessSchedule::from_json($json->access_schedule) + : null, acs_system_id: $json->acs_system_id, acs_user_id: $json->acs_user_id, created_at: $json->created_at, @@ -19,41 +20,41 @@ public static function from_json(mixed $json): AcsUser|null email: $json->email ?? null, email_address: $json->email_address ?? null, external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, full_name: $json->full_name ?? null, hid_acs_system_id: $json->hid_acs_system_id ?? null, is_suspended: $json->is_suspended, phone_number: $json->phone_number ?? null, - user_identity_email_address: $json->user_identity_email_address ?? null, + user_identity_email_address: $json->user_identity_email_address ?? + null, user_identity_full_name: $json->user_identity_full_name ?? null, user_identity_id: $json->user_identity_id ?? null, - user_identity_phone_number: $json->user_identity_phone_number ?? null, - workspace_id: $json->workspace_id, + user_identity_phone_number: $json->user_identity_phone_number ?? + null, + workspace_id: $json->workspace_id ); } - - public function __construct( - public AcsUserAccessSchedule | null $access_schedule, + public AcsUserAccessSchedule|null $access_schedule, public string $acs_system_id, public string $acs_user_id, public string $created_at, public string $display_name, - public string | null $email, - public string | null $email_address, - public string | null $external_type, - public string | null $external_type_display_name, - public string | null $full_name, - public string | null $hid_acs_system_id, + public string|null $email, + public string|null $email_address, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $full_name, + public string|null $hid_acs_system_id, public bool $is_suspended, - public string | null $phone_number, - public string | null $user_identity_email_address, - public string | null $user_identity_full_name, - public string | null $user_identity_id, - public string | null $user_identity_phone_number, - public string $workspace_id, + public string|null $phone_number, + public string|null $user_identity_email_address, + public string|null $user_identity_full_name, + public string|null $user_identity_id, + public string|null $user_identity_phone_number, + public string $workspace_id ) { } - } diff --git a/src/Objects/AcsUserAccessSchedule.php b/src/Objects/AcsUserAccessSchedule.php index dcb2fc0..2d3fcde 100644 --- a/src/Objects/AcsUserAccessSchedule.php +++ b/src/Objects/AcsUserAccessSchedule.php @@ -4,24 +4,17 @@ class AcsUserAccessSchedule { - public static function from_json(mixed $json): AcsUserAccessSchedule|null { if (!$json) { return null; } - return new self( - ends_at: $json->ends_at, - starts_at: $json->starts_at, - ); + return new self(ends_at: $json->ends_at, starts_at: $json->starts_at); } - - public function __construct( public string $ends_at, - public string $starts_at, + public string $starts_at ) { } - } diff --git a/src/Objects/ActionAttempt.php b/src/Objects/ActionAttempt.php index a3ed7bc..6951b90 100644 --- a/src/Objects/ActionAttempt.php +++ b/src/Objects/ActionAttempt.php @@ -4,7 +4,6 @@ class ActionAttempt { - public static function from_json(mixed $json): ActionAttempt|null { if (!$json) { @@ -13,21 +12,20 @@ public static function from_json(mixed $json): ActionAttempt|null return new self( action_attempt_id: $json->action_attempt_id ?? null, action_type: $json->action_type ?? null, - error: isset($json->error) ? ActionAttemptError::from_json($json->error) : null, + error: isset($json->error) + ? ActionAttemptError::from_json($json->error) + : null, result: $json->result ?? null, - status: $json->status ?? null, + status: $json->status ?? null ); } - - public function __construct( - public string | null $action_attempt_id, - public string | null $action_type, - public ActionAttemptError | null $error, + public string|null $action_attempt_id, + public string|null $action_type, + public ActionAttemptError|null $error, public mixed $result, - public string | null $status, + public string|null $status ) { } - } diff --git a/src/Objects/ActionAttemptError.php b/src/Objects/ActionAttemptError.php index d958baa..b9c7355 100644 --- a/src/Objects/ActionAttemptError.php +++ b/src/Objects/ActionAttemptError.php @@ -4,24 +4,15 @@ class ActionAttemptError { - public static function from_json(mixed $json): ActionAttemptError|null { if (!$json) { return null; } - return new self( - message: $json->message, - type: $json->type, - ); + return new self(message: $json->message, type: $json->type); } - - - public function __construct( - public string $message, - public string $type, - ) { + public function __construct(public string $message, public string $type) + { } - } diff --git a/src/Objects/ClientSession.php b/src/Objects/ClientSession.php index 6401d2d..cc8fab2 100644 --- a/src/Objects/ClientSession.php +++ b/src/Objects/ClientSession.php @@ -4,7 +4,6 @@ class ClientSession { - public static function from_json(mixed $json): ClientSession|null { if (!$json) { @@ -19,12 +18,10 @@ public static function from_json(mixed $json): ClientSession|null token: $json->token, user_identifier_key: $json->user_identifier_key ?? null, user_identity_ids: $json->user_identity_ids, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $client_session_id, public array $connect_webview_ids, @@ -32,10 +29,9 @@ public function __construct( public string $created_at, public float $device_count, public string $token, - public string | null $user_identifier_key, + public string|null $user_identifier_key, public array $user_identity_ids, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/ClimateSettingSchedule.php b/src/Objects/ClimateSettingSchedule.php index deb832f..997e249 100644 --- a/src/Objects/ClimateSettingSchedule.php +++ b/src/Objects/ClimateSettingSchedule.php @@ -4,7 +4,6 @@ class ClimateSettingSchedule { - public static function from_json(mixed $json): ClimateSettingSchedule|null { if (!$json) { @@ -15,41 +14,40 @@ public static function from_json(mixed $json): ClimateSettingSchedule|null automatic_heating_enabled: $json->automatic_heating_enabled ?? null, climate_setting_schedule_id: $json->climate_setting_schedule_id, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, created_at: $json->created_at, device_id: $json->device_id, errors: $json->errors ?? null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, hvac_mode_setting: $json->hvac_mode_setting ?? null, manual_override_allowed: $json->manual_override_allowed ?? null, name: $json->name ?? null, schedule_ends_at: $json->schedule_ends_at, schedule_starts_at: $json->schedule_starts_at, - schedule_type: $json->schedule_type, + schedule_type: $json->schedule_type ); } - - public function __construct( - public bool | null $automatic_cooling_enabled, - public bool | null $automatic_heating_enabled, + public bool|null $automatic_cooling_enabled, + public bool|null $automatic_heating_enabled, public string $climate_setting_schedule_id, - public float | null $cooling_set_point_celsius, - public float | null $cooling_set_point_fahrenheit, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, public string $created_at, public string $device_id, public mixed $errors, - public float | null $heating_set_point_celsius, - public float | null $heating_set_point_fahrenheit, - public string | null $hvac_mode_setting, - public bool | null $manual_override_allowed, - public string | null $name, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public bool|null $manual_override_allowed, + public string|null $name, public string $schedule_ends_at, public string $schedule_starts_at, - public string $schedule_type, + public string $schedule_type ) { } - } diff --git a/src/Objects/ConnectWebview.php b/src/Objects/ConnectWebview.php index a21b57c..dba1355 100644 --- a/src/Objects/ConnectWebview.php +++ b/src/Objects/ConnectWebview.php @@ -4,7 +4,6 @@ class ConnectWebview { - public static function from_json(mixed $json): ConnectWebview|null { if (!$json) { @@ -21,7 +20,8 @@ public static function from_json(mixed $json): ConnectWebview|null connected_account_id: $json->connected_account_id ?? null, created_at: $json->created_at, custom_metadata: $json->custom_metadata, - custom_redirect_failure_url: $json->custom_redirect_failure_url ?? null, + custom_redirect_failure_url: $json->custom_redirect_failure_url ?? + null, custom_redirect_url: $json->custom_redirect_url ?? null, device_selection_mode: $json->device_selection_mode, login_successful: $json->login_successful, @@ -29,33 +29,30 @@ public static function from_json(mixed $json): ConnectWebview|null status: $json->status, url: $json->url, wait_for_device_creation: $json->wait_for_device_creation, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public array $accepted_devices, public array $accepted_providers, public bool $any_device_allowed, public bool $any_provider_allowed, - public string | null $authorized_at, + public string|null $authorized_at, public bool $automatically_manage_new_devices, public string $connect_webview_id, - public string | null $connected_account_id, + public string|null $connected_account_id, public string $created_at, public mixed $custom_metadata, - public string | null $custom_redirect_failure_url, - public string | null $custom_redirect_url, + public string|null $custom_redirect_failure_url, + public string|null $custom_redirect_url, public string $device_selection_mode, public bool $login_successful, - public string | null $selected_provider, + public string|null $selected_provider, public string $status, public string $url, public bool $wait_for_device_creation, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/ConnectedAccount.php b/src/Objects/ConnectedAccount.php index ed2a334..14a5e30 100644 --- a/src/Objects/ConnectedAccount.php +++ b/src/Objects/ConnectedAccount.php @@ -4,7 +4,6 @@ class ConnectedAccount { - public static function from_json(mixed $json): ConnectedAccount|null { if (!$json) { @@ -18,24 +17,25 @@ public static function from_json(mixed $json): ConnectedAccount|null created_at: $json->created_at ?? null, custom_metadata: $json->custom_metadata, errors: $json->errors ?? null, - user_identifier: isset($json->user_identifier) ? ConnectedAccountUserIdentifier::from_json($json->user_identifier) : null, - warnings: $json->warnings ?? null, + user_identifier: isset($json->user_identifier) + ? ConnectedAccountUserIdentifier::from_json( + $json->user_identifier + ) + : null, + warnings: $json->warnings ?? null ); } - - public function __construct( - public string | null $account_type, + public string|null $account_type, public string $account_type_display_name, public bool $automatically_manage_new_devices, - public string | null $connected_account_id, - public string | null $created_at, + public string|null $connected_account_id, + public string|null $created_at, public mixed $custom_metadata, public mixed $errors, - public ConnectedAccountUserIdentifier | null $user_identifier, - public mixed $warnings, + public ConnectedAccountUserIdentifier|null $user_identifier, + public mixed $warnings ) { } - } diff --git a/src/Objects/ConnectedAccountUserIdentifier.php b/src/Objects/ConnectedAccountUserIdentifier.php index 2c81346..259f86b 100644 --- a/src/Objects/ConnectedAccountUserIdentifier.php +++ b/src/Objects/ConnectedAccountUserIdentifier.php @@ -4,9 +4,9 @@ class ConnectedAccountUserIdentifier { - - public static function from_json(mixed $json): ConnectedAccountUserIdentifier|null - { + public static function from_json( + mixed $json + ): ConnectedAccountUserIdentifier|null { if (!$json) { return null; } @@ -15,19 +15,16 @@ public static function from_json(mixed $json): ConnectedAccountUserIdentifier|nu email: $json->email ?? null, exclusive: $json->exclusive ?? null, phone: $json->phone ?? null, - username: $json->username ?? null, + username: $json->username ?? null ); } - - public function __construct( - public string | null $api_url, - public string | null $email, - public bool | null $exclusive, - public string | null $phone, - public string | null $username, + public string|null $api_url, + public string|null $email, + public bool|null $exclusive, + public string|null $phone, + public string|null $username ) { } - } diff --git a/src/Objects/Device.php b/src/Objects/Device.php index 18d88f3..7255d0b 100644 --- a/src/Objects/Device.php +++ b/src/Objects/Device.php @@ -4,15 +4,16 @@ class Device { - public static function from_json(mixed $json): Device|null { if (!$json) { return null; } return new self( - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? null, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, can_remotely_lock: $json->can_remotely_lock ?? null, can_remotely_unlock: $json->can_remotely_unlock ?? null, can_simulate_removal: $json->can_simulate_removal ?? null, @@ -24,29 +25,29 @@ public static function from_json(mixed $json): Device|null device_type: $json->device_type, display_name: $json->display_name, errors: array_map( - fn ($e) => DeviceErrors::from_json($e), - $json->errors ?? [] - ), + fn($e) => DeviceErrors::from_json($e), + $json->errors ?? [] + ), is_managed: $json->is_managed, - location: isset($json->location) ? DeviceLocation::from_json($json->location) : null, + location: isset($json->location) + ? DeviceLocation::from_json($json->location) + : null, nickname: $json->nickname ?? null, properties: DeviceProperties::from_json($json->properties), warnings: array_map( - fn ($w) => DeviceWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, + fn($w) => DeviceWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id ); } - - public function __construct( - public bool | null $can_program_offline_access_codes, - public bool | null $can_program_online_access_codes, - public bool | null $can_remotely_lock, - public bool | null $can_remotely_unlock, - public bool | null $can_simulate_removal, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_removal, public array $capabilities_supported, public string $connected_account_id, public string $created_at, @@ -56,12 +57,11 @@ public function __construct( public string $display_name, public array $errors, public bool $is_managed, - public DeviceLocation | null $location, - public string | null $nickname, + public DeviceLocation|null $location, + public string|null $nickname, public DeviceProperties $properties, public array $warnings, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/DeviceAccelerometerZ.php b/src/Objects/DeviceAccelerometerZ.php index d5952c9..214cb85 100644 --- a/src/Objects/DeviceAccelerometerZ.php +++ b/src/Objects/DeviceAccelerometerZ.php @@ -4,24 +4,15 @@ class DeviceAccelerometerZ { - public static function from_json(mixed $json): DeviceAccelerometerZ|null { if (!$json) { return null; } - return new self( - time: $json->time, - value: $json->value, - ); + return new self(time: $json->time, value: $json->value); } - - - public function __construct( - public string $time, - public float $value, - ) { + public function __construct(public string $time, public float $value) + { } - } diff --git a/src/Objects/DeviceAccessoryKeypad.php b/src/Objects/DeviceAccessoryKeypad.php index 8bd6d04..413c914 100644 --- a/src/Objects/DeviceAccessoryKeypad.php +++ b/src/Objects/DeviceAccessoryKeypad.php @@ -4,24 +4,22 @@ class DeviceAccessoryKeypad { - public static function from_json(mixed $json): DeviceAccessoryKeypad|null { if (!$json) { return null; } return new self( - battery: isset($json->battery) ? DeviceBattery::from_json($json->battery) : null, - is_connected: $json->is_connected, + battery: isset($json->battery) + ? DeviceBattery::from_json($json->battery) + : null, + is_connected: $json->is_connected ); } - - public function __construct( - public DeviceBattery | null $battery, - public bool $is_connected, + public DeviceBattery|null $battery, + public bool $is_connected ) { } - } diff --git a/src/Objects/DeviceActiveClimateSettingSchedule.php b/src/Objects/DeviceActiveClimateSettingSchedule.php index 275cc46..52ec8dc 100644 --- a/src/Objects/DeviceActiveClimateSettingSchedule.php +++ b/src/Objects/DeviceActiveClimateSettingSchedule.php @@ -4,9 +4,9 @@ class DeviceActiveClimateSettingSchedule { - - public static function from_json(mixed $json): DeviceActiveClimateSettingSchedule|null - { + public static function from_json( + mixed $json + ): DeviceActiveClimateSettingSchedule|null { if (!$json) { return null; } @@ -15,41 +15,40 @@ public static function from_json(mixed $json): DeviceActiveClimateSettingSchedul automatic_heating_enabled: $json->automatic_heating_enabled ?? null, climate_setting_schedule_id: $json->climate_setting_schedule_id, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, created_at: $json->created_at, device_id: $json->device_id, errors: $json->errors ?? null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, hvac_mode_setting: $json->hvac_mode_setting ?? null, manual_override_allowed: $json->manual_override_allowed ?? null, name: $json->name ?? null, schedule_ends_at: $json->schedule_ends_at, schedule_starts_at: $json->schedule_starts_at, - schedule_type: $json->schedule_type, + schedule_type: $json->schedule_type ); } - - public function __construct( - public bool | null $automatic_cooling_enabled, - public bool | null $automatic_heating_enabled, + public bool|null $automatic_cooling_enabled, + public bool|null $automatic_heating_enabled, public string $climate_setting_schedule_id, - public float | null $cooling_set_point_celsius, - public float | null $cooling_set_point_fahrenheit, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, public string $created_at, public string $device_id, public mixed $errors, - public float | null $heating_set_point_celsius, - public float | null $heating_set_point_fahrenheit, - public string | null $hvac_mode_setting, - public bool | null $manual_override_allowed, - public string | null $name, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public bool|null $manual_override_allowed, + public string|null $name, public string $schedule_ends_at, public string $schedule_starts_at, - public string $schedule_type, + public string $schedule_type ) { } - } diff --git a/src/Objects/DeviceAppearance.php b/src/Objects/DeviceAppearance.php index f88db85..07ecae8 100644 --- a/src/Objects/DeviceAppearance.php +++ b/src/Objects/DeviceAppearance.php @@ -4,22 +4,15 @@ class DeviceAppearance { - public static function from_json(mixed $json): DeviceAppearance|null { if (!$json) { return null; } - return new self( - name: $json->name, - ); + return new self(name: $json->name); } - - - public function __construct( - public string $name, - ) { + public function __construct(public string $name) + { } - } diff --git a/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php b/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php index a1d033e..e5701b8 100644 --- a/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php +++ b/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php @@ -4,27 +4,24 @@ class DeviceAssaAbloyCredentialServiceMetadata { - - public static function from_json(mixed $json): DeviceAssaAbloyCredentialServiceMetadata|null - { + public static function from_json( + mixed $json + ): DeviceAssaAbloyCredentialServiceMetadata|null { if (!$json) { return null; } return new self( endpoints: array_map( - fn ($e) => DeviceEndpoints::from_json($e), - $json->endpoints ?? [] - ), - has_active_endpoint: $json->has_active_endpoint, + fn($e) => DeviceEndpoints::from_json($e), + $json->endpoints ?? [] + ), + has_active_endpoint: $json->has_active_endpoint ); } - - public function __construct( public array $endpoints, - public bool $has_active_endpoint, + public bool $has_active_endpoint ) { } - } diff --git a/src/Objects/DeviceAugustMetadata.php b/src/Objects/DeviceAugustMetadata.php index 9f438ab..fe31006 100644 --- a/src/Objects/DeviceAugustMetadata.php +++ b/src/Objects/DeviceAugustMetadata.php @@ -4,7 +4,6 @@ class DeviceAugustMetadata { - public static function from_json(mixed $json): DeviceAugustMetadata|null { if (!$json) { @@ -17,21 +16,18 @@ public static function from_json(mixed $json): DeviceAugustMetadata|null keypad_battery_level: $json->keypad_battery_level ?? null, lock_id: $json->lock_id, lock_name: $json->lock_name, - model: $json->model ?? null, + model: $json->model ?? null ); } - - public function __construct( public bool $has_keypad, - public string | null $house_id, + public string|null $house_id, public string $house_name, - public string | null $keypad_battery_level, + public string|null $keypad_battery_level, public string $lock_id, public string $lock_name, - public string | null $model, + public string|null $model ) { } - } diff --git a/src/Objects/DeviceAvigilonAltaMetadata.php b/src/Objects/DeviceAvigilonAltaMetadata.php index fb1ffbf..f09233b 100644 --- a/src/Objects/DeviceAvigilonAltaMetadata.php +++ b/src/Objects/DeviceAvigilonAltaMetadata.php @@ -4,9 +4,9 @@ class DeviceAvigilonAltaMetadata { - - public static function from_json(mixed $json): DeviceAvigilonAltaMetadata|null - { + public static function from_json( + mixed $json + ): DeviceAvigilonAltaMetadata|null { if (!$json) { return null; } @@ -16,20 +16,17 @@ public static function from_json(mixed $json): DeviceAvigilonAltaMetadata|null site_id: $json->site_id, site_name: $json->site_name, zone_id: $json->zone_id, - zone_name: $json->zone_name, + zone_name: $json->zone_name ); } - - public function __construct( public string $entry_name, public string $org_name, public float $site_id, public string $site_name, public float $zone_id, - public string $zone_name, + public string $zone_name ) { } - } diff --git a/src/Objects/DeviceBattery.php b/src/Objects/DeviceBattery.php index fb36697..ad41667 100644 --- a/src/Objects/DeviceBattery.php +++ b/src/Objects/DeviceBattery.php @@ -4,22 +4,15 @@ class DeviceBattery { - public static function from_json(mixed $json): DeviceBattery|null { if (!$json) { return null; } - return new self( - level: $json->level, - ); + return new self(level: $json->level); } - - - public function __construct( - public float $level, - ) { + public function __construct(public float $level) + { } - } diff --git a/src/Objects/DeviceBrivoMetadata.php b/src/Objects/DeviceBrivoMetadata.php index f72ce3c..9119d8b 100644 --- a/src/Objects/DeviceBrivoMetadata.php +++ b/src/Objects/DeviceBrivoMetadata.php @@ -4,22 +4,15 @@ class DeviceBrivoMetadata { - public static function from_json(mixed $json): DeviceBrivoMetadata|null { if (!$json) { return null; } - return new self( - device_name: $json->device_name, - ); + return new self(device_name: $json->device_name); } - - - public function __construct( - public string $device_name, - ) { + public function __construct(public string $device_name) + { } - } diff --git a/src/Objects/DeviceCodeConstraints.php b/src/Objects/DeviceCodeConstraints.php index 9e65ac9..cc582a0 100644 --- a/src/Objects/DeviceCodeConstraints.php +++ b/src/Objects/DeviceCodeConstraints.php @@ -4,7 +4,6 @@ class DeviceCodeConstraints { - public static function from_json(mixed $json): DeviceCodeConstraints|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceCodeConstraints|null return new self( constraint_type: $json->constraint_type, max_length: $json->max_length ?? null, - min_length: $json->min_length ?? null, + min_length: $json->min_length ?? null ); } - - public function __construct( public string $constraint_type, - public float | null $max_length, - public float | null $min_length, + public float|null $max_length, + public float|null $min_length ) { } - } diff --git a/src/Objects/DeviceControlbywebMetadata.php b/src/Objects/DeviceControlbywebMetadata.php index 9e38bd1..1d4ee88 100644 --- a/src/Objects/DeviceControlbywebMetadata.php +++ b/src/Objects/DeviceControlbywebMetadata.php @@ -4,26 +4,23 @@ class DeviceControlbywebMetadata { - - public static function from_json(mixed $json): DeviceControlbywebMetadata|null - { + public static function from_json( + mixed $json + ): DeviceControlbywebMetadata|null { if (!$json) { return null; } return new self( device_id: $json->device_id, device_name: $json->device_name, - relay_name: $json->relay_name ?? null, + relay_name: $json->relay_name ?? null ); } - - public function __construct( public string $device_id, public string $device_name, - public string | null $relay_name, + public string|null $relay_name ) { } - } diff --git a/src/Objects/DeviceCurrentClimateSetting.php b/src/Objects/DeviceCurrentClimateSetting.php index 5351b09..0cf2bec 100644 --- a/src/Objects/DeviceCurrentClimateSetting.php +++ b/src/Objects/DeviceCurrentClimateSetting.php @@ -4,9 +4,9 @@ class DeviceCurrentClimateSetting { - - public static function from_json(mixed $json): DeviceCurrentClimateSetting|null - { + public static function from_json( + mixed $json + ): DeviceCurrentClimateSetting|null { if (!$json) { return null; } @@ -14,26 +14,25 @@ public static function from_json(mixed $json): DeviceCurrentClimateSetting|null automatic_cooling_enabled: $json->automatic_cooling_enabled, automatic_heating_enabled: $json->automatic_heating_enabled, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, hvac_mode_setting: $json->hvac_mode_setting, - manual_override_allowed: $json->manual_override_allowed, + manual_override_allowed: $json->manual_override_allowed ); } - - public function __construct( public bool $automatic_cooling_enabled, public bool $automatic_heating_enabled, - public float | null $cooling_set_point_celsius, - public float | null $cooling_set_point_fahrenheit, - public float | null $heating_set_point_celsius, - public float | null $heating_set_point_fahrenheit, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, public string $hvac_mode_setting, - public bool $manual_override_allowed, + public bool $manual_override_allowed ) { } - } diff --git a/src/Objects/DeviceDefaultClimateSetting.php b/src/Objects/DeviceDefaultClimateSetting.php index 23c73a4..41c6689 100644 --- a/src/Objects/DeviceDefaultClimateSetting.php +++ b/src/Objects/DeviceDefaultClimateSetting.php @@ -4,9 +4,9 @@ class DeviceDefaultClimateSetting { - - public static function from_json(mixed $json): DeviceDefaultClimateSetting|null - { + public static function from_json( + mixed $json + ): DeviceDefaultClimateSetting|null { if (!$json) { return null; } @@ -14,26 +14,25 @@ public static function from_json(mixed $json): DeviceDefaultClimateSetting|null automatic_cooling_enabled: $json->automatic_cooling_enabled, automatic_heating_enabled: $json->automatic_heating_enabled, cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, hvac_mode_setting: $json->hvac_mode_setting, - manual_override_allowed: $json->manual_override_allowed, + manual_override_allowed: $json->manual_override_allowed ); } - - public function __construct( public bool $automatic_cooling_enabled, public bool $automatic_heating_enabled, - public float | null $cooling_set_point_celsius, - public float | null $cooling_set_point_fahrenheit, - public float | null $heating_set_point_celsius, - public float | null $heating_set_point_fahrenheit, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, public string $hvac_mode_setting, - public bool $manual_override_allowed, + public bool $manual_override_allowed ) { } - } diff --git a/src/Objects/DeviceDormakabaOracodeMetadata.php b/src/Objects/DeviceDormakabaOracodeMetadata.php index ca0e2a8..50795a3 100644 --- a/src/Objects/DeviceDormakabaOracodeMetadata.php +++ b/src/Objects/DeviceDormakabaOracodeMetadata.php @@ -4,9 +4,9 @@ class DeviceDormakabaOracodeMetadata { - - public static function from_json(mixed $json): DeviceDormakabaOracodeMetadata|null - { + public static function from_json( + mixed $json + ): DeviceDormakabaOracodeMetadata|null { if (!$json) { return null; } @@ -17,26 +17,23 @@ public static function from_json(mixed $json): DeviceDormakabaOracodeMetadata|nu door_name: $json->door_name, iana_timezone: $json->iana_timezone ?? null, predefined_time_slots: array_map( - fn ($p) => DevicePredefinedTimeSlots::from_json($p), - $json->predefined_time_slots ?? [] - ), + fn($p) => DevicePredefinedTimeSlots::from_json($p), + $json->predefined_time_slots ?? [] + ), site_id: $json->site_id, - site_name: $json->site_name, + site_name: $json->site_name ); } - - public function __construct( - public float | null $device_id, + public float|null $device_id, public float $door_id, public bool $door_is_wireless, public string $door_name, - public string | null $iana_timezone, - public array | null $predefined_time_slots, + public string|null $iana_timezone, + public array|null $predefined_time_slots, public float $site_id, - public string $site_name, + public string $site_name ) { } - } diff --git a/src/Objects/DeviceEcobeeMetadata.php b/src/Objects/DeviceEcobeeMetadata.php index 5582b1c..304c50c 100644 --- a/src/Objects/DeviceEcobeeMetadata.php +++ b/src/Objects/DeviceEcobeeMetadata.php @@ -4,7 +4,6 @@ class DeviceEcobeeMetadata { - public static function from_json(mixed $json): DeviceEcobeeMetadata|null { if (!$json) { @@ -12,16 +11,13 @@ public static function from_json(mixed $json): DeviceEcobeeMetadata|null } return new self( device_name: $json->device_name, - ecobee_device_id: $json->ecobee_device_id, + ecobee_device_id: $json->ecobee_device_id ); } - - public function __construct( public string $device_name, - public string $ecobee_device_id, + public string $ecobee_device_id ) { } - } diff --git a/src/Objects/DeviceEndpoints.php b/src/Objects/DeviceEndpoints.php index 6df6381..2b2b6ea 100644 --- a/src/Objects/DeviceEndpoints.php +++ b/src/Objects/DeviceEndpoints.php @@ -4,7 +4,6 @@ class DeviceEndpoints { - public static function from_json(mixed $json): DeviceEndpoints|null { if (!$json) { @@ -12,16 +11,13 @@ public static function from_json(mixed $json): DeviceEndpoints|null } return new self( endpoint_id: $json->endpoint_id, - is_active: $json->is_active, + is_active: $json->is_active ); } - - public function __construct( public string $endpoint_id, - public bool $is_active, + public bool $is_active ) { } - } diff --git a/src/Objects/DeviceErrors.php b/src/Objects/DeviceErrors.php index b3322de..fcb95c4 100644 --- a/src/Objects/DeviceErrors.php +++ b/src/Objects/DeviceErrors.php @@ -4,7 +4,6 @@ class DeviceErrors { - public static function from_json(mixed $json): DeviceErrors|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceErrors|null return new self( error_code: $json->error_code, message: $json->message, - created_at: $json->created_at ?? null, + created_at: $json->created_at ?? null ); } - - public function __construct( public string $error_code, public string $message, - public string | null $created_at, + public string|null $created_at ) { } - } diff --git a/src/Objects/DeviceFourSuitesMetadata.php b/src/Objects/DeviceFourSuitesMetadata.php index 46d34cc..6ff4695 100644 --- a/src/Objects/DeviceFourSuitesMetadata.php +++ b/src/Objects/DeviceFourSuitesMetadata.php @@ -4,7 +4,6 @@ class DeviceFourSuitesMetadata { - public static function from_json(mixed $json): DeviceFourSuitesMetadata|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceFourSuitesMetadata|null return new self( device_id: $json->device_id, device_name: $json->device_name, - reclose_delay_in_seconds: $json->reclose_delay_in_seconds, + reclose_delay_in_seconds: $json->reclose_delay_in_seconds ); } - - public function __construct( public float $device_id, public string $device_name, - public float $reclose_delay_in_seconds, + public float $reclose_delay_in_seconds ) { } - } diff --git a/src/Objects/DeviceGenieMetadata.php b/src/Objects/DeviceGenieMetadata.php index fe16a73..0332ea0 100644 --- a/src/Objects/DeviceGenieMetadata.php +++ b/src/Objects/DeviceGenieMetadata.php @@ -4,7 +4,6 @@ class DeviceGenieMetadata { - public static function from_json(mixed $json): DeviceGenieMetadata|null { if (!$json) { @@ -12,16 +11,13 @@ public static function from_json(mixed $json): DeviceGenieMetadata|null } return new self( device_name: $json->device_name, - door_name: $json->door_name, + door_name: $json->door_name ); } - - public function __construct( public string $device_name, - public string $door_name, + public string $door_name ) { } - } diff --git a/src/Objects/DeviceHoneywellResideoMetadata.php b/src/Objects/DeviceHoneywellResideoMetadata.php index 4a9bca9..ff1372d 100644 --- a/src/Objects/DeviceHoneywellResideoMetadata.php +++ b/src/Objects/DeviceHoneywellResideoMetadata.php @@ -4,24 +4,21 @@ class DeviceHoneywellResideoMetadata { - - public static function from_json(mixed $json): DeviceHoneywellResideoMetadata|null - { + public static function from_json( + mixed $json + ): DeviceHoneywellResideoMetadata|null { if (!$json) { return null; } return new self( device_name: $json->device_name, - honeywell_resideo_device_id: $json->honeywell_resideo_device_id, + honeywell_resideo_device_id: $json->honeywell_resideo_device_id ); } - - public function __construct( public string $device_name, - public string $honeywell_resideo_device_id, + public string $honeywell_resideo_device_id ) { } - } diff --git a/src/Objects/DeviceHubitatMetadata.php b/src/Objects/DeviceHubitatMetadata.php index 3b1e500..30f4c71 100644 --- a/src/Objects/DeviceHubitatMetadata.php +++ b/src/Objects/DeviceHubitatMetadata.php @@ -4,7 +4,6 @@ class DeviceHubitatMetadata { - public static function from_json(mixed $json): DeviceHubitatMetadata|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceHubitatMetadata|null return new self( device_id: $json->device_id, device_label: $json->device_label, - device_name: $json->device_name, + device_name: $json->device_name ); } - - public function __construct( public string $device_id, public string $device_label, - public string $device_name, + public string $device_name ) { } - } diff --git a/src/Objects/DeviceHumidity.php b/src/Objects/DeviceHumidity.php index ef401cd..c9019d1 100644 --- a/src/Objects/DeviceHumidity.php +++ b/src/Objects/DeviceHumidity.php @@ -4,24 +4,15 @@ class DeviceHumidity { - public static function from_json(mixed $json): DeviceHumidity|null { if (!$json) { return null; } - return new self( - time: $json->time, - value: $json->value, - ); + return new self(time: $json->time, value: $json->value); } - - - public function __construct( - public string $time, - public float $value, - ) { + public function __construct(public string $time, public float $value) + { } - } diff --git a/src/Objects/DeviceIglooMetadata.php b/src/Objects/DeviceIglooMetadata.php index f87f21d..d6abbde 100644 --- a/src/Objects/DeviceIglooMetadata.php +++ b/src/Objects/DeviceIglooMetadata.php @@ -4,7 +4,6 @@ class DeviceIglooMetadata { - public static function from_json(mixed $json): DeviceIglooMetadata|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceIglooMetadata|null return new self( bridge_id: $json->bridge_id, device_id: $json->device_id, - model: $json->model ?? null, + model: $json->model ?? null ); } - - public function __construct( public string $bridge_id, public string $device_id, - public string | null $model, + public string|null $model ) { } - } diff --git a/src/Objects/DeviceIgloohomeMetadata.php b/src/Objects/DeviceIgloohomeMetadata.php index 653ac3f..6330509 100644 --- a/src/Objects/DeviceIgloohomeMetadata.php +++ b/src/Objects/DeviceIgloohomeMetadata.php @@ -4,7 +4,6 @@ class DeviceIgloohomeMetadata { - public static function from_json(mixed $json): DeviceIgloohomeMetadata|null { if (!$json) { @@ -15,19 +14,16 @@ public static function from_json(mixed $json): DeviceIgloohomeMetadata|null bridge_name: $json->bridge_name ?? null, device_id: $json->device_id, device_name: $json->device_name, - keypad_id: $json->keypad_id ?? null, + keypad_id: $json->keypad_id ?? null ); } - - public function __construct( - public string | null $bridge_id, - public string | null $bridge_name, + public string|null $bridge_id, + public string|null $bridge_name, public string $device_id, public string $device_name, - public string | null $keypad_id, + public string|null $keypad_id ) { } - } diff --git a/src/Objects/DeviceKeypadBattery.php b/src/Objects/DeviceKeypadBattery.php index 347e975..785a3e2 100644 --- a/src/Objects/DeviceKeypadBattery.php +++ b/src/Objects/DeviceKeypadBattery.php @@ -4,22 +4,15 @@ class DeviceKeypadBattery { - public static function from_json(mixed $json): DeviceKeypadBattery|null { if (!$json) { return null; } - return new self( - level: $json->level, - ); + return new self(level: $json->level); } - - - public function __construct( - public float $level, - ) { + public function __construct(public float $level) + { } - } diff --git a/src/Objects/DeviceKwiksetMetadata.php b/src/Objects/DeviceKwiksetMetadata.php index fbd01dd..013ac79 100644 --- a/src/Objects/DeviceKwiksetMetadata.php +++ b/src/Objects/DeviceKwiksetMetadata.php @@ -4,7 +4,6 @@ class DeviceKwiksetMetadata { - public static function from_json(mixed $json): DeviceKwiksetMetadata|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceKwiksetMetadata|null return new self( device_id: $json->device_id, device_name: $json->device_name, - model_number: $json->model_number, + model_number: $json->model_number ); } - - public function __construct( public string $device_id, public string $device_name, - public string $model_number, + public string $model_number ) { } - } diff --git a/src/Objects/DeviceLatestSensorValues.php b/src/Objects/DeviceLatestSensorValues.php index c189843..df59f48 100644 --- a/src/Objects/DeviceLatestSensorValues.php +++ b/src/Objects/DeviceLatestSensorValues.php @@ -4,30 +4,28 @@ class DeviceLatestSensorValues { - public static function from_json(mixed $json): DeviceLatestSensorValues|null { if (!$json) { return null; } return new self( - accelerometer_z: DeviceAccelerometerZ::from_json($json->accelerometer_z), + accelerometer_z: DeviceAccelerometerZ::from_json( + $json->accelerometer_z + ), humidity: DeviceHumidity::from_json($json->humidity), pressure: DevicePressure::from_json($json->pressure), sound: DeviceSound::from_json($json->sound), - temperature: DeviceTemperature::from_json($json->temperature), + temperature: DeviceTemperature::from_json($json->temperature) ); } - - public function __construct( public DeviceAccelerometerZ $accelerometer_z, public DeviceHumidity $humidity, public DevicePressure $pressure, public DeviceSound $sound, - public DeviceTemperature $temperature, + public DeviceTemperature $temperature ) { } - } diff --git a/src/Objects/DeviceLocation.php b/src/Objects/DeviceLocation.php index 62ec8ee..db99399 100644 --- a/src/Objects/DeviceLocation.php +++ b/src/Objects/DeviceLocation.php @@ -4,7 +4,6 @@ class DeviceLocation { - public static function from_json(mixed $json): DeviceLocation|null { if (!$json) { @@ -12,16 +11,13 @@ public static function from_json(mixed $json): DeviceLocation|null } return new self( location_name: $json->location_name ?? null, - timezone: $json->timezone ?? null, + timezone: $json->timezone ?? null ); } - - public function __construct( - public string | null $location_name, - public string | null $timezone, + public string|null $location_name, + public string|null $timezone ) { } - } diff --git a/src/Objects/DeviceLocklyMetadata.php b/src/Objects/DeviceLocklyMetadata.php index 5ff72fb..0228d34 100644 --- a/src/Objects/DeviceLocklyMetadata.php +++ b/src/Objects/DeviceLocklyMetadata.php @@ -4,7 +4,6 @@ class DeviceLocklyMetadata { - public static function from_json(mixed $json): DeviceLocklyMetadata|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceLocklyMetadata|null return new self( device_id: $json->device_id, device_name: $json->device_name, - model: $json->model ?? null, + model: $json->model ?? null ); } - - public function __construct( public string $device_id, public string $device_name, - public string | null $model, + public string|null $model ) { } - } diff --git a/src/Objects/DeviceMinutMetadata.php b/src/Objects/DeviceMinutMetadata.php index 2d6443e..3727f84 100644 --- a/src/Objects/DeviceMinutMetadata.php +++ b/src/Objects/DeviceMinutMetadata.php @@ -4,7 +4,6 @@ class DeviceMinutMetadata { - public static function from_json(mixed $json): DeviceMinutMetadata|null { if (!$json) { @@ -13,17 +12,16 @@ public static function from_json(mixed $json): DeviceMinutMetadata|null return new self( device_id: $json->device_id, device_name: $json->device_name, - latest_sensor_values: DeviceLatestSensorValues::from_json($json->latest_sensor_values), + latest_sensor_values: DeviceLatestSensorValues::from_json( + $json->latest_sensor_values + ) ); } - - public function __construct( public string $device_id, public string $device_name, - public DeviceLatestSensorValues $latest_sensor_values, + public DeviceLatestSensorValues $latest_sensor_values ) { } - } diff --git a/src/Objects/DeviceModel.php b/src/Objects/DeviceModel.php index db79eaf..8e3d76c 100644 --- a/src/Objects/DeviceModel.php +++ b/src/Objects/DeviceModel.php @@ -4,34 +4,34 @@ class DeviceModel { - public static function from_json(mixed $json): DeviceModel|null { if (!$json) { return null; } return new self( - accessory_keypad_supported: $json->accessory_keypad_supported ?? null, - can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? null, + accessory_keypad_supported: $json->accessory_keypad_supported ?? + null, + can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? + null, display_name: $json->display_name, has_built_in_keypad: $json->has_built_in_keypad ?? null, manufacturer_display_name: $json->manufacturer_display_name, - offline_access_codes_supported: $json->offline_access_codes_supported ?? null, - online_access_codes_supported: $json->online_access_codes_supported ?? null, + offline_access_codes_supported: $json->offline_access_codes_supported ?? + null, + online_access_codes_supported: $json->online_access_codes_supported ?? + null ); } - - public function __construct( - public bool | null $accessory_keypad_supported, - public bool | null $can_connect_accessory_keypad, + public bool|null $accessory_keypad_supported, + public bool|null $can_connect_accessory_keypad, public string $display_name, - public bool | null $has_built_in_keypad, + public bool|null $has_built_in_keypad, public string $manufacturer_display_name, - public bool | null $offline_access_codes_supported, - public bool | null $online_access_codes_supported, + public bool|null $offline_access_codes_supported, + public bool|null $online_access_codes_supported ) { } - } diff --git a/src/Objects/DeviceNestMetadata.php b/src/Objects/DeviceNestMetadata.php index 9b0ec57..1f138b9 100644 --- a/src/Objects/DeviceNestMetadata.php +++ b/src/Objects/DeviceNestMetadata.php @@ -4,7 +4,6 @@ class DeviceNestMetadata { - public static function from_json(mixed $json): DeviceNestMetadata|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceNestMetadata|null return new self( custom_name: $json->custom_name, device_name: $json->device_name, - nest_device_id: $json->nest_device_id, + nest_device_id: $json->nest_device_id ); } - - public function __construct( public string $custom_name, public string $device_name, - public string $nest_device_id, + public string $nest_device_id ) { } - } diff --git a/src/Objects/DeviceNoiseawareMetadata.php b/src/Objects/DeviceNoiseawareMetadata.php index aa3d2cc..46d1177 100644 --- a/src/Objects/DeviceNoiseawareMetadata.php +++ b/src/Objects/DeviceNoiseawareMetadata.php @@ -4,7 +4,6 @@ class DeviceNoiseawareMetadata { - public static function from_json(mixed $json): DeviceNoiseawareMetadata|null { if (!$json) { @@ -15,19 +14,16 @@ public static function from_json(mixed $json): DeviceNoiseawareMetadata|null device_model: $json->device_model, device_name: $json->device_name, noise_level_decibel: $json->noise_level_decibel, - noise_level_nrs: $json->noise_level_nrs, + noise_level_nrs: $json->noise_level_nrs ); } - - public function __construct( public string $device_id, public string $device_model, public string $device_name, public float $noise_level_decibel, - public float $noise_level_nrs, + public float $noise_level_nrs ) { } - } diff --git a/src/Objects/DeviceNukiMetadata.php b/src/Objects/DeviceNukiMetadata.php index 20c36d6..3d32229 100644 --- a/src/Objects/DeviceNukiMetadata.php +++ b/src/Objects/DeviceNukiMetadata.php @@ -4,7 +4,6 @@ class DeviceNukiMetadata { - public static function from_json(mixed $json): DeviceNukiMetadata|null { if (!$json) { @@ -15,19 +14,16 @@ public static function from_json(mixed $json): DeviceNukiMetadata|null device_name: $json->device_name, keypad_2_paired: $json->keypad_2_paired ?? null, keypad_battery_critical: $json->keypad_battery_critical ?? null, - keypad_paired: $json->keypad_paired ?? null, + keypad_paired: $json->keypad_paired ?? null ); } - - public function __construct( public string $device_id, public string $device_name, - public bool | null $keypad_2_paired, - public bool | null $keypad_battery_critical, - public bool | null $keypad_paired, + public bool|null $keypad_2_paired, + public bool|null $keypad_battery_critical, + public bool|null $keypad_paired ) { } - } diff --git a/src/Objects/DevicePredefinedTimeSlots.php b/src/Objects/DevicePredefinedTimeSlots.php index fe2427d..1265644 100644 --- a/src/Objects/DevicePredefinedTimeSlots.php +++ b/src/Objects/DevicePredefinedTimeSlots.php @@ -4,9 +4,9 @@ class DevicePredefinedTimeSlots { - - public static function from_json(mixed $json): DevicePredefinedTimeSlots|null - { + public static function from_json( + mixed $json + ): DevicePredefinedTimeSlots|null { if (!$json) { return null; } @@ -20,12 +20,10 @@ public static function from_json(mixed $json): DevicePredefinedTimeSlots|null is_master: $json->is_master, is_one_shot: $json->is_one_shot, name: $json->name, - prefix: $json->prefix, + prefix: $json->prefix ); } - - public function __construct( public string $check_in_time, public string $check_out_time, @@ -36,8 +34,7 @@ public function __construct( public bool $is_master, public bool $is_one_shot, public string $name, - public float $prefix, + public float $prefix ) { } - } diff --git a/src/Objects/DevicePressure.php b/src/Objects/DevicePressure.php index d7e89e8..e56458a 100644 --- a/src/Objects/DevicePressure.php +++ b/src/Objects/DevicePressure.php @@ -4,24 +4,15 @@ class DevicePressure { - public static function from_json(mixed $json): DevicePressure|null { if (!$json) { return null; } - return new self( - time: $json->time, - value: $json->value, - ); + return new self(time: $json->time, value: $json->value); } - - - public function __construct( - public string $time, - public float $value, - ) { + public function __construct(public string $time, public float $value) + { } - } diff --git a/src/Objects/DeviceProperties.php b/src/Objects/DeviceProperties.php index 6c87b63..4f0cf4e 100644 --- a/src/Objects/DeviceProperties.php +++ b/src/Objects/DeviceProperties.php @@ -4,16 +4,19 @@ class DeviceProperties { - public static function from_json(mixed $json): DeviceProperties|null { if (!$json) { return null; } return new self( - accessory_keypad: isset($json->accessory_keypad) ? DeviceAccessoryKeypad::from_json($json->accessory_keypad) : null, + accessory_keypad: isset($json->accessory_keypad) + ? DeviceAccessoryKeypad::from_json($json->accessory_keypad) + : null, appearance: DeviceAppearance::from_json($json->appearance), - battery: isset($json->battery) ? DeviceBattery::from_json($json->battery) : null, + battery: isset($json->battery) + ? DeviceBattery::from_json($json->battery) + : null, battery_level: $json->battery_level ?? null, has_direct_power: $json->has_direct_power ?? null, image_alt_text: $json->image_alt_text ?? null, @@ -21,164 +24,272 @@ public static function from_json(mixed $json): DeviceProperties|null manufacturer: $json->manufacturer ?? null, model: DeviceModel::from_json($json->model), name: $json->name, - offline_access_codes_enabled: $json->offline_access_codes_enabled ?? null, + offline_access_codes_enabled: $json->offline_access_codes_enabled ?? + null, online: $json->online, - online_access_codes_enabled: $json->online_access_codes_enabled ?? null, + online_access_codes_enabled: $json->online_access_codes_enabled ?? + null, serial_number: $json->serial_number ?? null, supports_accessory_keypad: $json->supports_accessory_keypad ?? null, - supports_offline_access_codes: $json->supports_offline_access_codes ?? null, - assa_abloy_credential_service_metadata: isset($json->assa_abloy_credential_service_metadata) ? DeviceAssaAbloyCredentialServiceMetadata::from_json($json->assa_abloy_credential_service_metadata) : null, - august_metadata: isset($json->august_metadata) ? DeviceAugustMetadata::from_json($json->august_metadata) : null, - avigilon_alta_metadata: isset($json->avigilon_alta_metadata) ? DeviceAvigilonAltaMetadata::from_json($json->avigilon_alta_metadata) : null, - brivo_metadata: isset($json->brivo_metadata) ? DeviceBrivoMetadata::from_json($json->brivo_metadata) : null, - controlbyweb_metadata: isset($json->controlbyweb_metadata) ? DeviceControlbywebMetadata::from_json($json->controlbyweb_metadata) : null, - dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) ? DeviceDormakabaOracodeMetadata::from_json($json->dormakaba_oracode_metadata) : null, - ecobee_metadata: isset($json->ecobee_metadata) ? DeviceEcobeeMetadata::from_json($json->ecobee_metadata) : null, - four_suites_metadata: isset($json->four_suites_metadata) ? DeviceFourSuitesMetadata::from_json($json->four_suites_metadata) : null, - genie_metadata: isset($json->genie_metadata) ? DeviceGenieMetadata::from_json($json->genie_metadata) : null, - honeywell_resideo_metadata: isset($json->honeywell_resideo_metadata) ? DeviceHoneywellResideoMetadata::from_json($json->honeywell_resideo_metadata) : null, - hubitat_metadata: isset($json->hubitat_metadata) ? DeviceHubitatMetadata::from_json($json->hubitat_metadata) : null, - igloo_metadata: isset($json->igloo_metadata) ? DeviceIglooMetadata::from_json($json->igloo_metadata) : null, - igloohome_metadata: isset($json->igloohome_metadata) ? DeviceIgloohomeMetadata::from_json($json->igloohome_metadata) : null, - kwikset_metadata: isset($json->kwikset_metadata) ? DeviceKwiksetMetadata::from_json($json->kwikset_metadata) : null, - lockly_metadata: isset($json->lockly_metadata) ? DeviceLocklyMetadata::from_json($json->lockly_metadata) : null, - minut_metadata: isset($json->minut_metadata) ? DeviceMinutMetadata::from_json($json->minut_metadata) : null, - nest_metadata: isset($json->nest_metadata) ? DeviceNestMetadata::from_json($json->nest_metadata) : null, - noiseaware_metadata: isset($json->noiseaware_metadata) ? DeviceNoiseawareMetadata::from_json($json->noiseaware_metadata) : null, - nuki_metadata: isset($json->nuki_metadata) ? DeviceNukiMetadata::from_json($json->nuki_metadata) : null, - salto_metadata: isset($json->salto_metadata) ? DeviceSaltoMetadata::from_json($json->salto_metadata) : null, - schlage_metadata: isset($json->schlage_metadata) ? DeviceSchlageMetadata::from_json($json->schlage_metadata) : null, - seam_bridge_metadata: isset($json->seam_bridge_metadata) ? DeviceSeamBridgeMetadata::from_json($json->seam_bridge_metadata) : null, - smartthings_metadata: isset($json->smartthings_metadata) ? DeviceSmartthingsMetadata::from_json($json->smartthings_metadata) : null, - tedee_metadata: isset($json->tedee_metadata) ? DeviceTedeeMetadata::from_json($json->tedee_metadata) : null, - ttlock_metadata: isset($json->ttlock_metadata) ? DeviceTtlockMetadata::from_json($json->ttlock_metadata) : null, - two_n_metadata: isset($json->two_n_metadata) ? DeviceTwoNMetadata::from_json($json->two_n_metadata) : null, - wyze_metadata: isset($json->wyze_metadata) ? DeviceWyzeMetadata::from_json($json->wyze_metadata) : null, - _experimental_supported_code_from_access_codes_lengths: $json->_experimental_supported_code_from_access_codes_lengths ?? null, + supports_offline_access_codes: $json->supports_offline_access_codes ?? + null, + assa_abloy_credential_service_metadata: isset( + $json->assa_abloy_credential_service_metadata + ) + ? DeviceAssaAbloyCredentialServiceMetadata::from_json( + $json->assa_abloy_credential_service_metadata + ) + : null, + august_metadata: isset($json->august_metadata) + ? DeviceAugustMetadata::from_json($json->august_metadata) + : null, + avigilon_alta_metadata: isset($json->avigilon_alta_metadata) + ? DeviceAvigilonAltaMetadata::from_json( + $json->avigilon_alta_metadata + ) + : null, + brivo_metadata: isset($json->brivo_metadata) + ? DeviceBrivoMetadata::from_json($json->brivo_metadata) + : null, + controlbyweb_metadata: isset($json->controlbyweb_metadata) + ? DeviceControlbywebMetadata::from_json( + $json->controlbyweb_metadata + ) + : null, + dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) + ? DeviceDormakabaOracodeMetadata::from_json( + $json->dormakaba_oracode_metadata + ) + : null, + ecobee_metadata: isset($json->ecobee_metadata) + ? DeviceEcobeeMetadata::from_json($json->ecobee_metadata) + : null, + four_suites_metadata: isset($json->four_suites_metadata) + ? DeviceFourSuitesMetadata::from_json( + $json->four_suites_metadata + ) + : null, + genie_metadata: isset($json->genie_metadata) + ? DeviceGenieMetadata::from_json($json->genie_metadata) + : null, + honeywell_resideo_metadata: isset($json->honeywell_resideo_metadata) + ? DeviceHoneywellResideoMetadata::from_json( + $json->honeywell_resideo_metadata + ) + : null, + hubitat_metadata: isset($json->hubitat_metadata) + ? DeviceHubitatMetadata::from_json($json->hubitat_metadata) + : null, + igloo_metadata: isset($json->igloo_metadata) + ? DeviceIglooMetadata::from_json($json->igloo_metadata) + : null, + igloohome_metadata: isset($json->igloohome_metadata) + ? DeviceIgloohomeMetadata::from_json($json->igloohome_metadata) + : null, + kwikset_metadata: isset($json->kwikset_metadata) + ? DeviceKwiksetMetadata::from_json($json->kwikset_metadata) + : null, + lockly_metadata: isset($json->lockly_metadata) + ? DeviceLocklyMetadata::from_json($json->lockly_metadata) + : null, + minut_metadata: isset($json->minut_metadata) + ? DeviceMinutMetadata::from_json($json->minut_metadata) + : null, + nest_metadata: isset($json->nest_metadata) + ? DeviceNestMetadata::from_json($json->nest_metadata) + : null, + noiseaware_metadata: isset($json->noiseaware_metadata) + ? DeviceNoiseawareMetadata::from_json( + $json->noiseaware_metadata + ) + : null, + nuki_metadata: isset($json->nuki_metadata) + ? DeviceNukiMetadata::from_json($json->nuki_metadata) + : null, + salto_metadata: isset($json->salto_metadata) + ? DeviceSaltoMetadata::from_json($json->salto_metadata) + : null, + schlage_metadata: isset($json->schlage_metadata) + ? DeviceSchlageMetadata::from_json($json->schlage_metadata) + : null, + seam_bridge_metadata: isset($json->seam_bridge_metadata) + ? DeviceSeamBridgeMetadata::from_json( + $json->seam_bridge_metadata + ) + : null, + smartthings_metadata: isset($json->smartthings_metadata) + ? DeviceSmartthingsMetadata::from_json( + $json->smartthings_metadata + ) + : null, + tedee_metadata: isset($json->tedee_metadata) + ? DeviceTedeeMetadata::from_json($json->tedee_metadata) + : null, + ttlock_metadata: isset($json->ttlock_metadata) + ? DeviceTtlockMetadata::from_json($json->ttlock_metadata) + : null, + two_n_metadata: isset($json->two_n_metadata) + ? DeviceTwoNMetadata::from_json($json->two_n_metadata) + : null, + wyze_metadata: isset($json->wyze_metadata) + ? DeviceWyzeMetadata::from_json($json->wyze_metadata) + : null, + _experimental_supported_code_from_access_codes_lengths: $json->_experimental_supported_code_from_access_codes_lengths ?? + null, code_constraints: array_map( - fn ($c) => DeviceCodeConstraints::from_json($c), - $json->code_constraints ?? [] - ), + fn($c) => DeviceCodeConstraints::from_json($c), + $json->code_constraints ?? [] + ), door_open: $json->door_open ?? null, has_native_entry_events: $json->has_native_entry_events ?? null, - keypad_battery: isset($json->keypad_battery) ? DeviceKeypadBattery::from_json($json->keypad_battery) : null, + keypad_battery: isset($json->keypad_battery) + ? DeviceKeypadBattery::from_json($json->keypad_battery) + : null, locked: $json->locked ?? null, - max_active_codes_supported: $json->max_active_codes_supported ?? null, + max_active_codes_supported: $json->max_active_codes_supported ?? + null, supported_code_lengths: $json->supported_code_lengths ?? null, - supports_backup_access_code_pool: $json->supports_backup_access_code_pool ?? null, - active_climate_setting_schedule: isset($json->active_climate_setting_schedule) ? DeviceActiveClimateSettingSchedule::from_json($json->active_climate_setting_schedule) : null, - available_hvac_mode_settings: $json->available_hvac_mode_settings ?? null, - can_enable_automatic_cooling: $json->can_enable_automatic_cooling ?? null, - can_enable_automatic_heating: $json->can_enable_automatic_heating ?? null, - current_climate_setting: isset($json->current_climate_setting) ? DeviceCurrentClimateSetting::from_json($json->current_climate_setting) : null, - default_climate_setting: isset($json->default_climate_setting) ? DeviceDefaultClimateSetting::from_json($json->default_climate_setting) : null, + supports_backup_access_code_pool: $json->supports_backup_access_code_pool ?? + null, + active_climate_setting_schedule: isset( + $json->active_climate_setting_schedule + ) + ? DeviceActiveClimateSettingSchedule::from_json( + $json->active_climate_setting_schedule + ) + : null, + available_hvac_mode_settings: $json->available_hvac_mode_settings ?? + null, + can_enable_automatic_cooling: $json->can_enable_automatic_cooling ?? + null, + can_enable_automatic_heating: $json->can_enable_automatic_heating ?? + null, + current_climate_setting: isset($json->current_climate_setting) + ? DeviceCurrentClimateSetting::from_json( + $json->current_climate_setting + ) + : null, + default_climate_setting: isset($json->default_climate_setting) + ? DeviceDefaultClimateSetting::from_json( + $json->default_climate_setting + ) + : null, fan_mode_setting: $json->fan_mode_setting ?? null, - is_climate_setting_schedule_active: $json->is_climate_setting_schedule_active ?? null, + is_climate_setting_schedule_active: $json->is_climate_setting_schedule_active ?? + null, is_cooling: $json->is_cooling ?? null, is_cooling_available: $json->is_cooling_available ?? null, is_fan_running: $json->is_fan_running ?? null, is_heating: $json->is_heating ?? null, is_heating_available: $json->is_heating_available ?? null, - is_temporary_manual_override_active: $json->is_temporary_manual_override_active ?? null, - max_cooling_set_point_celsius: $json->max_cooling_set_point_celsius ?? null, - max_cooling_set_point_fahrenheit: $json->max_cooling_set_point_fahrenheit ?? null, - max_heating_set_point_celsius: $json->max_heating_set_point_celsius ?? null, - max_heating_set_point_fahrenheit: $json->max_heating_set_point_fahrenheit ?? null, - min_cooling_set_point_celsius: $json->min_cooling_set_point_celsius ?? null, - min_cooling_set_point_fahrenheit: $json->min_cooling_set_point_fahrenheit ?? null, - min_heating_cooling_delta_celsius: $json->min_heating_cooling_delta_celsius ?? null, - min_heating_cooling_delta_fahrenheit: $json->min_heating_cooling_delta_fahrenheit ?? null, - min_heating_set_point_celsius: $json->min_heating_set_point_celsius ?? null, - min_heating_set_point_fahrenheit: $json->min_heating_set_point_fahrenheit ?? null, + is_temporary_manual_override_active: $json->is_temporary_manual_override_active ?? + null, + max_cooling_set_point_celsius: $json->max_cooling_set_point_celsius ?? + null, + max_cooling_set_point_fahrenheit: $json->max_cooling_set_point_fahrenheit ?? + null, + max_heating_set_point_celsius: $json->max_heating_set_point_celsius ?? + null, + max_heating_set_point_fahrenheit: $json->max_heating_set_point_fahrenheit ?? + null, + min_cooling_set_point_celsius: $json->min_cooling_set_point_celsius ?? + null, + min_cooling_set_point_fahrenheit: $json->min_cooling_set_point_fahrenheit ?? + null, + min_heating_cooling_delta_celsius: $json->min_heating_cooling_delta_celsius ?? + null, + min_heating_cooling_delta_fahrenheit: $json->min_heating_cooling_delta_fahrenheit ?? + null, + min_heating_set_point_celsius: $json->min_heating_set_point_celsius ?? + null, + min_heating_set_point_fahrenheit: $json->min_heating_set_point_fahrenheit ?? + null, relative_humidity: $json->relative_humidity ?? null, temperature_celsius: $json->temperature_celsius ?? null, - temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null ); } - - public function __construct( - public DeviceAccessoryKeypad | null $accessory_keypad, + public DeviceAccessoryKeypad|null $accessory_keypad, public DeviceAppearance $appearance, - public DeviceBattery | null $battery, - public float | null $battery_level, - public bool | null $has_direct_power, - public string | null $image_alt_text, - public string | null $image_url, - public string | null $manufacturer, + public DeviceBattery|null $battery, + public float|null $battery_level, + public bool|null $has_direct_power, + public string|null $image_alt_text, + public string|null $image_url, + public string|null $manufacturer, public DeviceModel $model, public string $name, - public bool | null $offline_access_codes_enabled, + public bool|null $offline_access_codes_enabled, public bool $online, - public bool | null $online_access_codes_enabled, - public string | null $serial_number, - public bool | null $supports_accessory_keypad, - public bool | null $supports_offline_access_codes, - public DeviceAssaAbloyCredentialServiceMetadata | null $assa_abloy_credential_service_metadata, - public DeviceAugustMetadata | null $august_metadata, - public DeviceAvigilonAltaMetadata | null $avigilon_alta_metadata, - public DeviceBrivoMetadata | null $brivo_metadata, - public DeviceControlbywebMetadata | null $controlbyweb_metadata, - public DeviceDormakabaOracodeMetadata | null $dormakaba_oracode_metadata, - public DeviceEcobeeMetadata | null $ecobee_metadata, - public DeviceFourSuitesMetadata | null $four_suites_metadata, - public DeviceGenieMetadata | null $genie_metadata, - public DeviceHoneywellResideoMetadata | null $honeywell_resideo_metadata, - public DeviceHubitatMetadata | null $hubitat_metadata, - public DeviceIglooMetadata | null $igloo_metadata, - public DeviceIgloohomeMetadata | null $igloohome_metadata, - public DeviceKwiksetMetadata | null $kwikset_metadata, - public DeviceLocklyMetadata | null $lockly_metadata, - public DeviceMinutMetadata | null $minut_metadata, - public DeviceNestMetadata | null $nest_metadata, - public DeviceNoiseawareMetadata | null $noiseaware_metadata, - public DeviceNukiMetadata | null $nuki_metadata, - public DeviceSaltoMetadata | null $salto_metadata, - public DeviceSchlageMetadata | null $schlage_metadata, - public DeviceSeamBridgeMetadata | null $seam_bridge_metadata, - public DeviceSmartthingsMetadata | null $smartthings_metadata, - public DeviceTedeeMetadata | null $tedee_metadata, - public DeviceTtlockMetadata | null $ttlock_metadata, - public DeviceTwoNMetadata | null $two_n_metadata, - public DeviceWyzeMetadata | null $wyze_metadata, - public array | null $_experimental_supported_code_from_access_codes_lengths, - public array | null $code_constraints, - public bool | null $door_open, - public bool | null $has_native_entry_events, - public DeviceKeypadBattery | null $keypad_battery, - public bool | null $locked, - public float | null $max_active_codes_supported, - public array | null $supported_code_lengths, - public bool | null $supports_backup_access_code_pool, - public DeviceActiveClimateSettingSchedule | null $active_climate_setting_schedule, - public array | null $available_hvac_mode_settings, - public bool | null $can_enable_automatic_cooling, - public bool | null $can_enable_automatic_heating, - public DeviceCurrentClimateSetting | null $current_climate_setting, - public DeviceDefaultClimateSetting | null $default_climate_setting, - public string | null $fan_mode_setting, - public bool | null $is_climate_setting_schedule_active, - public bool | null $is_cooling, - public bool | null $is_cooling_available, - public bool | null $is_fan_running, - public bool | null $is_heating, - public bool | null $is_heating_available, - public bool | null $is_temporary_manual_override_active, - public float | null $max_cooling_set_point_celsius, - public float | null $max_cooling_set_point_fahrenheit, - public float | null $max_heating_set_point_celsius, - public float | null $max_heating_set_point_fahrenheit, - public float | null $min_cooling_set_point_celsius, - public float | null $min_cooling_set_point_fahrenheit, - public float | null $min_heating_cooling_delta_celsius, - public float | null $min_heating_cooling_delta_fahrenheit, - public float | null $min_heating_set_point_celsius, - public float | null $min_heating_set_point_fahrenheit, - public float | null $relative_humidity, - public float | null $temperature_celsius, - public float | null $temperature_fahrenheit, + public bool|null $online_access_codes_enabled, + public string|null $serial_number, + public bool|null $supports_accessory_keypad, + public bool|null $supports_offline_access_codes, + public DeviceAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, + public DeviceAugustMetadata|null $august_metadata, + public DeviceAvigilonAltaMetadata|null $avigilon_alta_metadata, + public DeviceBrivoMetadata|null $brivo_metadata, + public DeviceControlbywebMetadata|null $controlbyweb_metadata, + public DeviceDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, + public DeviceEcobeeMetadata|null $ecobee_metadata, + public DeviceFourSuitesMetadata|null $four_suites_metadata, + public DeviceGenieMetadata|null $genie_metadata, + public DeviceHoneywellResideoMetadata|null $honeywell_resideo_metadata, + public DeviceHubitatMetadata|null $hubitat_metadata, + public DeviceIglooMetadata|null $igloo_metadata, + public DeviceIgloohomeMetadata|null $igloohome_metadata, + public DeviceKwiksetMetadata|null $kwikset_metadata, + public DeviceLocklyMetadata|null $lockly_metadata, + public DeviceMinutMetadata|null $minut_metadata, + public DeviceNestMetadata|null $nest_metadata, + public DeviceNoiseawareMetadata|null $noiseaware_metadata, + public DeviceNukiMetadata|null $nuki_metadata, + public DeviceSaltoMetadata|null $salto_metadata, + public DeviceSchlageMetadata|null $schlage_metadata, + public DeviceSeamBridgeMetadata|null $seam_bridge_metadata, + public DeviceSmartthingsMetadata|null $smartthings_metadata, + public DeviceTedeeMetadata|null $tedee_metadata, + public DeviceTtlockMetadata|null $ttlock_metadata, + public DeviceTwoNMetadata|null $two_n_metadata, + public DeviceWyzeMetadata|null $wyze_metadata, + public array|null $_experimental_supported_code_from_access_codes_lengths, + public array|null $code_constraints, + public bool|null $door_open, + public bool|null $has_native_entry_events, + public DeviceKeypadBattery|null $keypad_battery, + public bool|null $locked, + public float|null $max_active_codes_supported, + public array|null $supported_code_lengths, + public bool|null $supports_backup_access_code_pool, + public DeviceActiveClimateSettingSchedule|null $active_climate_setting_schedule, + public array|null $available_hvac_mode_settings, + public bool|null $can_enable_automatic_cooling, + public bool|null $can_enable_automatic_heating, + public DeviceCurrentClimateSetting|null $current_climate_setting, + public DeviceDefaultClimateSetting|null $default_climate_setting, + public string|null $fan_mode_setting, + public bool|null $is_climate_setting_schedule_active, + public bool|null $is_cooling, + public bool|null $is_cooling_available, + public bool|null $is_fan_running, + public bool|null $is_heating, + public bool|null $is_heating_available, + public bool|null $is_temporary_manual_override_active, + public float|null $max_cooling_set_point_celsius, + public float|null $max_cooling_set_point_fahrenheit, + public float|null $max_heating_set_point_celsius, + public float|null $max_heating_set_point_fahrenheit, + public float|null $min_cooling_set_point_celsius, + public float|null $min_cooling_set_point_fahrenheit, + public float|null $min_heating_cooling_delta_celsius, + public float|null $min_heating_cooling_delta_fahrenheit, + public float|null $min_heating_set_point_celsius, + public float|null $min_heating_set_point_fahrenheit, + public float|null $relative_humidity, + public float|null $temperature_celsius, + public float|null $temperature_fahrenheit ) { } - } diff --git a/src/Objects/DeviceProvider.php b/src/Objects/DeviceProvider.php index 4a59aec..7bbbcc9 100644 --- a/src/Objects/DeviceProvider.php +++ b/src/Objects/DeviceProvider.php @@ -4,7 +4,6 @@ class DeviceProvider { - public static function from_json(mixed $json): DeviceProvider|null { if (!$json) { @@ -14,18 +13,15 @@ public static function from_json(mixed $json): DeviceProvider|null device_provider_name: $json->device_provider_name, display_name: $json->display_name, image_url: $json->image_url, - provider_categories: $json->provider_categories, + provider_categories: $json->provider_categories ); } - - public function __construct( public string $device_provider_name, public string $display_name, public string $image_url, - public array $provider_categories, + public array $provider_categories ) { } - } diff --git a/src/Objects/DeviceSaltoMetadata.php b/src/Objects/DeviceSaltoMetadata.php index 91694f1..047845a 100644 --- a/src/Objects/DeviceSaltoMetadata.php +++ b/src/Objects/DeviceSaltoMetadata.php @@ -4,7 +4,6 @@ class DeviceSaltoMetadata { - public static function from_json(mixed $json): DeviceSaltoMetadata|null { if (!$json) { @@ -16,20 +15,17 @@ public static function from_json(mixed $json): DeviceSaltoMetadata|null lock_id: $json->lock_id, lock_type: $json->lock_type, locked_state: $json->locked_state, - model: $json->model ?? null, + model: $json->model ?? null ); } - - public function __construct( public string $battery_level, public string $customer_reference, public string $lock_id, public string $lock_type, public string $locked_state, - public string | null $model, + public string|null $model ) { } - } diff --git a/src/Objects/DeviceSchlageMetadata.php b/src/Objects/DeviceSchlageMetadata.php index 4e9785e..1f0ffd5 100644 --- a/src/Objects/DeviceSchlageMetadata.php +++ b/src/Objects/DeviceSchlageMetadata.php @@ -4,7 +4,6 @@ class DeviceSchlageMetadata { - public static function from_json(mixed $json): DeviceSchlageMetadata|null { if (!$json) { @@ -14,18 +13,15 @@ public static function from_json(mixed $json): DeviceSchlageMetadata|null access_code_length: $json->access_code_length ?? null, device_id: $json->device_id, device_name: $json->device_name, - model: $json->model ?? null, + model: $json->model ?? null ); } - - public function __construct( - public float | null $access_code_length, + public float|null $access_code_length, public string $device_id, public string $device_name, - public string | null $model, + public string|null $model ) { } - } diff --git a/src/Objects/DeviceSeamBridgeMetadata.php b/src/Objects/DeviceSeamBridgeMetadata.php index 825a0ec..18d016a 100644 --- a/src/Objects/DeviceSeamBridgeMetadata.php +++ b/src/Objects/DeviceSeamBridgeMetadata.php @@ -4,7 +4,6 @@ class DeviceSeamBridgeMetadata { - public static function from_json(mixed $json): DeviceSeamBridgeMetadata|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceSeamBridgeMetadata|null return new self( device_num: $json->device_num, name: $json->name, - unlock_method: $json->unlock_method ?? null, + unlock_method: $json->unlock_method ?? null ); } - - public function __construct( public float $device_num, public string $name, - public string | null $unlock_method, + public string|null $unlock_method ) { } - } diff --git a/src/Objects/DeviceSmartthingsMetadata.php b/src/Objects/DeviceSmartthingsMetadata.php index f4626ca..06b8eed 100644 --- a/src/Objects/DeviceSmartthingsMetadata.php +++ b/src/Objects/DeviceSmartthingsMetadata.php @@ -4,9 +4,9 @@ class DeviceSmartthingsMetadata { - - public static function from_json(mixed $json): DeviceSmartthingsMetadata|null - { + public static function from_json( + mixed $json + ): DeviceSmartthingsMetadata|null { if (!$json) { return null; } @@ -14,18 +14,15 @@ public static function from_json(mixed $json): DeviceSmartthingsMetadata|null device_id: $json->device_id, device_name: $json->device_name, location_id: $json->location_id ?? null, - model: $json->model ?? null, + model: $json->model ?? null ); } - - public function __construct( public string $device_id, public string $device_name, - public string | null $location_id, - public string | null $model, + public string|null $location_id, + public string|null $model ) { } - } diff --git a/src/Objects/DeviceSound.php b/src/Objects/DeviceSound.php index a72f645..1138b4e 100644 --- a/src/Objects/DeviceSound.php +++ b/src/Objects/DeviceSound.php @@ -4,24 +4,15 @@ class DeviceSound { - public static function from_json(mixed $json): DeviceSound|null { if (!$json) { return null; } - return new self( - time: $json->time, - value: $json->value, - ); + return new self(time: $json->time, value: $json->value); } - - - public function __construct( - public string $time, - public float $value, - ) { + public function __construct(public string $time, public float $value) + { } - } diff --git a/src/Objects/DeviceTedeeMetadata.php b/src/Objects/DeviceTedeeMetadata.php index 9394383..01439f7 100644 --- a/src/Objects/DeviceTedeeMetadata.php +++ b/src/Objects/DeviceTedeeMetadata.php @@ -4,7 +4,6 @@ class DeviceTedeeMetadata { - public static function from_json(mixed $json): DeviceTedeeMetadata|null { if (!$json) { @@ -17,21 +16,18 @@ public static function from_json(mixed $json): DeviceTedeeMetadata|null device_model: $json->device_model, device_name: $json->device_name, keypad_id: $json->keypad_id ?? null, - serial_number: $json->serial_number, + serial_number: $json->serial_number ); } - - public function __construct( public float $bridge_id, public string $bridge_name, public float $device_id, public string $device_model, public string $device_name, - public float | null $keypad_id, - public string $serial_number, + public float|null $keypad_id, + public string $serial_number ) { } - } diff --git a/src/Objects/DeviceTemperature.php b/src/Objects/DeviceTemperature.php index 0b59a8d..f88e4be 100644 --- a/src/Objects/DeviceTemperature.php +++ b/src/Objects/DeviceTemperature.php @@ -4,24 +4,15 @@ class DeviceTemperature { - public static function from_json(mixed $json): DeviceTemperature|null { if (!$json) { return null; } - return new self( - time: $json->time, - value: $json->value, - ); + return new self(time: $json->time, value: $json->value); } - - - public function __construct( - public string $time, - public float $value, - ) { + public function __construct(public string $time, public float $value) + { } - } diff --git a/src/Objects/DeviceTtlockMetadata.php b/src/Objects/DeviceTtlockMetadata.php index e84e12d..4e9cd4f 100644 --- a/src/Objects/DeviceTtlockMetadata.php +++ b/src/Objects/DeviceTtlockMetadata.php @@ -4,24 +4,17 @@ class DeviceTtlockMetadata { - public static function from_json(mixed $json): DeviceTtlockMetadata|null { if (!$json) { return null; } - return new self( - lock_alias: $json->lock_alias, - lock_id: $json->lock_id, - ); + return new self(lock_alias: $json->lock_alias, lock_id: $json->lock_id); } - - public function __construct( public string $lock_alias, - public float $lock_id, + public float $lock_id ) { } - } diff --git a/src/Objects/DeviceTwoNMetadata.php b/src/Objects/DeviceTwoNMetadata.php index 45c3875..39da975 100644 --- a/src/Objects/DeviceTwoNMetadata.php +++ b/src/Objects/DeviceTwoNMetadata.php @@ -4,7 +4,6 @@ class DeviceTwoNMetadata { - public static function from_json(mixed $json): DeviceTwoNMetadata|null { if (!$json) { @@ -12,16 +11,13 @@ public static function from_json(mixed $json): DeviceTwoNMetadata|null } return new self( device_id: $json->device_id, - device_name: $json->device_name, + device_name: $json->device_name ); } - - public function __construct( public float $device_id, - public string $device_name, + public string $device_name ) { } - } diff --git a/src/Objects/DeviceWarnings.php b/src/Objects/DeviceWarnings.php index f8cea1d..fa29faf 100644 --- a/src/Objects/DeviceWarnings.php +++ b/src/Objects/DeviceWarnings.php @@ -4,7 +4,6 @@ class DeviceWarnings { - public static function from_json(mixed $json): DeviceWarnings|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): DeviceWarnings|null return new self( message: $json->message, warning_code: $json->warning_code, - created_at: $json->created_at ?? null, + created_at: $json->created_at ?? null ); } - - public function __construct( public string $message, public string $warning_code, - public string | null $created_at, + public string|null $created_at ) { } - } diff --git a/src/Objects/DeviceWyzeMetadata.php b/src/Objects/DeviceWyzeMetadata.php index 6a2743d..ad3d65d 100644 --- a/src/Objects/DeviceWyzeMetadata.php +++ b/src/Objects/DeviceWyzeMetadata.php @@ -4,7 +4,6 @@ class DeviceWyzeMetadata { - public static function from_json(mixed $json): DeviceWyzeMetadata|null { if (!$json) { @@ -18,22 +17,19 @@ public static function from_json(mixed $json): DeviceWyzeMetadata|null locker_status_hardlock: $json->locker_status_hardlock ?? null, product_model: $json->product_model, product_name: $json->product_name, - product_type: $json->product_type, + product_type: $json->product_type ); } - - public function __construct( public string $device_id, public string $device_info_model, public string $device_name, - public string | null $keypad_uuid, - public float | null $locker_status_hardlock, + public string|null $keypad_uuid, + public float|null $locker_status_hardlock, public string $product_model, public string $product_name, - public string $product_type, + public string $product_type ) { } - } diff --git a/src/Objects/EnrollmentAutomation.php b/src/Objects/EnrollmentAutomation.php index 4467d41..176ba37 100644 --- a/src/Objects/EnrollmentAutomation.php +++ b/src/Objects/EnrollmentAutomation.php @@ -4,7 +4,6 @@ class EnrollmentAutomation { - public static function from_json(mixed $json): EnrollmentAutomation|null { if (!$json) { @@ -15,19 +14,16 @@ public static function from_json(mixed $json): EnrollmentAutomation|null credential_manager_acs_system_id: $json->credential_manager_acs_system_id, enrollment_automation_id: $json->enrollment_automation_id, user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $created_at, public string $credential_manager_acs_system_id, public string $enrollment_automation_id, public string $user_identity_id, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/Event.php b/src/Objects/Event.php index 06697d4..1e58b30 100644 --- a/src/Objects/Event.php +++ b/src/Objects/Event.php @@ -4,7 +4,6 @@ class Event { - public static function from_json(mixed $json): Event|null { if (!$json) { @@ -16,20 +15,17 @@ public static function from_json(mixed $json): Event|null event_id: $json->event_id, event_type: $json->event_type, occurred_at: $json->occurred_at, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $created_at, - public string | null $device_id, + public string|null $device_id, public string $event_id, public string $event_type, public string $occurred_at, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/Network.php b/src/Objects/Network.php index 463ad82..c17b16d 100644 --- a/src/Objects/Network.php +++ b/src/Objects/Network.php @@ -4,7 +4,6 @@ class Network { - public static function from_json(mixed $json): Network|null { if (!$json) { @@ -14,18 +13,15 @@ public static function from_json(mixed $json): Network|null created_at: $json->created_at, display_name: $json->display_name, network_id: $json->network_id, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $created_at, public string $display_name, public string $network_id, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/NoiseThreshold.php b/src/Objects/NoiseThreshold.php index 629bd97..0a3c962 100644 --- a/src/Objects/NoiseThreshold.php +++ b/src/Objects/NoiseThreshold.php @@ -4,7 +4,6 @@ class NoiseThreshold { - public static function from_json(mixed $json): NoiseThreshold|null { if (!$json) { @@ -17,21 +16,18 @@ public static function from_json(mixed $json): NoiseThreshold|null noise_threshold_decibels: $json->noise_threshold_decibels, noise_threshold_id: $json->noise_threshold_id, noise_threshold_nrs: $json->noise_threshold_nrs ?? null, - starts_daily_at: $json->starts_daily_at, + starts_daily_at: $json->starts_daily_at ); } - - public function __construct( public string $device_id, public string $ends_daily_at, public string $name, public float $noise_threshold_decibels, public string $noise_threshold_id, - public float | null $noise_threshold_nrs, - public string $starts_daily_at, + public float|null $noise_threshold_nrs, + public string $starts_daily_at ) { } - } diff --git a/src/Objects/Phone.php b/src/Objects/Phone.php index 8609361..9132a45 100644 --- a/src/Objects/Phone.php +++ b/src/Objects/Phone.php @@ -4,15 +4,16 @@ class Phone { - public static function from_json(mixed $json): Phone|null { if (!$json) { return null; } return new self( - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? null, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, can_remotely_lock: $json->can_remotely_lock ?? null, can_remotely_unlock: $json->can_remotely_unlock ?? null, can_simulate_removal: $json->can_simulate_removal ?? null, @@ -23,29 +24,29 @@ public static function from_json(mixed $json): Phone|null device_type: $json->device_type, display_name: $json->display_name, errors: array_map( - fn ($e) => PhoneErrors::from_json($e), - $json->errors ?? [] - ), + fn($e) => PhoneErrors::from_json($e), + $json->errors ?? [] + ), is_managed: $json->is_managed, - location: isset($json->location) ? PhoneLocation::from_json($json->location) : null, + location: isset($json->location) + ? PhoneLocation::from_json($json->location) + : null, nickname: $json->nickname ?? null, properties: PhoneProperties::from_json($json->properties), warnings: array_map( - fn ($w) => PhoneWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, + fn($w) => PhoneWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id ); } - - public function __construct( - public bool | null $can_program_offline_access_codes, - public bool | null $can_program_online_access_codes, - public bool | null $can_remotely_lock, - public bool | null $can_remotely_unlock, - public bool | null $can_simulate_removal, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_removal, public array $capabilities_supported, public string $created_at, public mixed $custom_metadata, @@ -54,12 +55,11 @@ public function __construct( public string $display_name, public array $errors, public bool $is_managed, - public PhoneLocation | null $location, - public string | null $nickname, + public PhoneLocation|null $location, + public string|null $nickname, public PhoneProperties $properties, public array $warnings, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php b/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php index 2a7c01e..aaebfb0 100644 --- a/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php +++ b/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php @@ -4,27 +4,24 @@ class PhoneAssaAbloyCredentialServiceMetadata { - - public static function from_json(mixed $json): PhoneAssaAbloyCredentialServiceMetadata|null - { + public static function from_json( + mixed $json + ): PhoneAssaAbloyCredentialServiceMetadata|null { if (!$json) { return null; } return new self( endpoints: array_map( - fn ($e) => PhoneEndpoints::from_json($e), - $json->endpoints ?? [] - ), - has_active_endpoint: $json->has_active_endpoint, + fn($e) => PhoneEndpoints::from_json($e), + $json->endpoints ?? [] + ), + has_active_endpoint: $json->has_active_endpoint ); } - - public function __construct( public array $endpoints, - public bool $has_active_endpoint, + public bool $has_active_endpoint ) { } - } diff --git a/src/Objects/PhoneEndpoints.php b/src/Objects/PhoneEndpoints.php index 6e7c901..ef2497f 100644 --- a/src/Objects/PhoneEndpoints.php +++ b/src/Objects/PhoneEndpoints.php @@ -4,7 +4,6 @@ class PhoneEndpoints { - public static function from_json(mixed $json): PhoneEndpoints|null { if (!$json) { @@ -12,16 +11,13 @@ public static function from_json(mixed $json): PhoneEndpoints|null } return new self( endpoint_id: $json->endpoint_id, - is_active: $json->is_active, + is_active: $json->is_active ); } - - public function __construct( public string $endpoint_id, - public bool $is_active, + public bool $is_active ) { } - } diff --git a/src/Objects/PhoneErrors.php b/src/Objects/PhoneErrors.php index 00396ce..a09d12f 100644 --- a/src/Objects/PhoneErrors.php +++ b/src/Objects/PhoneErrors.php @@ -4,7 +4,6 @@ class PhoneErrors { - public static function from_json(mixed $json): PhoneErrors|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): PhoneErrors|null return new self( error_code: $json->error_code, message: $json->message, - created_at: $json->created_at ?? null, + created_at: $json->created_at ?? null ); } - - public function __construct( public string $error_code, public string $message, - public string | null $created_at, + public string|null $created_at ) { } - } diff --git a/src/Objects/PhoneLocation.php b/src/Objects/PhoneLocation.php index ba3e557..5af1657 100644 --- a/src/Objects/PhoneLocation.php +++ b/src/Objects/PhoneLocation.php @@ -4,7 +4,6 @@ class PhoneLocation { - public static function from_json(mixed $json): PhoneLocation|null { if (!$json) { @@ -12,16 +11,13 @@ public static function from_json(mixed $json): PhoneLocation|null } return new self( location_name: $json->location_name ?? null, - timezone: $json->timezone ?? null, + timezone: $json->timezone ?? null ); } - - public function __construct( - public string | null $location_name, - public string | null $timezone, + public string|null $location_name, + public string|null $timezone ) { } - } diff --git a/src/Objects/PhoneProperties.php b/src/Objects/PhoneProperties.php index 0dea6a2..c6f02cc 100644 --- a/src/Objects/PhoneProperties.php +++ b/src/Objects/PhoneProperties.php @@ -4,22 +4,24 @@ class PhoneProperties { - public static function from_json(mixed $json): PhoneProperties|null { if (!$json) { return null; } return new self( - assa_abloy_credential_service_metadata: isset($json->assa_abloy_credential_service_metadata) ? PhoneAssaAbloyCredentialServiceMetadata::from_json($json->assa_abloy_credential_service_metadata) : null, + assa_abloy_credential_service_metadata: isset( + $json->assa_abloy_credential_service_metadata + ) + ? PhoneAssaAbloyCredentialServiceMetadata::from_json( + $json->assa_abloy_credential_service_metadata + ) + : null ); } - - public function __construct( - public PhoneAssaAbloyCredentialServiceMetadata | null $assa_abloy_credential_service_metadata, + public PhoneAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata ) { } - } diff --git a/src/Objects/PhoneWarnings.php b/src/Objects/PhoneWarnings.php index 9749b8d..965de6c 100644 --- a/src/Objects/PhoneWarnings.php +++ b/src/Objects/PhoneWarnings.php @@ -4,7 +4,6 @@ class PhoneWarnings { - public static function from_json(mixed $json): PhoneWarnings|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): PhoneWarnings|null return new self( message: $json->message, warning_code: $json->warning_code, - created_at: $json->created_at ?? null, + created_at: $json->created_at ?? null ); } - - public function __construct( public string $message, public string $warning_code, - public string | null $created_at, + public string|null $created_at ) { } - } diff --git a/src/Objects/ServiceHealth.php b/src/Objects/ServiceHealth.php index b0a8cd0..692d3ed 100644 --- a/src/Objects/ServiceHealth.php +++ b/src/Objects/ServiceHealth.php @@ -4,7 +4,6 @@ class ServiceHealth { - public static function from_json(mixed $json): ServiceHealth|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): ServiceHealth|null return new self( description: $json->description, service: $json->service, - status: $json->status, + status: $json->status ); } - - public function __construct( public string $description, public string $service, - public string $status, + public string $status ) { } - } diff --git a/src/Objects/UnmanagedAccessCode.php b/src/Objects/UnmanagedAccessCode.php index a30cda5..2f14365 100644 --- a/src/Objects/UnmanagedAccessCode.php +++ b/src/Objects/UnmanagedAccessCode.php @@ -4,7 +4,6 @@ class UnmanagedAccessCode { - public static function from_json(mixed $json): UnmanagedAccessCode|null { if (!$json) { @@ -22,26 +21,23 @@ public static function from_json(mixed $json): UnmanagedAccessCode|null starts_at: $json->starts_at ?? null, status: $json->status, type: $json->type, - warnings: $json->warnings ?? null, + warnings: $json->warnings ?? null ); } - - public function __construct( public string $access_code_id, - public string | null $code, + public string|null $code, public string $created_at, public string $device_id, - public string | null $ends_at, + public string|null $ends_at, public mixed $errors, public bool $is_managed, - public string | null $name, - public string | null $starts_at, + public string|null $name, + public string|null $starts_at, public string $status, public string $type, - public mixed $warnings, + public mixed $warnings ) { } - } diff --git a/src/Objects/UnmanagedDevice.php b/src/Objects/UnmanagedDevice.php index c398df6..cbfefbd 100644 --- a/src/Objects/UnmanagedDevice.php +++ b/src/Objects/UnmanagedDevice.php @@ -4,15 +4,16 @@ class UnmanagedDevice { - public static function from_json(mixed $json): UnmanagedDevice|null { if (!$json) { return null; } return new self( - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? null, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, can_remotely_lock: $json->can_remotely_lock ?? null, can_remotely_unlock: $json->can_remotely_unlock ?? null, can_simulate_removal: $json->can_simulate_removal ?? null, @@ -22,27 +23,25 @@ public static function from_json(mixed $json): UnmanagedDevice|null device_id: $json->device_id, device_type: $json->device_type, errors: array_map( - fn ($e) => UnmanagedDeviceErrors::from_json($e), - $json->errors ?? [] - ), + fn($e) => UnmanagedDeviceErrors::from_json($e), + $json->errors ?? [] + ), is_managed: $json->is_managed, properties: UnmanagedDeviceProperties::from_json($json->properties), warnings: array_map( - fn ($w) => UnmanagedDeviceWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, + fn($w) => UnmanagedDeviceWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id ); } - - public function __construct( - public bool | null $can_program_offline_access_codes, - public bool | null $can_program_online_access_codes, - public bool | null $can_remotely_lock, - public bool | null $can_remotely_unlock, - public bool | null $can_simulate_removal, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_removal, public array $capabilities_supported, public string $connected_account_id, public string $created_at, @@ -52,8 +51,7 @@ public function __construct( public bool $is_managed, public UnmanagedDeviceProperties $properties, public array $warnings, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/Objects/UnmanagedDeviceAccessoryKeypad.php b/src/Objects/UnmanagedDeviceAccessoryKeypad.php index 67f58a6..f231858 100644 --- a/src/Objects/UnmanagedDeviceAccessoryKeypad.php +++ b/src/Objects/UnmanagedDeviceAccessoryKeypad.php @@ -4,24 +4,23 @@ class UnmanagedDeviceAccessoryKeypad { - - public static function from_json(mixed $json): UnmanagedDeviceAccessoryKeypad|null - { + public static function from_json( + mixed $json + ): UnmanagedDeviceAccessoryKeypad|null { if (!$json) { return null; } return new self( - battery: isset($json->battery) ? UnmanagedDeviceBattery::from_json($json->battery) : null, - is_connected: $json->is_connected, + battery: isset($json->battery) + ? UnmanagedDeviceBattery::from_json($json->battery) + : null, + is_connected: $json->is_connected ); } - - public function __construct( - public UnmanagedDeviceBattery | null $battery, - public bool $is_connected, + public UnmanagedDeviceBattery|null $battery, + public bool $is_connected ) { } - } diff --git a/src/Objects/UnmanagedDeviceBattery.php b/src/Objects/UnmanagedDeviceBattery.php index 178ee63..175aa6b 100644 --- a/src/Objects/UnmanagedDeviceBattery.php +++ b/src/Objects/UnmanagedDeviceBattery.php @@ -4,22 +4,15 @@ class UnmanagedDeviceBattery { - public static function from_json(mixed $json): UnmanagedDeviceBattery|null { if (!$json) { return null; } - return new self( - level: $json->level, - ); + return new self(level: $json->level); } - - - public function __construct( - public float $level, - ) { + public function __construct(public float $level) + { } - } diff --git a/src/Objects/UnmanagedDeviceErrors.php b/src/Objects/UnmanagedDeviceErrors.php index 005e3bd..2792f54 100644 --- a/src/Objects/UnmanagedDeviceErrors.php +++ b/src/Objects/UnmanagedDeviceErrors.php @@ -4,7 +4,6 @@ class UnmanagedDeviceErrors { - public static function from_json(mixed $json): UnmanagedDeviceErrors|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): UnmanagedDeviceErrors|null return new self( error_code: $json->error_code, message: $json->message, - created_at: $json->created_at ?? null, + created_at: $json->created_at ?? null ); } - - public function __construct( public string $error_code, public string $message, - public string | null $created_at, + public string|null $created_at ) { } - } diff --git a/src/Objects/UnmanagedDeviceModel.php b/src/Objects/UnmanagedDeviceModel.php index bb2a0ce..f46c5db 100644 --- a/src/Objects/UnmanagedDeviceModel.php +++ b/src/Objects/UnmanagedDeviceModel.php @@ -4,34 +4,34 @@ class UnmanagedDeviceModel { - public static function from_json(mixed $json): UnmanagedDeviceModel|null { if (!$json) { return null; } return new self( - accessory_keypad_supported: $json->accessory_keypad_supported ?? null, - can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? null, + accessory_keypad_supported: $json->accessory_keypad_supported ?? + null, + can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? + null, display_name: $json->display_name, has_built_in_keypad: $json->has_built_in_keypad ?? null, manufacturer_display_name: $json->manufacturer_display_name, - offline_access_codes_supported: $json->offline_access_codes_supported ?? null, - online_access_codes_supported: $json->online_access_codes_supported ?? null, + offline_access_codes_supported: $json->offline_access_codes_supported ?? + null, + online_access_codes_supported: $json->online_access_codes_supported ?? + null ); } - - public function __construct( - public bool | null $accessory_keypad_supported, - public bool | null $can_connect_accessory_keypad, + public bool|null $accessory_keypad_supported, + public bool|null $can_connect_accessory_keypad, public string $display_name, - public bool | null $has_built_in_keypad, + public bool|null $has_built_in_keypad, public string $manufacturer_display_name, - public bool | null $offline_access_codes_supported, - public bool | null $online_access_codes_supported, + public bool|null $offline_access_codes_supported, + public bool|null $online_access_codes_supported ) { } - } diff --git a/src/Objects/UnmanagedDeviceProperties.php b/src/Objects/UnmanagedDeviceProperties.php index ded524a..3970c94 100644 --- a/src/Objects/UnmanagedDeviceProperties.php +++ b/src/Objects/UnmanagedDeviceProperties.php @@ -4,42 +4,47 @@ class UnmanagedDeviceProperties { - - public static function from_json(mixed $json): UnmanagedDeviceProperties|null - { + public static function from_json( + mixed $json + ): UnmanagedDeviceProperties|null { if (!$json) { return null; } return new self( - accessory_keypad: isset($json->accessory_keypad) ? UnmanagedDeviceAccessoryKeypad::from_json($json->accessory_keypad) : null, - battery: isset($json->battery) ? UnmanagedDeviceBattery::from_json($json->battery) : null, + accessory_keypad: isset($json->accessory_keypad) + ? UnmanagedDeviceAccessoryKeypad::from_json( + $json->accessory_keypad + ) + : null, + battery: isset($json->battery) + ? UnmanagedDeviceBattery::from_json($json->battery) + : null, battery_level: $json->battery_level ?? null, image_alt_text: $json->image_alt_text ?? null, image_url: $json->image_url ?? null, manufacturer: $json->manufacturer ?? null, model: UnmanagedDeviceModel::from_json($json->model), name: $json->name, - offline_access_codes_enabled: $json->offline_access_codes_enabled ?? null, + offline_access_codes_enabled: $json->offline_access_codes_enabled ?? + null, online: $json->online, - online_access_codes_enabled: $json->online_access_codes_enabled ?? null, + online_access_codes_enabled: $json->online_access_codes_enabled ?? + null ); } - - public function __construct( - public UnmanagedDeviceAccessoryKeypad | null $accessory_keypad, - public UnmanagedDeviceBattery | null $battery, - public float | null $battery_level, - public string | null $image_alt_text, - public string | null $image_url, - public string | null $manufacturer, + public UnmanagedDeviceAccessoryKeypad|null $accessory_keypad, + public UnmanagedDeviceBattery|null $battery, + public float|null $battery_level, + public string|null $image_alt_text, + public string|null $image_url, + public string|null $manufacturer, public UnmanagedDeviceModel $model, public string $name, - public bool | null $offline_access_codes_enabled, + public bool|null $offline_access_codes_enabled, public bool $online, - public bool | null $online_access_codes_enabled, + public bool|null $online_access_codes_enabled ) { } - } diff --git a/src/Objects/UnmanagedDeviceWarnings.php b/src/Objects/UnmanagedDeviceWarnings.php index 8cad447..84cc664 100644 --- a/src/Objects/UnmanagedDeviceWarnings.php +++ b/src/Objects/UnmanagedDeviceWarnings.php @@ -4,7 +4,6 @@ class UnmanagedDeviceWarnings { - public static function from_json(mixed $json): UnmanagedDeviceWarnings|null { if (!$json) { @@ -13,17 +12,14 @@ public static function from_json(mixed $json): UnmanagedDeviceWarnings|null return new self( message: $json->message, warning_code: $json->warning_code, - created_at: $json->created_at ?? null, + created_at: $json->created_at ?? null ); } - - public function __construct( public string $message, public string $warning_code, - public string | null $created_at, + public string|null $created_at ) { } - } diff --git a/src/Objects/UserIdentity.php b/src/Objects/UserIdentity.php index 99f573b..c529a3c 100644 --- a/src/Objects/UserIdentity.php +++ b/src/Objects/UserIdentity.php @@ -4,7 +4,6 @@ class UserIdentity { - public static function from_json(mixed $json): UserIdentity|null { if (!$json) { @@ -18,22 +17,19 @@ public static function from_json(mixed $json): UserIdentity|null phone_number: $json->phone_number ?? null, user_identity_id: $json->user_identity_id, user_identity_key: $json->user_identity_key ?? null, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( public string $created_at, public string $display_name, - public string | null $email_address, - public string | null $full_name, - public string | null $phone_number, + public string|null $email_address, + public string|null $full_name, + public string|null $phone_number, public string $user_identity_id, - public string | null $user_identity_key, - public string $workspace_id, + public string|null $user_identity_key, + public string $workspace_id ) { } - } diff --git a/src/Objects/Webhook.php b/src/Objects/Webhook.php index 7671fd6..0aa3975 100644 --- a/src/Objects/Webhook.php +++ b/src/Objects/Webhook.php @@ -4,7 +4,6 @@ class Webhook { - public static function from_json(mixed $json): Webhook|null { if (!$json) { @@ -14,18 +13,15 @@ public static function from_json(mixed $json): Webhook|null event_types: $json->event_types ?? null, secret: $json->secret ?? null, url: $json->url, - webhook_id: $json->webhook_id, + webhook_id: $json->webhook_id ); } - - public function __construct( - public array | null $event_types, - public string | null $secret, + public array|null $event_types, + public string|null $secret, public string $url, - public string $webhook_id, + public string $webhook_id ) { } - } diff --git a/src/Objects/Workspace.php b/src/Objects/Workspace.php index 9e9941d..7122fba 100644 --- a/src/Objects/Workspace.php +++ b/src/Objects/Workspace.php @@ -4,7 +4,6 @@ class Workspace { - public static function from_json(mixed $json): Workspace|null { if (!$json) { @@ -14,18 +13,15 @@ public static function from_json(mixed $json): Workspace|null connect_partner_name: $json->connect_partner_name ?? null, is_sandbox: $json->is_sandbox, name: $json->name, - workspace_id: $json->workspace_id, + workspace_id: $json->workspace_id ); } - - public function __construct( - public string | null $connect_partner_name, + public string|null $connect_partner_name, public bool $is_sandbox, public string $name, - public string $workspace_id, + public string $workspace_id ) { } - } diff --git a/src/SeamClient.php b/src/SeamClient.php index 50d0fda..63bafc2 100644 --- a/src/SeamClient.php +++ b/src/SeamClient.php @@ -33,4694 +33,4083 @@ use GuzzleHttp\Client as HTTPClient; use \Exception as Exception; -define('LTS_VERSION', '1.0.0'); +define("LTS_VERSION", "1.0.0"); class SeamClient { - public AccessCodesClient $access_codes; - public AcsClient $acs; - public ActionAttemptsClient $action_attempts; - public ClientSessionsClient $client_sessions; - public ConnectWebviewsClient $connect_webviews; - public ConnectedAccountsClient $connected_accounts; - public DevicesClient $devices; - public EventsClient $events; - public LocksClient $locks; - public NetworksClient $networks; - public NoiseSensorsClient $noise_sensors; - public PhonesClient $phones; - public ThermostatsClient $thermostats; - public UserIdentitiesClient $user_identities; - public WebhooksClient $webhooks; - public WorkspacesClient $workspaces; - - public string $api_key; - public HTTPClient $client; - public string $ltsVersion = LTS_VERSION; - - public function __construct( - $api_key, - $endpoint = "https://connect.getseam.com", - $throw_http_errors = false - ) { - $this->api_key = $api_key; - $seam_sdk_version = PackageVersion::get(); - $this->client = new HTTPClient([ - "base_uri" => $endpoint, - "timeout" => 60.0, - "headers" => [ - "Authorization" => "Bearer " . $this->api_key, - "User-Agent" => "Seam PHP Client ". $seam_sdk_version, - "seam-sdk-name" => "seamapi/php", - "seam-sdk-version" => $seam_sdk_version, - "seam-lts-version" => $this->ltsVersion - ], - "http_errors" => $throw_http_errors, - ]); - $this->access_codes = new AccessCodesClient($this); - $this->acs = new AcsClient($this); - $this->action_attempts = new ActionAttemptsClient($this); - $this->client_sessions = new ClientSessionsClient($this); - $this->connect_webviews = new ConnectWebviewsClient($this); - $this->connected_accounts = new ConnectedAccountsClient($this); - $this->devices = new DevicesClient($this); - $this->events = new EventsClient($this); - $this->locks = new LocksClient($this); - $this->networks = new NetworksClient($this); - $this->noise_sensors = new NoiseSensorsClient($this); - $this->phones = new PhonesClient($this); - $this->thermostats = new ThermostatsClient($this); - $this->user_identities = new UserIdentitiesClient($this); - $this->webhooks = new WebhooksClient($this); - $this->workspaces = new WorkspacesClient($this); - } - - public function request( - $method, - $path, - $json = null, - $query = null, - $inner_object = null - ) { - $options = [ - "json" => $json, - "query" => $query, - ]; - $options = array_filter($options, fn ($option) => $option !== null); - - // TODO handle request errors - $response = $this->client->request($method, $path, $options); - $status_code = $response->getStatusCode(); - $request_id = $response->getHeaderLine('seam-request-id'); - - $res_json = null; - try { - $res_json = json_decode($response->getBody()); - } catch (Exception $ignoreError) { - } - - if (($res_json->error ?? null) != null) { - throw new Exception( - "Error Calling \"" . - $method . - " " . - $path . - "\" : " . - ($res_json->error->type ?? "") . - ": " . - $res_json->error->message . - " [Request ID: " . $request_id . "]" - ); - } - - if ($status_code >= 400) { - $error_message = $response->getReasonPhrase(); - - throw new Exception( - "HTTP Error: " . $error_message . " [" . $status_code . "] " . $method . " " . $path . - " [Request ID: " . $request_id . "]" - ); - } - - if ($inner_object) { - if (!is_array($res_json->$inner_object) && ($res_json->$inner_object ?? null) == null) { - throw new Exception( - 'Missing Inner Object "' . - $inner_object . - '" for ' . - $method . - " " . - $path . - " [Request ID: " . $request_id . "]" - ); - } - return $res_json->$inner_object; - } - return $res_json; - } -} - -class AccessCodesClient -{ - private SeamClient $seam; - public AccessCodesSimulateClient $simulate; - public AccessCodesUnmanagedClient $unmanaged; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->simulate = new AccessCodesSimulateClient($seam); -$this->unmanaged = new AccessCodesUnmanagedClient($seam); - } - - - public function create( - string $device_id, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $code = null, - string $common_code_key = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - string $starts_at = null, - bool $sync = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): AccessCode { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($common_code_key !== null) { - $request_payload["common_code_key"] = $common_code_key; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - if ($is_offline_access_code !== null) { - $request_payload["is_offline_access_code"] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - if ($use_backup_access_code_pool !== null) { - $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload["use_offline_access_code"] = $use_offline_access_code; - } - - $res = $this->seam->request( - "POST", - "/access_codes/create", - json: $request_payload, - inner_object: "access_code", - ); - - - - - - return AccessCode::from_json($res); - } - - public function create_multiple( - array $device_ids, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $behavior_when_code_cannot_be_shared = null, - string $code = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - float $preferred_code_length = null, - string $starts_at = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): array { - $request_payload = []; - - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; - } - if ($behavior_when_code_cannot_be_shared !== null) { - $request_payload["behavior_when_code_cannot_be_shared"] = $behavior_when_code_cannot_be_shared; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - if ($is_offline_access_code !== null) { - $request_payload["is_offline_access_code"] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; - } - if ($preferred_code_length !== null) { - $request_payload["preferred_code_length"] = $preferred_code_length; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($use_backup_access_code_pool !== null) { - $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload["use_offline_access_code"] = $use_offline_access_code; - } - - $res = $this->seam->request( - "POST", - "/access_codes/create_multiple", - json: $request_payload, - inner_object: "access_codes", - ); - - - - - - return array_map(fn ($r) => AccessCode::from_json($r), $res); - } - - public function delete( - string $access_code_id, - string $device_id = null, - bool $sync = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/delete", - json: $request_payload, - - ); - - - - - - - } - - public function generate_code( - string $device_id - ): AccessCode { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/generate_code", - json: $request_payload, - inner_object: "generated_code", - ); - - - - - - return AccessCode::from_json($res); - } - - public function get( - string $access_code_id = null, - string $code = null, - string $device_id = null - ): AccessCode { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/get", - json: $request_payload, - inner_object: "access_code", - ); - - - - - - return AccessCode::from_json($res); - } - - public function list( - array $access_code_ids = null, - string $device_id = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($access_code_ids !== null) { - $request_payload["access_code_ids"] = $access_code_ids; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/access_codes/list", - json: $request_payload, - inner_object: "access_codes", - ); - - - - - - return array_map(fn ($r) => AccessCode::from_json($r), $res); - } - - public function pull_backup_access_code( - string $access_code_id - ): AccessCode { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/pull_backup_access_code", - json: $request_payload, - inner_object: "backup_access_code", - ); - - - - - - return AccessCode::from_json($res); - } - - public function update( - string $access_code_id, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $code = null, - string $device_id = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_managed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - string $starts_at = null, - bool $sync = null, - string $type = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($is_offline_access_code !== null) { - $request_payload["is_offline_access_code"] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - if ($type !== null) { - $request_payload["type"] = $type; - } - if ($use_backup_access_code_pool !== null) { - $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload["use_offline_access_code"] = $use_offline_access_code; - } - - $this->seam->request( - "POST", - "/access_codes/update", - json: $request_payload, - - ); - - - - - - - } - -} - -class AccessCodesSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function create_unmanaged_access_code( - string $code, - string $device_id, - string $name - ): UnmanagedAccessCode { - $request_payload = []; - - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/access_codes/simulate/create_unmanaged_access_code", - json: $request_payload, - inner_object: "access_code", - ); - - - - - - return UnmanagedAccessCode::from_json($res); - } - -} - -class AccessCodesUnmanagedClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function convert_to_managed( - string $access_code_id, - bool $allow_external_modification = null, - bool $force = null, - bool $is_external_modification_allowed = null, - bool $sync = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($force !== null) { - $request_payload["force"] = $force; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/convert_to_managed", - json: $request_payload, - - ); - - - - - - - } - - public function delete( - string $access_code_id, - bool $sync = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/delete", - json: $request_payload, - - ); - - - - - - - } - - public function get( - string $access_code_id = null, - string $code = null, - string $device_id = null - ): UnmanagedAccessCode { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/unmanaged/get", - json: $request_payload, - inner_object: "access_code", - ); - - - - - - return UnmanagedAccessCode::from_json($res); - } - - public function list( - string $device_id, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/access_codes/unmanaged/list", - json: $request_payload, - inner_object: "access_codes", - ); - - - - - - return array_map(fn ($r) => UnmanagedAccessCode::from_json($r), $res); - } - - public function update( - string $access_code_id, - bool $is_managed, - bool $allow_external_modification = null, - bool $force = null, - bool $is_external_modification_allowed = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($force !== null) { - $request_payload["force"] = $force; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/update", - json: $request_payload, - - ); - - - - - - - } - -} - -class AcsAccessGroupsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function add_user( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/access_groups/add_user", - json: $request_payload, - - ); - - - - - - - } - - public function get( - string $acs_access_group_id - ): AcsAccessGroup { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/get", - json: $request_payload, - inner_object: "acs_access_group", - ); - - - - - - return AcsAccessGroup::from_json($res); - } - - public function list( - string $acs_system_id = null, - string $acs_user_id = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/list", - json: $request_payload, - inner_object: "acs_access_groups", - ); - - - - - - return array_map(fn ($r) => AcsAccessGroup::from_json($r), $res); - } - - public function list_users( - string $acs_access_group_id - ): array { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/list_users", - json: $request_payload, - inner_object: "acs_users", - ); - - - - - - return array_map(fn ($r) => AcsUser::from_json($r), $res); - } - - public function remove_user( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/access_groups/remove_user", - json: $request_payload, - - ); - - - - - - - } - -} - -class AcsClient -{ - private SeamClient $seam; - public AcsAccessGroupsClient $access_groups; - public AcsCredentialPoolsClient $credential_pools; - public AcsCredentialProvisioningAutomationsClient $credential_provisioning_automations; - public AcsCredentialsClient $credentials; - public AcsEntrancesClient $entrances; - public AcsSystemsClient $systems; - public AcsUsersClient $users; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->access_groups = new AcsAccessGroupsClient($seam); -$this->credential_pools = new AcsCredentialPoolsClient($seam); -$this->credential_provisioning_automations = new AcsCredentialProvisioningAutomationsClient($seam); -$this->credentials = new AcsCredentialsClient($seam); -$this->entrances = new AcsEntrancesClient($seam); -$this->systems = new AcsSystemsClient($seam); -$this->users = new AcsUsersClient($seam); - } - - -} - -class AcsCredentialPoolsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function list( - string $acs_system_id - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credential_pools/list", - json: $request_payload, - inner_object: "acs_credential_pools", - ); - - - - - - return array_map(fn ($r) => AcsCredentialPool::from_json($r), $res); - } - -} - -class AcsCredentialProvisioningAutomationsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function launch( - string $credential_manager_acs_system_id, - string $user_identity_id, - string $acs_credential_pool_id = null, - bool $create_credential_manager_user = null, - string $credential_manager_acs_user_id = null - ): AcsCredentialProvisioningAutomation { - $request_payload = []; - - if ($credential_manager_acs_system_id !== null) { - $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($acs_credential_pool_id !== null) { - $request_payload["acs_credential_pool_id"] = $acs_credential_pool_id; - } - if ($create_credential_manager_user !== null) { - $request_payload["create_credential_manager_user"] = $create_credential_manager_user; - } - if ($credential_manager_acs_user_id !== null) { - $request_payload["credential_manager_acs_user_id"] = $credential_manager_acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credential_provisioning_automations/launch", - json: $request_payload, - inner_object: "acs_credential_provisioning_automation", - ); - - - - - - return AcsCredentialProvisioningAutomation::from_json($res); - } - -} - -class AcsCredentialsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function assign( - string $acs_credential_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/assign", - json: $request_payload, - - ); - - - - - - - } - - public function create( - string $access_method, - string $acs_user_id, - array $allowed_acs_entrance_ids = null, - string $code = null, - string $credential_manager_acs_system_id = null, - string $ends_at = null, - bool $is_multi_phone_sync_credential = null, - string $starts_at = null, - mixed $visionline_metadata = null - ): AcsCredential { - $request_payload = []; - - if ($access_method !== null) { - $request_payload["access_method"] = $access_method; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($allowed_acs_entrance_ids !== null) { - $request_payload["allowed_acs_entrance_ids"] = $allowed_acs_entrance_ids; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($credential_manager_acs_system_id !== null) { - $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_multi_phone_sync_credential !== null) { - $request_payload["is_multi_phone_sync_credential"] = $is_multi_phone_sync_credential; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($visionline_metadata !== null) { - $request_payload["visionline_metadata"] = $visionline_metadata; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/create", - json: $request_payload, - inner_object: "acs_credential", - ); - - - - - - return AcsCredential::from_json($res); - } - - public function delete( - string $acs_credential_id - ): void { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/delete", - json: $request_payload, - - ); - - - - - - - } - - public function get( - string $acs_credential_id - ): AcsCredential { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/get", - json: $request_payload, - inner_object: "acs_credential", - ); - - - - - - return AcsCredential::from_json($res); - } - - public function list( - string $acs_user_id = null, - string $acs_system_id = null, - string $user_identity_id = null, - bool $is_multi_phone_sync_credential = null - ): array { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($is_multi_phone_sync_credential !== null) { - $request_payload["is_multi_phone_sync_credential"] = $is_multi_phone_sync_credential; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/list", - json: $request_payload, - inner_object: "acs_credentials", - ); - - - - - - return array_map(fn ($r) => AcsCredential::from_json($r), $res); - } - - public function unassign( - string $acs_credential_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/unassign", - json: $request_payload, - - ); - - - - - - - } - - public function update( - string $acs_credential_id, - string $code - ): void { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - - $this->seam->request( - "POST", - "/acs/credentials/update", - json: $request_payload, - - ); - - - - - - - } - -} - -class AcsEntrancesClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function get( - string $acs_entrance_id - ): AcsEntrance { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/get", - json: $request_payload, - inner_object: "acs_entrance", - ); - - - - - - return AcsEntrance::from_json($res); - } - - public function grant_access( - string $acs_entrance_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/entrances/grant_access", - json: $request_payload, - - ); - - - - - - - } - - public function list( - string $acs_credential_id = null, - string $acs_system_id = null - ): array { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/list", - json: $request_payload, - inner_object: "acs_entrances", - ); - - - - - - return array_map(fn ($r) => AcsEntrance::from_json($r), $res); - } - - public function list_credentials_with_access( - string $acs_entrance_id, - array $include_if = null - ): array { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/list_credentials_with_access", - json: $request_payload, - inner_object: "acs_credentials", - ); - - - - - - return array_map(fn ($r) => AcsCredential::from_json($r), $res); - } - -} - -class AcsSystemsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function get( - string $acs_system_id - ): AcsSystem { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/systems/get", - json: $request_payload, - inner_object: "acs_system", - ); - - - - - - return AcsSystem::from_json($res); - } - - public function list( - string $connected_account_id = null - ): array { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - - $res = $this->seam->request( - "POST", - "/acs/systems/list", - json: $request_payload, - inner_object: "acs_systems", - ); - - - - - - return array_map(fn ($r) => AcsSystem::from_json($r), $res); - } - -} - -class AcsUsersClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function add_to_access_group( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/add_to_access_group", - json: $request_payload, - - ); - - - - - - - } - - public function create( - string $acs_system_id, - mixed $access_schedule = null, - array $acs_access_group_ids = null, - string $email = null, - string $email_address = null, - string $full_name = null, - string $phone_number = null, - string $user_identity_id = null - ): AcsUser { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($access_schedule !== null) { - $request_payload["access_schedule"] = $access_schedule; - } - if ($acs_access_group_ids !== null) { - $request_payload["acs_access_group_ids"] = $acs_access_group_ids; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/create", - json: $request_payload, - inner_object: "acs_user", - ); - - - - - - return AcsUser::from_json($res); - } - - public function delete( - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/delete", - json: $request_payload, - - ); - - - - - - - } - - public function get( - string $acs_user_id - ): AcsUser { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/get", - json: $request_payload, - inner_object: "acs_user", - ); - - - - - - return AcsUser::from_json($res); - } - - public function list( - string $acs_system_id = null, - string $user_identity_email_address = null, - string $user_identity_id = null, - string $user_identity_phone_number = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($user_identity_email_address !== null) { - $request_payload["user_identity_email_address"] = $user_identity_email_address; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($user_identity_phone_number !== null) { - $request_payload["user_identity_phone_number"] = $user_identity_phone_number; - } - - $res = $this->seam->request( - "POST", - "/acs/users/list", - json: $request_payload, - inner_object: "acs_users", - ); - - - - - - return array_map(fn ($r) => AcsUser::from_json($r), $res); - } - - public function list_accessible_entrances( - string $acs_user_id - ): array { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/list_accessible_entrances", - json: $request_payload, - inner_object: "acs_entrances", - ); - - - - - - return array_map(fn ($r) => AcsEntrance::from_json($r), $res); - } - - public function remove_from_access_group( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/remove_from_access_group", - json: $request_payload, - - ); - - - - - - - } - - public function revoke_access_to_all_entrances( - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/revoke_access_to_all_entrances", - json: $request_payload, - - ); - - - - - - - } - - public function suspend( - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/suspend", - json: $request_payload, - - ); - - - - - - - } - - public function unsuspend( - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/unsuspend", - json: $request_payload, - - ); - - - - - - - } - - public function update( - string $acs_user_id, - mixed $access_schedule = null, - string $email = null, - string $email_address = null, - string $full_name = null, - string $hid_acs_system_id = null, - string $phone_number = null - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($access_schedule !== null) { - $request_payload["access_schedule"] = $access_schedule; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($hid_acs_system_id !== null) { - $request_payload["hid_acs_system_id"] = $hid_acs_system_id; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - - $this->seam->request( - "POST", - "/acs/users/update", - json: $request_payload, - - ); - - - - - - - } - -} - -class ActionAttemptsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function get( - string $action_attempt_id - ): ActionAttempt { - $request_payload = []; - - if ($action_attempt_id !== null) { - $request_payload["action_attempt_id"] = $action_attempt_id; - } - - $res = $this->seam->request( - "POST", - "/action_attempts/get", - json: $request_payload, - inner_object: "action_attempt", - ); - - - - - - return ActionAttempt::from_json($res); - } - - public function list( - array $action_attempt_ids - ): array { - $request_payload = []; - - if ($action_attempt_ids !== null) { - $request_payload["action_attempt_ids"] = $action_attempt_ids; - } - - $res = $this->seam->request( - "POST", - "/action_attempts/list", - json: $request_payload, - inner_object: "action_attempts", - ); - - - - - - return array_map(fn ($r) => ActionAttempt::from_json($r), $res); - } - public function poll_until_ready(string $action_attempt_id): ActionAttempt - { - $seam = $this->seam; - $time_waiting = 0.0; - $action_attempt = $seam->action_attempts->get($action_attempt_id); - - while ($action_attempt->status == "pending") { - $action_attempt = $seam->action_attempts->get( - $action_attempt->action_attempt_id - ); - if ($time_waiting > 20.0) { - throw new Exception("Timed out waiting for action attempt to be ready"); - } - $time_waiting += 0.4; - usleep(400000); // sleep for 0.4 seconds - } - - if ($action_attempt->status == "failed") { - throw new Exception( - "Action Attempt failed: " . $action_attempt->error->message - ); - } - - return $action_attempt; - } -} - -class ClientSessionsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function create( - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $expires_at = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): ClientSession { - $request_payload = []; - - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($expires_at !== null) { - $request_payload["expires_at"] = $expires_at; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/create", - json: $request_payload, - inner_object: "client_session", - ); - - - - - - return ClientSession::from_json($res); - } - - public function delete( - string $client_session_id - ): void { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - - $this->seam->request( - "POST", - "/client_sessions/delete", - json: $request_payload, - - ); - - - - - - - } - - public function get( - string $client_session_id = null, - string $user_identifier_key = null - ): ClientSession { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/get", - json: $request_payload, - inner_object: "client_session", - ); - - - - - - return ClientSession::from_json($res); - } - - public function get_or_create( - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $expires_at = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): ClientSession { - $request_payload = []; - - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($expires_at !== null) { - $request_payload["expires_at"] = $expires_at; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/get_or_create", - json: $request_payload, - inner_object: "client_session", - ); - - - - - - return ClientSession::from_json($res); - } - - public function grant_access( - string $client_session_id = null, - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): void { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $this->seam->request( - "POST", - "/client_sessions/grant_access", - json: $request_payload, - - ); - - - - - - - } - - public function list( - string $client_session_id = null, - string $connect_webview_id = null, - string $user_identifier_key = null, - string $user_identity_id = null, - bool $without_user_identifier_key = null - ): array { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($without_user_identifier_key !== null) { - $request_payload["without_user_identifier_key"] = $without_user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/list", - json: $request_payload, - inner_object: "client_sessions", - ); - - - - - - return array_map(fn ($r) => ClientSession::from_json($r), $res); - } - - public function revoke( - string $client_session_id - ): void { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - - $this->seam->request( - "POST", - "/client_sessions/revoke", - json: $request_payload, - - ); - - - - - - - } - -} - -class ConnectWebviewsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function create( - array $accepted_providers = null, - bool $automatically_manage_new_devices = null, - mixed $custom_metadata = null, - string $custom_redirect_failure_url = null, - string $custom_redirect_url = null, - string $device_selection_mode = null, - string $provider_category = null, - bool $wait_for_device_creation = null - ): ConnectWebview { - $request_payload = []; - - if ($accepted_providers !== null) { - $request_payload["accepted_providers"] = $accepted_providers; - } - if ($automatically_manage_new_devices !== null) { - $request_payload["automatically_manage_new_devices"] = $automatically_manage_new_devices; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - if ($custom_redirect_failure_url !== null) { - $request_payload["custom_redirect_failure_url"] = $custom_redirect_failure_url; - } - if ($custom_redirect_url !== null) { - $request_payload["custom_redirect_url"] = $custom_redirect_url; - } - if ($device_selection_mode !== null) { - $request_payload["device_selection_mode"] = $device_selection_mode; - } - if ($provider_category !== null) { - $request_payload["provider_category"] = $provider_category; - } - if ($wait_for_device_creation !== null) { - $request_payload["wait_for_device_creation"] = $wait_for_device_creation; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/create", - json: $request_payload, - inner_object: "connect_webview", - ); - - - - - - return ConnectWebview::from_json($res); - } - - public function delete( - string $connect_webview_id - ): void { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - - $this->seam->request( - "POST", - "/connect_webviews/delete", - json: $request_payload, - - ); - - - - - - - } - - public function get( - string $connect_webview_id - ): ConnectWebview { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/get", - json: $request_payload, - inner_object: "connect_webview", - ); - - - - - - return ConnectWebview::from_json($res); - } - - public function list( - mixed $custom_metadata_has = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/list", - json: $request_payload, - inner_object: "connect_webviews", - ); - - - - - - return array_map(fn ($r) => ConnectWebview::from_json($r), $res); - } - -} - -class ConnectedAccountsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function delete( - string $connected_account_id, - bool $sync = null - ): void { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/connected_accounts/delete", - json: $request_payload, - - ); - - - - - - - } - - public function get( - string $connected_account_id = null, - string $email = null - ): ConnectedAccount { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - - $res = $this->seam->request( - "POST", - "/connected_accounts/get", - json: $request_payload, - inner_object: "connected_account", - ); - - - - - - return ConnectedAccount::from_json($res); - } - - public function list( - mixed $custom_metadata_has = null - ): array { - $request_payload = []; - - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - - $res = $this->seam->request( - "POST", - "/connected_accounts/list", - json: $request_payload, - inner_object: "connected_accounts", - ); - - - - - - return array_map(fn ($r) => ConnectedAccount::from_json($r), $res); - } - - public function update( - string $connected_account_id, - bool $automatically_manage_new_devices = null, - mixed $custom_metadata = null - ): ConnectedAccount { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($automatically_manage_new_devices !== null) { - $request_payload["automatically_manage_new_devices"] = $automatically_manage_new_devices; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - - $res = $this->seam->request( - "POST", - "/connected_accounts/update", - json: $request_payload, - inner_object: "connected_account", - ); - - - - - - return ConnectedAccount::from_json($res); - } - -} - -class DevicesClient -{ - private SeamClient $seam; - public DevicesSimulateClient $simulate; - public DevicesUnmanagedClient $unmanaged; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->simulate = new DevicesSimulateClient($seam); -$this->unmanaged = new DevicesUnmanagedClient($seam); - } - - - public function delete( - string $device_id - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/delete", - json: $request_payload, - - ); - - - - - - - } - - public function get( - string $device_id = null, - string $name = null - ): Device { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/devices/get", - json: $request_payload, - inner_object: "device", - ); - - - - - - return Device::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/devices/list", - json: $request_payload, - inner_object: "devices", - ); - - - - - - return array_map(fn ($r) => Device::from_json($r), $res); - } - - public function list_device_providers( - string $provider_category = null - ): array { - $request_payload = []; - - if ($provider_category !== null) { - $request_payload["provider_category"] = $provider_category; - } - - $res = $this->seam->request( - "POST", - "/devices/list_device_providers", - json: $request_payload, - inner_object: "device_providers", - ); - - - - - - return array_map(fn ($r) => DeviceProvider::from_json($r), $res); - } - - public function update( - string $device_id, - mixed $custom_metadata = null, - bool $is_managed = null, - string $name = null, - mixed $properties = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($properties !== null) { - $request_payload["properties"] = $properties; - } - - $this->seam->request( - "POST", - "/devices/update", - json: $request_payload, - - ); - - - - - - - } - -} - -class DevicesSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function remove( - string $device_id - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/simulate/remove", - json: $request_payload, - - ); - - - - - - - } - -} - -class DevicesUnmanagedClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function get( - string $device_id = null, - string $name = null - ): UnmanagedDevice { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/devices/unmanaged/get", - json: $request_payload, - inner_object: "device", - ); - - - - - - return UnmanagedDevice::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/devices/unmanaged/list", - json: $request_payload, - inner_object: "devices", - ); - - - - - - return array_map(fn ($r) => UnmanagedDevice::from_json($r), $res); - } - - public function update( - string $device_id, - bool $is_managed - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - - $this->seam->request( - "POST", - "/devices/unmanaged/update", - json: $request_payload, - - ); - - - - - - - } - -} - -class EventsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function get( - string $device_id = null, - string $event_id = null, - string $event_type = null - ): Event { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($event_id !== null) { - $request_payload["event_id"] = $event_id; - } - if ($event_type !== null) { - $request_payload["event_type"] = $event_type; - } - - $res = $this->seam->request( - "POST", - "/events/get", - json: $request_payload, - inner_object: "event", - ); - - - - - - return Event::from_json($res); - } - - public function list( - string $access_code_id = null, - array $access_code_ids = null, - array $between = null, - string $connected_account_id = null, - string $device_id = null, - array $device_ids = null, - string $event_type = null, - array $event_types = null, - float $limit = null, - string $since = null - ): array { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($access_code_ids !== null) { - $request_payload["access_code_ids"] = $access_code_ids; - } - if ($between !== null) { - $request_payload["between"] = $between; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($event_type !== null) { - $request_payload["event_type"] = $event_type; - } - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($since !== null) { - $request_payload["since"] = $since; - } - - $res = $this->seam->request( - "POST", - "/events/list", - json: $request_payload, - inner_object: "events", - ); - - - - - - return array_map(fn ($r) => Event::from_json($r), $res); - } - -} - -class LocksClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function get( - string $device_id = null, - string $name = null - ): Device { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/locks/get", - json: $request_payload, - inner_object: "device", - ); - - - - - - return Device::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/locks/list", - json: $request_payload, - inner_object: "devices", - ); - - - - - - return array_map(fn ($r) => Device::from_json($r), $res); - } - - public function lock_door( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/locks/lock_door", - json: $request_payload, - inner_object: "action_attempt", - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - - - } - - public function unlock_door( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/locks/unlock_door", - json: $request_payload, - inner_object: "action_attempt", - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); + public AccessCodesClient $access_codes; + public AcsClient $acs; + public ActionAttemptsClient $action_attempts; + public ClientSessionsClient $client_sessions; + public ConnectWebviewsClient $connect_webviews; + public ConnectedAccountsClient $connected_accounts; + public DevicesClient $devices; + public EventsClient $events; + public LocksClient $locks; + public NetworksClient $networks; + public NoiseSensorsClient $noise_sensors; + public PhonesClient $phones; + public ThermostatsClient $thermostats; + public UserIdentitiesClient $user_identities; + public WebhooksClient $webhooks; + public WorkspacesClient $workspaces; + + public string $api_key; + public HTTPClient $client; + public string $ltsVersion = LTS_VERSION; + + public function __construct( + $api_key, + $endpoint = "https://connect.getseam.com", + $throw_http_errors = false + ) { + $this->api_key = $api_key; + $seam_sdk_version = PackageVersion::get(); + $this->client = new HTTPClient([ + "base_uri" => $endpoint, + "timeout" => 60.0, + "headers" => [ + "Authorization" => "Bearer " . $this->api_key, + "User-Agent" => "Seam PHP Client " . $seam_sdk_version, + "seam-sdk-name" => "seamapi/php", + "seam-sdk-version" => $seam_sdk_version, + "seam-lts-version" => $this->ltsVersion, + ], + "http_errors" => $throw_http_errors, + ]); + $this->access_codes = new AccessCodesClient($this); + $this->acs = new AcsClient($this); + $this->action_attempts = new ActionAttemptsClient($this); + $this->client_sessions = new ClientSessionsClient($this); + $this->connect_webviews = new ConnectWebviewsClient($this); + $this->connected_accounts = new ConnectedAccountsClient($this); + $this->devices = new DevicesClient($this); + $this->events = new EventsClient($this); + $this->locks = new LocksClient($this); + $this->networks = new NetworksClient($this); + $this->noise_sensors = new NoiseSensorsClient($this); + $this->phones = new PhonesClient($this); + $this->thermostats = new ThermostatsClient($this); + $this->user_identities = new UserIdentitiesClient($this); + $this->webhooks = new WebhooksClient($this); + $this->workspaces = new WorkspacesClient($this); + } + + public function request( + $method, + $path, + $json = null, + $query = null, + $inner_object = null + ) { + $options = [ + "json" => $json, + "query" => $query, + ]; + $options = array_filter($options, fn($option) => $option !== null); + + // TODO handle request errors + $response = $this->client->request($method, $path, $options); + $status_code = $response->getStatusCode(); + $request_id = $response->getHeaderLine("seam-request-id"); + + $res_json = null; + try { + $res_json = json_decode($response->getBody()); + } catch (Exception $ignoreError) { + } + + if (($res_json->error ?? null) != null) { + throw new Exception( + "Error Calling \"" . + $method . + " " . + $path . + "\" : " . + ($res_json->error->type ?? "") . + ": " . + $res_json->error->message . + " [Request ID: " . + $request_id . + "]" + ); + } + + if ($status_code >= 400) { + $error_message = $response->getReasonPhrase(); + + throw new Exception( + "HTTP Error: " . + $error_message . + " [" . + $status_code . + "] " . + $method . + " " . + $path . + " [Request ID: " . + $request_id . + "]" + ); + } + + if ($inner_object) { + if ( + !is_array($res_json->$inner_object) && + ($res_json->$inner_object ?? null) == null + ) { + throw new Exception( + 'Missing Inner Object "' . + $inner_object . + '" for ' . + $method . + " " . + $path . + " [Request ID: " . + $request_id . + "]" + ); + } + return $res_json->$inner_object; + } + return $res_json; } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - - - } - } -class NetworksClient +class AccessCodesClient { - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - + private SeamClient $seam; + public AccessCodesSimulateClient $simulate; + public AccessCodesUnmanagedClient $unmanaged; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + $this->simulate = new AccessCodesSimulateClient($seam); + $this->unmanaged = new AccessCodesUnmanagedClient($seam); + } + + public function create( + string $device_id, + bool $allow_external_modification = null, + bool $attempt_for_offline_device = null, + string $code = null, + string $common_code_key = null, + string $ends_at = null, + bool $is_external_modification_allowed = null, + bool $is_offline_access_code = null, + bool $is_one_time_use = null, + string $max_time_rounding = null, + string $name = null, + bool $prefer_native_scheduling = null, + string $starts_at = null, + bool $sync = null, + bool $use_backup_access_code_pool = null, + bool $use_offline_access_code = null + ): AccessCode { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($attempt_for_offline_device !== null) { + $request_payload[ + "attempt_for_offline_device" + ] = $attempt_for_offline_device; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($common_code_key !== null) { + $request_payload["common_code_key"] = $common_code_key; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($is_offline_access_code !== null) { + $request_payload[ + "is_offline_access_code" + ] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($prefer_native_scheduling !== null) { + $request_payload[ + "prefer_native_scheduling" + ] = $prefer_native_scheduling; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + if ($use_backup_access_code_pool !== null) { + $request_payload[ + "use_backup_access_code_pool" + ] = $use_backup_access_code_pool; + } + if ($use_offline_access_code !== null) { + $request_payload[ + "use_offline_access_code" + ] = $use_offline_access_code; + } + + $res = $this->seam->request( + "POST", + "/access_codes/create", + json: $request_payload, + inner_object: "access_code" + ); - public function get( - string $network_id - ): Network { - $request_payload = []; + return AccessCode::from_json($res); + } + + public function create_multiple( + array $device_ids, + bool $allow_external_modification = null, + bool $attempt_for_offline_device = null, + string $behavior_when_code_cannot_be_shared = null, + string $code = null, + string $ends_at = null, + bool $is_external_modification_allowed = null, + bool $is_offline_access_code = null, + bool $is_one_time_use = null, + string $max_time_rounding = null, + string $name = null, + bool $prefer_native_scheduling = null, + float $preferred_code_length = null, + string $starts_at = null, + bool $use_backup_access_code_pool = null, + bool $use_offline_access_code = null + ): array { + $request_payload = []; + + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($attempt_for_offline_device !== null) { + $request_payload[ + "attempt_for_offline_device" + ] = $attempt_for_offline_device; + } + if ($behavior_when_code_cannot_be_shared !== null) { + $request_payload[ + "behavior_when_code_cannot_be_shared" + ] = $behavior_when_code_cannot_be_shared; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($is_offline_access_code !== null) { + $request_payload[ + "is_offline_access_code" + ] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($prefer_native_scheduling !== null) { + $request_payload[ + "prefer_native_scheduling" + ] = $prefer_native_scheduling; + } + if ($preferred_code_length !== null) { + $request_payload["preferred_code_length"] = $preferred_code_length; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($use_backup_access_code_pool !== null) { + $request_payload[ + "use_backup_access_code_pool" + ] = $use_backup_access_code_pool; + } + if ($use_offline_access_code !== null) { + $request_payload[ + "use_offline_access_code" + ] = $use_offline_access_code; + } + + $res = $this->seam->request( + "POST", + "/access_codes/create_multiple", + json: $request_payload, + inner_object: "access_codes" + ); - if ($network_id !== null) { - $request_payload["network_id"] = $network_id; + return array_map(fn($r) => AccessCode::from_json($r), $res); + } + + public function delete( + string $access_code_id, + string $device_id = null, + bool $sync = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/access_codes/delete", + json: $request_payload + ); } - $res = $this->seam->request( - "POST", - "/networks/get", - json: $request_payload, - inner_object: "network", - ); - - - - - - return Network::from_json($res); - } - - public function list( - - ): array { - $request_payload = []; + public function generate_code(string $device_id): AccessCode + { + $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + $res = $this->seam->request( + "POST", + "/access_codes/generate_code", + json: $request_payload, + inner_object: "generated_code" + ); - $res = $this->seam->request( - "POST", - "/networks/list", - json: $request_payload, - inner_object: "networks", - ); + return AccessCode::from_json($res); + } + + public function get( + string $access_code_id = null, + string $code = null, + string $device_id = null + ): AccessCode { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->request( + "POST", + "/access_codes/get", + json: $request_payload, + inner_object: "access_code" + ); + return AccessCode::from_json($res); + } + + public function list( + array $access_code_ids = null, + string $device_id = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($access_code_ids !== null) { + $request_payload["access_code_ids"] = $access_code_ids; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/access_codes/list", + json: $request_payload, + inner_object: "access_codes" + ); + return array_map(fn($r) => AccessCode::from_json($r), $res); + } + public function pull_backup_access_code(string $access_code_id): AccessCode + { + $request_payload = []; + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } - return array_map(fn ($r) => Network::from_json($r), $res); - } + $res = $this->seam->request( + "POST", + "/access_codes/pull_backup_access_code", + json: $request_payload, + inner_object: "backup_access_code" + ); + return AccessCode::from_json($res); + } + + public function update( + string $access_code_id, + bool $allow_external_modification = null, + bool $attempt_for_offline_device = null, + string $code = null, + string $device_id = null, + string $ends_at = null, + bool $is_external_modification_allowed = null, + bool $is_managed = null, + bool $is_offline_access_code = null, + bool $is_one_time_use = null, + string $max_time_rounding = null, + string $name = null, + bool $prefer_native_scheduling = null, + string $starts_at = null, + bool $sync = null, + string $type = null, + bool $use_backup_access_code_pool = null, + bool $use_offline_access_code = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($attempt_for_offline_device !== null) { + $request_payload[ + "attempt_for_offline_device" + ] = $attempt_for_offline_device; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + if ($is_offline_access_code !== null) { + $request_payload[ + "is_offline_access_code" + ] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($prefer_native_scheduling !== null) { + $request_payload[ + "prefer_native_scheduling" + ] = $prefer_native_scheduling; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + if ($type !== null) { + $request_payload["type"] = $type; + } + if ($use_backup_access_code_pool !== null) { + $request_payload[ + "use_backup_access_code_pool" + ] = $use_backup_access_code_pool; + } + if ($use_offline_access_code !== null) { + $request_payload[ + "use_offline_access_code" + ] = $use_offline_access_code; + } + + $this->seam->request( + "POST", + "/access_codes/update", + json: $request_payload + ); + } } -class NoiseSensorsNoiseThresholdsClient +class AccessCodesSimulateClient { - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - - - public function create( - string $device_id, - string $ends_daily_at, - string $starts_daily_at, - string $name = null, - float $noise_threshold_decibels = null, - float $noise_threshold_nrs = null, - bool $sync = null - ): NoiseThreshold { - $request_payload = []; + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function create_unmanaged_access_code( + string $code, + string $device_id, + string $name + ): UnmanagedAccessCode { + $request_payload = []; + + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->request( + "POST", + "/access_codes/simulate/create_unmanaged_access_code", + json: $request_payload, + inner_object: "access_code" + ); - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($ends_daily_at !== null) { - $request_payload["ends_daily_at"] = $ends_daily_at; - } - if ($starts_daily_at !== null) { - $request_payload["starts_daily_at"] = $starts_daily_at; + return UnmanagedAccessCode::from_json($res); } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($noise_threshold_decibels !== null) { - $request_payload["noise_threshold_decibels"] = $noise_threshold_decibels; - } - if ($noise_threshold_nrs !== null) { - $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/create", - json: $request_payload, - inner_object: "noise_threshold", - ); - - - - - - return NoiseThreshold::from_json($res); - } - - public function delete( - string $device_id, - string $noise_threshold_id, - bool $sync = null - ): void { - $request_payload = []; +} - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; +class AccessCodesUnmanagedClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function convert_to_managed( + string $access_code_id, + bool $allow_external_modification = null, + bool $force = null, + bool $is_external_modification_allowed = null, + bool $sync = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($force !== null) { + $request_payload["force"] = $force; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/access_codes/unmanaged/convert_to_managed", + json: $request_payload + ); } - $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/delete", - json: $request_payload, - - ); - - - + public function delete(string $access_code_id, bool $sync = null): void + { + $request_payload = []; + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } - - } - - public function get( - string $noise_threshold_id - ): NoiseThreshold { - $request_payload = []; - - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; + $this->seam->request( + "POST", + "/access_codes/unmanaged/delete", + json: $request_payload + ); } - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/get", - json: $request_payload, - inner_object: "noise_threshold", - ); - - + public function get( + string $access_code_id = null, + string $code = null, + string $device_id = null + ): UnmanagedAccessCode { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->request( + "POST", + "/access_codes/unmanaged/get", + json: $request_payload, + inner_object: "access_code" + ); + return UnmanagedAccessCode::from_json($res); + } + public function list( + string $device_id, + string $user_identifier_key = null + ): array { + $request_payload = []; - return NoiseThreshold::from_json($res); - } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } - public function list( - string $device_id, - bool $is_programmed = null - ): array { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/access_codes/unmanaged/list", + json: $request_payload, + inner_object: "access_codes" + ); - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; + return array_map(fn($r) => UnmanagedAccessCode::from_json($r), $res); + } + + public function update( + string $access_code_id, + bool $is_managed, + bool $allow_external_modification = null, + bool $force = null, + bool $is_external_modification_allowed = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($force !== null) { + $request_payload["force"] = $force; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + + $this->seam->request( + "POST", + "/access_codes/unmanaged/update", + json: $request_payload + ); } - if ($is_programmed !== null) { - $request_payload["is_programmed"] = $is_programmed; +} + +class AcsAccessGroupsClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function add_user( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/access_groups/add_user", + json: $request_payload + ); } - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/list", - json: $request_payload, - inner_object: "noise_thresholds", - ); + public function get(string $acs_access_group_id): AcsAccessGroup + { + $request_payload = []; + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + $res = $this->seam->request( + "POST", + "/acs/access_groups/get", + json: $request_payload, + inner_object: "acs_access_group" + ); + return AcsAccessGroup::from_json($res); + } + public function list( + string $acs_system_id = null, + string $acs_user_id = null + ): array { + $request_payload = []; - return array_map(fn ($r) => NoiseThreshold::from_json($r), $res); - } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } - public function update( - string $device_id, - string $noise_threshold_id, - string $ends_daily_at = null, - string $name = null, - float $noise_threshold_decibels = null, - float $noise_threshold_nrs = null, - string $starts_daily_at = null, - bool $sync = null - ): void { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/acs/access_groups/list", + json: $request_payload, + inner_object: "acs_access_groups" + ); - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; - } - if ($ends_daily_at !== null) { - $request_payload["ends_daily_at"] = $ends_daily_at; + return array_map(fn($r) => AcsAccessGroup::from_json($r), $res); } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($noise_threshold_decibels !== null) { - $request_payload["noise_threshold_decibels"] = $noise_threshold_decibels; - } - if ($noise_threshold_nrs !== null) { - $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; - } - if ($starts_daily_at !== null) { - $request_payload["starts_daily_at"] = $starts_daily_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/update", - json: $request_payload, - - ); + public function list_users(string $acs_access_group_id): array + { + $request_payload = []; + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + $res = $this->seam->request( + "POST", + "/acs/access_groups/list_users", + json: $request_payload, + inner_object: "acs_users" + ); + return array_map(fn($r) => AcsUser::from_json($r), $res); + } + public function remove_user( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; - } + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + $this->seam->request( + "POST", + "/acs/access_groups/remove_user", + json: $request_payload + ); + } } -class NoiseSensorsClient +class AcsClient { - private SeamClient $seam; - public NoiseSensorsNoiseThresholdsClient $noise_thresholds; - public NoiseSensorsSimulateClient $simulate; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->noise_thresholds = new NoiseSensorsNoiseThresholdsClient($seam); -$this->simulate = new NoiseSensorsSimulateClient($seam); - } - - + private SeamClient $seam; + public AcsAccessGroupsClient $access_groups; + public AcsCredentialPoolsClient $credential_pools; + public AcsCredentialProvisioningAutomationsClient $credential_provisioning_automations; + public AcsCredentialsClient $credentials; + public AcsEntrancesClient $entrances; + public AcsSystemsClient $systems; + public AcsUsersClient $users; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + $this->access_groups = new AcsAccessGroupsClient($seam); + $this->credential_pools = new AcsCredentialPoolsClient($seam); + $this->credential_provisioning_automations = new AcsCredentialProvisioningAutomationsClient( + $seam + ); + $this->credentials = new AcsCredentialsClient($seam); + $this->entrances = new AcsEntrancesClient($seam); + $this->systems = new AcsSystemsClient($seam); + $this->users = new AcsUsersClient($seam); + } } -class NoiseSensorsSimulateClient +class AcsCredentialPoolsClient { - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } + private SeamClient $seam; - - public function trigger_noise_threshold( - string $device_id - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; } - $this->seam->request( - "POST", - "/noise_sensors/simulate/trigger_noise_threshold", - json: $request_payload, - - ); - - + public function list(string $acs_system_id): array + { + $request_payload = []; + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + $res = $this->seam->request( + "POST", + "/acs/credential_pools/list", + json: $request_payload, + inner_object: "acs_credential_pools" + ); - - } - + return array_map(fn($r) => AcsCredentialPool::from_json($r), $res); + } } -class PhonesClient +class AcsCredentialProvisioningAutomationsClient { - private SeamClient $seam; - public PhonesSimulateClient $simulate; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->simulate = new PhonesSimulateClient($seam); - } - - - public function deactivate( - string $device_id - ): void { - $request_payload = []; + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function launch( + string $credential_manager_acs_system_id, + string $user_identity_id, + string $acs_credential_pool_id = null, + bool $create_credential_manager_user = null, + string $credential_manager_acs_user_id = null + ): AcsCredentialProvisioningAutomation { + $request_payload = []; + + if ($credential_manager_acs_system_id !== null) { + $request_payload[ + "credential_manager_acs_system_id" + ] = $credential_manager_acs_system_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($acs_credential_pool_id !== null) { + $request_payload[ + "acs_credential_pool_id" + ] = $acs_credential_pool_id; + } + if ($create_credential_manager_user !== null) { + $request_payload[ + "create_credential_manager_user" + ] = $create_credential_manager_user; + } + if ($credential_manager_acs_user_id !== null) { + $request_payload[ + "credential_manager_acs_user_id" + ] = $credential_manager_acs_user_id; + } + + $res = $this->seam->request( + "POST", + "/acs/credential_provisioning_automations/launch", + json: $request_payload, + inner_object: "acs_credential_provisioning_automation" + ); - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; + return AcsCredentialProvisioningAutomation::from_json($res); } +} - $this->seam->request( - "POST", - "/phones/deactivate", - json: $request_payload, - - ); - - - - +class AcsCredentialsClient +{ + private SeamClient $seam; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } - } + public function assign(string $acs_credential_id, string $acs_user_id): void + { + $request_payload = []; - public function list( - string $owner_user_identity_id = null - ): array { - $request_payload = []; + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } - if ($owner_user_identity_id !== null) { - $request_payload["owner_user_identity_id"] = $owner_user_identity_id; + $this->seam->request( + "POST", + "/acs/credentials/assign", + json: $request_payload + ); } - $res = $this->seam->request( - "POST", - "/phones/list", - json: $request_payload, - inner_object: "phones", - ); - + public function create( + string $access_method, + string $acs_user_id, + array $allowed_acs_entrance_ids = null, + string $code = null, + string $credential_manager_acs_system_id = null, + string $ends_at = null, + bool $is_multi_phone_sync_credential = null, + string $starts_at = null, + mixed $visionline_metadata = null + ): AcsCredential { + $request_payload = []; + + if ($access_method !== null) { + $request_payload["access_method"] = $access_method; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($allowed_acs_entrance_ids !== null) { + $request_payload[ + "allowed_acs_entrance_ids" + ] = $allowed_acs_entrance_ids; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($credential_manager_acs_system_id !== null) { + $request_payload[ + "credential_manager_acs_system_id" + ] = $credential_manager_acs_system_id; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_multi_phone_sync_credential !== null) { + $request_payload[ + "is_multi_phone_sync_credential" + ] = $is_multi_phone_sync_credential; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($visionline_metadata !== null) { + $request_payload["visionline_metadata"] = $visionline_metadata; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/create", + json: $request_payload, + inner_object: "acs_credential" + ); + return AcsCredential::from_json($res); + } + public function delete(string $acs_credential_id): void + { + $request_payload = []; + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } - return array_map(fn ($r) => Phone::from_json($r), $res); - } + $this->seam->request( + "POST", + "/acs/credentials/delete", + json: $request_payload + ); + } -} + public function get(string $acs_credential_id): AcsCredential + { + $request_payload = []; -class PhonesSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + $res = $this->seam->request( + "POST", + "/acs/credentials/get", + json: $request_payload, + inner_object: "acs_credential" + ); - public function create_sandbox_phone( - string $user_identity_id, - mixed $assa_abloy_metadata = null, - string $custom_sdk_installation_id = null, - mixed $phone_metadata = null - ): Phone { - $request_payload = []; + return AcsCredential::from_json($res); + } + + public function list( + string $acs_user_id = null, + string $acs_system_id = null, + string $user_identity_id = null, + bool $is_multi_phone_sync_credential = null + ): array { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($is_multi_phone_sync_credential !== null) { + $request_payload[ + "is_multi_phone_sync_credential" + ] = $is_multi_phone_sync_credential; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/list", + json: $request_payload, + inner_object: "acs_credentials" + ); - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($assa_abloy_metadata !== null) { - $request_payload["assa_abloy_metadata"] = $assa_abloy_metadata; - } - if ($custom_sdk_installation_id !== null) { - $request_payload["custom_sdk_installation_id"] = $custom_sdk_installation_id; - } - if ($phone_metadata !== null) { - $request_payload["phone_metadata"] = $phone_metadata; + return array_map(fn($r) => AcsCredential::from_json($r), $res); } - $res = $this->seam->request( - "POST", - "/phones/simulate/create_sandbox_phone", - json: $request_payload, - inner_object: "phone", - ); - + public function unassign( + string $acs_credential_id, + string $acs_user_id + ): void { + $request_payload = []; + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + $this->seam->request( + "POST", + "/acs/credentials/unassign", + json: $request_payload + ); + } + public function update(string $acs_credential_id, string $code): void + { + $request_payload = []; - return Phone::from_json($res); - } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + $this->seam->request( + "POST", + "/acs/credentials/update", + json: $request_payload + ); + } } -class ThermostatsClimateSettingSchedulesClient +class AcsEntrancesClient { - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } - + private SeamClient $seam; - public function create( - string $device_id, - string $schedule_ends_at, - string $schedule_starts_at, - bool $automatic_cooling_enabled = null, - bool $automatic_heating_enabled = null, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - string $hvac_mode_setting = null, - bool $manual_override_allowed = null, - string $name = null, - string $schedule_type = null - ): ClimateSettingSchedule { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($schedule_ends_at !== null) { - $request_payload["schedule_ends_at"] = $schedule_ends_at; - } - if ($schedule_starts_at !== null) { - $request_payload["schedule_starts_at"] = $schedule_starts_at; - } - if ($automatic_cooling_enabled !== null) { - $request_payload["automatic_cooling_enabled"] = $automatic_cooling_enabled; - } - if ($automatic_heating_enabled !== null) { - $request_payload["automatic_heating_enabled"] = $automatic_heating_enabled; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - if ($hvac_mode_setting !== null) { - $request_payload["hvac_mode_setting"] = $hvac_mode_setting; - } - if ($manual_override_allowed !== null) { - $request_payload["manual_override_allowed"] = $manual_override_allowed; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($schedule_type !== null) { - $request_payload["schedule_type"] = $schedule_type; - } - - $res = $this->seam->request( - "POST", - "/thermostats/climate_setting_schedules/create", - json: $request_payload, - inner_object: "climate_setting_schedule", - ); - - + public function get(string $acs_entrance_id): AcsEntrance + { + $request_payload = []; + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } - return ClimateSettingSchedule::from_json($res); - } - - public function delete( - string $climate_setting_schedule_id - ): void { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/acs/entrances/get", + json: $request_payload, + inner_object: "acs_entrance" + ); - if ($climate_setting_schedule_id !== null) { - $request_payload["climate_setting_schedule_id"] = $climate_setting_schedule_id; + return AcsEntrance::from_json($res); } - $this->seam->request( - "POST", - "/thermostats/climate_setting_schedules/delete", - json: $request_payload, - - ); - - - - - - - } + public function grant_access( + string $acs_entrance_id, + string $acs_user_id + ): void { + $request_payload = []; - public function get( - string $climate_setting_schedule_id = null, - string $device_id = null - ): ClimateSettingSchedule { - $request_payload = []; + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } - if ($climate_setting_schedule_id !== null) { - $request_payload["climate_setting_schedule_id"] = $climate_setting_schedule_id; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; + $this->seam->request( + "POST", + "/acs/entrances/grant_access", + json: $request_payload + ); } - $res = $this->seam->request( - "POST", - "/thermostats/climate_setting_schedules/get", - json: $request_payload, - inner_object: "climate_setting_schedule", - ); - - - - - - return ClimateSettingSchedule::from_json($res); - } - - public function list( - string $device_id, - string $user_identifier_key = null - ): array { - $request_payload = []; + public function list( + string $acs_credential_id = null, + string $acs_system_id = null + ): array { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + + $res = $this->seam->request( + "POST", + "/acs/entrances/list", + json: $request_payload, + inner_object: "acs_entrances" + ); - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; + return array_map(fn($r) => AcsEntrance::from_json($r), $res); } - $res = $this->seam->request( - "POST", - "/thermostats/climate_setting_schedules/list", - json: $request_payload, - inner_object: "climate_setting_schedules", - ); - - + public function list_credentials_with_access( + string $acs_entrance_id, + array $include_if = null + ): array { + $request_payload = []; + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + $res = $this->seam->request( + "POST", + "/acs/entrances/list_credentials_with_access", + json: $request_payload, + inner_object: "acs_credentials" + ); - return array_map(fn ($r) => ClimateSettingSchedule::from_json($r), $res); - } + return array_map(fn($r) => AcsCredential::from_json($r), $res); + } +} - public function update( - string $climate_setting_schedule_id, - bool $automatic_cooling_enabled = null, - bool $automatic_heating_enabled = null, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - string $hvac_mode_setting = null, - bool $manual_override_allowed = null, - string $name = null, - string $schedule_ends_at = null, - string $schedule_starts_at = null, - string $schedule_type = null - ): void { - $request_payload = []; +class AcsSystemsClient +{ + private SeamClient $seam; - if ($climate_setting_schedule_id !== null) { - $request_payload["climate_setting_schedule_id"] = $climate_setting_schedule_id; - } - if ($automatic_cooling_enabled !== null) { - $request_payload["automatic_cooling_enabled"] = $automatic_cooling_enabled; - } - if ($automatic_heating_enabled !== null) { - $request_payload["automatic_heating_enabled"] = $automatic_heating_enabled; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - if ($hvac_mode_setting !== null) { - $request_payload["hvac_mode_setting"] = $hvac_mode_setting; - } - if ($manual_override_allowed !== null) { - $request_payload["manual_override_allowed"] = $manual_override_allowed; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($schedule_ends_at !== null) { - $request_payload["schedule_ends_at"] = $schedule_ends_at; - } - if ($schedule_starts_at !== null) { - $request_payload["schedule_starts_at"] = $schedule_starts_at; - } - if ($schedule_type !== null) { - $request_payload["schedule_type"] = $schedule_type; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; } - $this->seam->request( - "POST", - "/thermostats/climate_setting_schedules/update", - json: $request_payload, - - ); + public function get(string $acs_system_id): AcsSystem + { + $request_payload = []; + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + $res = $this->seam->request( + "POST", + "/acs/systems/get", + json: $request_payload, + inner_object: "acs_system" + ); + return AcsSystem::from_json($res); + } + public function list(string $connected_account_id = null): array + { + $request_payload = []; + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } - } + $res = $this->seam->request( + "POST", + "/acs/systems/list", + json: $request_payload, + inner_object: "acs_systems" + ); + return array_map(fn($r) => AcsSystem::from_json($r), $res); + } } -class ThermostatsClient +class AcsUsersClient { - private SeamClient $seam; - public ThermostatsClimateSettingSchedulesClient $climate_setting_schedules; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->climate_setting_schedules = new ThermostatsClimateSettingSchedulesClient($seam); - } - - - public function cool( - string $device_id, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function add_to_access_group( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/users/add_to_access_group", + json: $request_payload + ); } - $res = $this->seam->request( - "POST", - "/thermostats/cool", - json: $request_payload, - inner_object: "action_attempt", - ); + public function create( + string $acs_system_id, + mixed $access_schedule = null, + array $acs_access_group_ids = null, + string $email = null, + string $email_address = null, + string $full_name = null, + string $phone_number = null, + string $user_identity_id = null + ): AcsUser { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($access_schedule !== null) { + $request_payload["access_schedule"] = $access_schedule; + } + if ($acs_access_group_ids !== null) { + $request_payload["acs_access_group_ids"] = $acs_access_group_ids; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/acs/users/create", + json: $request_payload, + inner_object: "acs_user" + ); - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); + return AcsUser::from_json($res); } - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); + public function delete(string $acs_user_id): void + { + $request_payload = []; - return $action_attempt; + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } - - } - - public function get( - string $device_id = null, - string $name = null - ): Device { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; + $this->seam->request( + "POST", + "/acs/users/delete", + json: $request_payload + ); } - $res = $this->seam->request( - "POST", - "/thermostats/get", - json: $request_payload, - inner_object: "thermostat", - ); - - - + public function get(string $acs_user_id): AcsUser + { + $request_payload = []; + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } - return Device::from_json($res); - } - - public function heat( - string $device_id, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } + $res = $this->seam->request( + "POST", + "/acs/users/get", + json: $request_payload, + inner_object: "acs_user" + ); - $res = $this->seam->request( - "POST", - "/thermostats/heat", - json: $request_payload, - inner_object: "action_attempt", - ); + return AcsUser::from_json($res); + } + + public function list( + string $acs_system_id = null, + string $user_identity_email_address = null, + string $user_identity_id = null, + string $user_identity_phone_number = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($user_identity_email_address !== null) { + $request_payload[ + "user_identity_email_address" + ] = $user_identity_email_address; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($user_identity_phone_number !== null) { + $request_payload[ + "user_identity_phone_number" + ] = $user_identity_phone_number; + } + + $res = $this->seam->request( + "POST", + "/acs/users/list", + json: $request_payload, + inner_object: "acs_users" + ); - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); + return array_map(fn($r) => AcsUser::from_json($r), $res); } - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - - - } - - public function heat_cool( - string $device_id, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; + public function list_accessible_entrances(string $acs_user_id): array + { + $request_payload = []; - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } - $res = $this->seam->request( - "POST", - "/thermostats/heat_cool", - json: $request_payload, - inner_object: "action_attempt", - ); + $res = $this->seam->request( + "POST", + "/acs/users/list_accessible_entrances", + json: $request_payload, + inner_object: "acs_entrances" + ); - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); + return array_map(fn($r) => AcsEntrance::from_json($r), $res); } - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); + public function remove_from_access_group( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; - return $action_attempt; + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + $this->seam->request( + "POST", + "/acs/users/remove_from_access_group", + json: $request_payload + ); + } - } + public function revoke_access_to_all_entrances(string $acs_user_id): void + { + $request_payload = []; - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; + $this->seam->request( + "POST", + "/acs/users/revoke_access_to_all_entrances", + json: $request_payload + ); } - $res = $this->seam->request( - "POST", - "/thermostats/list", - json: $request_payload, - inner_object: "thermostats", - ); - - + public function suspend(string $acs_user_id): void + { + $request_payload = []; + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + $this->seam->request( + "POST", + "/acs/users/suspend", + json: $request_payload + ); + } - return array_map(fn ($r) => Device::from_json($r), $res); - } + public function unsuspend(string $acs_user_id): void + { + $request_payload = []; - public function off( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; + $this->seam->request( + "POST", + "/acs/users/unsuspend", + json: $request_payload + ); } - if ($sync !== null) { - $request_payload["sync"] = $sync; + + public function update( + string $acs_user_id, + mixed $access_schedule = null, + string $email = null, + string $email_address = null, + string $full_name = null, + string $hid_acs_system_id = null, + string $phone_number = null + ): void { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($access_schedule !== null) { + $request_payload["access_schedule"] = $access_schedule; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($hid_acs_system_id !== null) { + $request_payload["hid_acs_system_id"] = $hid_acs_system_id; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + + $this->seam->request( + "POST", + "/acs/users/update", + json: $request_payload + ); } +} - $res = $this->seam->request( - "POST", - "/thermostats/off", - json: $request_payload, - inner_object: "action_attempt", - ); +class ActionAttemptsClient +{ + private SeamClient $seam; - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); + public function __construct(SeamClient $seam) + { + $this->seam = $seam; } - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); + public function get(string $action_attempt_id): ActionAttempt + { + $request_payload = []; - return $action_attempt; + if ($action_attempt_id !== null) { + $request_payload["action_attempt_id"] = $action_attempt_id; + } + $res = $this->seam->request( + "POST", + "/action_attempts/get", + json: $request_payload, + inner_object: "action_attempt" + ); - } + return ActionAttempt::from_json($res); + } - public function set_fan_mode( - string $device_id, - string $fan_mode = null, - string $fan_mode_setting = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; + public function list(array $action_attempt_ids): array + { + $request_payload = []; - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($fan_mode !== null) { - $request_payload["fan_mode"] = $fan_mode; - } - if ($fan_mode_setting !== null) { - $request_payload["fan_mode_setting"] = $fan_mode_setting; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } + if ($action_attempt_ids !== null) { + $request_payload["action_attempt_ids"] = $action_attempt_ids; + } - $res = $this->seam->request( - "POST", - "/thermostats/set_fan_mode", - json: $request_payload, - inner_object: "action_attempt", - ); + $res = $this->seam->request( + "POST", + "/action_attempts/list", + json: $request_payload, + inner_object: "action_attempts" + ); - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); + return array_map(fn($r) => ActionAttempt::from_json($r), $res); + } + public function poll_until_ready(string $action_attempt_id): ActionAttempt + { + $seam = $this->seam; + $time_waiting = 0.0; + $action_attempt = $seam->action_attempts->get($action_attempt_id); + + while ($action_attempt->status == "pending") { + $action_attempt = $seam->action_attempts->get( + $action_attempt->action_attempt_id + ); + if ($time_waiting > 20.0) { + throw new Exception( + "Timed out waiting for action attempt to be ready" + ); + } + $time_waiting += 0.4; + usleep(400000); // sleep for 0.4 seconds + } + + if ($action_attempt->status == "failed") { + throw new Exception( + "Action Attempt failed: " . $action_attempt->error->message + ); + } + + return $action_attempt; } +} - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; +class ClientSessionsClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function create( + array $connect_webview_ids = null, + array $connected_account_ids = null, + string $expires_at = null, + string $user_identifier_key = null, + array $user_identity_ids = null + ): ClientSession { + $request_payload = []; + + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($expires_at !== null) { + $request_payload["expires_at"] = $expires_at; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + + $res = $this->seam->request( + "POST", + "/client_sessions/create", + json: $request_payload, + inner_object: "client_session" + ); + return ClientSession::from_json($res); + } - } + public function delete(string $client_session_id): void + { + $request_payload = []; - public function update( - mixed $default_climate_setting, - string $device_id - ): void { - $request_payload = []; + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } - if ($default_climate_setting !== null) { - $request_payload["default_climate_setting"] = $default_climate_setting; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; + $this->seam->request( + "POST", + "/client_sessions/delete", + json: $request_payload + ); } - $this->seam->request( - "POST", - "/thermostats/update", - json: $request_payload, - - ); + public function get( + string $client_session_id = null, + string $user_identifier_key = null + ): ClientSession { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/client_sessions/get", + json: $request_payload, + inner_object: "client_session" + ); + return ClientSession::from_json($res); + } + + public function get_or_create( + array $connect_webview_ids = null, + array $connected_account_ids = null, + string $expires_at = null, + string $user_identifier_key = null, + array $user_identity_ids = null + ): ClientSession { + $request_payload = []; + + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($expires_at !== null) { + $request_payload["expires_at"] = $expires_at; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + + $res = $this->seam->request( + "POST", + "/client_sessions/get_or_create", + json: $request_payload, + inner_object: "client_session" + ); + return ClientSession::from_json($res); + } + + public function grant_access( + string $client_session_id = null, + array $connect_webview_ids = null, + array $connected_account_ids = null, + string $user_identifier_key = null, + array $user_identity_ids = null + ): void { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + + $this->seam->request( + "POST", + "/client_sessions/grant_access", + json: $request_payload + ); + } + public function list( + string $client_session_id = null, + string $connect_webview_id = null, + string $user_identifier_key = null, + string $user_identity_id = null, + bool $without_user_identifier_key = null + ): array { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($without_user_identifier_key !== null) { + $request_payload[ + "without_user_identifier_key" + ] = $without_user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/client_sessions/list", + json: $request_payload, + inner_object: "client_sessions" + ); + return array_map(fn($r) => ClientSession::from_json($r), $res); + } + public function revoke(string $client_session_id): void + { + $request_payload = []; - } + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + $this->seam->request( + "POST", + "/client_sessions/revoke", + json: $request_payload + ); + } } -class UserIdentitiesClient +class ConnectWebviewsClient { - private SeamClient $seam; - public UserIdentitiesEnrollmentAutomationsClient $enrollment_automations; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->enrollment_automations = new UserIdentitiesEnrollmentAutomationsClient($seam); - } + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function create( + array $accepted_providers = null, + bool $automatically_manage_new_devices = null, + mixed $custom_metadata = null, + string $custom_redirect_failure_url = null, + string $custom_redirect_url = null, + string $device_selection_mode = null, + string $provider_category = null, + bool $wait_for_device_creation = null + ): ConnectWebview { + $request_payload = []; + + if ($accepted_providers !== null) { + $request_payload["accepted_providers"] = $accepted_providers; + } + if ($automatically_manage_new_devices !== null) { + $request_payload[ + "automatically_manage_new_devices" + ] = $automatically_manage_new_devices; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + if ($custom_redirect_failure_url !== null) { + $request_payload[ + "custom_redirect_failure_url" + ] = $custom_redirect_failure_url; + } + if ($custom_redirect_url !== null) { + $request_payload["custom_redirect_url"] = $custom_redirect_url; + } + if ($device_selection_mode !== null) { + $request_payload["device_selection_mode"] = $device_selection_mode; + } + if ($provider_category !== null) { + $request_payload["provider_category"] = $provider_category; + } + if ($wait_for_device_creation !== null) { + $request_payload[ + "wait_for_device_creation" + ] = $wait_for_device_creation; + } + + $res = $this->seam->request( + "POST", + "/connect_webviews/create", + json: $request_payload, + inner_object: "connect_webview" + ); + + return ConnectWebview::from_json($res); + } + public function delete(string $connect_webview_id): void + { + $request_payload = []; - public function add_acs_user( - string $acs_user_id, - string $user_identity_id - ): void { - $request_payload = []; + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; + $this->seam->request( + "POST", + "/connect_webviews/delete", + json: $request_payload + ); } - $this->seam->request( - "POST", - "/user_identities/add_acs_user", - json: $request_payload, - - ); - + public function get(string $connect_webview_id): ConnectWebview + { + $request_payload = []; + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + $res = $this->seam->request( + "POST", + "/connect_webviews/get", + json: $request_payload, + inner_object: "connect_webview" + ); + return ConnectWebview::from_json($res); + } + public function list( + mixed $custom_metadata_has = null, + string $user_identifier_key = null + ): array { + $request_payload = []; - } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } - public function create( - string $email_address = null, - string $full_name = null, - string $phone_number = null, - string $user_identity_key = null - ): UserIdentity { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/connect_webviews/list", + json: $request_payload, + inner_object: "connect_webviews" + ); - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; + return array_map(fn($r) => ConnectWebview::from_json($r), $res); } +} - $res = $this->seam->request( - "POST", - "/user_identities/create", - json: $request_payload, - inner_object: "user_identity", - ); +class ConnectedAccountsClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function delete( + string $connected_account_id, + bool $sync = null + ): void { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/connected_accounts/delete", + json: $request_payload + ); + } + public function get( + string $connected_account_id = null, + string $email = null + ): ConnectedAccount { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + + $res = $this->seam->request( + "POST", + "/connected_accounts/get", + json: $request_payload, + inner_object: "connected_account" + ); + return ConnectedAccount::from_json($res); + } + public function list(mixed $custom_metadata_has = null): array + { + $request_payload = []; + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } - return UserIdentity::from_json($res); - } + $res = $this->seam->request( + "POST", + "/connected_accounts/list", + json: $request_payload, + inner_object: "connected_accounts" + ); - public function delete( - string $user_identity_id - ): void { - $request_payload = []; + return array_map(fn($r) => ConnectedAccount::from_json($r), $res); + } + + public function update( + string $connected_account_id, + bool $automatically_manage_new_devices = null, + mixed $custom_metadata = null + ): ConnectedAccount { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($automatically_manage_new_devices !== null) { + $request_payload[ + "automatically_manage_new_devices" + ] = $automatically_manage_new_devices; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + + $res = $this->seam->request( + "POST", + "/connected_accounts/update", + json: $request_payload, + inner_object: "connected_account" + ); - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; + return ConnectedAccount::from_json($res); } +} - $this->seam->request( - "POST", - "/user_identities/delete", - json: $request_payload, - - ); +class DevicesClient +{ + private SeamClient $seam; + public DevicesSimulateClient $simulate; + public DevicesUnmanagedClient $unmanaged; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + $this->simulate = new DevicesSimulateClient($seam); + $this->unmanaged = new DevicesUnmanagedClient($seam); + } + public function delete(string $device_id): void + { + $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + $this->seam->request("POST", "/devices/delete", json: $request_payload); + } + public function get(string $device_id = null, string $name = null): Device + { + $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } - } + $res = $this->seam->request( + "POST", + "/devices/get", + json: $request_payload, + inner_object: "device" + ); - public function get( - string $user_identity_id = null, - string $user_identity_key = null - ): UserIdentity { - $request_payload = []; + return Device::from_json($res); + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/devices/list", + json: $request_payload, + inner_object: "devices" + ); - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; + return array_map(fn($r) => Device::from_json($r), $res); } - $res = $this->seam->request( - "POST", - "/user_identities/get", - json: $request_payload, - inner_object: "user_identity", - ); - - + public function list_device_providers( + string $provider_category = null + ): array { + $request_payload = []; + if ($provider_category !== null) { + $request_payload["provider_category"] = $provider_category; + } + $res = $this->seam->request( + "POST", + "/devices/list_device_providers", + json: $request_payload, + inner_object: "device_providers" + ); - return UserIdentity::from_json($res); - } + return array_map(fn($r) => DeviceProvider::from_json($r), $res); + } + + public function update( + string $device_id, + mixed $custom_metadata = null, + bool $is_managed = null, + string $name = null, + mixed $properties = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($properties !== null) { + $request_payload["properties"] = $properties; + } + + $this->seam->request("POST", "/devices/update", json: $request_payload); + } +} - public function grant_access_to_device( - string $device_id, - string $user_identity_id - ): void { - $request_payload = []; +class DevicesSimulateClient +{ + private SeamClient $seam; - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; } - $this->seam->request( - "POST", - "/user_identities/grant_access_to_device", - json: $request_payload, - - ); + public function remove(string $device_id): void + { + $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + $this->seam->request( + "POST", + "/devices/simulate/remove", + json: $request_payload + ); + } +} +class DevicesUnmanagedClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function get( + string $device_id = null, + string $name = null + ): UnmanagedDevice { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->request( + "POST", + "/devices/unmanaged/get", + json: $request_payload, + inner_object: "device" + ); + return UnmanagedDevice::from_json($res); + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/devices/unmanaged/list", + json: $request_payload, + inner_object: "devices" + ); + return array_map(fn($r) => UnmanagedDevice::from_json($r), $res); + } - } + public function update(string $device_id, bool $is_managed): void + { + $request_payload = []; - public function list( - string $credential_manager_acs_system_id = null - ): array { - $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } - if ($credential_manager_acs_system_id !== null) { - $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; + $this->seam->request( + "POST", + "/devices/unmanaged/update", + json: $request_payload + ); } +} - $res = $this->seam->request( - "POST", - "/user_identities/list", - json: $request_payload, - inner_object: "user_identities", - ); +class EventsClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function get( + string $device_id = null, + string $event_id = null, + string $event_type = null + ): Event { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($event_id !== null) { + $request_payload["event_id"] = $event_id; + } + if ($event_type !== null) { + $request_payload["event_type"] = $event_type; + } + + $res = $this->seam->request( + "POST", + "/events/get", + json: $request_payload, + inner_object: "event" + ); + return Event::from_json($res); + } + + public function list( + string $access_code_id = null, + array $access_code_ids = null, + array $between = null, + string $connected_account_id = null, + string $device_id = null, + array $device_ids = null, + string $event_type = null, + array $event_types = null, + float $limit = null, + string $since = null + ): array { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($access_code_ids !== null) { + $request_payload["access_code_ids"] = $access_code_ids; + } + if ($between !== null) { + $request_payload["between"] = $between; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($event_type !== null) { + $request_payload["event_type"] = $event_type; + } + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($since !== null) { + $request_payload["since"] = $since; + } + + $res = $this->seam->request( + "POST", + "/events/list", + json: $request_payload, + inner_object: "events" + ); + return array_map(fn($r) => Event::from_json($r), $res); + } +} +class LocksClient +{ + private SeamClient $seam; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } - return array_map(fn ($r) => UserIdentity::from_json($r), $res); - } + public function get(string $device_id = null, string $name = null): Device + { + $request_payload = []; - public function list_accessible_devices( - string $user_identity_id - ): array { - $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } + $res = $this->seam->request( + "POST", + "/locks/get", + json: $request_payload, + inner_object: "device" + ); - $res = $this->seam->request( - "POST", - "/user_identities/list_accessible_devices", - json: $request_payload, - inner_object: "devices", - ); + return Device::from_json($res); + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/locks/list", + json: $request_payload, + inner_object: "devices" + ); + return array_map(fn($r) => Device::from_json($r), $res); + } + public function lock_door( + string $device_id, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + $res = $this->seam->request( + "POST", + "/locks/lock_door", + json: $request_payload, + inner_object: "action_attempt" + ); - return array_map(fn ($r) => Device::from_json($r), $res); - } + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } - public function list_acs_systems( - string $user_identity_id - ): array { - $request_payload = []; + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; + return $action_attempt; } - $res = $this->seam->request( - "POST", - "/user_identities/list_acs_systems", - json: $request_payload, - inner_object: "acs_systems", - ); - - + public function unlock_door( + string $device_id, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + $res = $this->seam->request( + "POST", + "/locks/unlock_door", + json: $request_payload, + inner_object: "action_attempt" + ); - return array_map(fn ($r) => AcsSystem::from_json($r), $res); - } + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } - public function list_acs_users( - string $user_identity_id - ): array { - $request_payload = []; + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; + return $action_attempt; } +} - $res = $this->seam->request( - "POST", - "/user_identities/list_acs_users", - json: $request_payload, - inner_object: "acs_users", - ); - - +class NetworksClient +{ + private SeamClient $seam; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + public function get(string $network_id): Network + { + $request_payload = []; - return array_map(fn ($r) => AcsUser::from_json($r), $res); - } + if ($network_id !== null) { + $request_payload["network_id"] = $network_id; + } - public function remove_acs_user( - string $acs_user_id, - string $user_identity_id - ): void { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/networks/get", + json: $request_payload, + inner_object: "network" + ); - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; + return Network::from_json($res); } - $this->seam->request( - "POST", - "/user_identities/remove_acs_user", - json: $request_payload, - - ); + public function list(): array + { + $request_payload = []; + $res = $this->seam->request( + "POST", + "/networks/list", + json: $request_payload, + inner_object: "networks" + ); + return array_map(fn($r) => Network::from_json($r), $res); + } +} +class NoiseSensorsNoiseThresholdsClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function create( + string $device_id, + string $ends_daily_at, + string $starts_daily_at, + string $name = null, + float $noise_threshold_decibels = null, + float $noise_threshold_nrs = null, + bool $sync = null + ): NoiseThreshold { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($ends_daily_at !== null) { + $request_payload["ends_daily_at"] = $ends_daily_at; + } + if ($starts_daily_at !== null) { + $request_payload["starts_daily_at"] = $starts_daily_at; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($noise_threshold_decibels !== null) { + $request_payload[ + "noise_threshold_decibels" + ] = $noise_threshold_decibels; + } + if ($noise_threshold_nrs !== null) { + $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/create", + json: $request_payload, + inner_object: "noise_threshold" + ); + return NoiseThreshold::from_json($res); + } + + public function delete( + string $device_id, + string $noise_threshold_id, + bool $sync = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/delete", + json: $request_payload + ); + } + public function get(string $noise_threshold_id): NoiseThreshold + { + $request_payload = []; - } + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } - public function revoke_access_to_device( - string $device_id, - string $user_identity_id - ): void { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/get", + json: $request_payload, + inner_object: "noise_threshold" + ); - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; + return NoiseThreshold::from_json($res); } - $this->seam->request( - "POST", - "/user_identities/revoke_access_to_device", - json: $request_payload, - - ); + public function list(string $device_id, bool $is_programmed = null): array + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($is_programmed !== null) { + $request_payload["is_programmed"] = $is_programmed; + } + $res = $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/list", + json: $request_payload, + inner_object: "noise_thresholds" + ); + return array_map(fn($r) => NoiseThreshold::from_json($r), $res); + } + + public function update( + string $device_id, + string $noise_threshold_id, + string $ends_daily_at = null, + string $name = null, + float $noise_threshold_decibels = null, + float $noise_threshold_nrs = null, + string $starts_daily_at = null, + bool $sync = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } + if ($ends_daily_at !== null) { + $request_payload["ends_daily_at"] = $ends_daily_at; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($noise_threshold_decibels !== null) { + $request_payload[ + "noise_threshold_decibels" + ] = $noise_threshold_decibels; + } + if ($noise_threshold_nrs !== null) { + $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; + } + if ($starts_daily_at !== null) { + $request_payload["starts_daily_at"] = $starts_daily_at; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/update", + json: $request_payload + ); + } +} +class NoiseSensorsClient +{ + private SeamClient $seam; + public NoiseSensorsNoiseThresholdsClient $noise_thresholds; + public NoiseSensorsSimulateClient $simulate; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + $this->noise_thresholds = new NoiseSensorsNoiseThresholdsClient($seam); + $this->simulate = new NoiseSensorsSimulateClient($seam); + } +} +class NoiseSensorsSimulateClient +{ + private SeamClient $seam; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } - } + public function trigger_noise_threshold(string $device_id): void + { + $request_payload = []; - public function update( - string $user_identity_id, - string $email_address = null, - string $full_name = null, - string $phone_number = null, - string $user_identity_key = null - ): void { - $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; + $this->seam->request( + "POST", + "/noise_sensors/simulate/trigger_noise_threshold", + json: $request_payload + ); } +} - $this->seam->request( - "POST", - "/user_identities/update", - json: $request_payload, - - ); +class PhonesClient +{ + private SeamClient $seam; + public PhonesSimulateClient $simulate; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + $this->simulate = new PhonesSimulateClient($seam); + } + public function deactivate(string $device_id): void + { + $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + $this->seam->request( + "POST", + "/phones/deactivate", + json: $request_payload + ); + } + public function list(string $owner_user_identity_id = null): array + { + $request_payload = []; + if ($owner_user_identity_id !== null) { + $request_payload[ + "owner_user_identity_id" + ] = $owner_user_identity_id; + } - } + $res = $this->seam->request( + "POST", + "/phones/list", + json: $request_payload, + inner_object: "phones" + ); + return array_map(fn($r) => Phone::from_json($r), $res); + } } -class UserIdentitiesEnrollmentAutomationsClient +class PhonesSimulateClient { - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function create_sandbox_phone( + string $user_identity_id, + mixed $assa_abloy_metadata = null, + string $custom_sdk_installation_id = null, + mixed $phone_metadata = null + ): Phone { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($assa_abloy_metadata !== null) { + $request_payload["assa_abloy_metadata"] = $assa_abloy_metadata; + } + if ($custom_sdk_installation_id !== null) { + $request_payload[ + "custom_sdk_installation_id" + ] = $custom_sdk_installation_id; + } + if ($phone_metadata !== null) { + $request_payload["phone_metadata"] = $phone_metadata; + } + + $res = $this->seam->request( + "POST", + "/phones/simulate/create_sandbox_phone", + json: $request_payload, + inner_object: "phone" + ); + return Phone::from_json($res); + } +} - public function delete( - string $enrollment_automation_id - ): void { - $request_payload = []; +class ThermostatsClimateSettingSchedulesClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function create( + string $device_id, + string $schedule_ends_at, + string $schedule_starts_at, + bool $automatic_cooling_enabled = null, + bool $automatic_heating_enabled = null, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + string $hvac_mode_setting = null, + bool $manual_override_allowed = null, + string $name = null, + string $schedule_type = null + ): ClimateSettingSchedule { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($schedule_ends_at !== null) { + $request_payload["schedule_ends_at"] = $schedule_ends_at; + } + if ($schedule_starts_at !== null) { + $request_payload["schedule_starts_at"] = $schedule_starts_at; + } + if ($automatic_cooling_enabled !== null) { + $request_payload[ + "automatic_cooling_enabled" + ] = $automatic_cooling_enabled; + } + if ($automatic_heating_enabled !== null) { + $request_payload[ + "automatic_heating_enabled" + ] = $automatic_heating_enabled; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + if ($hvac_mode_setting !== null) { + $request_payload["hvac_mode_setting"] = $hvac_mode_setting; + } + if ($manual_override_allowed !== null) { + $request_payload[ + "manual_override_allowed" + ] = $manual_override_allowed; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($schedule_type !== null) { + $request_payload["schedule_type"] = $schedule_type; + } + + $res = $this->seam->request( + "POST", + "/thermostats/climate_setting_schedules/create", + json: $request_payload, + inner_object: "climate_setting_schedule" + ); - if ($enrollment_automation_id !== null) { - $request_payload["enrollment_automation_id"] = $enrollment_automation_id; + return ClimateSettingSchedule::from_json($res); } - $this->seam->request( - "POST", - "/user_identities/enrollment_automations/delete", - json: $request_payload, - - ); + public function delete(string $climate_setting_schedule_id): void + { + $request_payload = []; + if ($climate_setting_schedule_id !== null) { + $request_payload[ + "climate_setting_schedule_id" + ] = $climate_setting_schedule_id; + } + $this->seam->request( + "POST", + "/thermostats/climate_setting_schedules/delete", + json: $request_payload + ); + } + public function get( + string $climate_setting_schedule_id = null, + string $device_id = null + ): ClimateSettingSchedule { + $request_payload = []; + + if ($climate_setting_schedule_id !== null) { + $request_payload[ + "climate_setting_schedule_id" + ] = $climate_setting_schedule_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->request( + "POST", + "/thermostats/climate_setting_schedules/get", + json: $request_payload, + inner_object: "climate_setting_schedule" + ); + return ClimateSettingSchedule::from_json($res); + } + public function list( + string $device_id, + string $user_identifier_key = null + ): array { + $request_payload = []; - } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } - public function get( - string $enrollment_automation_id - ): EnrollmentAutomation { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/thermostats/climate_setting_schedules/list", + json: $request_payload, + inner_object: "climate_setting_schedules" + ); - if ($enrollment_automation_id !== null) { - $request_payload["enrollment_automation_id"] = $enrollment_automation_id; + return array_map(fn($r) => ClimateSettingSchedule::from_json($r), $res); + } + + public function update( + string $climate_setting_schedule_id, + bool $automatic_cooling_enabled = null, + bool $automatic_heating_enabled = null, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + string $hvac_mode_setting = null, + bool $manual_override_allowed = null, + string $name = null, + string $schedule_ends_at = null, + string $schedule_starts_at = null, + string $schedule_type = null + ): void { + $request_payload = []; + + if ($climate_setting_schedule_id !== null) { + $request_payload[ + "climate_setting_schedule_id" + ] = $climate_setting_schedule_id; + } + if ($automatic_cooling_enabled !== null) { + $request_payload[ + "automatic_cooling_enabled" + ] = $automatic_cooling_enabled; + } + if ($automatic_heating_enabled !== null) { + $request_payload[ + "automatic_heating_enabled" + ] = $automatic_heating_enabled; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + if ($hvac_mode_setting !== null) { + $request_payload["hvac_mode_setting"] = $hvac_mode_setting; + } + if ($manual_override_allowed !== null) { + $request_payload[ + "manual_override_allowed" + ] = $manual_override_allowed; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($schedule_ends_at !== null) { + $request_payload["schedule_ends_at"] = $schedule_ends_at; + } + if ($schedule_starts_at !== null) { + $request_payload["schedule_starts_at"] = $schedule_starts_at; + } + if ($schedule_type !== null) { + $request_payload["schedule_type"] = $schedule_type; + } + + $this->seam->request( + "POST", + "/thermostats/climate_setting_schedules/update", + json: $request_payload + ); } +} - $res = $this->seam->request( - "POST", - "/user_identities/enrollment_automations/get", - json: $request_payload, - inner_object: "enrollment_automation", - ); - +class ThermostatsClient +{ + private SeamClient $seam; + public ThermostatsClimateSettingSchedulesClient $climate_setting_schedules; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + $this->climate_setting_schedules = new ThermostatsClimateSettingSchedulesClient( + $seam + ); + } + public function cool( + string $device_id, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/cool", + json: $request_payload, + inner_object: "action_attempt" + ); + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); - return EnrollmentAutomation::from_json($res); - } + return $action_attempt; + } - public function launch( - string $credential_manager_acs_system_id, - string $user_identity_id, - string $acs_credential_pool_id = null, - bool $create_credential_manager_user = null, - string $credential_manager_acs_user_id = null - ): void { - $request_payload = []; + public function get(string $device_id = null, string $name = null): Device + { + $request_payload = []; - if ($credential_manager_acs_system_id !== null) { - $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($acs_credential_pool_id !== null) { - $request_payload["acs_credential_pool_id"] = $acs_credential_pool_id; - } - if ($create_credential_manager_user !== null) { - $request_payload["create_credential_manager_user"] = $create_credential_manager_user; - } - if ($credential_manager_acs_user_id !== null) { - $request_payload["credential_manager_acs_user_id"] = $credential_manager_acs_user_id; - } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } - $this->seam->request( - "POST", - "/user_identities/enrollment_automations/launch", - json: $request_payload, - inner_object: "enrollment_automation", - ); + $res = $this->seam->request( + "POST", + "/thermostats/get", + json: $request_payload, + inner_object: "thermostat" + ); + return Device::from_json($res); + } + + public function heat( + string $device_id, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/heat", + json: $request_payload, + inner_object: "action_attempt" + ); + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + return $action_attempt; + } + + public function heat_cool( + string $device_id, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/heat_cool", + json: $request_payload, + inner_object: "action_attempt" + ); + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } - } + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); - public function list( - string $user_identity_id - ): array { - $request_payload = []; + return $action_attempt; + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/thermostats/list", + json: $request_payload, + inner_object: "thermostats" + ); - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; + return array_map(fn($r) => Device::from_json($r), $res); } - $res = $this->seam->request( - "POST", - "/user_identities/enrollment_automations/list", - json: $request_payload, - inner_object: "enrollment_automations", - ); + public function off( + string $device_id, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + $res = $this->seam->request( + "POST", + "/thermostats/off", + json: $request_payload, + inner_object: "action_attempt" + ); + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + return $action_attempt; + } + + public function set_fan_mode( + string $device_id, + string $fan_mode = null, + string $fan_mode_setting = null, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($fan_mode !== null) { + $request_payload["fan_mode"] = $fan_mode; + } + if ($fan_mode_setting !== null) { + $request_payload["fan_mode_setting"] = $fan_mode_setting; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/set_fan_mode", + json: $request_payload, + inner_object: "action_attempt" + ); - return array_map(fn ($r) => EnrollmentAutomation::from_json($r), $res); - } + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } -} + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); -class WebhooksClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } + return $action_attempt; + } + public function update( + mixed $default_climate_setting, + string $device_id + ): void { + $request_payload = []; - public function create( - string $url, - array $event_types = null - ): Webhook { - $request_payload = []; + if ($default_climate_setting !== null) { + $request_payload[ + "default_climate_setting" + ] = $default_climate_setting; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } - if ($url !== null) { - $request_payload["url"] = $url; + $this->seam->request( + "POST", + "/thermostats/update", + json: $request_payload + ); } - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; +} + +class UserIdentitiesClient +{ + private SeamClient $seam; + public UserIdentitiesEnrollmentAutomationsClient $enrollment_automations; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + $this->enrollment_automations = new UserIdentitiesEnrollmentAutomationsClient( + $seam + ); } - $res = $this->seam->request( - "POST", - "/webhooks/create", - json: $request_payload, - inner_object: "webhook", - ); + public function add_acs_user( + string $acs_user_id, + string $user_identity_id + ): void { + $request_payload = []; + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + $this->seam->request( + "POST", + "/user_identities/add_acs_user", + json: $request_payload + ); + } + public function create( + string $email_address = null, + string $full_name = null, + string $phone_number = null, + string $user_identity_key = null + ): UserIdentity { + $request_payload = []; + + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + + $res = $this->seam->request( + "POST", + "/user_identities/create", + json: $request_payload, + inner_object: "user_identity" + ); + return UserIdentity::from_json($res); + } - return Webhook::from_json($res); - } + public function delete(string $user_identity_id): void + { + $request_payload = []; - public function delete( - string $webhook_id - ): void { - $request_payload = []; + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; + $this->seam->request( + "POST", + "/user_identities/delete", + json: $request_payload + ); } - $this->seam->request( - "POST", - "/webhooks/delete", - json: $request_payload, - - ); + public function get( + string $user_identity_id = null, + string $user_identity_key = null + ): UserIdentity { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + + $res = $this->seam->request( + "POST", + "/user_identities/get", + json: $request_payload, + inner_object: "user_identity" + ); + return UserIdentity::from_json($res); + } + public function grant_access_to_device( + string $device_id, + string $user_identity_id + ): void { + $request_payload = []; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + $this->seam->request( + "POST", + "/user_identities/grant_access_to_device", + json: $request_payload + ); + } + public function list(string $credential_manager_acs_system_id = null): array + { + $request_payload = []; - } + if ($credential_manager_acs_system_id !== null) { + $request_payload[ + "credential_manager_acs_system_id" + ] = $credential_manager_acs_system_id; + } - public function get( - string $webhook_id - ): Webhook { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/user_identities/list", + json: $request_payload, + inner_object: "user_identities" + ); - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; + return array_map(fn($r) => UserIdentity::from_json($r), $res); } - $res = $this->seam->request( - "POST", - "/webhooks/get", - json: $request_payload, - inner_object: "webhook", - ); + public function list_accessible_devices(string $user_identity_id): array + { + $request_payload = []; + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + $res = $this->seam->request( + "POST", + "/user_identities/list_accessible_devices", + json: $request_payload, + inner_object: "devices" + ); + return array_map(fn($r) => Device::from_json($r), $res); + } + public function list_acs_systems(string $user_identity_id): array + { + $request_payload = []; - return Webhook::from_json($res); - } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } - public function list( - - ): array { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/user_identities/list_acs_systems", + json: $request_payload, + inner_object: "acs_systems" + ); + return array_map(fn($r) => AcsSystem::from_json($r), $res); + } + public function list_acs_users(string $user_identity_id): array + { + $request_payload = []; - $res = $this->seam->request( - "POST", - "/webhooks/list", - json: $request_payload, - inner_object: "webhooks", - ); + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + $res = $this->seam->request( + "POST", + "/user_identities/list_acs_users", + json: $request_payload, + inner_object: "acs_users" + ); + return array_map(fn($r) => AcsUser::from_json($r), $res); + } + public function remove_acs_user( + string $acs_user_id, + string $user_identity_id + ): void { + $request_payload = []; + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } - return array_map(fn ($r) => Webhook::from_json($r), $res); - } + $this->seam->request( + "POST", + "/user_identities/remove_acs_user", + json: $request_payload + ); + } - public function update( - array $event_types, - string $webhook_id - ): void { - $request_payload = []; + public function revoke_access_to_device( + string $device_id, + string $user_identity_id + ): void { + $request_payload = []; - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $this->seam->request( + "POST", + "/user_identities/revoke_access_to_device", + json: $request_payload + ); } - $this->seam->request( - "POST", - "/webhooks/update", - json: $request_payload, - - ); + public function update( + string $user_identity_id, + string $email_address = null, + string $full_name = null, + string $phone_number = null, + string $user_identity_key = null + ): void { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + + $this->seam->request( + "POST", + "/user_identities/update", + json: $request_payload + ); + } +} +class UserIdentitiesEnrollmentAutomationsClient +{ + private SeamClient $seam; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + public function delete(string $enrollment_automation_id): void + { + $request_payload = []; + if ($enrollment_automation_id !== null) { + $request_payload[ + "enrollment_automation_id" + ] = $enrollment_automation_id; + } + $this->seam->request( + "POST", + "/user_identities/enrollment_automations/delete", + json: $request_payload + ); + } - } + public function get(string $enrollment_automation_id): EnrollmentAutomation + { + $request_payload = []; -} + if ($enrollment_automation_id !== null) { + $request_payload[ + "enrollment_automation_id" + ] = $enrollment_automation_id; + } -class WorkspacesClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - - } + $res = $this->seam->request( + "POST", + "/user_identities/enrollment_automations/get", + json: $request_payload, + inner_object: "enrollment_automation" + ); + return EnrollmentAutomation::from_json($res); + } + + public function launch( + string $credential_manager_acs_system_id, + string $user_identity_id, + string $acs_credential_pool_id = null, + bool $create_credential_manager_user = null, + string $credential_manager_acs_user_id = null + ): void { + $request_payload = []; + + if ($credential_manager_acs_system_id !== null) { + $request_payload[ + "credential_manager_acs_system_id" + ] = $credential_manager_acs_system_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($acs_credential_pool_id !== null) { + $request_payload[ + "acs_credential_pool_id" + ] = $acs_credential_pool_id; + } + if ($create_credential_manager_user !== null) { + $request_payload[ + "create_credential_manager_user" + ] = $create_credential_manager_user; + } + if ($credential_manager_acs_user_id !== null) { + $request_payload[ + "credential_manager_acs_user_id" + ] = $credential_manager_acs_user_id; + } + + $this->seam->request( + "POST", + "/user_identities/enrollment_automations/launch", + json: $request_payload, + inner_object: "enrollment_automation" + ); + } - public function create( - string $connect_partner_name, - string $name, - bool $is_sandbox = null, - string $webview_logo_shape = null, - string $webview_primary_button_color = null - ): Workspace { - $request_payload = []; + public function list(string $user_identity_id): array + { + $request_payload = []; - if ($connect_partner_name !== null) { - $request_payload["connect_partner_name"] = $connect_partner_name; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($is_sandbox !== null) { - $request_payload["is_sandbox"] = $is_sandbox; - } - if ($webview_logo_shape !== null) { - $request_payload["webview_logo_shape"] = $webview_logo_shape; - } - if ($webview_primary_button_color !== null) { - $request_payload["webview_primary_button_color"] = $webview_primary_button_color; - } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } - $res = $this->seam->request( - "POST", - "/workspaces/create", - json: $request_payload, - inner_object: "workspace", - ); + $res = $this->seam->request( + "POST", + "/user_identities/enrollment_automations/list", + json: $request_payload, + inner_object: "enrollment_automations" + ); + return array_map(fn($r) => EnrollmentAutomation::from_json($r), $res); + } +} +class WebhooksClient +{ + private SeamClient $seam; + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + public function create(string $url, array $event_types = null): Webhook + { + $request_payload = []; - return Workspace::from_json($res); - } + if ($url !== null) { + $request_payload["url"] = $url; + } + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } - public function get( - - ): Workspace { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/webhooks/create", + json: $request_payload, + inner_object: "webhook" + ); + return Webhook::from_json($res); + } + public function delete(string $webhook_id): void + { + $request_payload = []; - $res = $this->seam->request( - "POST", - "/workspaces/get", - json: $request_payload, - inner_object: "workspace", - ); + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + $this->seam->request( + "POST", + "/webhooks/delete", + json: $request_payload + ); + } + public function get(string $webhook_id): Webhook + { + $request_payload = []; + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + $res = $this->seam->request( + "POST", + "/webhooks/get", + json: $request_payload, + inner_object: "webhook" + ); - return Workspace::from_json($res); - } + return Webhook::from_json($res); + } - public function list( - - ): array { - $request_payload = []; + public function list(): array + { + $request_payload = []; + $res = $this->seam->request( + "POST", + "/webhooks/list", + json: $request_payload, + inner_object: "webhooks" + ); + return array_map(fn($r) => Webhook::from_json($r), $res); + } - $res = $this->seam->request( - "POST", - "/workspaces/list", - json: $request_payload, - inner_object: "workspaces", - ); + public function update(array $event_types, string $webhook_id): void + { + $request_payload = []; + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + $this->seam->request( + "POST", + "/webhooks/update", + json: $request_payload + ); + } +} +class WorkspacesClient +{ + private SeamClient $seam; + + public function __construct(SeamClient $seam) + { + $this->seam = $seam; + } + + public function create( + string $connect_partner_name, + string $name, + bool $is_sandbox = null, + string $webview_logo_shape = null, + string $webview_primary_button_color = null + ): Workspace { + $request_payload = []; + + if ($connect_partner_name !== null) { + $request_payload["connect_partner_name"] = $connect_partner_name; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($is_sandbox !== null) { + $request_payload["is_sandbox"] = $is_sandbox; + } + if ($webview_logo_shape !== null) { + $request_payload["webview_logo_shape"] = $webview_logo_shape; + } + if ($webview_primary_button_color !== null) { + $request_payload[ + "webview_primary_button_color" + ] = $webview_primary_button_color; + } + + $res = $this->seam->request( + "POST", + "/workspaces/create", + json: $request_payload, + inner_object: "workspace" + ); + return Workspace::from_json($res); + } - return array_map(fn ($r) => Workspace::from_json($r), $res); - } + public function get(): Workspace + { + $request_payload = []; - public function reset_sandbox( - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; + $res = $this->seam->request( + "POST", + "/workspaces/get", + json: $request_payload, + inner_object: "workspace" + ); + return Workspace::from_json($res); + } + public function list(): array + { + $request_payload = []; - $res = $this->seam->request( - "POST", - "/workspaces/reset_sandbox", - json: $request_payload, - inner_object: "action_attempt", - ); + $res = $this->seam->request( + "POST", + "/workspaces/list", + json: $request_payload, + inner_object: "workspaces" + ); - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); + return array_map(fn($r) => Workspace::from_json($r), $res); } - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); + public function reset_sandbox( + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; - return $action_attempt; + $res = $this->seam->request( + "POST", + "/workspaces/reset_sandbox", + json: $request_payload, + inner_object: "action_attempt" + ); + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } - } + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + return $action_attempt; + } } diff --git a/src/Utils/PackageVersion.php b/src/Utils/PackageVersion.php index 852c79b..8c6665b 100644 --- a/src/Utils/PackageVersion.php +++ b/src/Utils/PackageVersion.php @@ -8,34 +8,37 @@ class PackageVersionException extends \Exception class PackageVersion { - public static function get() - { - $filePath = __DIR__ . "/../../package.json"; - - if (!file_exists($filePath)) { - throw new PackageVersionException( - "Can't get package version. File package.json does not exist." - ); + public static function get() + { + $filePath = __DIR__ . "/../../package.json"; + + if (!file_exists($filePath)) { + throw new PackageVersionException( + "Can't get package version. File package.json does not exist." + ); + } + + $content = file_get_contents($filePath); + if ($content === false) { + throw new PackageVersionException( + "Unable to read package.json file to get package version." + ); + } + + $json = json_decode($content, true); + if (json_last_error() !== JSON_ERROR_NONE) { + throw new PackageVersionException( + "JSON decode error occurred when decoding package.json: " . + json_last_error_msg() + ); + } + + if (!isset($json["version"])) { + throw new PackageVersionException( + "Version not set in package.json" + ); + } + + return $json["version"]; } - - $content = file_get_contents($filePath); - if ($content === false) { - throw new PackageVersionException( - "Unable to read package.json file to get package version." - ); - } - - $json = json_decode($content, true); - if (json_last_error() !== JSON_ERROR_NONE) { - throw new PackageVersionException( - "JSON decode error occurred when decoding package.json: " . json_last_error_msg() - ); - } - - if (!isset($json["version"])) { - throw new PackageVersionException("Version not set in package.json"); - } - - return $json["version"]; - } } diff --git a/tests/AccessCodesTest.php b/tests/AccessCodesTest.php index d767cc4..8781896 100644 --- a/tests/AccessCodesTest.php +++ b/tests/AccessCodesTest.php @@ -50,7 +50,7 @@ public function testAccessCodes(): void code: "5679" ); $access_code = $seam->access_codes->get( - access_code_id: $access_code_id + access_code_id: $access_code_id ); $this->assertTrue($access_code->code === "5679"); @@ -100,7 +100,7 @@ public function testAccessCodes(): void $this->assertTrue($formatted_ends_at === $end_date->format("Y-m-d")); $access_codes = $seam->access_codes->create_multiple( - device_ids: [$first_device_id, $second_device_id] + device_ids: [$first_device_id, $second_device_id] ); $this->assertTrue(count($access_codes) === 2); } @@ -136,18 +136,20 @@ public function testUnmanagedAccessCodes(): void usleep(200000); $current_managed_access_codes = $seam->access_codes->list( - device_id: $device_id + device_id: $device_id ); $this->assertTrue( - count($managed_access_codes_before_update) + 1 === count($current_managed_access_codes) + count($managed_access_codes_before_update) + 1 === + count($current_managed_access_codes) ); $this->assertTrue( - !empty(array_filter( - $current_managed_access_codes, - function ($ac) use ($unmanaged_access_code_id) { - return $ac->access_code_id === $unmanaged_access_code_id; - } - )) + !empty( + array_filter($current_managed_access_codes, function ($ac) use ( + $unmanaged_access_code_id + ) { + return $ac->access_code_id === $unmanaged_access_code_id; + }) + ) ); } } diff --git a/tests/ClimateSettingSchedulesTest.php b/tests/ClimateSettingSchedulesTest.php index 1c84421..42d94dd 100644 --- a/tests/ClimateSettingSchedulesTest.php +++ b/tests/ClimateSettingSchedulesTest.php @@ -51,8 +51,8 @@ public function testClimateSettingSchedules(): void manual_override_allowed: true ); $updated_climate_setting_schedule = $seam->thermostats->climate_setting_schedules->get( - climate_setting_schedule_id: $climate_setting_schedule_id - ); + climate_setting_schedule_id: $climate_setting_schedule_id + ); $this->assertTrue( $updated_climate_setting_schedule->cooling_set_point_celsius == 21 ); diff --git a/tests/ConnectedAccountsTest.php b/tests/ConnectedAccountsTest.php index 5139e48..5c1c989 100644 --- a/tests/ConnectedAccountsTest.php +++ b/tests/ConnectedAccountsTest.php @@ -8,78 +8,78 @@ final class ConnectedAccountsTest extends TestCase { - public function testGetAndListConnectedAccounts(): void - { - $seam = Fixture::getTestServer(); - $connected_accounts = $seam->connected_accounts->list(); - $this->assertIsArray($connected_accounts); + public function testGetAndListConnectedAccounts(): void + { + $seam = Fixture::getTestServer(); + $connected_accounts = $seam->connected_accounts->list(); + $this->assertIsArray($connected_accounts); - $connected_account_id = $connected_accounts[0]->connected_account_id; - $connected_account = $seam->connected_accounts->get( - connected_account_id: $connected_account_id - ); - $this->assertTrue( - $connected_account->connected_account_id === $connected_account_id - ); - } + $connected_account_id = $connected_accounts[0]->connected_account_id; + $connected_account = $seam->connected_accounts->get( + connected_account_id: $connected_account_id + ); + $this->assertTrue( + $connected_account->connected_account_id === $connected_account_id + ); + } - public function testDeleteConnectedAccount(): void - { - $seam = Fixture::getTestServer(); - $connected_accounts = $seam->connected_accounts->list(); + public function testDeleteConnectedAccount(): void + { + $seam = Fixture::getTestServer(); + $connected_accounts = $seam->connected_accounts->list(); - $connected_account_id = $connected_accounts[0]->connected_account_id; + $connected_account_id = $connected_accounts[0]->connected_account_id; - $connected_account = $seam->connected_accounts->get( - connected_account_id: $connected_account_id - ); - $this->assertTrue( - $connected_account->connected_account_id === $connected_account_id - ); + $connected_account = $seam->connected_accounts->get( + connected_account_id: $connected_account_id + ); + $this->assertTrue( + $connected_account->connected_account_id === $connected_account_id + ); - $seam->connected_accounts->delete( - connected_account_id: $connected_account_id - ); + $seam->connected_accounts->delete( + connected_account_id: $connected_account_id + ); - try { - $connected_account = $seam->connected_accounts->get( - connected_account_id: $connected_account_id - ); - $this->fail("Expected the account to be deleted"); - } catch (Exception $exception) { - $this->assertTrue( - str_contains( - $exception->getMessage(), - "connected_account_not_found" - ) - ); + try { + $connected_account = $seam->connected_accounts->get( + connected_account_id: $connected_account_id + ); + $this->fail("Expected the account to be deleted"); + } catch (Exception $exception) { + $this->assertTrue( + str_contains( + $exception->getMessage(), + "connected_account_not_found" + ) + ); + } } - } - public function testUpdateConnectedAccount(): void - { - $seam = Fixture::getTestServer(); - $connected_accounts = $seam->connected_accounts->list(); + public function testUpdateConnectedAccount(): void + { + $seam = Fixture::getTestServer(); + $connected_accounts = $seam->connected_accounts->list(); - $connected_account_id = $connected_accounts[0]->connected_account_id; + $connected_account_id = $connected_accounts[0]->connected_account_id; - $connected_account = $seam->connected_accounts->get( - connected_account_id: $connected_account_id - ); - $this->assertTrue( - $connected_account->automatically_manage_new_devices === true - ); + $connected_account = $seam->connected_accounts->get( + connected_account_id: $connected_account_id + ); + $this->assertTrue( + $connected_account->automatically_manage_new_devices === true + ); - $seam->connected_accounts->update( - connected_account_id: $connected_account_id, - automatically_manage_new_devices: false - ); + $seam->connected_accounts->update( + connected_account_id: $connected_account_id, + automatically_manage_new_devices: false + ); - $connected_account = $seam->connected_accounts->get( - connected_account_id: $connected_account_id - ); - $this->assertTrue( - $connected_account->automatically_manage_new_devices === false - ); - } + $connected_account = $seam->connected_accounts->get( + connected_account_id: $connected_account_id + ); + $this->assertTrue( + $connected_account->automatically_manage_new_devices === false + ); + } } diff --git a/tests/DevicesTest.php b/tests/DevicesTest.php index c78fda9..272e879 100644 --- a/tests/DevicesTest.php +++ b/tests/DevicesTest.php @@ -110,4 +110,4 @@ public function testUnmanagedDevices(): void $unmanaged_devices = $seam->devices->unmanaged->list(); $this->assertTrue(count($unmanaged_devices) == 0); } -} \ No newline at end of file +} diff --git a/tests/SmokeTest.php b/tests/SmokeTest.php index e6f0b1e..ab51e6e 100644 --- a/tests/SmokeTest.php +++ b/tests/SmokeTest.php @@ -7,22 +7,23 @@ final class SmokeTest extends TestCase { - public function testGetDevices(): void - { - $seam = Fixture::getTestServer(); + public function testGetDevices(): void + { + $seam = Fixture::getTestServer(); - $devices_response = $seam->devices->list(); - $this->assertIsString($devices_response[0]->device_id); - } - public function testCreateAccessCode(): void - { - $seam = Fixture::getTestServer(); + $devices_response = $seam->devices->list(); + $this->assertIsString($devices_response[0]->device_id); + } + public function testCreateAccessCode(): void + { + $seam = Fixture::getTestServer(); - $access_code = $seam->access_codes->create( - device_id:"august_device_1", code:"1234" - ); + $access_code = $seam->access_codes->create( + device_id: "august_device_1", + code: "1234" + ); - $this->assertTrue($access_code->status === "setting"); - $this->assertTrue($access_code->code === "1234"); - } + $this->assertTrue($access_code->status === "setting"); + $this->assertTrue($access_code->code === "1234"); + } }