diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 51acdaa..8ea07c9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.37.0" + ".": "0.38.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b154e7a..3e385c4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-fc4a441d80d9a26574ef8af390a0c76265f5d4190daf90a04b6b353b128bbd97.yml -openapi_spec_hash: 192987649d3797c3a80e6ef201667b64 -config_hash: 8af430e19f4af86c05f2987241cae72f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-9462b3d8f055f8bda06da65583f5aa09a17d35254c5983796d8e84ebb3c62c47.yml +openapi_spec_hash: 1914dd35b8e0e5a21ccec91eac2a616d +config_hash: c6b88eea9a15840f26130eb8ed3b42a0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 64dfea7..7866e9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.38.0 (2026-02-25) + +Full Changelog: [v0.37.0...v0.38.0](https://github.com/kernel/kernel-go-sdk/compare/v0.37.0...v0.38.0) + +### Features + +* Neil/kernel 1029 past session search ([04750c0](https://github.com/kernel/kernel-go-sdk/commit/04750c05fd4b0491f34d65cf8e003a7ee38537b5)) + + +### Chores + +* **internal:** move custom custom `json` tags to `api` ([a35c88c](https://github.com/kernel/kernel-go-sdk/commit/a35c88ce383ecf7a2a98b303837948cd3edd3d39)) + ## 0.37.0 (2026-02-23) Full Changelog: [v0.36.1...v0.37.0](https://github.com/kernel/kernel-go-sdk/compare/v0.36.1...v0.37.0) diff --git a/README.md b/README.md index d56eecf..c1ec58b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Or to pin the version: ```sh -go get -u 'github.com/kernel/kernel-go-sdk@v0.37.0' +go get -u 'github.com/kernel/kernel-go-sdk@v0.38.0' ``` diff --git a/app.go b/app.go index 67239bb..47abc6f 100644 --- a/app.go +++ b/app.go @@ -64,19 +64,19 @@ func (r *AppService) ListAutoPaging(ctx context.Context, query AppListParams, op // Summary of an application version. type AppListResponse struct { // Unique identifier for the app version - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // List of actions available on the app - Actions []shared.AppAction `json:"actions,required"` + Actions []shared.AppAction `json:"actions" api:"required"` // Name of the application - AppName string `json:"app_name,required"` + AppName string `json:"app_name" api:"required"` // Deployment ID - Deployment string `json:"deployment,required"` + Deployment string `json:"deployment" api:"required"` // Environment variables configured for this app version - EnvVars map[string]string `json:"env_vars,required"` + EnvVars map[string]string `json:"env_vars" api:"required"` // Deployment region code - Region constant.AwsUsEast1a `json:"region,required"` + Region constant.AwsUsEast1a `json:"region" api:"required"` // Version label for the application - Version string `json:"version,required"` + Version string `json:"version" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field diff --git a/authconnection.go b/authconnection.go index 55816a6..041c7e1 100644 --- a/authconnection.go +++ b/authconnection.go @@ -155,15 +155,15 @@ func (r *AuthConnectionService) Submit(ctx context.Context, id string, body Auth // Response from starting a login flow type LoginResponse struct { // Auth connection ID - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // When the login flow expires - FlowExpiresAt time.Time `json:"flow_expires_at,required" format:"date-time"` + FlowExpiresAt time.Time `json:"flow_expires_at" api:"required" format:"date-time"` // Type of login flow started // // Any of "LOGIN", "REAUTH". - FlowType LoginResponseFlowType `json:"flow_type,required"` + FlowType LoginResponseFlowType `json:"flow_type" api:"required"` // URL to redirect user to for login - HostedURL string `json:"hosted_url,required" format:"uri"` + HostedURL string `json:"hosted_url" api:"required" format:"uri"` // One-time code for handoff (internal use) HandoffCode string `json:"handoff_code"` // Browser live view URL for watching the login flow @@ -200,18 +200,18 @@ const ( // recent login flow and are null when no flow has been initiated. type ManagedAuth struct { // Unique identifier for the auth connection - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Target domain for authentication - Domain string `json:"domain,required"` + Domain string `json:"domain" api:"required"` // Name of the profile associated with this auth connection - ProfileName string `json:"profile_name,required"` + ProfileName string `json:"profile_name" api:"required"` // Whether credentials are saved after every successful login. One-time codes // (TOTP, SMS, etc.) are not saved. - SaveCredentials bool `json:"save_credentials,required"` + SaveCredentials bool `json:"save_credentials" api:"required"` // Current authentication status of the managed profile // // Any of "AUTHENTICATED", "NEEDS_AUTH". - Status ManagedAuthStatus `json:"status,required"` + Status ManagedAuthStatus `json:"status" api:"required"` // Additional domains that are valid for this auth flow (besides the primary // domain). Useful when login pages redirect to different domains. // @@ -242,55 +242,55 @@ type ManagedAuth struct { // - { provider, auto: true } for external provider domain lookup Credential ManagedAuthCredential `json:"credential"` // Fields awaiting input (present when flow_step=awaiting_input) - DiscoveredFields []ManagedAuthDiscoveredField `json:"discovered_fields,nullable"` + DiscoveredFields []ManagedAuthDiscoveredField `json:"discovered_fields" api:"nullable"` // Machine-readable error code (present when flow_status=failed) - ErrorCode string `json:"error_code,nullable"` + ErrorCode string `json:"error_code" api:"nullable"` // Error message (present when flow_status=failed) - ErrorMessage string `json:"error_message,nullable"` + ErrorMessage string `json:"error_message" api:"nullable"` // Instructions for external action (present when // flow_step=awaiting_external_action) - ExternalActionMessage string `json:"external_action_message,nullable"` + ExternalActionMessage string `json:"external_action_message" api:"nullable"` // When the current flow expires (null when no flow in progress) - FlowExpiresAt time.Time `json:"flow_expires_at,nullable" format:"date-time"` + FlowExpiresAt time.Time `json:"flow_expires_at" api:"nullable" format:"date-time"` // Current flow status (null when no flow in progress) // // Any of "IN_PROGRESS", "SUCCESS", "FAILED", "EXPIRED", "CANCELED". - FlowStatus ManagedAuthFlowStatus `json:"flow_status,nullable"` + FlowStatus ManagedAuthFlowStatus `json:"flow_status" api:"nullable"` // Current step in the flow (null when no flow in progress) // // Any of "DISCOVERING", "AWAITING_INPUT", "AWAITING_EXTERNAL_ACTION", // "SUBMITTING", "COMPLETED". - FlowStep ManagedAuthFlowStep `json:"flow_step,nullable"` + FlowStep ManagedAuthFlowStep `json:"flow_step" api:"nullable"` // Type of the current flow (null when no flow in progress) // // Any of "LOGIN", "REAUTH". - FlowType ManagedAuthFlowType `json:"flow_type,nullable"` + FlowType ManagedAuthFlowType `json:"flow_type" api:"nullable"` // Interval in seconds between automatic health checks. When set, the system // periodically verifies the authentication status and triggers re-authentication // if needed. Maximum is 86400 (24 hours). Default is 3600 (1 hour). The minimum // depends on your plan: Enterprise: 300 (5 minutes), Startup: 1200 (20 minutes), // Hobbyist: 3600 (1 hour). - HealthCheckInterval int64 `json:"health_check_interval,nullable"` + HealthCheckInterval int64 `json:"health_check_interval" api:"nullable"` // URL to redirect user to for hosted login (present when flow in progress) - HostedURL string `json:"hosted_url,nullable" format:"uri"` + HostedURL string `json:"hosted_url" api:"nullable" format:"uri"` // When the profile was last successfully authenticated LastAuthAt time.Time `json:"last_auth_at" format:"date-time"` // Browser live view URL for debugging (present when flow in progress) - LiveViewURL string `json:"live_view_url,nullable" format:"uri"` + LiveViewURL string `json:"live_view_url" api:"nullable" format:"uri"` // MFA method options (present when flow_step=awaiting_input and MFA selection // required) - MfaOptions []ManagedAuthMfaOption `json:"mfa_options,nullable"` + MfaOptions []ManagedAuthMfaOption `json:"mfa_options" api:"nullable"` // SSO buttons available (present when flow_step=awaiting_input) - PendingSSOButtons []ManagedAuthPendingSSOButton `json:"pending_sso_buttons,nullable"` + PendingSSOButtons []ManagedAuthPendingSSOButton `json:"pending_sso_buttons" api:"nullable"` // URL where the browser landed after successful login PostLoginURL string `json:"post_login_url" format:"uri"` // ID of the proxy associated with this connection, if any. ProxyID string `json:"proxy_id"` // SSO provider being used (e.g., google, github, microsoft) - SSOProvider string `json:"sso_provider,nullable"` + SSOProvider string `json:"sso_provider" api:"nullable"` // Visible error message from the website (e.g., 'Incorrect password'). Present // when the website displays an error during login. - WebsiteError string `json:"website_error,nullable"` + WebsiteError string `json:"website_error" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -373,20 +373,20 @@ func (r *ManagedAuthCredential) UnmarshalJSON(data []byte) error { // A discovered form field type ManagedAuthDiscoveredField struct { // Field label - Label string `json:"label,required"` + Label string `json:"label" api:"required"` // Field name - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // CSS selector for the field - Selector string `json:"selector,required"` + Selector string `json:"selector" api:"required"` // Field type // // Any of "text", "email", "password", "tel", "number", "url", "code", "totp". - Type string `json:"type,required"` + Type string `json:"type" api:"required"` // If this field is associated with an MFA option, the type of that option (e.g., // password field linked to "Enter password" option) // // Any of "sms", "call", "email", "totp", "push", "password". - LinkedMfaType string `json:"linked_mfa_type,nullable"` + LinkedMfaType string `json:"linked_mfa_type" api:"nullable"` // Field placeholder Placeholder string `json:"placeholder"` // Whether field is required @@ -444,15 +444,15 @@ const ( // An MFA method option for verification type ManagedAuthMfaOption struct { // The visible option text - Label string `json:"label,required"` + Label string `json:"label" api:"required"` // The MFA delivery method type (includes password for auth method selection pages) // // Any of "sms", "call", "email", "totp", "push", "password". - Type string `json:"type,required"` + Type string `json:"type" api:"required"` // Additional instructions from the site - Description string `json:"description,nullable"` + Description string `json:"description" api:"nullable"` // The masked destination (phone/email) if shown - Target string `json:"target,nullable"` + Target string `json:"target" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Label respjson.Field @@ -473,11 +473,11 @@ func (r *ManagedAuthMfaOption) UnmarshalJSON(data []byte) error { // An SSO button for signing in with an external identity provider type ManagedAuthPendingSSOButton struct { // Visible button text - Label string `json:"label,required"` + Label string `json:"label" api:"required"` // Identity provider name - Provider string `json:"provider,required"` + Provider string `json:"provider" api:"required"` // XPath selector for the button - Selector string `json:"selector,required"` + Selector string `json:"selector" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Label respjson.Field @@ -499,9 +499,9 @@ func (r *ManagedAuthPendingSSOButton) UnmarshalJSON(data []byte) error { // The properties Domain, ProfileName are required. type ManagedAuthCreateRequestParam struct { // Domain for authentication - Domain string `json:"domain,required"` + Domain string `json:"domain" api:"required"` // Name of the profile to manage authentication for - ProfileName string `json:"profile_name,required"` + ProfileName string `json:"profile_name" api:"required"` // Interval in seconds between automatic health checks. When set, the system // periodically verifies the authentication status and triggers re-authentication // if needed. Maximum is 86400 (24 hours). Default is 3600 (1 hour). The minimum @@ -617,7 +617,7 @@ func (r *SubmitFieldsRequestParam) UnmarshalJSON(data []byte) error { // Response from submitting field values type SubmitFieldsResponse struct { // Whether the submission was accepted for processing - Accepted bool `json:"accepted,required"` + Accepted bool `json:"accepted" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Accepted respjson.Field @@ -748,18 +748,18 @@ func (r *AuthConnectionFollowResponseUnion) UnmarshalJSON(data []byte) error { // An event representing the current state of a managed auth flow. type AuthConnectionFollowResponseManagedAuthState struct { // Event type identifier (always "managed_auth_state"). - Event constant.ManagedAuthState `json:"event,required"` + Event constant.ManagedAuthState `json:"event" api:"required"` // Current flow status. // // Any of "IN_PROGRESS", "SUCCESS", "FAILED", "EXPIRED", "CANCELED". - FlowStatus string `json:"flow_status,required"` + FlowStatus string `json:"flow_status" api:"required"` // Current step in the flow. // // Any of "DISCOVERING", "AWAITING_INPUT", "AWAITING_EXTERNAL_ACTION", // "SUBMITTING", "COMPLETED". - FlowStep string `json:"flow_step,required"` + FlowStep string `json:"flow_step" api:"required"` // Time the state was reported. - Timestamp time.Time `json:"timestamp,required" format:"date-time"` + Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"` // Fields awaiting input (present when flow_step=AWAITING_INPUT). DiscoveredFields []AuthConnectionFollowResponseManagedAuthStateDiscoveredField `json:"discovered_fields"` // Machine-readable error code (present when flow_status=FAILED). @@ -818,20 +818,20 @@ func (r *AuthConnectionFollowResponseManagedAuthState) UnmarshalJSON(data []byte // A discovered form field type AuthConnectionFollowResponseManagedAuthStateDiscoveredField struct { // Field label - Label string `json:"label,required"` + Label string `json:"label" api:"required"` // Field name - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // CSS selector for the field - Selector string `json:"selector,required"` + Selector string `json:"selector" api:"required"` // Field type // // Any of "text", "email", "password", "tel", "number", "url", "code", "totp". - Type string `json:"type,required"` + Type string `json:"type" api:"required"` // If this field is associated with an MFA option, the type of that option (e.g., // password field linked to "Enter password" option) // // Any of "sms", "call", "email", "totp", "push", "password". - LinkedMfaType string `json:"linked_mfa_type,nullable"` + LinkedMfaType string `json:"linked_mfa_type" api:"nullable"` // Field placeholder Placeholder string `json:"placeholder"` // Whether field is required @@ -861,15 +861,15 @@ func (r *AuthConnectionFollowResponseManagedAuthStateDiscoveredField) UnmarshalJ // An MFA method option for verification type AuthConnectionFollowResponseManagedAuthStateMfaOption struct { // The visible option text - Label string `json:"label,required"` + Label string `json:"label" api:"required"` // The MFA delivery method type (includes password for auth method selection pages) // // Any of "sms", "call", "email", "totp", "push", "password". - Type string `json:"type,required"` + Type string `json:"type" api:"required"` // Additional instructions from the site - Description string `json:"description,nullable"` + Description string `json:"description" api:"nullable"` // The masked destination (phone/email) if shown - Target string `json:"target,nullable"` + Target string `json:"target" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Label respjson.Field @@ -890,11 +890,11 @@ func (r *AuthConnectionFollowResponseManagedAuthStateMfaOption) UnmarshalJSON(da // An SSO button for signing in with an external identity provider type AuthConnectionFollowResponseManagedAuthStatePendingSSOButton struct { // Visible button text - Label string `json:"label,required"` + Label string `json:"label" api:"required"` // Identity provider name - Provider string `json:"provider,required"` + Provider string `json:"provider" api:"required"` // XPath selector for the button - Selector string `json:"selector,required"` + Selector string `json:"selector" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Label respjson.Field diff --git a/browser.go b/browser.go index a295c50..8b130b0 100644 --- a/browser.go +++ b/browser.go @@ -158,7 +158,7 @@ func (r *BrowserService) LoadExtensions(ctx context.Context, id string, body Bro // Deprecated: deprecated type BrowserPersistence struct { // DEPRECATED: Unique identifier for the persistent browser session. - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -189,7 +189,7 @@ func (r BrowserPersistence) ToParam() BrowserPersistenceParam { // The property ID is required. type BrowserPersistenceParam struct { // DEPRECATED: Unique identifier for the persistent browser session. - ID string `json:"id,required"` + ID string `json:"id" api:"required"` paramObj } @@ -204,13 +204,13 @@ func (r *BrowserPersistenceParam) UnmarshalJSON(data []byte) error { // Browser profile metadata. type Profile struct { // Unique identifier for the profile - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Timestamp when the profile was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Timestamp when the profile was last used LastUsedAt time.Time `json:"last_used_at" format:"date-time"` // Optional, easier-to-reference name for the profile - Name string `json:"name,nullable"` + Name string `json:"name" api:"nullable"` // Timestamp when the profile was last updated UpdatedAt time.Time `json:"updated_at" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. @@ -233,17 +233,17 @@ func (r *Profile) UnmarshalJSON(data []byte) error { type BrowserNewResponse struct { // Websocket URL for Chrome DevTools Protocol connections to the browser session - CdpWsURL string `json:"cdp_ws_url,required"` + CdpWsURL string `json:"cdp_ws_url" api:"required"` // When the browser session was created. - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Whether the browser session is running in headless mode. - Headless bool `json:"headless,required"` + Headless bool `json:"headless" api:"required"` // Unique identifier for the browser session - SessionID string `json:"session_id,required"` + SessionID string `json:"session_id" api:"required"` // Whether the browser session is running in stealth mode. - Stealth bool `json:"stealth,required"` + Stealth bool `json:"stealth" api:"required"` // The number of seconds of inactivity before the browser session is terminated. - TimeoutSeconds int64 `json:"timeout_seconds,required"` + TimeoutSeconds int64 `json:"timeout_seconds" api:"required"` // Remote URL for live viewing the browser session. Only available for non-headless // browsers. BrowserLiveViewURL string `json:"browser_live_view_url"` @@ -299,17 +299,17 @@ func (r *BrowserNewResponse) UnmarshalJSON(data []byte) error { type BrowserGetResponse struct { // Websocket URL for Chrome DevTools Protocol connections to the browser session - CdpWsURL string `json:"cdp_ws_url,required"` + CdpWsURL string `json:"cdp_ws_url" api:"required"` // When the browser session was created. - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Whether the browser session is running in headless mode. - Headless bool `json:"headless,required"` + Headless bool `json:"headless" api:"required"` // Unique identifier for the browser session - SessionID string `json:"session_id,required"` + SessionID string `json:"session_id" api:"required"` // Whether the browser session is running in stealth mode. - Stealth bool `json:"stealth,required"` + Stealth bool `json:"stealth" api:"required"` // The number of seconds of inactivity before the browser session is terminated. - TimeoutSeconds int64 `json:"timeout_seconds,required"` + TimeoutSeconds int64 `json:"timeout_seconds" api:"required"` // Remote URL for live viewing the browser session. Only available for non-headless // browsers. BrowserLiveViewURL string `json:"browser_live_view_url"` @@ -365,17 +365,17 @@ func (r *BrowserGetResponse) UnmarshalJSON(data []byte) error { type BrowserUpdateResponse struct { // Websocket URL for Chrome DevTools Protocol connections to the browser session - CdpWsURL string `json:"cdp_ws_url,required"` + CdpWsURL string `json:"cdp_ws_url" api:"required"` // When the browser session was created. - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Whether the browser session is running in headless mode. - Headless bool `json:"headless,required"` + Headless bool `json:"headless" api:"required"` // Unique identifier for the browser session - SessionID string `json:"session_id,required"` + SessionID string `json:"session_id" api:"required"` // Whether the browser session is running in stealth mode. - Stealth bool `json:"stealth,required"` + Stealth bool `json:"stealth" api:"required"` // The number of seconds of inactivity before the browser session is terminated. - TimeoutSeconds int64 `json:"timeout_seconds,required"` + TimeoutSeconds int64 `json:"timeout_seconds" api:"required"` // Remote URL for live viewing the browser session. Only available for non-headless // browsers. BrowserLiveViewURL string `json:"browser_live_view_url"` @@ -431,17 +431,17 @@ func (r *BrowserUpdateResponse) UnmarshalJSON(data []byte) error { type BrowserListResponse struct { // Websocket URL for Chrome DevTools Protocol connections to the browser session - CdpWsURL string `json:"cdp_ws_url,required"` + CdpWsURL string `json:"cdp_ws_url" api:"required"` // When the browser session was created. - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Whether the browser session is running in headless mode. - Headless bool `json:"headless,required"` + Headless bool `json:"headless" api:"required"` // Unique identifier for the browser session - SessionID string `json:"session_id,required"` + SessionID string `json:"session_id" api:"required"` // Whether the browser session is running in stealth mode. - Stealth bool `json:"stealth,required"` + Stealth bool `json:"stealth" api:"required"` // The number of seconds of inactivity before the browser session is terminated. - TimeoutSeconds int64 `json:"timeout_seconds,required"` + TimeoutSeconds int64 `json:"timeout_seconds" api:"required"` // Remote URL for live viewing the browser session. Only available for non-headless // browsers. BrowserLiveViewURL string `json:"browser_live_view_url"` @@ -589,6 +589,8 @@ type BrowserListParams struct { Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Number of results to skip. Defaults to 0. Offset param.Opt[int64] `query:"offset,omitzero" json:"-"` + // Search browsers by session ID, profile ID, or proxy ID. + Query param.Opt[string] `query:"query,omitzero" json:"-"` // Filter sessions by status. "active" returns only active sessions (default), // "deleted" returns only soft-deleted sessions, "all" returns both. // @@ -617,7 +619,7 @@ const ( type BrowserDeleteParams struct { // Persistent browser identifier - PersistentID string `query:"persistent_id,required" json:"-"` + PersistentID string `query:"persistent_id" api:"required" json:"-"` paramObj } @@ -631,7 +633,7 @@ func (r BrowserDeleteParams) URLQuery() (v url.Values, err error) { type BrowserLoadExtensionsParams struct { // List of extensions to upload and activate - Extensions []BrowserLoadExtensionsParamsExtension `json:"extensions,omitzero,required"` + Extensions []BrowserLoadExtensionsParamsExtension `json:"extensions,omitzero" api:"required"` paramObj } @@ -656,10 +658,10 @@ func (r BrowserLoadExtensionsParams) MarshalMultipart() (data []byte, contentTyp // The properties Name, ZipFile are required. type BrowserLoadExtensionsParamsExtension struct { // Folder name to place the extension under /home/kernel/extensions/ - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // Zip archive containing an unpacked Chromium extension (must include // manifest.json) - ZipFile io.Reader `json:"zip_file,omitzero,required" format:"binary"` + ZipFile io.Reader `json:"zip_file,omitzero" api:"required" format:"binary"` paramObj } diff --git a/browser_test.go b/browser_test.go index 485aa34..1b78a49 100644 --- a/browser_test.go +++ b/browser_test.go @@ -149,6 +149,7 @@ func TestBrowserListWithOptionalParams(t *testing.T) { IncludeDeleted: kernel.Bool(true), Limit: kernel.Int(1), Offset: kernel.Int(0), + Query: kernel.String("query"), Status: kernel.BrowserListParamsStatusActive, }) if err != nil { diff --git a/browsercomputer.go b/browsercomputer.go index 9d2d806..4708f06 100644 --- a/browsercomputer.go +++ b/browsercomputer.go @@ -167,9 +167,9 @@ func (r *BrowserComputerService) TypeText(ctx context.Context, id string, body B type BrowserComputerGetMousePositionResponse struct { // X coordinate of the cursor - X int64 `json:"x,required"` + X int64 `json:"x" api:"required"` // Y coordinate of the cursor - Y int64 `json:"y,required"` + Y int64 `json:"y" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { X respjson.Field @@ -188,7 +188,7 @@ func (r *BrowserComputerGetMousePositionResponse) UnmarshalJSON(data []byte) err // Generic OK response. type BrowserComputerSetCursorVisibilityResponse struct { // Indicates success. - Ok bool `json:"ok,required"` + Ok bool `json:"ok" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Ok respjson.Field @@ -205,7 +205,7 @@ func (r *BrowserComputerSetCursorVisibilityResponse) UnmarshalJSON(data []byte) type BrowserComputerBatchParams struct { // Ordered list of actions to execute. Execution stops on the first error. - Actions []BrowserComputerBatchParamsAction `json:"actions,omitzero,required"` + Actions []BrowserComputerBatchParamsAction `json:"actions,omitzero" api:"required"` paramObj } @@ -227,7 +227,7 @@ type BrowserComputerBatchParamsAction struct { // // Any of "click_mouse", "move_mouse", "type_text", "press_key", "scroll", // "drag_mouse", "set_cursor", "sleep". - Type string `json:"type,omitzero,required"` + Type string `json:"type,omitzero" api:"required"` ClickMouse BrowserComputerBatchParamsActionClickMouse `json:"click_mouse,omitzero"` DragMouse BrowserComputerBatchParamsActionDragMouse `json:"drag_mouse,omitzero"` MoveMouse BrowserComputerBatchParamsActionMoveMouse `json:"move_mouse,omitzero"` @@ -257,9 +257,9 @@ func init() { // The properties X, Y are required. type BrowserComputerBatchParamsActionClickMouse struct { // X coordinate of the click position - X int64 `json:"x,required"` + X int64 `json:"x" api:"required"` // Y coordinate of the click position - Y int64 `json:"y,required"` + Y int64 `json:"y" api:"required"` // Number of times to repeat the click NumClicks param.Opt[int64] `json:"num_clicks,omitzero"` // Mouse button to interact with @@ -296,7 +296,7 @@ func init() { type BrowserComputerBatchParamsActionDragMouse struct { // Ordered list of [x, y] coordinate pairs to move through while dragging. Must // contain at least 2 points. - Path [][]int64 `json:"path,omitzero,required"` + Path [][]int64 `json:"path,omitzero" api:"required"` // Delay in milliseconds between button down and starting to move along the path. Delay param.Opt[int64] `json:"delay,omitzero"` // Delay in milliseconds between relative steps while dragging (not the initial @@ -330,9 +330,9 @@ func init() { // The properties X, Y are required. type BrowserComputerBatchParamsActionMoveMouse struct { // X coordinate to move the cursor to - X int64 `json:"x,required"` + X int64 `json:"x" api:"required"` // Y coordinate to move the cursor to - Y int64 `json:"y,required"` + Y int64 `json:"y" api:"required"` // Modifier keys to hold during the move HoldKeys []string `json:"hold_keys,omitzero"` paramObj @@ -352,7 +352,7 @@ type BrowserComputerBatchParamsActionPressKey struct { // xdotool (see X11 keysym definitions). Examples include "Return", "Shift", // "Ctrl", "Alt", "F5". Items in this list could also be combinations, e.g. // "Ctrl+t" or "Ctrl+Shift+Tab". - Keys []string `json:"keys,omitzero,required"` + Keys []string `json:"keys,omitzero" api:"required"` // Duration to hold the keys down in milliseconds. If omitted or 0, keys are // tapped. Duration param.Opt[int64] `json:"duration,omitzero"` @@ -372,9 +372,9 @@ func (r *BrowserComputerBatchParamsActionPressKey) UnmarshalJSON(data []byte) er // The properties X, Y are required. type BrowserComputerBatchParamsActionScroll struct { // X coordinate at which to perform the scroll - X int64 `json:"x,required"` + X int64 `json:"x" api:"required"` // Y coordinate at which to perform the scroll - Y int64 `json:"y,required"` + Y int64 `json:"y" api:"required"` // Horizontal scroll amount. Positive scrolls right, negative scrolls left. DeltaX param.Opt[int64] `json:"delta_x,omitzero"` // Vertical scroll amount. Positive scrolls down, negative scrolls up. @@ -395,7 +395,7 @@ func (r *BrowserComputerBatchParamsActionScroll) UnmarshalJSON(data []byte) erro // The property Hidden is required. type BrowserComputerBatchParamsActionSetCursor struct { // Whether the cursor should be hidden or visible - Hidden bool `json:"hidden,required"` + Hidden bool `json:"hidden" api:"required"` paramObj } @@ -412,7 +412,7 @@ func (r *BrowserComputerBatchParamsActionSetCursor) UnmarshalJSON(data []byte) e // The property DurationMs is required. type BrowserComputerBatchParamsActionSleep struct { // Duration to sleep in milliseconds. - DurationMs int64 `json:"duration_ms,required"` + DurationMs int64 `json:"duration_ms" api:"required"` paramObj } @@ -427,7 +427,7 @@ func (r *BrowserComputerBatchParamsActionSleep) UnmarshalJSON(data []byte) error // The property Text is required. type BrowserComputerBatchParamsActionTypeText struct { // Text to type on the browser instance - Text string `json:"text,required"` + Text string `json:"text" api:"required"` // Delay in milliseconds between keystrokes Delay param.Opt[int64] `json:"delay,omitzero"` paramObj @@ -457,13 +457,13 @@ func (r *BrowserComputerCaptureScreenshotParams) UnmarshalJSON(data []byte) erro // The properties Height, Width, X, Y are required. type BrowserComputerCaptureScreenshotParamsRegion struct { // Height of the region in pixels - Height int64 `json:"height,required"` + Height int64 `json:"height" api:"required"` // Width of the region in pixels - Width int64 `json:"width,required"` + Width int64 `json:"width" api:"required"` // X coordinate of the region's top-left corner - X int64 `json:"x,required"` + X int64 `json:"x" api:"required"` // Y coordinate of the region's top-left corner - Y int64 `json:"y,required"` + Y int64 `json:"y" api:"required"` paramObj } @@ -477,9 +477,9 @@ func (r *BrowserComputerCaptureScreenshotParamsRegion) UnmarshalJSON(data []byte type BrowserComputerClickMouseParams struct { // X coordinate of the click position - X int64 `json:"x,required"` + X int64 `json:"x" api:"required"` // Y coordinate of the click position - Y int64 `json:"y,required"` + Y int64 `json:"y" api:"required"` // Number of times to repeat the click NumClicks param.Opt[int64] `json:"num_clicks,omitzero"` // Mouse button to interact with @@ -526,7 +526,7 @@ const ( type BrowserComputerDragMouseParams struct { // Ordered list of [x, y] coordinate pairs to move through while dragging. Must // contain at least 2 points. - Path [][]int64 `json:"path,omitzero,required"` + Path [][]int64 `json:"path,omitzero" api:"required"` // Delay in milliseconds between button down and starting to move along the path. Delay param.Opt[int64] `json:"delay,omitzero"` // Delay in milliseconds between relative steps while dragging (not the initial @@ -562,9 +562,9 @@ const ( type BrowserComputerMoveMouseParams struct { // X coordinate to move the cursor to - X int64 `json:"x,required"` + X int64 `json:"x" api:"required"` // Y coordinate to move the cursor to - Y int64 `json:"y,required"` + Y int64 `json:"y" api:"required"` // Modifier keys to hold during the move HoldKeys []string `json:"hold_keys,omitzero"` paramObj @@ -583,7 +583,7 @@ type BrowserComputerPressKeyParams struct { // xdotool (see X11 keysym definitions). Examples include "Return", "Shift", // "Ctrl", "Alt", "F5". Items in this list could also be combinations, e.g. // "Ctrl+t" or "Ctrl+Shift+Tab". - Keys []string `json:"keys,omitzero,required"` + Keys []string `json:"keys,omitzero" api:"required"` // Duration to hold the keys down in milliseconds. If omitted or 0, keys are // tapped. Duration param.Opt[int64] `json:"duration,omitzero"` @@ -602,9 +602,9 @@ func (r *BrowserComputerPressKeyParams) UnmarshalJSON(data []byte) error { type BrowserComputerScrollParams struct { // X coordinate at which to perform the scroll - X int64 `json:"x,required"` + X int64 `json:"x" api:"required"` // Y coordinate at which to perform the scroll - Y int64 `json:"y,required"` + Y int64 `json:"y" api:"required"` // Horizontal scroll amount. Positive scrolls right, negative scrolls left. DeltaX param.Opt[int64] `json:"delta_x,omitzero"` // Vertical scroll amount. Positive scrolls down, negative scrolls up. @@ -624,7 +624,7 @@ func (r *BrowserComputerScrollParams) UnmarshalJSON(data []byte) error { type BrowserComputerSetCursorVisibilityParams struct { // Whether the cursor should be hidden or visible - Hidden bool `json:"hidden,required"` + Hidden bool `json:"hidden" api:"required"` paramObj } @@ -638,7 +638,7 @@ func (r *BrowserComputerSetCursorVisibilityParams) UnmarshalJSON(data []byte) er type BrowserComputerTypeTextParams struct { // Text to type on the browser instance - Text string `json:"text,required"` + Text string `json:"text" api:"required"` // Delay in milliseconds between keystrokes Delay param.Opt[int64] `json:"delay,omitzero"` paramObj diff --git a/browserf.go b/browserf.go index 55ce317..6005bc0 100644 --- a/browserf.go +++ b/browserf.go @@ -200,17 +200,17 @@ func (r *BrowserFService) WriteFile(ctx context.Context, id string, contents io. type BrowserFFileInfoResponse struct { // Whether the path is a directory. - IsDir bool `json:"is_dir,required"` + IsDir bool `json:"is_dir" api:"required"` // Last modification time. - ModTime time.Time `json:"mod_time,required" format:"date-time"` + ModTime time.Time `json:"mod_time" api:"required" format:"date-time"` // File mode bits (e.g., "drwxr-xr-x" or "-rw-r--r--"). - Mode string `json:"mode,required"` + Mode string `json:"mode" api:"required"` // Base name of the file or directory. - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // Absolute path. - Path string `json:"path,required"` + Path string `json:"path" api:"required"` // Size in bytes. 0 for directories. - SizeBytes int64 `json:"size_bytes,required"` + SizeBytes int64 `json:"size_bytes" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { IsDir respjson.Field @@ -232,17 +232,17 @@ func (r *BrowserFFileInfoResponse) UnmarshalJSON(data []byte) error { type BrowserFListFilesResponse struct { // Whether the path is a directory. - IsDir bool `json:"is_dir,required"` + IsDir bool `json:"is_dir" api:"required"` // Last modification time. - ModTime time.Time `json:"mod_time,required" format:"date-time"` + ModTime time.Time `json:"mod_time" api:"required" format:"date-time"` // File mode bits (e.g., "drwxr-xr-x" or "-rw-r--r--"). - Mode string `json:"mode,required"` + Mode string `json:"mode" api:"required"` // Base name of the file or directory. - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // Absolute path. - Path string `json:"path,required"` + Path string `json:"path" api:"required"` // Size in bytes. 0 for directories. - SizeBytes int64 `json:"size_bytes,required"` + SizeBytes int64 `json:"size_bytes" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { IsDir respjson.Field @@ -264,7 +264,7 @@ func (r *BrowserFListFilesResponse) UnmarshalJSON(data []byte) error { type BrowserFNewDirectoryParams struct { // Absolute directory path to create. - Path string `json:"path,required"` + Path string `json:"path" api:"required"` // Optional directory mode (octal string, e.g. 755). Defaults to 755. Mode param.Opt[string] `json:"mode,omitzero"` paramObj @@ -280,7 +280,7 @@ func (r *BrowserFNewDirectoryParams) UnmarshalJSON(data []byte) error { type BrowserFDeleteDirectoryParams struct { // Absolute path to delete. - Path string `json:"path,required"` + Path string `json:"path" api:"required"` paramObj } @@ -294,7 +294,7 @@ func (r *BrowserFDeleteDirectoryParams) UnmarshalJSON(data []byte) error { type BrowserFDeleteFileParams struct { // Absolute path to delete. - Path string `json:"path,required"` + Path string `json:"path" api:"required"` paramObj } @@ -308,7 +308,7 @@ func (r *BrowserFDeleteFileParams) UnmarshalJSON(data []byte) error { type BrowserFDownloadDirZipParams struct { // Absolute directory path to archive and download. - Path string `query:"path,required" json:"-"` + Path string `query:"path" api:"required" json:"-"` paramObj } @@ -323,7 +323,7 @@ func (r BrowserFDownloadDirZipParams) URLQuery() (v url.Values, err error) { type BrowserFFileInfoParams struct { // Absolute path of the file or directory. - Path string `query:"path,required" json:"-"` + Path string `query:"path" api:"required" json:"-"` paramObj } @@ -337,7 +337,7 @@ func (r BrowserFFileInfoParams) URLQuery() (v url.Values, err error) { type BrowserFListFilesParams struct { // Absolute directory path. - Path string `query:"path,required" json:"-"` + Path string `query:"path" api:"required" json:"-"` paramObj } @@ -352,9 +352,9 @@ func (r BrowserFListFilesParams) URLQuery() (v url.Values, err error) { type BrowserFMoveParams struct { // Absolute destination path. - DestPath string `json:"dest_path,required"` + DestPath string `json:"dest_path" api:"required"` // Absolute source path. - SrcPath string `json:"src_path,required"` + SrcPath string `json:"src_path" api:"required"` paramObj } @@ -368,7 +368,7 @@ func (r *BrowserFMoveParams) UnmarshalJSON(data []byte) error { type BrowserFReadFileParams struct { // Absolute file path to read. - Path string `query:"path,required" json:"-"` + Path string `query:"path" api:"required" json:"-"` paramObj } @@ -382,9 +382,9 @@ func (r BrowserFReadFileParams) URLQuery() (v url.Values, err error) { type BrowserFSetFilePermissionsParams struct { // File mode bits (octal string, e.g. 644). - Mode string `json:"mode,required"` + Mode string `json:"mode" api:"required"` // Absolute path whose permissions are to be changed. - Path string `json:"path,required"` + Path string `json:"path" api:"required"` // New group name or GID. Group param.Opt[string] `json:"group,omitzero"` // New owner username or UID. @@ -401,7 +401,7 @@ func (r *BrowserFSetFilePermissionsParams) UnmarshalJSON(data []byte) error { } type BrowserFUploadParams struct { - Files []BrowserFUploadParamsFile `json:"files,omitzero,required"` + Files []BrowserFUploadParamsFile `json:"files,omitzero" api:"required"` paramObj } @@ -426,8 +426,8 @@ func (r BrowserFUploadParams) MarshalMultipart() (data []byte, contentType strin // The properties DestPath, File are required. type BrowserFUploadParamsFile struct { // Absolute destination path to write the file. - DestPath string `json:"dest_path,required"` - File io.Reader `json:"file,omitzero,required" format:"binary"` + DestPath string `json:"dest_path" api:"required"` + File io.Reader `json:"file,omitzero" api:"required" format:"binary"` paramObj } @@ -441,8 +441,8 @@ func (r *BrowserFUploadParamsFile) UnmarshalJSON(data []byte) error { type BrowserFUploadZipParams struct { // Absolute destination directory to extract the archive to. - DestPath string `json:"dest_path,required"` - ZipFile io.Reader `json:"zip_file,omitzero,required" format:"binary"` + DestPath string `json:"dest_path" api:"required"` + ZipFile io.Reader `json:"zip_file,omitzero" api:"required" format:"binary"` paramObj } @@ -466,7 +466,7 @@ func (r BrowserFUploadZipParams) MarshalMultipart() (data []byte, contentType st type BrowserFWriteFileParams struct { // Destination absolute file path. - Path string `query:"path,required" json:"-"` + Path string `query:"path" api:"required" json:"-"` // Optional file mode (octal string, e.g. 644). Defaults to 644. Mode param.Opt[string] `query:"mode,omitzero" json:"-"` paramObj diff --git a/browserfwatch.go b/browserfwatch.go index 742e40d..4d11c4e 100644 --- a/browserfwatch.go +++ b/browserfwatch.go @@ -89,11 +89,11 @@ func (r *BrowserFWatchService) Stop(ctx context.Context, watchID string, body Br // Filesystem change event. type BrowserFWatchEventsResponse struct { // Absolute path of the file or directory. - Path string `json:"path,required"` + Path string `json:"path" api:"required"` // Event type. // // Any of "CREATE", "WRITE", "DELETE", "RENAME". - Type BrowserFWatchEventsResponseType `json:"type,required"` + Type BrowserFWatchEventsResponseType `json:"type" api:"required"` // Whether the affected path is a directory. IsDir bool `json:"is_dir"` // Base name of the file or directory affected. @@ -143,13 +143,13 @@ func (r *BrowserFWatchStartResponse) UnmarshalJSON(data []byte) error { } type BrowserFWatchEventsParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` paramObj } type BrowserFWatchStartParams struct { // Directory to watch. - Path string `json:"path,required"` + Path string `json:"path" api:"required"` // Whether to watch recursively. Recursive param.Opt[bool] `json:"recursive,omitzero"` paramObj @@ -164,6 +164,6 @@ func (r *BrowserFWatchStartParams) UnmarshalJSON(data []byte) error { } type BrowserFWatchStopParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` paramObj } diff --git a/browserlog.go b/browserlog.go index a082a8a..21fd09f 100644 --- a/browserlog.go +++ b/browserlog.go @@ -56,7 +56,7 @@ func (r *BrowserLogService) StreamStreaming(ctx context.Context, id string, quer type BrowserLogStreamParams struct { // Any of "path", "supervisor". - Source BrowserLogStreamParamsSource `query:"source,omitzero,required" json:"-"` + Source BrowserLogStreamParamsSource `query:"source,omitzero" api:"required" json:"-"` Follow param.Opt[bool] `query:"follow,omitzero" json:"-"` // only required if source is path Path param.Opt[string] `query:"path,omitzero" json:"-"` diff --git a/browserplaywright.go b/browserplaywright.go index 3cda9fc..bf3d10c 100644 --- a/browserplaywright.go +++ b/browserplaywright.go @@ -53,7 +53,7 @@ func (r *BrowserPlaywrightService) Execute(ctx context.Context, id string, body // Result of Playwright code execution type BrowserPlaywrightExecuteResponse struct { // Whether the code executed successfully - Success bool `json:"success,required"` + Success bool `json:"success" api:"required"` // Error message if execution failed Error string `json:"error"` // The value returned by the code (if any) @@ -86,7 +86,7 @@ type BrowserPlaywrightExecuteParams struct { // statement at the end to return a value. This value is returned as the `result` // property in the response. Example: "await page.goto('https://example.com'); // return await page.title();" - Code string `json:"code,required"` + Code string `json:"code" api:"required"` // Maximum execution time in seconds. Default is 60. TimeoutSec param.Opt[int64] `json:"timeout_sec,omitzero"` paramObj diff --git a/browserpool.go b/browserpool.go index 2bf22cf..28eeabd 100644 --- a/browserpool.go +++ b/browserpool.go @@ -135,15 +135,15 @@ func (r *BrowserPoolService) Release(ctx context.Context, idOrName string, body // A browser pool containing multiple identically configured browsers. type BrowserPool struct { // Unique identifier for the browser pool - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Number of browsers currently acquired from the pool - AcquiredCount int64 `json:"acquired_count,required"` + AcquiredCount int64 `json:"acquired_count" api:"required"` // Number of browsers currently available in the pool - AvailableCount int64 `json:"available_count,required"` + AvailableCount int64 `json:"available_count" api:"required"` // Configuration used to create all browsers in this pool - BrowserPoolConfig BrowserPoolBrowserPoolConfig `json:"browser_pool_config,required"` + BrowserPoolConfig BrowserPoolBrowserPoolConfig `json:"browser_pool_config" api:"required"` // Timestamp when the browser pool was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Browser pool name, if set Name string `json:"name"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. @@ -170,7 +170,7 @@ type BrowserPoolBrowserPoolConfig struct { // Number of browsers to maintain in the pool. The maximum size is determined by // your organization's pooled sessions limit (the sum of all pool sizes cannot // exceed your limit). - Size int64 `json:"size,required"` + Size int64 `json:"size" api:"required"` // List of browser extensions to load into the session. Provide each by id or name. Extensions []shared.BrowserExtension `json:"extensions"` // Percentage of the pool to fill per minute. Defaults to 10%. @@ -230,17 +230,17 @@ func (r *BrowserPoolBrowserPoolConfig) UnmarshalJSON(data []byte) error { type BrowserPoolAcquireResponse struct { // Websocket URL for Chrome DevTools Protocol connections to the browser session - CdpWsURL string `json:"cdp_ws_url,required"` + CdpWsURL string `json:"cdp_ws_url" api:"required"` // When the browser session was created. - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Whether the browser session is running in headless mode. - Headless bool `json:"headless,required"` + Headless bool `json:"headless" api:"required"` // Unique identifier for the browser session - SessionID string `json:"session_id,required"` + SessionID string `json:"session_id" api:"required"` // Whether the browser session is running in stealth mode. - Stealth bool `json:"stealth,required"` + Stealth bool `json:"stealth" api:"required"` // The number of seconds of inactivity before the browser session is terminated. - TimeoutSeconds int64 `json:"timeout_seconds,required"` + TimeoutSeconds int64 `json:"timeout_seconds" api:"required"` // Remote URL for live viewing the browser session. Only available for non-headless // browsers. BrowserLiveViewURL string `json:"browser_live_view_url"` @@ -298,7 +298,7 @@ type BrowserPoolNewParams struct { // Number of browsers to maintain in the pool. The maximum size is determined by // your organization's pooled sessions limit (the sum of all pool sizes cannot // exceed your limit). - Size int64 `json:"size,required"` + Size int64 `json:"size" api:"required"` // Percentage of the pool to fill per minute. Defaults to 10%. FillRatePerMinute param.Opt[int64] `json:"fill_rate_per_minute,omitzero"` // If true, launches the browser using a headless image. Defaults to false. @@ -347,7 +347,7 @@ type BrowserPoolUpdateParams struct { // Number of browsers to maintain in the pool. The maximum size is determined by // your organization's pooled sessions limit (the sum of all pool sizes cannot // exceed your limit). - Size int64 `json:"size,required"` + Size int64 `json:"size" api:"required"` // Whether to discard all idle browsers and rebuild the pool immediately. Defaults // to false. DiscardAllIdle param.Opt[bool] `json:"discard_all_idle,omitzero"` @@ -428,7 +428,7 @@ func (r *BrowserPoolAcquireParams) UnmarshalJSON(data []byte) error { type BrowserPoolReleaseParams struct { // Browser session ID to release back to the pool - SessionID string `json:"session_id,required"` + SessionID string `json:"session_id" api:"required"` // Whether to reuse the browser instance or destroy it and create a new one. // Defaults to true. Reuse param.Opt[bool] `json:"reuse,omitzero"` diff --git a/browserprocess.go b/browserprocess.go index 50bbbb4..68d3d72 100644 --- a/browserprocess.go +++ b/browserprocess.go @@ -176,7 +176,7 @@ func (r *BrowserProcessExecResponse) UnmarshalJSON(data []byte) error { // Generic OK response. type BrowserProcessKillResponse struct { // Indicates success. - Ok bool `json:"ok,required"` + Ok bool `json:"ok" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Ok respjson.Field @@ -194,7 +194,7 @@ func (r *BrowserProcessKillResponse) UnmarshalJSON(data []byte) error { // Generic OK response. type BrowserProcessResizeResponse struct { // Indicates success. - Ok bool `json:"ok,required"` + Ok bool `json:"ok" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Ok respjson.Field @@ -238,7 +238,7 @@ type BrowserProcessStatusResponse struct { // Estimated CPU usage percentage. CPUPct float64 `json:"cpu_pct"` // Exit code if the process has exited. - ExitCode int64 `json:"exit_code,nullable"` + ExitCode int64 `json:"exit_code" api:"nullable"` // Estimated resident memory usage in bytes. MemBytes int64 `json:"mem_bytes"` // Process state. @@ -336,7 +336,7 @@ const ( type BrowserProcessExecParams struct { // Executable or shell command to run. - Command string `json:"command,required"` + Command string `json:"command" api:"required"` // Run the process as this user. AsUser param.Opt[string] `json:"as_user,omitzero"` // Working directory (absolute path) to run the command in. @@ -361,11 +361,11 @@ func (r *BrowserProcessExecParams) UnmarshalJSON(data []byte) error { } type BrowserProcessKillParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` // Signal to send. // // Any of "TERM", "KILL", "INT", "HUP". - Signal BrowserProcessKillParamsSignal `json:"signal,omitzero,required"` + Signal BrowserProcessKillParamsSignal `json:"signal,omitzero" api:"required"` paramObj } @@ -388,11 +388,11 @@ const ( ) type BrowserProcessResizeParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` // New terminal columns. - Cols int64 `json:"cols,required"` + Cols int64 `json:"cols" api:"required"` // New terminal rows. - Rows int64 `json:"rows,required"` + Rows int64 `json:"rows" api:"required"` paramObj } @@ -406,7 +406,7 @@ func (r *BrowserProcessResizeParams) UnmarshalJSON(data []byte) error { type BrowserProcessSpawnParams struct { // Executable or shell command to run. - Command string `json:"command,required"` + Command string `json:"command" api:"required"` // Run the process as this user. AsUser param.Opt[string] `json:"as_user,omitzero"` // Working directory (absolute path) to run the command in. @@ -437,14 +437,14 @@ func (r *BrowserProcessSpawnParams) UnmarshalJSON(data []byte) error { } type BrowserProcessStatusParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` paramObj } type BrowserProcessStdinParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` // Base64-encoded data to write. - DataB64 string `json:"data_b64,required"` + DataB64 string `json:"data_b64" api:"required"` paramObj } @@ -457,6 +457,6 @@ func (r *BrowserProcessStdinParams) UnmarshalJSON(data []byte) error { } type BrowserProcessStdoutStreamParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` paramObj } diff --git a/browserreplay.go b/browserreplay.go index dede935..3b928af 100644 --- a/browserreplay.go +++ b/browserreplay.go @@ -97,13 +97,13 @@ func (r *BrowserReplayService) Stop(ctx context.Context, replayID string, body B // Information about a browser replay recording. type BrowserReplayListResponse struct { // Unique identifier for the replay recording. - ReplayID string `json:"replay_id,required"` + ReplayID string `json:"replay_id" api:"required"` // Timestamp when replay finished - FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"` + FinishedAt time.Time `json:"finished_at" api:"nullable" format:"date-time"` // URL for viewing the replay recording. ReplayViewURL string `json:"replay_view_url"` // Timestamp when replay started - StartedAt time.Time `json:"started_at,nullable" format:"date-time"` + StartedAt time.Time `json:"started_at" api:"nullable" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ReplayID respjson.Field @@ -124,13 +124,13 @@ func (r *BrowserReplayListResponse) UnmarshalJSON(data []byte) error { // Information about a browser replay recording. type BrowserReplayStartResponse struct { // Unique identifier for the replay recording. - ReplayID string `json:"replay_id,required"` + ReplayID string `json:"replay_id" api:"required"` // Timestamp when replay finished - FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"` + FinishedAt time.Time `json:"finished_at" api:"nullable" format:"date-time"` // URL for viewing the replay recording. ReplayViewURL string `json:"replay_view_url"` // Timestamp when replay started - StartedAt time.Time `json:"started_at,nullable" format:"date-time"` + StartedAt time.Time `json:"started_at" api:"nullable" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ReplayID respjson.Field @@ -149,7 +149,7 @@ func (r *BrowserReplayStartResponse) UnmarshalJSON(data []byte) error { } type BrowserReplayDownloadParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` paramObj } @@ -170,6 +170,6 @@ func (r *BrowserReplayStartParams) UnmarshalJSON(data []byte) error { } type BrowserReplayStopParams struct { - ID string `path:"id,required" json:"-"` + ID string `path:"id" api:"required" json:"-"` paramObj } diff --git a/credential.go b/credential.go index 87329ae..e3d1606 100644 --- a/credential.go +++ b/credential.go @@ -131,11 +131,11 @@ func (r *CredentialService) TotpCode(ctx context.Context, idOrName string, opts // The properties Domain, Name, Values are required. type CreateCredentialRequestParam struct { // Target domain this credential is for - Domain string `json:"domain,required"` + Domain string `json:"domain" api:"required"` // Unique name for the credential within the organization - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // Field name to value mapping (e.g., username, password) - Values map[string]string `json:"values,omitzero,required"` + Values map[string]string `json:"values,omitzero" api:"required"` // If set, indicates this credential should be used with the specified SSO provider // (e.g., google, github, microsoft). When the target site has a matching SSO // button, it will be clicked first before filling credential values on the @@ -158,15 +158,15 @@ func (r *CreateCredentialRequestParam) UnmarshalJSON(data []byte) error { // A stored credential for automatic re-authentication type Credential struct { // Unique identifier for the credential - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // When the credential was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Target domain this credential is for - Domain string `json:"domain,required"` + Domain string `json:"domain" api:"required"` // Unique name for the credential within the organization - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // When the credential was last updated - UpdatedAt time.Time `json:"updated_at,required" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"` // Whether this credential has a TOTP secret configured for automatic 2FA HasTotpSecret bool `json:"has_totp_secret"` // Whether this credential has stored values (email, password, etc.) @@ -175,7 +175,7 @@ type Credential struct { // (e.g., google, github, microsoft). When the target site has a matching SSO // button, it will be clicked first before filling credential values on the // identity provider's login page. - SSOProvider string `json:"sso_provider,nullable"` + SSOProvider string `json:"sso_provider" api:"nullable"` // Current 6-digit TOTP code. Only included in create/update responses when // totp_secret was just set. TotpCode string `json:"totp_code"` @@ -230,9 +230,9 @@ func (r *UpdateCredentialRequestParam) UnmarshalJSON(data []byte) error { type CredentialTotpCodeResponse struct { // Current 6-digit TOTP code - Code string `json:"code,required"` + Code string `json:"code" api:"required"` // When this code expires (ISO 8601 timestamp) - ExpiresAt time.Time `json:"expires_at,required" format:"date-time"` + ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Code respjson.Field diff --git a/credentialprovider.go b/credentialprovider.go index 2e6c172..4b99d53 100644 --- a/credentialprovider.go +++ b/credentialprovider.go @@ -122,13 +122,13 @@ func (r *CredentialProviderService) Test(ctx context.Context, id string, opts .. // The properties Token, Name, ProviderType are required. type CreateCredentialProviderRequestParam struct { // Service account token for the provider (e.g., 1Password service account token) - Token string `json:"token,required"` + Token string `json:"token" api:"required"` // Human-readable name for this provider instance (unique per org) - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // Type of credential provider // // Any of "onepassword". - ProviderType CreateCredentialProviderRequestProviderType `json:"provider_type,omitzero,required"` + ProviderType CreateCredentialProviderRequestProviderType `json:"provider_type,omitzero" api:"required"` // How long to cache credential lists (default 300 seconds) CacheTtlSeconds param.Opt[int64] `json:"cache_ttl_seconds,omitzero"` paramObj @@ -153,21 +153,21 @@ const ( // lookup type CredentialProvider struct { // Unique identifier for the credential provider - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // When the credential provider was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Whether the provider is enabled for credential lookups - Enabled bool `json:"enabled,required"` + Enabled bool `json:"enabled" api:"required"` // Human-readable name for this provider instance - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // Priority order for credential lookups (lower numbers are checked first) - Priority int64 `json:"priority,required"` + Priority int64 `json:"priority" api:"required"` // Type of credential provider // // Any of "onepassword". - ProviderType CredentialProviderProviderType `json:"provider_type,required"` + ProviderType CredentialProviderProviderType `json:"provider_type" api:"required"` // When the credential provider was last updated - UpdatedAt time.Time `json:"updated_at,required" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -198,15 +198,15 @@ const ( // A credential item from an external provider (e.g., a 1Password login item) type CredentialProviderItem struct { // Unique identifier for the item within the provider - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Path to reference this item (VaultName/ItemTitle format) - Path string `json:"path,required"` + Path string `json:"path" api:"required"` // Display name of the credential item - Title string `json:"title,required"` + Title string `json:"title" api:"required"` // ID of the vault containing this item - VaultID string `json:"vault_id,required"` + VaultID string `json:"vault_id" api:"required"` // Name of the vault containing this item - VaultName string `json:"vault_name,required"` + VaultName string `json:"vault_name" api:"required"` // URLs associated with this credential URLs []string `json:"urls"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. @@ -231,9 +231,9 @@ func (r *CredentialProviderItem) UnmarshalJSON(data []byte) error { // Result of testing a credential provider connection type CredentialProviderTestResult struct { // Whether the connection test was successful - Success bool `json:"success,required"` + Success bool `json:"success" api:"required"` // List of vaults accessible by the service account - Vaults []CredentialProviderTestResultVault `json:"vaults,required"` + Vaults []CredentialProviderTestResultVault `json:"vaults" api:"required"` // Error message if the test failed Error string `json:"error"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. @@ -254,9 +254,9 @@ func (r *CredentialProviderTestResult) UnmarshalJSON(data []byte) error { type CredentialProviderTestResultVault struct { // Vault ID - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Vault name - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field diff --git a/deployment.go b/deployment.go index d9d523d..d49aa8a 100644 --- a/deployment.go +++ b/deployment.go @@ -126,11 +126,11 @@ func (r *DeploymentService) FollowStreaming(ctx context.Context, id string, quer // An event representing the current state of a deployment. type DeploymentStateEvent struct { // Deployment record information. - Deployment DeploymentStateEventDeployment `json:"deployment,required"` + Deployment DeploymentStateEventDeployment `json:"deployment" api:"required"` // Event type identifier (always "deployment_state"). - Event constant.DeploymentState `json:"event,required"` + Event constant.DeploymentState `json:"event" api:"required"` // Time the state was reported. - Timestamp time.Time `json:"timestamp,required" format:"date-time"` + Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Deployment respjson.Field @@ -150,15 +150,15 @@ func (r *DeploymentStateEvent) UnmarshalJSON(data []byte) error { // Deployment record information. type DeploymentStateEventDeployment struct { // Unique identifier for the deployment - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Timestamp when the deployment was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Deployment region code - Region constant.AwsUsEast1a `json:"region,required"` + Region constant.AwsUsEast1a `json:"region" api:"required"` // Current status of the deployment // // Any of "queued", "in_progress", "running", "failed", "stopped". - Status string `json:"status,required"` + Status string `json:"status" api:"required"` // Relative path to the application entrypoint EntrypointRelPath string `json:"entrypoint_rel_path"` // Environment variables configured for this deployment @@ -166,7 +166,7 @@ type DeploymentStateEventDeployment struct { // Status reason StatusReason string `json:"status_reason"` // Timestamp when the deployment was last updated - UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -191,15 +191,15 @@ func (r *DeploymentStateEventDeployment) UnmarshalJSON(data []byte) error { // Deployment record information. type DeploymentNewResponse struct { // Unique identifier for the deployment - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Timestamp when the deployment was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Deployment region code - Region constant.AwsUsEast1a `json:"region,required"` + Region constant.AwsUsEast1a `json:"region" api:"required"` // Current status of the deployment // // Any of "queued", "in_progress", "running", "failed", "stopped". - Status DeploymentNewResponseStatus `json:"status,required"` + Status DeploymentNewResponseStatus `json:"status" api:"required"` // Relative path to the application entrypoint EntrypointRelPath string `json:"entrypoint_rel_path"` // Environment variables configured for this deployment @@ -207,7 +207,7 @@ type DeploymentNewResponse struct { // Status reason StatusReason string `json:"status_reason"` // Timestamp when the deployment was last updated - UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -243,15 +243,15 @@ const ( // Deployment record information. type DeploymentGetResponse struct { // Unique identifier for the deployment - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Timestamp when the deployment was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Deployment region code - Region constant.AwsUsEast1a `json:"region,required"` + Region constant.AwsUsEast1a `json:"region" api:"required"` // Current status of the deployment // // Any of "queued", "in_progress", "running", "failed", "stopped". - Status DeploymentGetResponseStatus `json:"status,required"` + Status DeploymentGetResponseStatus `json:"status" api:"required"` // Relative path to the application entrypoint EntrypointRelPath string `json:"entrypoint_rel_path"` // Environment variables configured for this deployment @@ -259,7 +259,7 @@ type DeploymentGetResponse struct { // Status reason StatusReason string `json:"status_reason"` // Timestamp when the deployment was last updated - UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -295,15 +295,15 @@ const ( // Deployment record information. type DeploymentListResponse struct { // Unique identifier for the deployment - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Timestamp when the deployment was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Deployment region code - Region constant.AwsUsEast1a `json:"region,required"` + Region constant.AwsUsEast1a `json:"region" api:"required"` // Current status of the deployment // // Any of "queued", "in_progress", "running", "failed", "stopped". - Status DeploymentListResponseStatus `json:"status,required"` + Status DeploymentListResponseStatus `json:"status" api:"required"` // Relative path to the application entrypoint EntrypointRelPath string `json:"entrypoint_rel_path"` // Environment variables configured for this deployment @@ -311,7 +311,7 @@ type DeploymentListResponse struct { // Status reason StatusReason string `json:"status_reason"` // Timestamp when the deployment was last updated - UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -425,19 +425,19 @@ func (r *DeploymentFollowResponseUnion) UnmarshalJSON(data []byte) error { // Summary of an application version. type DeploymentFollowResponseAppVersionSummaryEvent struct { // Unique identifier for the app version - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // List of actions available on the app - Actions []shared.AppAction `json:"actions,required"` + Actions []shared.AppAction `json:"actions" api:"required"` // Name of the application - AppName string `json:"app_name,required"` + AppName string `json:"app_name" api:"required"` // Event type identifier (always "app_version_summary"). - Event constant.AppVersionSummary `json:"event,required"` + Event constant.AppVersionSummary `json:"event" api:"required"` // Deployment region code - Region constant.AwsUsEast1a `json:"region,required"` + Region constant.AwsUsEast1a `json:"region" api:"required"` // Time the state was reported. - Timestamp time.Time `json:"timestamp,required" format:"date-time"` + Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"` // Version label for the application - Version string `json:"version,required"` + Version string `json:"version" api:"required"` // Environment variables configured for this app version EnvVars map[string]string `json:"env_vars"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. @@ -512,15 +512,15 @@ const ( // The properties Entrypoint, Ref, Type, URL are required. type DeploymentNewParamsSource struct { // Relative path to the application entrypoint within the selected path. - Entrypoint string `json:"entrypoint,required"` + Entrypoint string `json:"entrypoint" api:"required"` // Git ref (branch, tag, or commit SHA) to fetch. - Ref string `json:"ref,required"` + Ref string `json:"ref" api:"required"` // Source type identifier. // // Any of "github". - Type string `json:"type,omitzero,required"` + Type string `json:"type,omitzero" api:"required"` // Base repository URL (without blob/tree suffixes). - URL string `json:"url,required"` + URL string `json:"url" api:"required"` // Path within the repo to deploy (omit to use repo root). Path param.Opt[string] `json:"path,omitzero"` // Authentication for private repositories. @@ -547,11 +547,11 @@ func init() { // The properties Token, Method are required. type DeploymentNewParamsSourceAuth struct { // GitHub PAT or installation access token - Token string `json:"token,required" format:"password"` + Token string `json:"token" api:"required" format:"password"` // Auth method // // Any of "github_token". - Method string `json:"method,omitzero,required"` + Method string `json:"method,omitzero" api:"required"` paramObj } diff --git a/extension.go b/extension.go index 9021c5f..4127432 100644 --- a/extension.go +++ b/extension.go @@ -98,16 +98,16 @@ func (r *ExtensionService) Upload(ctx context.Context, body ExtensionUploadParam // A browser extension uploaded to Kernel. type ExtensionListResponse struct { // Unique identifier for the extension - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Timestamp when the extension was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Size of the extension archive in bytes - SizeBytes int64 `json:"size_bytes,required"` + SizeBytes int64 `json:"size_bytes" api:"required"` // Timestamp when the extension was last used - LastUsedAt time.Time `json:"last_used_at,nullable" format:"date-time"` + LastUsedAt time.Time `json:"last_used_at" api:"nullable" format:"date-time"` // Optional, easier-to-reference name for the extension. Must be unique within the // organization. - Name string `json:"name,nullable"` + Name string `json:"name" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -129,16 +129,16 @@ func (r *ExtensionListResponse) UnmarshalJSON(data []byte) error { // A browser extension uploaded to Kernel. type ExtensionUploadResponse struct { // Unique identifier for the extension - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Timestamp when the extension was created - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Size of the extension archive in bytes - SizeBytes int64 `json:"size_bytes,required"` + SizeBytes int64 `json:"size_bytes" api:"required"` // Timestamp when the extension was last used - LastUsedAt time.Time `json:"last_used_at,nullable" format:"date-time"` + LastUsedAt time.Time `json:"last_used_at" api:"nullable" format:"date-time"` // Optional, easier-to-reference name for the extension. Must be unique within the // organization. - Name string `json:"name,nullable"` + Name string `json:"name" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -159,7 +159,7 @@ func (r *ExtensionUploadResponse) UnmarshalJSON(data []byte) error { type ExtensionDownloadFromChromeStoreParams struct { // Chrome Web Store URL for the extension. - URL string `query:"url,required" json:"-"` + URL string `query:"url" api:"required" json:"-"` // Target operating system for the extension package. Defaults to linux. // // Any of "win", "mac", "linux". @@ -187,7 +187,7 @@ const ( type ExtensionUploadParams struct { // ZIP file containing the browser extension. - File io.Reader `json:"file,omitzero,required" format:"binary"` + File io.Reader `json:"file,omitzero" api:"required" format:"binary"` // Optional unique name within the organization to reference this extension. Name param.Opt[string] `json:"name,omitzero"` paramObj diff --git a/internal/apiform/form_test.go b/internal/apiform/form_test.go index 26c66e1..b0b7ebe 100644 --- a/internal/apiform/form_test.go +++ b/internal/apiform/form_test.go @@ -48,18 +48,18 @@ type DateTime struct { type AdditionalProperties struct { A bool `form:"a"` - Extras map[string]any `form:"-,extras"` + Extras map[string]any `form:"-" api:"extrafields"` } type TypedAdditionalProperties struct { A bool `form:"a"` - Extras map[string]int `form:"-,extras"` + Extras map[string]int `form:"-" api:"extrafields"` } type EmbeddedStructs struct { AdditionalProperties A *int `form:"number2"` - Extras map[string]any `form:"-,extras"` + Extras map[string]any `form:"-" api:"extrafields"` } type Recursive struct { diff --git a/internal/apiform/tag.go b/internal/apiform/tag.go index 736fc1e..b353617 100644 --- a/internal/apiform/tag.go +++ b/internal/apiform/tag.go @@ -5,6 +5,7 @@ import ( "strings" ) +const apiStructTag = "api" const jsonStructTag = "json" const formStructTag = "form" const formatStructTag = "format" @@ -42,9 +43,27 @@ func parseFormStructTag(field reflect.StructField) (tag parsedStructTag, ok bool tag.omitzero = true } } + + parseApiStructTag(field, &tag) return } +func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) { + raw, ok := field.Tag.Lookup(apiStructTag) + if !ok { + return + } + parts := strings.Split(raw, ",") + for _, part := range parts { + switch part { + case "extrafields": + tag.extras = true + case "required": + tag.required = true + } + } +} + func parseFormatStructTag(field reflect.StructField) (format string, ok bool) { format, ok = field.Tag.Lookup(formatStructTag) return diff --git a/internal/apijson/decodeparam_test.go b/internal/apijson/decodeparam_test.go index df4e51e..2b4bb51 100644 --- a/internal/apijson/decodeparam_test.go +++ b/internal/apijson/decodeparam_test.go @@ -50,10 +50,10 @@ func TestOptionalDecoders(t *testing.T) { type paramObject = param.APIObject type BasicObject struct { - ReqInt int64 `json:"req_int,required"` - ReqFloat float64 `json:"req_float,required"` - ReqString string `json:"req_string,required"` - ReqBool bool `json:"req_bool,required"` + ReqInt int64 `json:"req_int" api:"required"` + ReqFloat float64 `json:"req_float" api:"required"` + ReqString string `json:"req_string" api:"required"` + ReqBool bool `json:"req_bool" api:"required"` OptInt param.Opt[int64] `json:"opt_int"` OptFloat param.Opt[float64] `json:"opt_float"` @@ -110,7 +110,7 @@ func TestBasicObject(t *testing.T) { } type ComplexObject struct { - Basic BasicObject `json:"basic,required"` + Basic BasicObject `json:"basic" api:"required"` Enum string `json:"enum"` paramObject } @@ -152,29 +152,29 @@ func TestComplexObject(t *testing.T) { type paramUnion = param.APIUnion type MemberA struct { - Name string `json:"name,required"` - Age int `json:"age,required"` + Name string `json:"name" api:"required"` + Age int `json:"age" api:"required"` } type MemberB struct { - Name string `json:"name,required"` - Age string `json:"age,required"` + Name string `json:"name" api:"required"` + Age string `json:"age" api:"required"` } type MemberC struct { - Name string `json:"name,required"` - Age int `json:"age,required"` + Name string `json:"name" api:"required"` + Age int `json:"age" api:"required"` Status string `json:"status"` } type MemberD struct { - Cost int `json:"cost,required"` - Status string `json:"status,required"` + Cost int `json:"cost" api:"required"` + Status string `json:"status" api:"required"` } type MemberE struct { - Cost int `json:"cost,required"` - Status string `json:"status,required"` + Cost int `json:"cost" api:"required"` + Status string `json:"status" api:"required"` } type MemberF struct { @@ -318,21 +318,21 @@ func (c ConstantB) Default() string { return "B" } func (c ConstantC) Default() string { return "C" } type DiscVariantA struct { - Name string `json:"name,required"` - Age int `json:"age,required"` - Type ConstantA `json:"type,required"` + Name string `json:"name" api:"required"` + Age int `json:"age" api:"required"` + Type ConstantA `json:"type" api:"required"` } type DiscVariantB struct { - Name string `json:"name,required"` - Age int `json:"age,required"` - Type ConstantB `json:"type,required"` + Name string `json:"name" api:"required"` + Age int `json:"age" api:"required"` + Type ConstantB `json:"type" api:"required"` } type DiscVariantC struct { - Name string `json:"name,required"` - Age float64 `json:"age,required"` - Type ConstantC `json:"type,required"` + Name string `json:"name" api:"required"` + Age float64 `json:"age" api:"required"` + Type ConstantC `json:"type" api:"required"` } type DiscriminatedUnion struct { @@ -352,13 +352,13 @@ func init() { } type FooVariant struct { - Type string `json:"type,required"` - Value string `json:"value,required"` + Type string `json:"type" api:"required"` + Value string `json:"value" api:"required"` } type BarVariant struct { - Type string `json:"type,required"` - Enable bool `json:"enable,required"` + Type string `json:"type" api:"required"` + Enable bool `json:"enable" api:"required"` } type MultiDiscriminatorUnion struct { diff --git a/internal/apijson/decoderesp_test.go b/internal/apijson/decoderesp_test.go index fc3d0c3..3a65ed1 100644 --- a/internal/apijson/decoderesp_test.go +++ b/internal/apijson/decoderesp_test.go @@ -8,7 +8,7 @@ import ( ) type StructWithNullExtraField struct { - Results []string `json:"results,required"` + Results []string `json:"results" api:"required"` JSON struct { Results respjson.Field ExtraFields map[string]respjson.Field diff --git a/internal/apijson/json_test.go b/internal/apijson/json_test.go index 02904d2..fac9fcc 100644 --- a/internal/apijson/json_test.go +++ b/internal/apijson/json_test.go @@ -40,12 +40,12 @@ type DateTime struct { type AdditionalProperties struct { A bool `json:"a"` - ExtraFields map[string]any `json:"-,extras"` + ExtraFields map[string]any `json:"-" api:"extrafields"` } type TypedAdditionalProperties struct { A bool `json:"a"` - ExtraFields map[string]int `json:"-,extras"` + ExtraFields map[string]int `json:"-" api:"extrafields"` } type EmbeddedStruct struct { @@ -65,7 +65,7 @@ type EmbeddedStructJSON struct { type EmbeddedStructs struct { EmbeddedStruct A *int `json:"a"` - ExtraFields map[string]any `json:"-,extras"` + ExtraFields map[string]any `json:"-" api:"extrafields"` JSON EmbeddedStructsJSON } @@ -86,7 +86,7 @@ type JSONFieldStruct struct { B int64 `json:"b"` C string `json:"c"` D string `json:"d"` - ExtraFields map[string]int64 `json:",extras"` + ExtraFields map[string]int64 `json:"" api:"extrafields"` JSON JSONFieldStructJSON `json:",metadata"` } diff --git a/internal/apijson/tag.go b/internal/apijson/tag.go index 812fb3c..49731b8 100644 --- a/internal/apijson/tag.go +++ b/internal/apijson/tag.go @@ -5,6 +5,7 @@ import ( "strings" ) +const apiStructTag = "api" const jsonStructTag = "json" const formatStructTag = "format" @@ -38,9 +39,28 @@ func parseJSONStructTag(field reflect.StructField) (tag parsedStructTag, ok bool tag.inline = true } } + + // the `api` struct tag is only used alongside `json` for custom behaviour + parseApiStructTag(field, &tag) return } +func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) { + raw, ok := field.Tag.Lookup(apiStructTag) + if !ok { + return + } + parts := strings.Split(raw, ",") + for _, part := range parts { + switch part { + case "extrafields": + tag.extras = true + case "required": + tag.required = true + } + } +} + func parseFormatStructTag(field reflect.StructField) (format string, ok bool) { format, ok = field.Tag.Lookup(formatStructTag) return diff --git a/internal/version.go b/internal/version.go index 23009ef..5b058ce 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.37.0" // x-release-please-version +const PackageVersion = "0.38.0" // x-release-please-version diff --git a/invocation.go b/invocation.go index a9f723f..b9fc47a 100644 --- a/invocation.go +++ b/invocation.go @@ -148,10 +148,10 @@ func (r *InvocationService) ListBrowsers(ctx context.Context, id string, opts .. // An event representing the current state of an invocation. type InvocationStateEvent struct { // Event type identifier (always "invocation_state"). - Event constant.InvocationState `json:"event,required"` - Invocation InvocationStateEventInvocation `json:"invocation,required"` + Event constant.InvocationState `json:"event" api:"required"` + Invocation InvocationStateEventInvocation `json:"invocation" api:"required"` // Time the state was reported. - Timestamp time.Time `json:"timestamp,required" format:"date-time"` + Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Event respjson.Field @@ -170,22 +170,22 @@ func (r *InvocationStateEvent) UnmarshalJSON(data []byte) error { type InvocationStateEventInvocation struct { // ID of the invocation - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Name of the action invoked - ActionName string `json:"action_name,required"` + ActionName string `json:"action_name" api:"required"` // Name of the application - AppName string `json:"app_name,required"` + AppName string `json:"app_name" api:"required"` // RFC 3339 Nanoseconds timestamp when the invocation started - StartedAt time.Time `json:"started_at,required" format:"date-time"` + StartedAt time.Time `json:"started_at" api:"required" format:"date-time"` // Status of the invocation // // Any of "queued", "running", "succeeded", "failed". - Status string `json:"status,required"` + Status string `json:"status" api:"required"` // Version label for the application - Version string `json:"version,required"` + Version string `json:"version" api:"required"` // RFC 3339 Nanoseconds timestamp when the invocation finished (null if still // running) - FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"` + FinishedAt time.Time `json:"finished_at" api:"nullable" format:"date-time"` // Output produced by the action, rendered as a JSON string. This could be: string, // number, boolean, array, object, or null. Output string `json:"output"` @@ -218,13 +218,13 @@ func (r *InvocationStateEventInvocation) UnmarshalJSON(data []byte) error { type InvocationNewResponse struct { // ID of the invocation - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Name of the action invoked - ActionName string `json:"action_name,required"` + ActionName string `json:"action_name" api:"required"` // Status of the invocation // // Any of "queued", "running", "succeeded", "failed". - Status InvocationNewResponseStatus `json:"status,required"` + Status InvocationNewResponseStatus `json:"status" api:"required"` // The return value of the action that was invoked, rendered as a JSON string. This // could be: string, number, boolean, array, object, or null. Output string `json:"output"` @@ -260,22 +260,22 @@ const ( type InvocationGetResponse struct { // ID of the invocation - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Name of the action invoked - ActionName string `json:"action_name,required"` + ActionName string `json:"action_name" api:"required"` // Name of the application - AppName string `json:"app_name,required"` + AppName string `json:"app_name" api:"required"` // RFC 3339 Nanoseconds timestamp when the invocation started - StartedAt time.Time `json:"started_at,required" format:"date-time"` + StartedAt time.Time `json:"started_at" api:"required" format:"date-time"` // Status of the invocation // // Any of "queued", "running", "succeeded", "failed". - Status InvocationGetResponseStatus `json:"status,required"` + Status InvocationGetResponseStatus `json:"status" api:"required"` // Version label for the application - Version string `json:"version,required"` + Version string `json:"version" api:"required"` // RFC 3339 Nanoseconds timestamp when the invocation finished (null if still // running) - FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"` + FinishedAt time.Time `json:"finished_at" api:"nullable" format:"date-time"` // Output produced by the action, rendered as a JSON string. This could be: string, // number, boolean, array, object, or null. Output string `json:"output"` @@ -318,22 +318,22 @@ const ( type InvocationUpdateResponse struct { // ID of the invocation - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Name of the action invoked - ActionName string `json:"action_name,required"` + ActionName string `json:"action_name" api:"required"` // Name of the application - AppName string `json:"app_name,required"` + AppName string `json:"app_name" api:"required"` // RFC 3339 Nanoseconds timestamp when the invocation started - StartedAt time.Time `json:"started_at,required" format:"date-time"` + StartedAt time.Time `json:"started_at" api:"required" format:"date-time"` // Status of the invocation // // Any of "queued", "running", "succeeded", "failed". - Status InvocationUpdateResponseStatus `json:"status,required"` + Status InvocationUpdateResponseStatus `json:"status" api:"required"` // Version label for the application - Version string `json:"version,required"` + Version string `json:"version" api:"required"` // RFC 3339 Nanoseconds timestamp when the invocation finished (null if still // running) - FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"` + FinishedAt time.Time `json:"finished_at" api:"nullable" format:"date-time"` // Output produced by the action, rendered as a JSON string. This could be: string, // number, boolean, array, object, or null. Output string `json:"output"` @@ -376,22 +376,22 @@ const ( type InvocationListResponse struct { // ID of the invocation - ID string `json:"id,required"` + ID string `json:"id" api:"required"` // Name of the action invoked - ActionName string `json:"action_name,required"` + ActionName string `json:"action_name" api:"required"` // Name of the application - AppName string `json:"app_name,required"` + AppName string `json:"app_name" api:"required"` // RFC 3339 Nanoseconds timestamp when the invocation started - StartedAt time.Time `json:"started_at,required" format:"date-time"` + StartedAt time.Time `json:"started_at" api:"required" format:"date-time"` // Status of the invocation // // Any of "queued", "running", "succeeded", "failed". - Status InvocationListResponseStatus `json:"status,required"` + Status InvocationListResponseStatus `json:"status" api:"required"` // Version label for the application - Version string `json:"version,required"` + Version string `json:"version" api:"required"` // RFC 3339 Nanoseconds timestamp when the invocation finished (null if still // running) - FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"` + FinishedAt time.Time `json:"finished_at" api:"nullable" format:"date-time"` // Output produced by the action, rendered as a JSON string. This could be: string, // number, boolean, array, object, or null. Output string `json:"output"` @@ -520,7 +520,7 @@ func (r *InvocationFollowResponseUnion) UnmarshalJSON(data []byte) error { } type InvocationListBrowsersResponse struct { - Browsers []InvocationListBrowsersResponseBrowser `json:"browsers,required"` + Browsers []InvocationListBrowsersResponseBrowser `json:"browsers" api:"required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Browsers respjson.Field @@ -537,17 +537,17 @@ func (r *InvocationListBrowsersResponse) UnmarshalJSON(data []byte) error { type InvocationListBrowsersResponseBrowser struct { // Websocket URL for Chrome DevTools Protocol connections to the browser session - CdpWsURL string `json:"cdp_ws_url,required"` + CdpWsURL string `json:"cdp_ws_url" api:"required"` // When the browser session was created. - CreatedAt time.Time `json:"created_at,required" format:"date-time"` + CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"` // Whether the browser session is running in headless mode. - Headless bool `json:"headless,required"` + Headless bool `json:"headless" api:"required"` // Unique identifier for the browser session - SessionID string `json:"session_id,required"` + SessionID string `json:"session_id" api:"required"` // Whether the browser session is running in stealth mode. - Stealth bool `json:"stealth,required"` + Stealth bool `json:"stealth" api:"required"` // The number of seconds of inactivity before the browser session is terminated. - TimeoutSeconds int64 `json:"timeout_seconds,required"` + TimeoutSeconds int64 `json:"timeout_seconds" api:"required"` // Remote URL for live viewing the browser session. Only available for non-headless // browsers. BrowserLiveViewURL string `json:"browser_live_view_url"` @@ -603,11 +603,11 @@ func (r *InvocationListBrowsersResponseBrowser) UnmarshalJSON(data []byte) error type InvocationNewParams struct { // Name of the action to invoke - ActionName string `json:"action_name,required"` + ActionName string `json:"action_name" api:"required"` // Name of the application - AppName string `json:"app_name,required"` + AppName string `json:"app_name" api:"required"` // Version of the application - Version string `json:"version,required"` + Version string `json:"version" api:"required"` // If true, invoke asynchronously. When set, the API responds 202 Accepted with // status "queued". Async param.Opt[bool] `json:"async,omitzero"` @@ -631,7 +631,7 @@ type InvocationUpdateParams struct { // New status for the invocation. // // Any of "succeeded", "failed". - Status InvocationUpdateParamsStatus `json:"status,omitzero,required"` + Status InvocationUpdateParamsStatus `json:"status,omitzero" api:"required"` // Updated output of the invocation rendered as JSON string. Output param.Opt[string] `json:"output,omitzero"` paramObj diff --git a/packages/respjson/decoder_test.go b/packages/respjson/decoder_test.go index b163661..61f6195 100644 --- a/packages/respjson/decoder_test.go +++ b/packages/respjson/decoder_test.go @@ -30,7 +30,7 @@ func (r *UnionOfStringIntOrObject) UnmarshalJSON(data []byte) error { type SubFields struct { OfBool bool `json:",inline"` - Name string `json:"name,required"` + Name string `json:"name" api:"required"` JSON struct { OfBool rj.Field Name rj.Field diff --git a/proxy.go b/proxy.go index 0cd6e66..a3f2c87 100644 --- a/proxy.go +++ b/proxy.go @@ -96,7 +96,7 @@ type ProxyNewResponse struct { // worst: `mobile` > `residential` > `isp` > `datacenter`. // // Any of "datacenter", "isp", "residential", "mobile", "custom". - Type ProxyNewResponseType `json:"type,required"` + Type ProxyNewResponseType `json:"type" api:"required"` ID string `json:"id"` // Configuration specific to the selected proxy `type`. Config ProxyNewResponseConfigUnion `json:"config"` @@ -341,9 +341,9 @@ func (r *ProxyNewResponseConfigMobileProxyConfig) UnmarshalJSON(data []byte) err // Configuration for a custom proxy (e.g., private proxy server). type ProxyNewResponseConfigCustomProxyConfig struct { // Proxy host address or IP. - Host string `json:"host,required"` + Host string `json:"host" api:"required"` // Proxy port. - Port int64 `json:"port,required"` + Port int64 `json:"port" api:"required"` // Whether the proxy has a password. HasPassword bool `json:"has_password"` // Username for proxy authentication. @@ -387,7 +387,7 @@ type ProxyGetResponse struct { // worst: `mobile` > `residential` > `isp` > `datacenter`. // // Any of "datacenter", "isp", "residential", "mobile", "custom". - Type ProxyGetResponseType `json:"type,required"` + Type ProxyGetResponseType `json:"type" api:"required"` ID string `json:"id"` // Configuration specific to the selected proxy `type`. Config ProxyGetResponseConfigUnion `json:"config"` @@ -632,9 +632,9 @@ func (r *ProxyGetResponseConfigMobileProxyConfig) UnmarshalJSON(data []byte) err // Configuration for a custom proxy (e.g., private proxy server). type ProxyGetResponseConfigCustomProxyConfig struct { // Proxy host address or IP. - Host string `json:"host,required"` + Host string `json:"host" api:"required"` // Proxy port. - Port int64 `json:"port,required"` + Port int64 `json:"port" api:"required"` // Whether the proxy has a password. HasPassword bool `json:"has_password"` // Username for proxy authentication. @@ -678,7 +678,7 @@ type ProxyListResponse struct { // worst: `mobile` > `residential` > `isp` > `datacenter`. // // Any of "datacenter", "isp", "residential", "mobile", "custom". - Type ProxyListResponseType `json:"type,required"` + Type ProxyListResponseType `json:"type" api:"required"` ID string `json:"id"` // Configuration specific to the selected proxy `type`. Config ProxyListResponseConfigUnion `json:"config"` @@ -923,9 +923,9 @@ func (r *ProxyListResponseConfigMobileProxyConfig) UnmarshalJSON(data []byte) er // Configuration for a custom proxy (e.g., private proxy server). type ProxyListResponseConfigCustomProxyConfig struct { // Proxy host address or IP. - Host string `json:"host,required"` + Host string `json:"host" api:"required"` // Proxy port. - Port int64 `json:"port,required"` + Port int64 `json:"port" api:"required"` // Whether the proxy has a password. HasPassword bool `json:"has_password"` // Username for proxy authentication. @@ -969,7 +969,7 @@ type ProxyCheckResponse struct { // worst: `mobile` > `residential` > `isp` > `datacenter`. // // Any of "datacenter", "isp", "residential", "mobile", "custom". - Type ProxyCheckResponseType `json:"type,required"` + Type ProxyCheckResponseType `json:"type" api:"required"` ID string `json:"id"` // Configuration specific to the selected proxy `type`. Config ProxyCheckResponseConfigUnion `json:"config"` @@ -1214,9 +1214,9 @@ func (r *ProxyCheckResponseConfigMobileProxyConfig) UnmarshalJSON(data []byte) e // Configuration for a custom proxy (e.g., private proxy server). type ProxyCheckResponseConfigCustomProxyConfig struct { // Proxy host address or IP. - Host string `json:"host,required"` + Host string `json:"host" api:"required"` // Proxy port. - Port int64 `json:"port,required"` + Port int64 `json:"port" api:"required"` // Whether the proxy has a password. HasPassword bool `json:"has_password"` // Username for proxy authentication. @@ -1259,7 +1259,7 @@ type ProxyNewParams struct { // worst: `mobile` > `residential` > `isp` > `datacenter`. // // Any of "datacenter", "isp", "residential", "mobile", "custom". - Type ProxyNewParamsType `json:"type,omitzero,required"` + Type ProxyNewParamsType `json:"type,omitzero" api:"required"` // Readable name of the proxy. Name param.Opt[string] `json:"name,omitzero"` // Configuration specific to the selected proxy `type`. @@ -1543,9 +1543,9 @@ func init() { // The properties Host, Port are required. type ProxyNewParamsConfigCreateCustomProxyConfig struct { // Proxy host address or IP. - Host string `json:"host,required"` + Host string `json:"host" api:"required"` // Proxy port. - Port int64 `json:"port,required"` + Port int64 `json:"port" api:"required"` // Password for proxy authentication. Password param.Opt[string] `json:"password,omitzero"` // Username for proxy authentication. diff --git a/shared/shared.go b/shared/shared.go index 2f0f440..4ea1150 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -21,13 +21,13 @@ type paramObj = param.APIObject // An action available on the app type AppAction struct { // Name of the action - Name string `json:"name,required"` + Name string `json:"name" api:"required"` // JSON Schema (draft-07) describing the expected input payload. Null if schema // could not be automatically generated. - InputSchema map[string]any `json:"input_schema,nullable"` + InputSchema map[string]any `json:"input_schema" api:"nullable"` // JSON Schema (draft-07) describing the expected output payload. Null if schema // could not be automatically generated. - OutputSchema map[string]any `json:"output_schema,nullable"` + OutputSchema map[string]any `json:"output_schema" api:"nullable"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Name respjson.Field @@ -165,9 +165,9 @@ func (r *BrowserProfileParam) UnmarshalJSON(data []byte) error { // bandwidth reasonable). type BrowserViewport struct { // Browser window height in pixels. - Height int64 `json:"height,required"` + Height int64 `json:"height" api:"required"` // Browser window width in pixels. - Width int64 `json:"width,required"` + Width int64 `json:"width" api:"required"` // Display refresh rate in Hz. If omitted, automatically determined from width and // height. RefreshRate int64 `json:"refresh_rate"` @@ -208,9 +208,9 @@ func (r BrowserViewport) ToParam() BrowserViewportParam { // The properties Height, Width are required. type BrowserViewportParam struct { // Browser window height in pixels. - Height int64 `json:"height,required"` + Height int64 `json:"height" api:"required"` // Browser window width in pixels. - Width int64 `json:"width,required"` + Width int64 `json:"width" api:"required"` // Display refresh rate in Hz. If omitted, automatically determined from width and // height. RefreshRate param.Opt[int64] `json:"refresh_rate,omitzero"` @@ -247,11 +247,11 @@ func (r *ErrorDetail) UnmarshalJSON(data []byte) error { // An error event from the application. type ErrorEvent struct { - Error ErrorModel `json:"error,required"` + Error ErrorModel `json:"error" api:"required"` // Event type identifier (always "error"). - Event constant.Error `json:"event,required"` + Event constant.Error `json:"event" api:"required"` // Time the error occurred. - Timestamp time.Time `json:"timestamp,required" format:"date-time"` + Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Error respjson.Field @@ -273,9 +273,9 @@ func (ErrorEvent) ImplAuthConnectionFollowResponseUnion() {} type ErrorModel struct { // Application-specific error code (machine-readable) - Code string `json:"code,required"` + Code string `json:"code" api:"required"` // Human-readable error description for debugging - Message string `json:"message,required"` + Message string `json:"message" api:"required"` // Additional error details (for multiple errors) Details []ErrorDetail `json:"details"` InnerError ErrorDetail `json:"inner_error"` @@ -299,9 +299,9 @@ func (r *ErrorModel) UnmarshalJSON(data []byte) error { // Heartbeat event sent periodically to keep SSE connection alive. type HeartbeatEvent struct { // Event type identifier (always "sse_heartbeat"). - Event constant.SseHeartbeat `json:"event,required"` + Event constant.SseHeartbeat `json:"event" api:"required"` // Time the heartbeat was sent. - Timestamp time.Time `json:"timestamp,required" format:"date-time"` + Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Event respjson.Field @@ -323,11 +323,11 @@ func (HeartbeatEvent) ImplAuthConnectionFollowResponseUnion() {} // A log entry from the application. type LogEvent struct { // Event type identifier (always "log"). - Event constant.Log `json:"event,required"` + Event constant.Log `json:"event" api:"required"` // Log message text. - Message string `json:"message,required"` + Message string `json:"message" api:"required"` // Time the log entry was produced. - Timestamp time.Time `json:"timestamp,required" format:"date-time"` + Timestamp time.Time `json:"timestamp" api:"required" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Event respjson.Field