feat(generated): Add Groups API and organization membership groups support#537
Conversation
Greptile SummaryThis generated PR adds a full
Confidence Score: 4/5Safe to merge with the manifest inconsistency addressed; the fixture file exists today so no tests are broken in the current state. One P1 finding: the manifest removal of testdata/list_user_organization_membership_base_list_data.json diverges from what the generated test files actually read. Tests pass today because the file still exists, but the next oagen run could delete it. All new service code is well-structured and follows established patterns. .oagen-manifest.json and groups_test.go warrant a second look for the fixture tracking inconsistency. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant GroupService
participant UserMgmtOMGroupService
participant WorkOS API
Caller->>GroupService: ListOrganizationGroups(orgID, params)
GroupService->>WorkOS API: GET /organizations/{orgID}/groups
WorkOS API-->>GroupService: Iterator[Group]
GroupService-->>Caller: Iterator[Group]
Caller->>GroupService: CreateOrganizationGroup(orgID, params)
GroupService->>WorkOS API: POST /organizations/{orgID}/groups
WorkOS API-->>GroupService: Group
GroupService-->>Caller: *Group
Caller->>GroupService: CreateOrganizationMembership(orgID, groupID, params)
GroupService->>WorkOS API: POST /organizations/{orgID}/groups/{groupID}/organization-memberships
WorkOS API-->>GroupService: Group
GroupService-->>Caller: *Group
Caller->>GroupService: DeleteOrganizationMembership(orgID, groupID, omID)
GroupService->>WorkOS API: DELETE /organizations/{orgID}/groups/{groupID}/organization-memberships/{omID}
WorkOS API-->>GroupService: 204 No Content
GroupService-->>Caller: error
Caller->>UserMgmtOMGroupService: ListOrganizationMembershipGroups(omID, params)
UserMgmtOMGroupService->>WorkOS API: GET /user_management/organization_memberships/{omID}/groups
WorkOS API-->>UserMgmtOMGroupService: Iterator[Group]
UserMgmtOMGroupService-->>Caller: Iterator[Group]
|
| // ItContactEmails is the email addresses of the IT contacts to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. | ||
| ItContactEmails []string `json:"it_contact_emails,omitempty"` |
There was a problem hiding this comment.
Breaking rename of
AdminEmails → ItContactEmails
The field AdminEmails (JSON: admin_emails) has been renamed to ItContactEmails (JSON: it_contact_emails) in AdminPortalGenerateLinkParams. Any existing caller that sets AdminEmails will get a compile error after upgrading. The same rename appears in the GenerateLink model in models.go. While this is generated code following the OpenAPI spec, a changelog note or deprecation period is worth considering to give consumers time to migrate.
| defer server.Close() | ||
|
|
||
| client := workos.NewClient("sk_test", workos.WithBaseURL(server.URL)) | ||
| result, err := client.Groups().CreateOrganizationMembership(context.Background(), "test_organizationId", "test_groupId", &workos.GroupsCreateOrganizationMembershipParams{}) |
There was a problem hiding this comment.
Required field left empty in
CreateOrganizationMembership test
GroupsCreateOrganizationMembershipParams.OrganizationMembershipID is a required string field with no omitempty tag, but the test constructs the params as &workos.GroupsCreateOrganizationMembershipParams{} (zero value), so an empty organization_membership_id is sent in the request body. The mock server accepts any body, so the test passes, but it never exercises the actual required-field serialization path. Setting a non-empty ID (e.g. "om_test123") would make the test more representative.
Summary
ListOrganizationGroups(),CreateOrganizationGroup(),GetOrganizationGroup(),UpdateOrganizationGroup(),DeleteOrganizationGroup()ListOrganizationMemberships(),CreateOrganizationMembership(),DeleteOrganizationMembership()Groupstruct with ID, name, description, organization_id, created_at, and updated_at fieldsListOrganizationMembershipGroups()to list groups for an organization membershipListOrganizationMembershipResources→ListResourcesForMembership,DeleteOrganizationMembershipRoleAssignment→RemoveRoleAssignment)WaitlistUser,WaitlistUserStateenum,CreateGroup,CreateGroupMembership,DomainVerificationIntentOptionsSSOProviderenumTriggered by workos/openapi-spec@36f2763