-
Notifications
You must be signed in to change notification settings - Fork 11
feat(generated): Add new event types, fields, and membership with user support #247
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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| 92db0495807c86fbbc4d45bd266a6c1f5bcbb59c | ||
| f908f520f9fcd63dfd42ed35b7f141a65b61609b |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| namespace WorkOS | ||
| { | ||
| using System; | ||
|
|
||
| /// <summary>Represents a dsync token created.</summary> | ||
| public class DsyncTokenCreated : EventSchema | ||
| { | ||
|
|
||
| /// <summary>The event payload.</summary> | ||
| public new DsyncTokenCreatedData Data { get; set; } = default!; | ||
| public new EventContext? Context { get; set; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| namespace WorkOS | ||
| { | ||
| using System; | ||
|
|
||
| /// <summary>The event payload.</summary> | ||
| public class DsyncTokenCreatedData | ||
| { | ||
|
|
||
| /// <summary>Distinguishes the directory token object.</summary> | ||
| public string Object { get; internal set; } = "directory_token"; | ||
|
|
||
| /// <summary>Unique identifier of the directory token.</summary> | ||
| public string Id { get; set; } = default!; | ||
|
|
||
| /// <summary>The ID of the directory the token authenticates to.</summary> | ||
| public string DirectoryId { get; set; } = default!; | ||
|
|
||
| /// <summary>The ID of the organization the directory belongs to.</summary> | ||
| public string? OrganizationId { get; set; } | ||
|
|
||
| /// <summary>The trailing characters of the bearer token, for identification only. The full token value is never included in events.</summary> | ||
| public string TokenSuffix { get; set; } = default!; | ||
|
|
||
| /// <summary>An ISO 8601 timestamp.</summary> | ||
| public DateTimeOffset CreatedAt { get; set; } | ||
|
|
||
| /// <summary>The timestamp at which the token expires, or null for tokens without a scheduled expiration. Used during rotation to indicate the grace window for the outgoing token.</summary> | ||
| public DateTimeOffset? ExpiresAt { get; set; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| namespace WorkOS | ||
| { | ||
| using System; | ||
|
|
||
| /// <summary>Represents a dsync token deleted.</summary> | ||
| public class DsyncTokenDeleted : EventSchema | ||
| { | ||
|
|
||
| /// <summary>The event payload.</summary> | ||
| public new DsyncTokenCreatedData Data { get; set; } = default!; | ||
| public new EventContext? Context { get; set; } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,9 @@ public class OrganizationMembership | |
| /// <summary>The primary role assigned to the user within the organization.</summary> | ||
| public AddRolePermission Role { get; set; } = default!; | ||
|
|
||
| /// <summary>The user that belongs to the organization through this membership.</summary> | ||
| public User User { get; set; } = default!; | ||
|
Comment on lines
+49
to
+50
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.
If the API only conditionally includes |
||
|
|
||
| /// <summary> | ||
| /// Typed accessor for <see cref="CustomAttributes"/>. Returns the value stored under | ||
| /// <paramref name="key"/> coerced to <typeparamref name="T"/>, or the default | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| // This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| namespace WorkOS | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using Newtonsoft.Json; | ||
| using STJS = System.Text.Json.Serialization; | ||
|
|
||
| /// <summary>Represents an user organization membership base with user.</summary> | ||
| public class UserOrganizationMembershipBaseWithUser | ||
| { | ||
|
|
||
| /// <summary>Distinguishes the organization membership object.</summary> | ||
| public string Object { get; internal set; } = "organization_membership"; | ||
|
|
||
| /// <summary>The unique ID of the organization membership.</summary> | ||
| public string Id { get; set; } = default!; | ||
|
|
||
| /// <summary>The ID of the user.</summary> | ||
| public string UserId { get; set; } = default!; | ||
|
|
||
| /// <summary>The ID of the organization which the user belongs to.</summary> | ||
| public string OrganizationId { get; set; } = default!; | ||
|
|
||
| /// <summary>The status of the organization membership. One of `active`, `inactive`, or `pending`.</summary> | ||
| [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
| [STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingDefault)] | ||
| public OrganizationMembershipCreatedDataStatus Status { get; set; } | ||
|
|
||
| /// <summary>Whether this organization membership is managed by a directory sync connection.</summary> | ||
| public bool DirectoryManaged { get; set; } | ||
|
|
||
| /// <summary>The name of the organization which the user belongs to.</summary> | ||
| public string? OrganizationName { get; set; } | ||
|
|
||
| /// <summary>An object containing IdP-sourced attributes from the linked [Directory User](https://workos.com/docs/reference/directory-sync/directory-user) or [SSO Profile](https://workos.com/docs/reference/sso/profile). Directory User attributes take precedence when both are linked.</summary> | ||
| public Dictionary<string, object>? CustomAttributes { get; set; } | ||
|
|
||
| /// <summary>An ISO 8601 timestamp.</summary> | ||
| public DateTimeOffset CreatedAt { get; set; } | ||
|
|
||
| /// <summary>An ISO 8601 timestamp.</summary> | ||
| public DateTimeOffset UpdatedAt { get; set; } | ||
|
|
||
| /// <summary>The user that belongs to the organization through this membership.</summary> | ||
| public User User { get; set; } = default!; | ||
|
|
||
| /// <summary> | ||
| /// Typed accessor for <see cref="CustomAttributes"/>. Returns the value stored under | ||
| /// <paramref name="key"/> coerced to <typeparamref name="T"/>, or the default | ||
| /// value when the key is missing or the value is not convertible. | ||
| /// </summary> | ||
| /// <typeparam name="T">Expected value type.</typeparam> | ||
| /// <param name="key">The key to look up.</param> | ||
| public T? GetCustomAttributesAttribute<T>(string key) | ||
| { | ||
| if (this.CustomAttributes == null) | ||
| { | ||
| return default; | ||
| } | ||
|
|
||
| if (!this.CustomAttributes.TryGetValue(key, out var value)) | ||
| { | ||
| return default; | ||
| } | ||
|
|
||
| if (value is T typed) | ||
| { | ||
| return typed; | ||
| } | ||
|
|
||
| if (value is Newtonsoft.Json.Linq.JToken token) | ||
| { | ||
| return token.ToObject<T>(); | ||
| } | ||
|
|
||
| if (value is System.Text.Json.JsonElement element) | ||
| { | ||
| return System.Text.Json.JsonSerializer.Deserialize<T>(element.GetRawText()); | ||
| } | ||
|
|
||
| return default; | ||
| } | ||
| } | ||
| } |
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.
DsyncTokenDeleted.Datatyped asDsyncTokenCreatedDataDsyncTokenDeletedreusesDsyncTokenCreatedDatafor itsDataproperty. While both events share the same directory-token payload shape today, naming the delete event's data type after the create event is misleading — callers inspectingevent.Data.GetType()or reading the property signature will seeDsyncTokenCreatedData, which could cause confusion or misdirection when the schemas diverge in the future.A dedicated
DsyncTokenDeletedDataclass (or at minimum a sharedDirectoryTokenDatabase) would make the intent clearer, consistent with how the rest of the SDK models paired event types (e.g., separateDatatypes per event class).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!