Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions src/anthropic/resources/beta/skills/skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ....pagination import SyncPageCursor, AsyncPageCursor
from ....pagination import SyncPage, AsyncPage
from ....types.beta import skill_list_params, skill_create_params
from ...._base_client import AsyncPaginator, make_request_options
from ....types.anthropic_beta_param import AnthropicBetaParam
Expand Down Expand Up @@ -193,7 +193,8 @@ def list(
self,
*,
limit: int | Omit = omit,
page: Optional[str] | Omit = omit,
after_id: Optional[str] | Omit = omit,
before_id: Optional[str] | Omit = omit,
source: Optional[str] | Omit = omit,
betas: List[AnthropicBetaParam] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -202,7 +203,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncPageCursor[SkillListResponse]:
) -> SyncPage[SkillListResponse]:
"""
List Skills

Expand All @@ -211,10 +212,11 @@ def list(

Maximum value is 100. Defaults to 20.

page: Pagination token for fetching a specific page of results.
after_id: ID of the object to use as the cursor for pagination.
When provided, returns the page of results immediately after this object.

Pass the value from a previous response's `next_page` field to get the next page
of results.
before_id: ID of the object to use as the cursor for pagination.
When provided, returns the page of results immediately before this object.

source: Filter skills by source.

Expand Down Expand Up @@ -246,7 +248,7 @@ def list(
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
return self._get_api_list(
"/v1/skills?beta=true",
page=SyncPageCursor[SkillListResponse],
page=SyncPage[SkillListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -255,7 +257,8 @@ def list(
query=maybe_transform(
{
"limit": limit,
"page": page,
"after_id": after_id,
"before_id": before_id,
"source": source,
},
skill_list_params.SkillListParams,
Expand Down Expand Up @@ -465,7 +468,8 @@ def list(
self,
*,
limit: int | Omit = omit,
page: Optional[str] | Omit = omit,
after_id: Optional[str] | Omit = omit,
before_id: Optional[str] | Omit = omit,
source: Optional[str] | Omit = omit,
betas: List[AnthropicBetaParam] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -474,7 +478,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[SkillListResponse, AsyncPageCursor[SkillListResponse]]:
) -> AsyncPaginator[SkillListResponse, AsyncPage[SkillListResponse]]:
"""
List Skills

Expand All @@ -483,10 +487,11 @@ def list(

Maximum value is 100. Defaults to 20.

page: Pagination token for fetching a specific page of results.
after_id: ID of the object to use as the cursor for pagination.
When provided, returns the page of results immediately after this object.

Pass the value from a previous response's `next_page` field to get the next page
of results.
before_id: ID of the object to use as the cursor for pagination.
When provided, returns the page of results immediately before this object.

source: Filter skills by source.

Expand Down Expand Up @@ -518,7 +523,7 @@ def list(
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
return self._get_api_list(
"/v1/skills?beta=true",
page=AsyncPageCursor[SkillListResponse],
page=AsyncPage[SkillListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -527,7 +532,8 @@ def list(
query=maybe_transform(
{
"limit": limit,
"page": page,
"after_id": after_id,
"before_id": before_id,
"source": source,
},
skill_list_params.SkillListParams,
Expand Down
13 changes: 9 additions & 4 deletions src/anthropic/types/beta/skill_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ class SkillListParams(TypedDict, total=False):
Maximum value is 100. Defaults to 20.
"""

page: Optional[str]
"""Pagination token for fetching a specific page of results.
after_id: Optional[str]
"""ID of the object to use as the cursor for pagination.

Pass the value from a previous response's `next_page` field to get the next page
of results.
When provided, returns the page of results immediately after this object.
"""

before_id: Optional[str]
"""ID of the object to use as the cursor for pagination.

When provided, returns the page of results immediately before this object.
"""

source: Optional[str]
Expand Down
24 changes: 13 additions & 11 deletions tests/api_resources/beta/test_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from anthropic import Anthropic, AsyncAnthropic
from tests.utils import assert_matches_type
from anthropic.pagination import SyncPageCursor, AsyncPageCursor
from anthropic.pagination import SyncPage, AsyncPage
from anthropic.types.beta import (
SkillListResponse,
SkillCreateResponse,
Expand Down Expand Up @@ -106,17 +106,18 @@ def test_path_params_retrieve(self, client: Anthropic) -> None:
@parametrize
def test_method_list(self, client: Anthropic) -> None:
skill = client.beta.skills.list()
assert_matches_type(SyncPageCursor[SkillListResponse], skill, path=["response"])
assert_matches_type(SyncPage[SkillListResponse], skill, path=["response"])

@parametrize
def test_method_list_with_all_params(self, client: Anthropic) -> None:
skill = client.beta.skills.list(
limit=0,
page="page",
after_id="after_id",
before_id="before_id",
source="source",
betas=["string"],
)
assert_matches_type(SyncPageCursor[SkillListResponse], skill, path=["response"])
assert_matches_type(SyncPage[SkillListResponse], skill, path=["response"])

@parametrize
def test_raw_response_list(self, client: Anthropic) -> None:
Expand All @@ -125,7 +126,7 @@ def test_raw_response_list(self, client: Anthropic) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
skill = response.parse()
assert_matches_type(SyncPageCursor[SkillListResponse], skill, path=["response"])
assert_matches_type(SyncPage[SkillListResponse], skill, path=["response"])

@parametrize
def test_streaming_response_list(self, client: Anthropic) -> None:
Expand All @@ -134,7 +135,7 @@ def test_streaming_response_list(self, client: Anthropic) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

skill = response.parse()
assert_matches_type(SyncPageCursor[SkillListResponse], skill, path=["response"])
assert_matches_type(SyncPage[SkillListResponse], skill, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -273,17 +274,18 @@ async def test_path_params_retrieve(self, async_client: AsyncAnthropic) -> None:
@parametrize
async def test_method_list(self, async_client: AsyncAnthropic) -> None:
skill = await async_client.beta.skills.list()
assert_matches_type(AsyncPageCursor[SkillListResponse], skill, path=["response"])
assert_matches_type(AsyncPage[SkillListResponse], skill, path=["response"])

@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) -> None:
skill = await async_client.beta.skills.list(
limit=0,
page="page",
after_id="after_id",
before_id="before_id",
source="source",
betas=["string"],
)
assert_matches_type(AsyncPageCursor[SkillListResponse], skill, path=["response"])
assert_matches_type(AsyncPage[SkillListResponse], skill, path=["response"])

@parametrize
async def test_raw_response_list(self, async_client: AsyncAnthropic) -> None:
Expand All @@ -292,7 +294,7 @@ async def test_raw_response_list(self, async_client: AsyncAnthropic) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
skill = response.parse()
assert_matches_type(AsyncPageCursor[SkillListResponse], skill, path=["response"])
assert_matches_type(AsyncPage[SkillListResponse], skill, path=["response"])

@parametrize
async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> None:
Expand All @@ -301,7 +303,7 @@ async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

skill = await response.parse()
assert_matches_type(AsyncPageCursor[SkillListResponse], skill, path=["response"])
assert_matches_type(AsyncPage[SkillListResponse], skill, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down