-
Notifications
You must be signed in to change notification settings - Fork 23
feat: Add external_id support for User and Organization entities #83
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
feat: Add external_id support for User and Organization entities #83
Conversation
Greptile OverviewGreptile SummaryThis PR adds Main issue to address before merge: both structs use Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
autonumber
participant App as Client Code
participant Orgs as WorkOS.Organizations
participant UM as WorkOS.UserManagement
participant HTTP as WorkOS.Client
participant API as WorkOS API
App->>Orgs: get_organization_by_external_id(external_id)
Orgs->>HTTP: GET /organizations/external_id/:external_id
HTTP->>API: HTTP request
API-->>HTTP: 200 {.., external_id}
HTTP-->>Orgs: {:ok, %Organization{external_id: ...}}
Orgs-->>App: {:ok, organization}
App->>UM: get_user_by_external_id(external_id)
UM->>HTTP: GET /user_management/users/external_id/:external_id
HTTP->>API: HTTP request
API-->>HTTP: 200 {.., external_id}
HTTP-->>UM: {:ok, %User{external_id: ...}}
UM-->>App: {:ok, user}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 files reviewed, 2 comments
Additional Comments (2)
|
|
Thanks for the review Greptile bot! I believe the current implementation is actually correct. The external_id field is intentionally not in @enforce_keys since it's optional. The cast/1 function explicitly sets external_id: map["external_id"], which will be nil when the key is absent from the API response. Since external_id isn't an enforced key, constructing the struct with external_id: nil works fine. |
|
Heya--would you mind merging in |
Add external_id field to User and Organization structs and implement new API endpoints to fetch entities by their external ID: - GET /user_management/users/external_id/:external_id - GET /organizations/external_id/:external_id New functions: - WorkOS.UserManagement.get_user_by_external_id/1,2 - WorkOS.Organizations.get_organization_by_external_id/1,2 This enables looking up users and organizations by their external identifier, which is useful when integrating WorkOS with existing user management systems.
49f736a to
19b0009
Compare
Sorry, didn't notice your message, went straight from my inbox to the failed action. |
Add external_id field to User and Organization structs and implement
new API endpoints to fetch entities by their external ID:
New functions:
This enables looking up users and organizations by their external
identifier, which is useful when integrating WorkOS with existing
user management systems.