-
Notifications
You must be signed in to change notification settings - Fork 55
feat!: Generate organizations APIs using oagen #1628
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
Draft
gjtorikian
wants to merge
1
commit into
main
Choose a base branch
from
oagen/own-organizations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/organizations/fixtures/audit-log-configuration-log-stream.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "id": "als_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "type": "Datadog", | ||
| "state": "active", | ||
| "last_synced_at": "2026-01-15T12:00:00.000Z", | ||
| "created_at": "2026-01-15T12:00:00.000Z" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "retention_period_in_days": 30, | ||
| "state": "active", | ||
| "log_stream": { | ||
| "id": "als_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "type": "Datadog", | ||
| "state": "active", | ||
| "last_synced_at": "2026-01-15T12:00:00.000Z", | ||
| "created_at": "2026-01-15T12:00:00.000Z" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "retention_period_in_days": 30 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "data": [ | ||
| { | ||
| "object": "organization", | ||
| "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "name": "Acme Inc.", | ||
| "domains": [ | ||
| { | ||
| "object": "organization_domain", | ||
| "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", | ||
| "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", | ||
| "domain": "foo-corp.com", | ||
| "state": "pending", | ||
| "verification_prefix": "superapp-domain-verification-z3kjny", | ||
| "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", | ||
| "verification_strategy": "dns", | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "updated_at": "2026-01-15T12:00:00.000Z" | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "tier": "diamond" | ||
| }, | ||
| "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", | ||
| "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "updated_at": "2026-01-15T12:00:00.000Z", | ||
| "allow_profiles_outside_organization": false | ||
| } | ||
| ], | ||
| "list_metadata": { | ||
| "before": null, | ||
| "after": null | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "domain": "foo-corp.com", | ||
| "state": "verified" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "Foo Corp", | ||
| "allow_profiles_outside_organization": false, | ||
| "domains": ["example.com"], | ||
| "domain_data": [ | ||
| { | ||
| "domain": "foo-corp.com", | ||
| "state": "verified" | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "tier": "diamond" | ||
| }, | ||
| "external_id": "ext_12345" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "object": "organization", | ||
| "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "name": "Acme Inc.", | ||
| "domains": [ | ||
| { | ||
| "object": "organization_domain", | ||
| "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", | ||
| "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", | ||
| "domain": "foo-corp.com", | ||
| "state": "pending", | ||
| "verification_prefix": "superapp-domain-verification-z3kjny", | ||
| "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", | ||
| "verification_strategy": "dns", | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "updated_at": "2026-01-15T12:00:00.000Z" | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "tier": "diamond" | ||
| }, | ||
| "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", | ||
| "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "updated_at": "2026-01-15T12:00:00.000Z", | ||
| "allow_profiles_outside_organization": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "retention_period_in_days": 30 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,16 @@ | ||
| { | ||
| "name": "Test Organization 2", | ||
| "object": "organization", | ||
| "id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", | ||
| "name": "Foo Corp", | ||
| "allow_profiles_outside_organization": false, | ||
| "domains": [ | ||
| "domains": ["foo-corp.com"], | ||
| "domain_data": [ | ||
| { | ||
| "domain": "example.com", | ||
| "object": "organization_domain", | ||
| "id": "org_domain_01EHT88Z8WZEFWYPM6EC9BX2R8" | ||
| "domain": "foo-corp.com", | ||
| "state": "verified" | ||
| } | ||
| ] | ||
| ], | ||
| "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", | ||
| "metadata": { | ||
| "tier": "diamond" | ||
| }, | ||
| "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191" | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/organizations/interfaces/audit-log-configuration-log-stream-state.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 const AuditLogConfigurationLogStreamState = { | ||
| Active: 'active', | ||
| Inactive: 'inactive', | ||
| Error: 'error', | ||
| Invalid: 'invalid', | ||
| } as const; | ||
|
|
||
| export type AuditLogConfigurationLogStreamState = | ||
| (typeof AuditLogConfigurationLogStreamState)[keyof typeof AuditLogConfigurationLogStreamState]; |
14 changes: 14 additions & 0 deletions
14
src/organizations/interfaces/audit-log-configuration-log-stream-type.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export const AuditLogConfigurationLogStreamType = { | ||
| AzureSentinel: 'AzureSentinel', | ||
| Datadog: 'Datadog', | ||
| GenericHttps: 'GenericHttps', | ||
| GoogleCloudStorage: 'GoogleCloudStorage', | ||
| S3: 'S3', | ||
| Snowflake: 'Snowflake', | ||
| Splunk: 'Splunk', | ||
| } as const; | ||
|
|
||
| export type AuditLogConfigurationLogStreamType = | ||
| (typeof AuditLogConfigurationLogStreamType)[keyof typeof AuditLogConfigurationLogStreamType]; |
26 changes: 26 additions & 0 deletions
26
src/organizations/interfaces/audit-log-configuration-log-stream.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| import type { AuditLogConfigurationLogStreamType } from './audit-log-configuration-log-stream-type.interface'; | ||
| import type { AuditLogConfigurationLogStreamState } from './audit-log-configuration-log-stream-state.interface'; | ||
|
|
||
| /** The Audit Log Stream currently configured for the organization, if any. */ | ||
| export interface AuditLogConfigurationLogStream { | ||
| /** Unique identifier of the Audit Log Stream. */ | ||
| id: string; | ||
| /** The type of the Audit Log Stream destination. */ | ||
| type: AuditLogConfigurationLogStreamType; | ||
| /** The current state of the Audit Log Stream. */ | ||
| state: AuditLogConfigurationLogStreamState; | ||
| /** ISO-8601 timestamp of when the last event was successfully synced, or null if no events have been synced. */ | ||
| lastSyncedAt: string | null; | ||
| /** An ISO 8601 timestamp. */ | ||
| createdAt: Date; | ||
| } | ||
|
|
||
| export interface AuditLogConfigurationLogStreamResponse { | ||
| id: string; | ||
| type: AuditLogConfigurationLogStreamType; | ||
| state: AuditLogConfigurationLogStreamState; | ||
| last_synced_at: string | null; | ||
| created_at: string; | ||
| } | ||
10 changes: 10 additions & 0 deletions
10
src/organizations/interfaces/audit-log-configuration-state.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 const AuditLogConfigurationState = { | ||
| Active: 'active', | ||
| Inactive: 'inactive', | ||
| Disabled: 'disabled', | ||
| } as const; | ||
|
|
||
| export type AuditLogConfigurationState = | ||
| (typeof AuditLogConfigurationState)[keyof typeof AuditLogConfigurationState]; |
25 changes: 25 additions & 0 deletions
25
src/organizations/interfaces/audit-log-configuration.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| import type { | ||
| AuditLogConfigurationLogStream, | ||
| AuditLogConfigurationLogStreamResponse, | ||
| } from './audit-log-configuration-log-stream.interface'; | ||
| import type { AuditLogConfigurationState } from './audit-log-configuration-state.interface'; | ||
|
|
||
| export interface AuditLogConfiguration { | ||
| /** Unique identifier of the Organization. */ | ||
| organizationId: string; | ||
| /** The number of days Audit Log events will be retained before being permanently deleted. */ | ||
| retentionPeriodInDays: number; | ||
| /** The current state of the audit log configuration for the organization. */ | ||
| state: AuditLogConfigurationState; | ||
| /** The Audit Log Stream currently configured for the organization, if any. */ | ||
| logStream?: AuditLogConfigurationLogStream; | ||
| } | ||
|
|
||
| export interface AuditLogConfigurationResponse { | ||
| organization_id: string; | ||
| retention_period_in_days: number; | ||
| state: AuditLogConfigurationState; | ||
| log_stream?: AuditLogConfigurationLogStreamResponse; | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/organizations/interfaces/audit-logs-retention.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 AuditLogsRetention { | ||
| /** The number of days Audit Log events will be retained before being permanently deleted. Valid values are 30 and 365. */ | ||
| retentionPeriodInDays: number | null; | ||
| } | ||
|
|
||
| export interface AuditLogsRetentionResponse { | ||
| retention_period_in_days: number | null; | ||
| } |
30 changes: 14 additions & 16 deletions
30
src/organizations/interfaces/create-organization-options.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,19 @@ | ||
| import { PostOptions } from '../../common/interfaces'; | ||
| import { DomainData } from './domain-data.interface'; | ||
| import { OrganizationDomainData } from './organization-domain-data.interface'; | ||
|
|
||
| // CreateOrganizationOptions mirrors the generated OrganizationInput request body | ||
| // so it can be passed straight to serializeOrganizationInput. Kept hand-owned | ||
| // because oagen only generates path-param option interfaces. | ||
| export interface CreateOrganizationOptions { | ||
| /** The name of the organization. */ | ||
| name: string; | ||
| domainData?: DomainData[]; | ||
| /** Whether the organization allows profiles from outside the organization to sign in. */ | ||
| allowProfilesOutsideOrganization?: boolean; | ||
| /** The domains associated with the organization. Deprecated in favor of `domain_data`. */ | ||
| domains?: string[]; | ||
| /** The domains associated with the organization, including verification state. */ | ||
| domainData?: OrganizationDomainData[]; | ||
| /** Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization. */ | ||
| metadata?: Record<string, string> | null; | ||
| /** An external identifier for the Organization. */ | ||
| externalId?: string | null; | ||
| metadata?: Record<string, string>; | ||
| } | ||
|
|
||
| export interface SerializedCreateOrganizationOptions { | ||
| name: string; | ||
| domain_data?: DomainData[]; | ||
| external_id?: string | null; | ||
| metadata?: Record<string, string>; | ||
| } | ||
|
|
||
| export type CreateOrganizationRequestOptions = Pick< | ||
| PostOptions, | ||
| 'idempotencyKey' | ||
| >; |
6 changes: 6 additions & 0 deletions
6
src/organizations/interfaces/delete-organization-options.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 DeleteOrganizationOptions { | ||
| /** Unique identifier of the Organization. */ | ||
| id: string; | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/organizations/interfaces/get-audit-log-configuration-options.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 GetAuditLogConfigurationOptions { | ||
| /** Unique identifier of the Organization. */ | ||
| id: string; | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/organizations/interfaces/get-organization-by-external-id-options.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 GetOrganizationByExternalIdOptions { | ||
| /** The external ID of the Organization. */ | ||
| externalId: string; | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/organizations/interfaces/get-organization-options.interface.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 GetOrganizationOptions { | ||
| /** Unique identifier of the Organization. */ | ||
| id: string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,23 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| export * from './audit-log-configuration-log-stream-state.interface'; | ||
| export * from './audit-log-configuration-log-stream-type.interface'; | ||
| export * from './audit-log-configuration-log-stream.interface'; | ||
| export * from './audit-log-configuration-state.interface'; | ||
| export * from './audit-log-configuration.interface'; | ||
| export * from './audit-logs-retention.interface'; | ||
| export * from './create-organization-options.interface'; | ||
| export * from './delete-organization-options.interface'; | ||
| export * from './domain-data.interface'; | ||
| export * from './get-audit-log-configuration-options.interface'; | ||
| export * from './get-organization-by-external-id-options.interface'; | ||
| export * from './get-organization-options.interface'; | ||
| export * from './list-organization-feature-flags-options.interface'; | ||
| export * from './list-organizations-options.interface'; | ||
| export * from './organization-domain-data-state.interface'; | ||
| export * from './organization-domain-data.interface'; | ||
| export * from './organization-input.interface'; | ||
| export * from './organization.interface'; | ||
| export * from './update-audit-logs-retention.interface'; | ||
| export * from './update-organization-options.interface'; | ||
| export * from './update-organization.interface'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lastSyncedAtstays a raw string whilecreatedAtis aDatecreatedAt: Dateis deserialized vianew Date(response.created_at)in the log-stream serializer, butlastSyncedAt: string | nullis passed through as-is. Both fields hold ISO 8601 timestamps; keeping one as a raw string while the other is aDateis inconsistent and surprising for consumers. Consider convertinglastSyncedAttoDate | nullfor consistency.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!