Skip to content

Migrate resource classes from Objects to Resources namespace - #454

Merged
razor-x merged 1 commit into
mainfrom
claude/objects-to-resources-refactor-66knpg
Jul 27, 2026
Merged

Migrate resource classes from Objects to Resources namespace#454
razor-x merged 1 commit into
mainfrom
claude/objects-to-resources-refactor-66knpg

Conversation

@razor-x

@razor-x razor-x commented Jul 27, 2026

Copy link
Copy Markdown
Member

This PR reorganizes the SDK's resource class structure by migrating all resource model classes from the Seam\Objects namespace to the Seam\Resources namespace.

Summary

The codebase has been refactored to consolidate resource definitions under a dedicated Resources namespace, improving the logical organization of the SDK. This change separates resource models from other object types and provides a clearer API structure.

Key Changes

  • Namespace Migration: Moved 100+ resource classes from src/Objects/ to src/Resources/, including:

    • Core resources: Device, AccessCode, AccessGrant, Event, ActionAttempt, AcsUser, AcsEntrance, AcsSystem, AcsCredential, AcsAccessGroup, AcsEncoder, ConnectedAccount, Phone, Space, Workspace, UserIdentity, UnmanagedDevice, UnmanagedAccessCode, AccessMethod, ClientSession, ConnectWebview, CustomerPortal, DeviceProvider, NoiseThreshold, Webhook, Batch, ConnectWebview, InstantKey, ThermostatSchedule, ThermostatDailyProgram
    • Nested resource classes and metadata classes
  • Updated Imports: Modified all import statements throughout the codebase to reference the new Seam\Resources namespace:

    • SeamClient.php updated with new use statements
    • Exception classes updated to import from Resources
    • Handlebars templates updated for code generation
  • Code Generation Updates: Updated codegen configuration files to generate resources in the new namespace:

    • codegen/lib/resource-model.ts - Updated to target src/Resources
    • codegen/layouts/resource.hbs - Updated namespace declaration
    • codegen/smith.ts - Updated paths
    • composer.json - Added PSR-4 autoloading for Seam\Resources
  • Removed Old Files: Deleted all resource class files from src/Objects/ directory

Implementation Details

The migration maintains full backward compatibility in terms of functionality—all class definitions, methods, and properties remain unchanged. Only the namespace has been updated. The from_json() factory methods and constructor signatures are preserved exactly as they were.

https://claude.ai/code/session_014yfWYVy7dgifgtsFPnrkDX

Generate the resource classes into src/Resources under the Seam\Resources
namespace instead of src/Objects under Seam\Objects.

Each blueprint resource now gets a single file. The classes that only exist
to type a nested object property of a resource (DeviceBattery, AcsSystemLocation,
and so on) are emitted as local classes in the file of the resource that
introduced them, rather than as 213 separate files.

Since those local classes no longer live in a file matching their name, add a
classmap autoload entry for src/Resources alongside the existing PSR-4 mapping.

The generated classes themselves are unchanged: all 213 class bodies are
byte-identical to the previous output.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yfWYVy7dgifgtsFPnrkDX
@razor-x
razor-x marked this pull request as ready for review July 27, 2026 23:43
@razor-x
razor-x merged commit 6c3352a into main Jul 27, 2026
5 checks passed
@razor-x
razor-x deleted the claude/objects-to-resources-refactor-66knpg branch July 27, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants