diff options
| author | Dax <[email protected]> | 2025-09-15 03:12:07 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-15 03:12:07 -0400 |
| commit | c1b4e1f19dd45eeea791354cb041c520f55e1cdb (patch) | |
| tree | cc238910a99092592bc4baf926d5c5509128f29f /packages/sdk/go/event.go | |
| parent | 89d820b1c44028e673f2b4317a2104abb2be2e67 (diff) | |
| download | opencode-c1b4e1f19dd45eeea791354cb041c520f55e1cdb.tar.gz opencode-c1b4e1f19dd45eeea791354cb041c520f55e1cdb.zip | |
Upgrade to Zod v4 (#2605)
Co-authored-by: GitHub Action <[email protected]>
Diffstat (limited to 'packages/sdk/go/event.go')
| -rw-r--r-- | packages/sdk/go/event.go | 367 |
1 files changed, 174 insertions, 193 deletions
diff --git a/packages/sdk/go/event.go b/packages/sdk/go/event.go index 00ba202cc..5d3bffcc2 100644 --- a/packages/sdk/go/event.go +++ b/packages/sdk/go/event.go @@ -57,14 +57,14 @@ type EventListResponse struct { // [EventListResponseEventMessageUpdatedProperties], // [EventListResponseEventMessageRemovedProperties], // [EventListResponseEventMessagePartUpdatedProperties], - // [EventListResponseEventMessagePartRemovedProperties], [Permission], + // [EventListResponseEventMessagePartRemovedProperties], + // [EventListResponseEventSessionCompactedProperties], [Permission], // [EventListResponseEventPermissionRepliedProperties], // [EventListResponseEventFileEditedProperties], + // [EventListResponseEventSessionIdleProperties], // [EventListResponseEventSessionUpdatedProperties], // [EventListResponseEventSessionDeletedProperties], - // [EventListResponseEventSessionIdleProperties], - // [EventListResponseEventSessionErrorProperties], - // [EventListResponseEventSessionCompactedProperties], [interface{}]. + // [EventListResponseEventSessionErrorProperties], [interface{}]. Properties interface{} `json:"properties,required"` Type EventListResponseType `json:"type,required"` JSON eventListResponseJSON `json:"-"` @@ -102,11 +102,11 @@ func (r *EventListResponse) UnmarshalJSON(data []byte) (err error) { // [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved], // [EventListResponseEventMessagePartUpdated], // [EventListResponseEventMessagePartRemoved], +// [EventListResponseEventSessionCompacted], // [EventListResponseEventPermissionUpdated], // [EventListResponseEventPermissionReplied], [EventListResponseEventFileEdited], -// [EventListResponseEventSessionUpdated], [EventListResponseEventSessionDeleted], -// [EventListResponseEventSessionIdle], [EventListResponseEventSessionError], -// [EventListResponseEventSessionCompacted], +// [EventListResponseEventSessionIdle], [EventListResponseEventSessionUpdated], +// [EventListResponseEventSessionDeleted], [EventListResponseEventSessionError], // [EventListResponseEventServerConnected]. func (r EventListResponse) AsUnion() EventListResponseUnion { return r.union @@ -117,11 +117,11 @@ func (r EventListResponse) AsUnion() EventListResponseUnion { // [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved], // [EventListResponseEventMessagePartUpdated], // [EventListResponseEventMessagePartRemoved], +// [EventListResponseEventSessionCompacted], // [EventListResponseEventPermissionUpdated], // [EventListResponseEventPermissionReplied], [EventListResponseEventFileEdited], -// [EventListResponseEventSessionUpdated], [EventListResponseEventSessionDeleted], -// [EventListResponseEventSessionIdle], [EventListResponseEventSessionError], -// [EventListResponseEventSessionCompacted] or +// [EventListResponseEventSessionIdle], [EventListResponseEventSessionUpdated], +// [EventListResponseEventSessionDeleted], [EventListResponseEventSessionError] or // [EventListResponseEventServerConnected]. type EventListResponseUnion interface { implementsEventListResponse() @@ -130,81 +130,66 @@ type EventListResponseUnion interface { func init() { apijson.RegisterUnion( reflect.TypeOf((*EventListResponseUnion)(nil)).Elem(), - "type", + "", apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventInstallationUpdated{}), - DiscriminatorValue: "installation.updated", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventInstallationUpdated{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventLspClientDiagnostics{}), - DiscriminatorValue: "lsp.client.diagnostics", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventLspClientDiagnostics{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventMessageUpdated{}), - DiscriminatorValue: "message.updated", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventMessageUpdated{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventMessageRemoved{}), - DiscriminatorValue: "message.removed", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventMessageRemoved{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventMessagePartUpdated{}), - DiscriminatorValue: "message.part.updated", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventMessagePartUpdated{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventMessagePartRemoved{}), - DiscriminatorValue: "message.part.removed", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventMessagePartRemoved{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventPermissionUpdated{}), - DiscriminatorValue: "permission.updated", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventSessionCompacted{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventPermissionReplied{}), - DiscriminatorValue: "permission.replied", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventPermissionUpdated{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventFileEdited{}), - DiscriminatorValue: "file.edited", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventPermissionReplied{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventSessionUpdated{}), - DiscriminatorValue: "session.updated", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventFileEdited{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventSessionDeleted{}), - DiscriminatorValue: "session.deleted", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventSessionIdle{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventSessionIdle{}), - DiscriminatorValue: "session.idle", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventSessionUpdated{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventSessionError{}), - DiscriminatorValue: "session.error", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventSessionDeleted{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventSessionCompacted{}), - DiscriminatorValue: "session.compacted", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventSessionError{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventServerConnected{}), - DiscriminatorValue: "server.connected", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventServerConnected{}), }, ) } @@ -577,6 +562,66 @@ func (r EventListResponseEventMessagePartRemovedType) IsKnown() bool { return false } +type EventListResponseEventSessionCompacted struct { + Properties EventListResponseEventSessionCompactedProperties `json:"properties,required"` + Type EventListResponseEventSessionCompactedType `json:"type,required"` + JSON eventListResponseEventSessionCompactedJSON `json:"-"` +} + +// eventListResponseEventSessionCompactedJSON contains the JSON metadata for the +// struct [EventListResponseEventSessionCompacted] +type eventListResponseEventSessionCompactedJSON struct { + Properties apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventListResponseEventSessionCompacted) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r eventListResponseEventSessionCompactedJSON) RawJSON() string { + return r.raw +} + +func (r EventListResponseEventSessionCompacted) implementsEventListResponse() {} + +type EventListResponseEventSessionCompactedProperties struct { + SessionID string `json:"sessionID,required"` + JSON eventListResponseEventSessionCompactedPropertiesJSON `json:"-"` +} + +// eventListResponseEventSessionCompactedPropertiesJSON contains the JSON metadata +// for the struct [EventListResponseEventSessionCompactedProperties] +type eventListResponseEventSessionCompactedPropertiesJSON struct { + SessionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventListResponseEventSessionCompactedProperties) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r eventListResponseEventSessionCompactedPropertiesJSON) RawJSON() string { + return r.raw +} + +type EventListResponseEventSessionCompactedType string + +const ( + EventListResponseEventSessionCompactedTypeSessionCompacted EventListResponseEventSessionCompactedType = "session.compacted" +) + +func (r EventListResponseEventSessionCompactedType) IsKnown() bool { + switch r { + case EventListResponseEventSessionCompactedTypeSessionCompacted: + return true + } + return false +} + type EventListResponseEventPermissionUpdated struct { Properties Permission `json:"properties,required"` Type EventListResponseEventPermissionUpdatedType `json:"type,required"` @@ -740,6 +785,66 @@ func (r EventListResponseEventFileEditedType) IsKnown() bool { return false } +type EventListResponseEventSessionIdle struct { + Properties EventListResponseEventSessionIdleProperties `json:"properties,required"` + Type EventListResponseEventSessionIdleType `json:"type,required"` + JSON eventListResponseEventSessionIdleJSON `json:"-"` +} + +// eventListResponseEventSessionIdleJSON contains the JSON metadata for the struct +// [EventListResponseEventSessionIdle] +type eventListResponseEventSessionIdleJSON struct { + Properties apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventListResponseEventSessionIdle) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r eventListResponseEventSessionIdleJSON) RawJSON() string { + return r.raw +} + +func (r EventListResponseEventSessionIdle) implementsEventListResponse() {} + +type EventListResponseEventSessionIdleProperties struct { + SessionID string `json:"sessionID,required"` + JSON eventListResponseEventSessionIdlePropertiesJSON `json:"-"` +} + +// eventListResponseEventSessionIdlePropertiesJSON contains the JSON metadata for +// the struct [EventListResponseEventSessionIdleProperties] +type eventListResponseEventSessionIdlePropertiesJSON struct { + SessionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventListResponseEventSessionIdleProperties) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r eventListResponseEventSessionIdlePropertiesJSON) RawJSON() string { + return r.raw +} + +type EventListResponseEventSessionIdleType string + +const ( + EventListResponseEventSessionIdleTypeSessionIdle EventListResponseEventSessionIdleType = "session.idle" +) + +func (r EventListResponseEventSessionIdleType) IsKnown() bool { + switch r { + case EventListResponseEventSessionIdleTypeSessionIdle: + return true + } + return false +} + type EventListResponseEventSessionUpdated struct { Properties EventListResponseEventSessionUpdatedProperties `json:"properties,required"` Type EventListResponseEventSessionUpdatedType `json:"type,required"` @@ -860,66 +965,6 @@ func (r EventListResponseEventSessionDeletedType) IsKnown() bool { return false } -type EventListResponseEventSessionIdle struct { - Properties EventListResponseEventSessionIdleProperties `json:"properties,required"` - Type EventListResponseEventSessionIdleType `json:"type,required"` - JSON eventListResponseEventSessionIdleJSON `json:"-"` -} - -// eventListResponseEventSessionIdleJSON contains the JSON metadata for the struct -// [EventListResponseEventSessionIdle] -type eventListResponseEventSessionIdleJSON struct { - Properties apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EventListResponseEventSessionIdle) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r eventListResponseEventSessionIdleJSON) RawJSON() string { - return r.raw -} - -func (r EventListResponseEventSessionIdle) implementsEventListResponse() {} - -type EventListResponseEventSessionIdleProperties struct { - SessionID string `json:"sessionID,required"` - JSON eventListResponseEventSessionIdlePropertiesJSON `json:"-"` -} - -// eventListResponseEventSessionIdlePropertiesJSON contains the JSON metadata for -// the struct [EventListResponseEventSessionIdleProperties] -type eventListResponseEventSessionIdlePropertiesJSON struct { - SessionID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EventListResponseEventSessionIdleProperties) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r eventListResponseEventSessionIdlePropertiesJSON) RawJSON() string { - return r.raw -} - -type EventListResponseEventSessionIdleType string - -const ( - EventListResponseEventSessionIdleTypeSessionIdle EventListResponseEventSessionIdleType = "session.idle" -) - -func (r EventListResponseEventSessionIdleType) IsKnown() bool { - switch r { - case EventListResponseEventSessionIdleTypeSessionIdle: - return true - } - return false -} - type EventListResponseEventSessionError struct { Properties EventListResponseEventSessionErrorProperties `json:"properties,required"` Type EventListResponseEventSessionErrorType `json:"type,required"` @@ -970,7 +1015,7 @@ func (r eventListResponseEventSessionErrorPropertiesJSON) RawJSON() string { type EventListResponseEventSessionErrorPropertiesError struct { // This field can have the runtime type of [shared.ProviderAuthErrorData], - // [shared.UnknownErrorData], [interface{}]. + // [shared.UnknownErrorData], [interface{}], [shared.MessageAbortedErrorData]. Data interface{} `json:"data,required"` Name EventListResponseEventSessionErrorPropertiesErrorName `json:"name,required"` JSON eventListResponseEventSessionErrorPropertiesErrorJSON `json:"-"` @@ -1020,26 +1065,22 @@ type EventListResponseEventSessionErrorPropertiesErrorUnion interface { func init() { apijson.RegisterUnion( reflect.TypeOf((*EventListResponseEventSessionErrorPropertiesErrorUnion)(nil)).Elem(), - "name", + "", apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.ProviderAuthError{}), - DiscriminatorValue: "ProviderAuthError", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.ProviderAuthError{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.UnknownError{}), - DiscriminatorValue: "UnknownError", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.UnknownError{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError{}), - DiscriminatorValue: "MessageOutputLengthError", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError{}), }, apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.MessageAbortedError{}), - DiscriminatorValue: "MessageAbortedError", + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.MessageAbortedError{}), }, ) } @@ -1116,66 +1157,6 @@ func (r EventListResponseEventSessionErrorType) IsKnown() bool { return false } -type EventListResponseEventSessionCompacted struct { - Properties EventListResponseEventSessionCompactedProperties `json:"properties,required"` - Type EventListResponseEventSessionCompactedType `json:"type,required"` - JSON eventListResponseEventSessionCompactedJSON `json:"-"` -} - -// eventListResponseEventSessionCompactedJSON contains the JSON metadata for the -// struct [EventListResponseEventSessionCompacted] -type eventListResponseEventSessionCompactedJSON struct { - Properties apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EventListResponseEventSessionCompacted) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r eventListResponseEventSessionCompactedJSON) RawJSON() string { - return r.raw -} - -func (r EventListResponseEventSessionCompacted) implementsEventListResponse() {} - -type EventListResponseEventSessionCompactedProperties struct { - SessionID string `json:"sessionID,required"` - JSON eventListResponseEventSessionCompactedPropertiesJSON `json:"-"` -} - -// eventListResponseEventSessionCompactedPropertiesJSON contains the JSON metadata -// for the struct [EventListResponseEventSessionCompactedProperties] -type eventListResponseEventSessionCompactedPropertiesJSON struct { - SessionID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EventListResponseEventSessionCompactedProperties) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r eventListResponseEventSessionCompactedPropertiesJSON) RawJSON() string { - return r.raw -} - -type EventListResponseEventSessionCompactedType string - -const ( - EventListResponseEventSessionCompactedTypeSessionCompacted EventListResponseEventSessionCompactedType = "session.compacted" -) - -func (r EventListResponseEventSessionCompactedType) IsKnown() bool { - switch r { - case EventListResponseEventSessionCompactedTypeSessionCompacted: - return true - } - return false -} - type EventListResponseEventServerConnected struct { Properties interface{} `json:"properties,required"` Type EventListResponseEventServerConnectedType `json:"type,required"` @@ -1224,20 +1205,20 @@ const ( EventListResponseTypeMessageRemoved EventListResponseType = "message.removed" EventListResponseTypeMessagePartUpdated EventListResponseType = "message.part.updated" EventListResponseTypeMessagePartRemoved EventListResponseType = "message.part.removed" + EventListResponseTypeSessionCompacted EventListResponseType = "session.compacted" EventListResponseTypePermissionUpdated EventListResponseType = "permission.updated" EventListResponseTypePermissionReplied EventListResponseType = "permission.replied" EventListResponseTypeFileEdited EventListResponseType = "file.edited" + EventListResponseTypeSessionIdle EventListResponseType = "session.idle" EventListResponseTypeSessionUpdated EventListResponseType = "session.updated" EventListResponseTypeSessionDeleted EventListResponseType = "session.deleted" - EventListResponseTypeSessionIdle EventListResponseType = "session.idle" EventListResponseTypeSessionError EventListResponseType = "session.error" - EventListResponseTypeSessionCompacted EventListResponseType = "session.compacted" EventListResponseTypeServerConnected EventListResponseType = "server.connected" ) func (r EventListResponseType) IsKnown() bool { switch r { - case EventListResponseTypeInstallationUpdated, EventListResponseTypeLspClientDiagnostics, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeMessagePartRemoved, EventListResponseTypePermissionUpdated, EventListResponseTypePermissionReplied, EventListResponseTypeFileEdited, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionIdle, EventListResponseTypeSessionError, EventListResponseTypeSessionCompacted, EventListResponseTypeServerConnected: + case EventListResponseTypeInstallationUpdated, EventListResponseTypeLspClientDiagnostics, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeMessagePartRemoved, EventListResponseTypeSessionCompacted, EventListResponseTypePermissionUpdated, EventListResponseTypePermissionReplied, EventListResponseTypeFileEdited, EventListResponseTypeSessionIdle, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionError, EventListResponseTypeServerConnected: return true } return false |
