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

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/skills/versions.rb,
sig/anthropic/resources/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:



129
130
131
# File 'lib/anthropic/resources/skills/versions.rb', line 129

def initialize(client:)
  @client = client
end

Instance Method Details

#create(skill_id, files:, request_options: {}) ⇒ Anthropic::Models::Skills::SkillVersion

Create Skill Version

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

Parameters:

  • skill_id (String)

    Unique identifier for the skill.

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

    Files to upload for the skill.

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

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/anthropic/resources/skills/versions.rb', line 23

def create(skill_id, params)
  parsed, options = Anthropic::Skills::VersionCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/skills/%1$s/versions", skill_id],
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: Anthropic::Skills::SkillVersion,
    options: options
  )
end

#delete(version, skill_id:, request_options: {}) ⇒ Anthropic::Models::Skills::DeletedSkillVersion

Delete Skill Version

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

Parameters:

  • version (String)

    Identifies the skill version: a version ID, or — where the endpoint accepts it —

  • skill_id (String)

    Unique identifier for the skill.

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

Returns:

See Also:



112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/anthropic/resources/skills/versions.rb', line 112

def delete(version, params)
  parsed, options = Anthropic::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", skill_id, version],
    model: Anthropic::Skills::DeletedSkillVersion,
    options: options
  )
end

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

List Skill Versions

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

Parameters:

  • skill_id (String)

    Unique identifier for the skill.

  • limit (Integer, nil)

    Number of results to return per page.

  • page (String, nil)

    Optionally set to the next_page token from the previous response.

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

Returns:

See Also:



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/anthropic/resources/skills/versions.rb', line 83

def list(skill_id, params = {})
  parsed, options = Anthropic::Skills::VersionListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/skills/%1$s/versions", skill_id],
    query: query,
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Skills::SkillVersion,
    options: options
  )
end

#retrieve(version, skill_id:, request_options: {}) ⇒ Anthropic::Models::Skills::SkillVersion

Get Skill Version

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

Parameters:

  • version (String)

    Identifies the skill version: a version ID, or — where the endpoint accepts it —

  • skill_id (String)

    Unique identifier for the skill.

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

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/anthropic/resources/skills/versions.rb', line 51

def retrieve(version, params)
  parsed, options = Anthropic::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", skill_id, version],
    model: Anthropic::Skills::SkillVersion,
    options: options
  )
end