Module: Anthropic::Models::Beta::BetaBrowserStateChange

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/beta/beta_browser_state_change.rb

Overview

A tab this call's execution opened that remains open at its end — the creation delta of the tabs inventory, not an event log.

Carries only the tab_id; the tab's title and url live on its tabs entry, which must include the same tab_id. A tab opened during a failed call gets no deferred tab_opened; it simply appears in the next result's tabs inventory.

Class Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, derefed_variants, dump, hash, inspect, to_sorbet_type, variants

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Class Method Details

.new(type:, **args) ⇒ Anthropic::Models::Beta::BetaBrowserStateChangeTabOpened, ...

Creates a new instance of the variant class whose type matches the given value, passing the remaining arguments to its constructor.

Some parameter documentations has been truncated, see Anthropic::Models::Beta::BetaBrowserStateChange for more details.

Parameters:

  • type (Symbol, String)
  • args (Hash{Symbol=>Object})

    Attributes for the chosen variant.

    @option args [String] :tab_id The tab_id of the opened tab, present in tabs.

    @option args [String] :download_id The caller-assigned identifier for this download, stable across the state change

    @option args [String] :url The final post-redirect URL the download was served from.

    @option args [String, nil] :path Where the executor saved the file, on the executor's filesystem. Only included w

    @option args [Integer, nil] :size_bytes The completed download's size.

    @option args [String, nil] :error The failure or cancellation detail, when known.

Returns:

Raises:

  • (ArgumentError)


65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/anthropic/models/beta/beta_browser_state_change.rb', line 65

def self.new(type:, **args)
  case type.to_sym
  when :tab_opened
    Anthropic::Beta::BetaBrowserStateChangeTabOpened.new(**args)
  when :download_started
    Anthropic::Beta::BetaBrowserStateChangeDownloadStarted.new(**args)
  when :download_completed
    Anthropic::Beta::BetaBrowserStateChangeDownloadCompleted.new(**args)
  when :download_failed
    Anthropic::Beta::BetaBrowserStateChangeDownloadFailed.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end