Class: Anthropic::Resources::Beta::Dreams

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/dreams.rb,
sig/anthropic/resources/beta/dreams.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Dreams

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Dreams.

Parameters:



153
154
155
# File 'lib/anthropic/resources/beta/dreams.rb', line 153

def initialize(client:)
  @client = client
end

Instance Method Details

#archive(dream_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream

Archive a Dream

Parameters:

Returns:

See Also:



115
116
117
118
119
120
121
122
123
124
# File 'lib/anthropic/resources/beta/dreams.rb', line 115

def archive(dream_id, params = {})
  parsed, options = Anthropic::Beta::DreamArchiveParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/dreams/%1$s/archive?beta=true", dream_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::BetaDream,
    options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **options}
  )
end

#cancel(dream_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream

Cancel a Dream

Parameters:

Returns:

See Also:



139
140
141
142
143
144
145
146
147
148
# File 'lib/anthropic/resources/beta/dreams.rb', line 139

def cancel(dream_id, params = {})
  parsed, options = Anthropic::Beta::DreamCancelParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/dreams/%1$s/cancel?beta=true", dream_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::BetaDream,
    options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **options}
  )
end

#create(inputs:, model:, instructions: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream

Create a Dream

Parameters:

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/anthropic/resources/beta/dreams.rb', line 24

def create(params)
  parsed, options = Anthropic::Beta::DreamCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @client.request(
    method: :post,
    path: "v1/dreams?beta=true",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::BetaDream,
    options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **options}
  )
end

#list(created_at_gt: nil, created_at_lt: nil, include_archived: nil, limit: nil, page: nil, statuses: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::BetaDream>

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

List Dreams

Parameters:

  • created_at_gt (Time)

    Query param: Return dreams with created_at strictly after this timestamp (excl

  • created_at_lt (Time)

    Query param: Return dreams with created_at strictly before this timestamp (exc

  • include_archived (Boolean)

    Query param: Query parameter for include_archived

  • limit (Integer)

    Query param: Query parameter for limit

  • page (String)

    Query param: Query parameter for page

  • statuses (Array<Symbol, Anthropic::Models::Beta::BetaDreamStatus>)

    Query param: Filter by lifecycle status. Repeat the parameter to match any of mu

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/anthropic/resources/beta/dreams.rb', line 87

def list(params = {})
  query_params = [:created_at_gt, :created_at_lt, :include_archived, :limit, :page, :statuses]
  parsed, options = Anthropic::Beta::DreamListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v1/dreams?beta=true",
    query: query.transform_keys(created_at_gt: "created_at[gt]", created_at_lt: "created_at[lt]"),
    headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::BetaDream,
    options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **options}
  )
end

#retrieve(dream_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream

Get a Dream

Parameters:

Returns:

See Also:



50
51
52
53
54
55
56
57
58
59
# File 'lib/anthropic/resources/beta/dreams.rb', line 50

def retrieve(dream_id, params = {})
  parsed, options = Anthropic::Beta::DreamRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/dreams/%1$s?beta=true", dream_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::BetaDream,
    options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **options}
  )
end