Class: Anthropic::Resources::Beta::Sessions::Resources

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/sessions/resources.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Resources

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 Resources.

Parameters:



178
179
180
# File 'lib/anthropic/resources/beta/sessions/resources.rb', line 178

def initialize(client:)
  @client = client
end

Instance Method Details

#add(session_id, file_id:, type:, mount_path: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Sessions::BetaManagedAgentsFileResource

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

Add Session Resource

Parameters:

Returns:

See Also:



162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/anthropic/resources/beta/sessions/resources.rb', line 162

def add(session_id, params)
  parsed, options = Anthropic::Beta::Sessions::ResourceAddParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @client.request(
    method: :post,
    path: ["v1/sessions/%1$s/resources?beta=true", session_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::Sessions::BetaManagedAgentsFileResource,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end

#delete(resource_id, session_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Sessions::BetaManagedAgentsDeleteSessionResource

Delete Session Resource

Parameters:

  • resource_id (String)

    Path param: Path parameter resource_id

  • session_id (String)

    Path param: Path parameter session_id

  • 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:



125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/anthropic/resources/beta/sessions/resources.rb', line 125

def delete(resource_id, params)
  parsed, options = Anthropic::Beta::Sessions::ResourceDeleteParams.dump_request(params)
  session_id =
    parsed.delete(:session_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["v1/sessions/%1$s/resources/%2$s?beta=true", session_id, resource_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::Sessions::BetaManagedAgentsDeleteSessionResource,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end

#list(session_id, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Sessions::BetaManagedAgentsGitHubRepositoryResource, Anthropic::Models::Beta::Sessions::BetaManagedAgentsFileResource>

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

List Session Resources

Parameters:

  • session_id (String)

    Path param: Path parameter session_id

  • limit (Integer)

    Query param: Maximum number of resources to return per page (max 1000). If omitt

  • page (String)

    Query param: Opaque cursor from a previous response’s next_page field.

  • 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:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/anthropic/resources/beta/sessions/resources.rb', line 95

def list(session_id, params = {})
  query_params = [:limit, :page]
  parsed, options = Anthropic::Beta::Sessions::ResourceListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["v1/sessions/%1$s/resources?beta=true", session_id],
    query: query,
    headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::Sessions::BetaManagedAgentsSessionResource,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end

#retrieve(resource_id, session_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Sessions::BetaManagedAgentsGitHubRepositoryResource, Anthropic::Models::Beta::Sessions::BetaManagedAgentsFileResource

Get Session Resource

Parameters:

  • resource_id (String)

    Path param: Path parameter resource_id

  • session_id (String)

    Path param: Path parameter session_id

  • 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:



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

def retrieve(resource_id, params)
  parsed, options = Anthropic::Beta::Sessions::ResourceRetrieveParams.dump_request(params)
  session_id =
    parsed.delete(:session_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["v1/sessions/%1$s/resources/%2$s?beta=true", session_id, resource_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Models::Beta::Sessions::ResourceRetrieveResponse,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end

#update(resource_id, session_id:, authorization_token:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Sessions::BetaManagedAgentsGitHubRepositoryResource, Anthropic::Models::Beta::Sessions::BetaManagedAgentsFileResource

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

Update Session Resource

Parameters:

  • resource_id (String)

    Path param: Path parameter resource_id

  • session_id (String)

    Path param: Path parameter session_id

  • authorization_token (String)

    Body param: New authorization token for the resource. Currently only ‘github_rep

  • 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:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/anthropic/resources/beta/sessions/resources.rb', line 58

def update(resource_id, params)
  parsed, options = Anthropic::Beta::Sessions::ResourceUpdateParams.dump_request(params)
  session_id =
    parsed.delete(:session_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  header_params = {betas: "anthropic-beta"}
  @client.request(
    method: :post,
    path: ["v1/sessions/%1$s/resources/%2$s?beta=true", session_id, resource_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Models::Beta::Sessions::ResourceUpdateResponse,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end