Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/policy/mount-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export const mountRules: Record<string, string> = {
// Org-scoped authorized applications -> Organizations
OrganizationsAuthorizedApplications: 'Organizations',

// Org-scoped IT contacts -> Organizations
OrganizationsItContacts: 'Organizations',

// User Management sub-services -> UserManagement, except the
// OrganizationMembership family (longer wildcard prefix wins) and the three
// exact entries below/above (exact always beats a wildcard):
Expand Down
15 changes: 15 additions & 0 deletions src/policy/operation-hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ export const operationHints: Record<string, OperationHint> = {
name: 'list_authorized_applications',
},

// -- IT contacts (mounted on Organizations) -----------------------------------
// Drop the `organization` prefix the path would otherwise produce, and name
// the invite/revoke sub-resources after the action.
'GET /organizations/{organization_id}/it_contacts': { name: 'list_it_contacts' },
'POST /organizations/{organization_id}/it_contacts': { name: 'create_it_contact' },
'DELETE /organizations/{organization_id}/it_contacts/{contact_id}': {
name: 'delete_it_contact',
},
'POST /organizations/{organization_id}/it_contacts/{contact_id}/invite': {
name: 'invite_it_contact',
},
'POST /organizations/{organization_id}/it_contacts/{contact_id}/revoke': {
name: 'revoke_it_contact',
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the change above, what do the SDK methods end up looking like?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node (other langs get the same names in their own casing):

await workos.organizations.listItContacts({ organizationId });
await workos.organizations.createItContact({ organizationId, email });
await workos.organizations.deleteItContact({ organizationId, contactId });
await workos.organizations.inviteItContact({ organizationId, contactId, intents: ['sso'] });
await workos.organizations.revokeItContact({ organizationId, contactId });

Without the hints they'd be workos.organizationsItContacts.listOrganizationItContacts(...) etc. See workos/workos-node#1681 for the actual implementation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we do for organization domains currently?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Organization domains are the other shape: the API itself is top-level, not nested — POST /organization_domains (with organization_id in the body), GET|DELETE /organization_domains/{id}, POST /organization_domains/{id}/verify — so they need no mount rule or hints, and the SDK gets workos.organizationDomains.createOrganizationDomain({ organizationId, domain }) / getOrganizationDomain(id) / verifyOrganizationDomain(id) / deleteOrganizationDomain(id).

IT contacts can't follow that without changing the shipped API paths, which is the option we ruled out above. The closest nested precedent is Groups (/organizations/{organizationId}/groups), which is mounted top-level as workos.groups.* — this PR deliberately doesn't follow that one per jonatas' call to keep the SDK consistent with the API hierarchy.


// -- External ID lookups (not derivable from path) ----------------------------
'GET /organizations/external_id/{external_id}': { name: 'get_organization_by_external_id' },
'GET /user_management/users/external_id/{external_id}': { name: 'get_user_by_external_id' },
Expand Down