-
Notifications
You must be signed in to change notification settings - Fork 57
feat: Add IT Contacts API #1681
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "email": "it-contact@example.com" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "intents": ["sso", "directory_sync"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "before": "it_contact_01HXYZ123456789ABCDEFGHIJ", | ||
| "after": "it_contact_01HXYZ987654321KJIHGFEDCBA" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "object": "list", | ||
| "data": [ | ||
| { | ||
| "object": "it_contact", | ||
| "id": "it_contact_01HXYZ123456789ABCDEFGHIJ", | ||
| "email": "it-contact@example.com", | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "updated_at": "2026-01-15T12:00:00.000Z" | ||
| } | ||
| ], | ||
| "list_metadata": { | ||
| "before": "it_contact_01HXYZ123456789ABCDEFGHIJ", | ||
| "after": "it_contact_01HXYZ987654321KJIHGFEDCBA" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "object": "it_contact", | ||
| "id": "it_contact_01HXYZ123456789ABCDEFGHIJ", | ||
| "email": "it-contact@example.com", | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "updated_at": "2026-01-15T12:00:00.000Z" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface CreateItContactOptions { | ||
| /** The ID of the organization. */ | ||
| organizationId: string; | ||
| /** The email address of the IT contact. */ | ||
| email: string; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface CreateItContact { | ||
| /** The email address of the IT contact. */ | ||
| email: string; | ||
| } | ||
|
|
||
| export interface CreateItContactResponse { | ||
| email: string; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface DeleteItContactOptions { | ||
| /** The ID of the organization. */ | ||
| organizationId: string; | ||
| /** The ID of the IT contact. */ | ||
| contactId: string; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,11 @@ | ||||||||||||||||||
| // This file is auto-generated by oagen. Do not edit. | ||||||||||||||||||
|
|
||||||||||||||||||
| export * from './create-it-contact-options.interface'; | ||||||||||||||||||
| export * from './create-it-contact.interface'; | ||||||||||||||||||
| export * from './delete-it-contact-options.interface'; | ||||||||||||||||||
| export * from './invite-it-contact-intents.interface'; | ||||||||||||||||||
| export * from './invite-it-contact-options.interface'; | ||||||||||||||||||
| export * from './invite-it-contact.interface'; | ||||||||||||||||||
| export * from './it-contact.interface'; | ||||||||||||||||||
| export * from './list-it-contacts-options.interface'; | ||||||||||||||||||
| export * from './revoke-it-contact-options.interface'; | ||||||||||||||||||
|
Comment on lines
+9
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ( Barrel omission vs. established generated patternThe interfaces barrel
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 — Since these files are generated and must not be hand-edited, exporting |
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export const InviteItContactIntents = { | ||
| SSO: 'sso', | ||
| DirectorySync: 'directory_sync', | ||
| LogStreams: 'log_streams', | ||
| DomainVerification: 'domain_verification', | ||
| BringYourOwnKey: 'bring_your_own_key', | ||
| } as const; | ||
|
|
||
| export type InviteItContactIntents = | ||
| (typeof InviteItContactIntents)[keyof typeof InviteItContactIntents]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| import type { InviteItContactIntents } from './invite-it-contact-intents.interface'; | ||
|
|
||
| export interface InviteItContactOptions { | ||
| /** The ID of the organization. */ | ||
| organizationId: string; | ||
| /** The ID of the IT contact. */ | ||
| contactId: string; | ||
| /** The Admin Portal features that the IT contact can configure. */ | ||
| intents: InviteItContactIntents[]; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| import type { InviteItContactIntents } from './invite-it-contact-intents.interface'; | ||
|
|
||
| export interface InviteItContact { | ||
| /** The Admin Portal features that the IT contact can configure. */ | ||
| intents: InviteItContactIntents[]; | ||
| } | ||
|
|
||
| export interface InviteItContactResponse { | ||
| intents: InviteItContactIntents[]; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| /** Pagination cursors for navigating between pages of results. */ | ||
| export interface ItContactListListMetadata { | ||
| /** An object ID that defines your place in the list. When the ID is not present, you are at the start of the list. */ | ||
| before: string | null; | ||
| /** An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. */ | ||
| after: string | null; | ||
| } | ||
|
|
||
| export interface ItContactListListMetadataResponse { | ||
| before: string | null; | ||
| after: string | null; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| import type { ItContact, ItContactResponse } from './it-contact.interface'; | ||
| import type { | ||
| ItContactListListMetadata, | ||
| ItContactListListMetadataResponse, | ||
| } from './it-contact-list-list-metadata.interface'; | ||
|
|
||
| export interface ItContactList { | ||
| /** Indicates this is a list response. */ | ||
| object: 'list'; | ||
| /** The list of records for the current page. */ | ||
| data: ItContact[]; | ||
| /** Pagination cursors for navigating between pages of results. */ | ||
| listMetadata: ItContactListListMetadata; | ||
| } | ||
|
|
||
| export interface ItContactListResponse { | ||
| object: 'list'; | ||
| data: ItContactResponse[]; | ||
| list_metadata: ItContactListListMetadataResponse; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface ItContact { | ||
| /** The IT Contact object. */ | ||
| object: 'it_contact'; | ||
| /** The unique ID of the IT Contact. */ | ||
| id: string; | ||
| /** The email address of the IT Contact. */ | ||
| email: string; | ||
| /** An ISO 8601 timestamp. */ | ||
| createdAt: Date; | ||
| /** An ISO 8601 timestamp. */ | ||
| updatedAt: Date; | ||
| } | ||
|
|
||
| export interface ItContactResponse { | ||
| object: 'it_contact'; | ||
| id: string; | ||
| email: string; | ||
| created_at: string; | ||
| updated_at: string; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface ListItContactsOptions { | ||
| /** The ID of the organization. */ | ||
| organizationId: string; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export interface RevokeItContactOptions { | ||
| /** The ID of the organization. */ | ||
| organizationId: string; | ||
| /** The ID of the IT contact. */ | ||
| contactId: string; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| import fetch from 'jest-fetch-mock'; | ||
| import { | ||
| fetchOnce, | ||
| fetchURL, | ||
| fetchMethod, | ||
| fetchBody, | ||
| } from '../common/utils/test-utils'; | ||
| import { WorkOS } from '../workos'; | ||
|
|
||
| import itContactListFixture from './fixtures/it-contact-list.json'; | ||
| import itContactFixture from './fixtures/it-contact.json'; | ||
|
|
||
| const workos = new WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU'); | ||
|
|
||
| describe('ItContacts', () => { | ||
| beforeEach(() => fetch.resetMocks()); | ||
|
|
||
| describe('listItContacts', () => { | ||
| it('returns the expected result', async () => { | ||
| fetchOnce(itContactListFixture); | ||
|
|
||
| const result = await workos.itContacts.listItContacts({ | ||
| organizationId: 'test_organizationId', | ||
| }); | ||
|
|
||
| expect(fetchMethod()).toBe('GET'); | ||
| expect(new URL(String(fetchURL())).pathname).toBe( | ||
| '/organizations/test_organizationId/it_contacts', | ||
| ); | ||
| expect(result.object).toBe('list'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('createItContact', () => { | ||
| it('sends the correct request and returns result', async () => { | ||
| fetchOnce(itContactFixture); | ||
|
|
||
| const result = await workos.itContacts.createItContact({ | ||
| organizationId: 'test_organizationId', | ||
| email: 'test@example.com', | ||
| }); | ||
|
|
||
| expect(fetchMethod()).toBe('POST'); | ||
| expect(new URL(String(fetchURL())).pathname).toBe( | ||
| '/organizations/test_organizationId/it_contacts', | ||
| ); | ||
| expect(fetchBody()).toEqual( | ||
| expect.objectContaining({ email: 'test@example.com' }), | ||
| ); | ||
| expect(result.object).toBe('it_contact'); | ||
| expect(result.id).toBe('it_contact_01HXYZ123456789ABCDEFGHIJ'); | ||
| expect(result.email).toBe('it-contact@example.com'); | ||
| expect(result.createdAt.toISOString()).toBe('2026-01-15T12:00:00.000Z'); | ||
| expect(result.updatedAt.toISOString()).toBe('2026-01-15T12:00:00.000Z'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('deleteItContact', () => { | ||
| it('sends a DELETE request', async () => { | ||
| fetchOnce({}, { status: 204 }); | ||
|
|
||
| await workos.itContacts.deleteItContact({ | ||
| organizationId: 'test_organizationId', | ||
| contactId: 'test_contactId', | ||
| }); | ||
|
|
||
| expect(fetchMethod()).toBe('DELETE'); | ||
| expect(new URL(String(fetchURL())).pathname).toBe( | ||
| '/organizations/test_organizationId/it_contacts/test_contactId', | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| describe('inviteItContact', () => { | ||
| it('sends the request', async () => { | ||
| fetchOnce({}); | ||
|
|
||
| await workos.itContacts.inviteItContact({ | ||
| organizationId: 'test_organizationId', | ||
| contactId: 'test_contactId', | ||
| intents: ['sso'], | ||
| }); | ||
|
|
||
| expect(fetchMethod()).toBe('POST'); | ||
| expect(new URL(String(fetchURL())).pathname).toBe( | ||
| '/organizations/test_organizationId/it_contacts/test_contactId/invite', | ||
| ); | ||
| expect(fetchBody()).toEqual( | ||
| expect.objectContaining({ intents: ['sso'] }), | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| describe('revokeItContact', () => { | ||
| it('sends the request', async () => { | ||
| fetchOnce({}); | ||
|
|
||
| await workos.itContacts.revokeItContact({ | ||
| organizationId: 'test_organizationId', | ||
| contactId: 'test_contactId', | ||
| }); | ||
|
|
||
| expect(fetchMethod()).toBe('POST'); | ||
| expect(new URL(String(fetchURL())).pathname).toBe( | ||
| '/organizations/test_organizationId/it_contacts/test_contactId/revoke', | ||
| ); | ||
| }); | ||
| }); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.