Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine Resource and Resources using class methods. #263

Closed
tdstein opened this issue Sep 4, 2024 · 1 comment
Closed

Combine Resource and Resources using class methods. #263

tdstein opened this issue Sep 4, 2024 · 1 comment
Labels
enhancement New feature or request sdk Used for automation

Comments

@tdstein
Copy link
Collaborator

tdstein commented Sep 4, 2024

It's possible to combine the Resource and Resources classes into a single class by refactoring all existing Resources methods as @classmethod implementations. This change requires defining session and url as class variables, which impacts the architecture of the Client class. Currently, these are instance variables, which are set on object initialization. This ensures that multiple clients can be defined for different Connect servers. Class variables, on the other hand, are scoped to the class, not the instance. Therefore, each client must define separate classes at runtime to ensure that the resources used by the client are scoped to the proper Connect server. Here is a simple example showing how to define classes at runtime with different instance variables: https://gist.github.com/tdstein/f8326a7f63562652a98ca7958c31f813

@tdstein tdstein added the enhancement New feature or request label Sep 4, 2024
@tdstein tdstein added the sdk Used for automation label Sep 13, 2024
@tdstein
Copy link
Collaborator Author

tdstein commented Nov 13, 2024

After further exploration, we discovered that this pattern introduces too many oddities. Foremost is handling multiple Client instances correctly. Using class variables to manage the url and session instances becomes overly complex.

@tdstein tdstein closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sdk Used for automation
Projects
None yet
Development

No branches or pull requests

1 participant