Class: Anthropic::Resources::Beta::Skills::Versions

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Versions

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

Parameters:



197
198
199
# File 'lib/anthropic/resources/beta/skills/versions.rb', line 197

def initialize(client:)
  @client = client
end

Instance Method Details

#create(skill_id, files:, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Skills::BetaSkillVersion

Create Skill Version

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

Parameters:

  • skill_id (String)

    Path param: Unique identifier for the skill.

  • files (Array<Pathname, StringIO, IO, String, Anthropic::FilePart>)

    Body param: Files to upload for the skill.

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

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

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

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

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/anthropic/resources/beta/skills/versions.rb', line 28

def create(skill_id, params)
  parsed, options = Anthropic::Beta::Skills::VersionCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"}
  @client.request(
    method: :post,
    path: ["v1/skills/%1$s/versions?beta=true", skill_id],
    headers: {
      "content-type" => "multipart/form-data",
      **parsed.slice(*header_params.keys)
    }.transform_keys(
      header_params
    ),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::Skills::BetaSkillVersion,
    options: options
  )
end

#delete(version, skill_id:, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Skills::BetaDeletedSkillVersion

Delete Skill Version

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

Parameters:

  • version (String)

    Path param: Identifies the skill version by its version ID.

  • skill_id (String)

    Path param: Unique identifier for the skill.

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

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

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

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

Returns:

See Also:



141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/anthropic/resources/beta/skills/versions.rb', line 141

def delete(version, params)
  parsed, options = Anthropic::Beta::Skills::VersionDeleteParams.dump_request(params)
  skill_id =
    parsed.delete(:skill_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["v1/skills/%1$s/versions/%2$s?beta=true", skill_id, version],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::Skills::BetaDeletedSkillVersion,
    options: options
  )
end

#download(version, skill_id:, betas: nil, workspace_id: nil, request_options: {}) ⇒ StringIO

Download a skill version's content as a zip archive.

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

Parameters:

  • version (String)

    Path param: Identifies the skill version by its version ID.

  • skill_id (String)

    Path param: Unique identifier for the skill.

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

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

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

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

Returns:

  • (StringIO)

See Also:



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/anthropic/resources/beta/skills/versions.rb', line 176

def download(version, params)
  parsed, options = Anthropic::Beta::Skills::VersionDownloadParams.dump_request(params)
  skill_id =
    parsed.delete(:skill_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["v1/skills/%1$s/versions/%2$s/content?beta=true", skill_id, version],
    headers: {"accept" => "application/binary", **parsed}.transform_keys(
      betas: "anthropic-beta",
      workspace_id: "anthropic-workspace-id"
    ),
    model: StringIO,
    options: options
  )
end

#list(skill_id, limit: nil, page: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Skills::BetaSkillVersion>

List Skill Versions

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

Parameters:

  • skill_id (String)

    Path param: Unique identifier for the skill.

  • limit (Integer, nil)

    Query param: Number of results to return per page.

  • page (String, nil)

    Query param: Optionally set to the next_page token from the previous response.

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

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

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

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

Returns:

See Also:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/anthropic/resources/beta/skills/versions.rb', line 103

def list(skill_id, params = {})
  query_params = [:limit, :page]
  parsed, options = Anthropic::Beta::Skills::VersionListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["v1/skills/%1$s/versions?beta=true", skill_id],
    query: query,
    headers: parsed.except(*query_params).transform_keys(
      betas: "anthropic-beta",
      workspace_id: "anthropic-workspace-id"
    ),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::Skills::BetaSkillVersion,
    options: options
  )
end

#retrieve(version, skill_id:, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Skills::BetaSkillVersion

Get Skill Version

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

Parameters:

  • version (String)

    Path param: Identifies the skill version: a version ID, or the literal latest

  • skill_id (String)

    Path param: Unique identifier for the skill.

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

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

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

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

Returns:

See Also:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/anthropic/resources/beta/skills/versions.rb', line 66

def retrieve(version, params)
  parsed, options = Anthropic::Beta::Skills::VersionRetrieveParams.dump_request(params)
  skill_id =
    parsed.delete(:skill_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["v1/skills/%1$s/versions/%2$s?beta=true", skill_id, version],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::Skills::BetaSkillVersion,
    options: options
  )
end