Skip to content

feat: Add IT Contacts API - #1681

Open
jonatascastro12 wants to merge 1 commit into
mainfrom
devin/1787249045-it-contacts
Open

feat: Add IT Contacts API#1681
jonatascastro12 wants to merge 1 commit into
mainfrom
devin/1787249045-it-contacts

Conversation

@jonatascastro12

Copy link
Copy Markdown
Contributor

Description

Adds the organization-scoped IT Contacts API as a new generated service, exposed as workos.itContacts:

workos.itContacts.listItContacts({ organizationId });
workos.itContacts.createItContact({ organizationId, email });
workos.itContacts.deleteItContact({ organizationId, contactId });
workos.itContacts.inviteItContact({ organizationId, contactId, intents });
workos.itContacts.revokeItContact({ organizationId, contactId });

src/it-contacts/** and the manifest entries are oagen output (generated with sdk:generate --lang node, scoped to the new service); the accessor in src/workos.ts and the interface barrel export in src/index.ts are 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 produced workos.organizationsItContacts.listOrganizationItContacts(...). That policy PR should merge first so regeneration stays stable. Shape follows Groups: flat top-level service, organizationId passed 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.

[ ] Yes

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

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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor
Original prompt from jonatas

Please work on ticket "Add IT Contacts API to Node SDK" (ENT-6867)

@playbook:playbook-b0d9a34380374c3e903d900d340d8da7

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot changed the title Add IT Contacts API feat: Add IT Contacts API Aug 20, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

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.

Devin Review found 2 potential issues.

Open in Devin Review

Comment on lines +9 to +11
export * from './it-contact.interface';
export * from './list-it-contacts-options.interface';
export * from './revoke-it-contact-options.interface';

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.

🟡 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.

Suggested change
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';
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

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.

Comment on lines +38 to +44
async listItContacts(options: ListItContactsOptions): Promise<ItContactList> {
const { organizationId } = options;
const { data } = await this.workos.get<ItContactListResponse>(
`/organizations/${encodeURIComponent(organizationId)}/it_contacts`,
);
return deserializeItContactList(data);
}

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.

🔍 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.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

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-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds an organization-scoped IT Contacts service with generated interfaces, serializers, fixtures, and tests, then exposes it on the shared WorkOS client.

  • Adds list, create, delete, invite, and revoke operations.
  • Converts API timestamps and pagination metadata into SDK models.
  • Exports the interfaces from the Node barrel, but not the Worker barrel.

Confidence Score: 4/5

The 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

Filename Overview
src/it-contacts/it-contacts.ts Adds five organization-scoped IT Contacts operations with encoded path parameters and generated serialization.
src/it-contacts/serializers/it-contact.serializer.ts Maps raw contact fields and converts API timestamp strings into Date objects.
src/it-contacts/serializers/it-contact-list.serializer.ts Deserializes contact arrays and cursor metadata using the generated serializers.
src/workos.ts Exposes the new service from the shared WorkOS base class, including Worker clients.
src/index.ts Exports IT Contacts interfaces from the Node entrypoint without adding the corresponding Worker export.
src/it-contacts/it-contacts.spec.ts Covers HTTP methods, routes, principal request bodies, and create-response date conversion.

Sequence Diagram

sequenceDiagram
  participant App as Application
  participant WorkOS as WorkOS client
  participant IT as ItContacts
  participant HTTP as Shared HTTP client
  participant API as WorkOS API
  App->>WorkOS: workos.itContacts
  App->>IT: list/create/delete/invite/revoke(options)
  IT->>HTTP: Encoded organization/contact route + payload
  HTTP->>API: HTTPS request
  API-->>HTTP: JSON or empty response
  HTTP-->>IT: Parsed response
  IT-->>App: Typed SDK model or void
Loading
Prompt To Fix All With AI
### Issue 1
src/index.ts:27
**Worker interface exports are missing**

When an edge consumer imports IT Contacts types from the Worker entrypoint, the barrel omits these runtime-neutral interfaces even though the shared `WorkOS` class exposes `itContacts`, causing TypeScript missing-export errors or forcing an import through the Node entrypoint.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Add IT Contacts API" | Re-trigger Greptile

Comment thread src/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant