feat: Add IT Contacts API - #1681
Conversation
Generate the ItContacts service from the OpenAPI spec and expose it as workos.itContacts, with list/create/delete/invite/revoke operations. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Original prompt from jonatas
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| export * from './it-contact.interface'; | ||
| export * from './list-it-contacts-options.interface'; | ||
| export * from './revoke-it-contact-options.interface'; |
There was a problem hiding this comment.
🟡 List response types for IT contacts are not publicly exported
The public type describing the IT contacts list result is left out of the module's export list (src/it-contacts/interfaces/index.ts:3-11), so anyone importing the SDK cannot reference the return type of the list operation even though every other list-returning module exposes it.
Impact: Consumers of the published package cannot import ItContactList/ItContactListListMetadata (and their response variants) to type their own code, unlike every other list-returning service.
Barrel omission vs. established generated pattern
The interfaces barrel src/it-contacts/interfaces/index.ts exports 9 interface files but omits it-contact-list.interface and it-contact-list-list-metadata.interface, both of which exist and are listed in .oagen-manifest.json:87,96,97. listItContacts returns Promise<ItContactList> (src/it-contacts/it-contacts.ts:38), and the top-level package re-exports this barrel via export * from './it-contacts/interfaces' (src/index.ts:27). By comparison, the analogous generated module exports its list-response interface in the barrel (e.g. src/pipes/interfaces/index.ts exports data-integrations-list-response.interface), and the it-contacts serializers barrel (src/it-contacts/serializers/index.ts:6-7) does export the corresponding list serializers, showing the interfaces barrel is inconsistent/incomplete.
| export * from './it-contact.interface'; | |
| export * from './list-it-contacts-options.interface'; | |
| export * from './revoke-it-contact-options.interface'; | |
| export * from './it-contact.interface'; | |
| export * from './it-contact-list.interface'; | |
| export * from './it-contact-list-list-metadata.interface'; | |
| export * from './list-it-contacts-options.interface'; | |
| export * from './revoke-it-contact-options.interface'; |
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
This is deliberate emitter behaviour, not an omission in this PR: the node barrel generator skips list-wrapper and list-metadata models — if (isListMetadataModel(model) || isListWrapperModel(model)) continue; in generateServiceBarrels (@workos/oagen-emitters). Other services just don't have a *-list.interface.ts today (IT Contacts is the first generated non-paginated list endpoint), so there's no precedent being broken; the pipes example is a *-list-response model, which isn't a list wrapper.
Since these files are generated and must not be hand-edited, exporting ItContactList/ItContactListListMetadata would need a change in the emitter rather than here. Leaving as generated; happy to file that upstream if we want list wrappers in the public type surface.
| async listItContacts(options: ListItContactsOptions): Promise<ItContactList> { | ||
| const { organizationId } = options; | ||
| const { data } = await this.workos.get<ItContactListResponse>( | ||
| `/organizations/${encodeURIComponent(organizationId)}/it_contacts`, | ||
| ); | ||
| return deserializeItContactList(data); | ||
| } |
There was a problem hiding this comment.
🔍 listItContacts does not use AutoPaginatable unlike Groups
listItContacts (src/it-contacts/it-contacts.ts:38-44) performs a plain GET and returns a materialized ItContactList rather than wrapping in AutoPaginatable and accepting pagination options, unlike the analogous listGroups in src/groups/groups.ts. The response still carries list_metadata cursors, so callers cannot auto-paginate. This appears intentional as generated output for this endpoint, but worth confirming against the spec that IT contacts are not paginated.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Correct as generated: GET /organizations/{organization_id}/it_contacts takes no pagination parameters in the spec (only the organization_id path param), so there is nothing for AutoPaginatable to page with. The list_metadata cursors come from the shared list wrapper shape. If the API adds limit/before/after later, regenerating will pick up the paginated shape.
Greptile SummaryThe PR adds an organization-scoped IT Contacts service with generated interfaces, serializers, fixtures, and tests, then exposes it on the shared WorkOS client.
Confidence Score: 4/5The PR needs the IT Contacts interface export added to the Worker entrypoint before merging so its runtime and TypeScript surfaces remain aligned. The shared WorkOS class exposes the new service in Worker builds, but the Worker package entrypoint omits all newly added IT Contacts interfaces, causing missing-export errors for edge consumers. Files Needing Attention: src/index.ts and src/index.worker.ts Important Files Changed
|
Description
Adds the organization-scoped IT Contacts API as a new generated service, exposed as
workos.itContacts:src/it-contacts/**and the manifest entries areoagenoutput (generated withsdk:generate --lang node, scoped to the new service); the accessor insrc/workos.tsand the interface barrel export insrc/index.tsare the manual wiring those generated files need.Service and method names come from the policy change in workos/openapi-spec#110 (
OrganizationsItContacts->ItContacts, plus operation-name hints); without it the default resolution would have producedworkos.organizationsItContacts.listOrganizationItContacts(...). That policy PR should merge first so regeneration stays stable. Shape followsGroups: flat top-level service,organizationIdpassed as an option, sub-resource actions (invite/revoke) as methods.Lint, typecheck and the full Jest suite pass locally.
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
Link to Devin session: https://app.devin.ai/sessions/2633e183d1b146d6a18a87e0e1b9c42b
Requested by: @jonatascastro12