| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
from typing import Mapping, Optional, cast |
| 4 |
|
| 5 |
import httpx2 |
| 6 |
|
| 7 |
from ..._files import deepcopy_with_paths |
| 8 |
from ..._types import ( |
| 9 |
Body, |
| 10 |
Omit, |
| 11 |
Query, |
| 12 |
Headers, |
| 13 |
NotGiven, |
| 14 |
FileTypes, |
| 15 |
SequenceNotStr, |
| 16 |
omit, |
| 17 |
not_given, |
| 18 |
) |
| 19 |
from ..._utils import extract_files, path_template, strip_not_given |
| 20 |
from .versions import ( |
| 21 |
Versions, |
| 22 |
AsyncVersions, |
| 23 |
VersionsWithRawResponse, |
| 24 |
AsyncVersionsWithRawResponse, |
| 25 |
VersionsWithStreamingResponse, |
| 26 |
AsyncVersionsWithStreamingResponse, |
| 27 |
) |
| 28 |
from ..._compat import cached_property |
| 29 |
from ..._resource import SyncAPIResource, AsyncAPIResource |
| 30 |
from ..._response import ( |
| 31 |
to_raw_response_wrapper, |
| 32 |
to_streamed_response_wrapper, |
| 33 |
async_to_raw_response_wrapper, |
| 34 |
async_to_streamed_response_wrapper, |
| 35 |
) |
| 36 |
from ...pagination import SyncPageCursor, AsyncPageCursor |
| 37 |
from ...types.skill import Skill |
| 38 |
from ..._base_client import AsyncPaginator, make_request_options |
| 39 |
from ...types.deleted_skill import DeletedSkill |
| 40 |
|
| 41 |
__all__ = ["Skills", "AsyncSkills"] |
| 42 |
|
| 43 |
|
| 44 |
class Skills(SyncAPIResource): |
| 45 |
@cached_property |
| 46 |
def versions(self) -> Versions: |
| 47 |
return Versions(self._client) |
| 48 |
|
| 49 |
@cached_property |
| 50 |
def with_raw_response(self) -> SkillsWithRawResponse: |
| 51 |
""" |
| 52 |
This property can be used as a prefix for any HTTP method call to return |
| 53 |
the raw response object instead of the parsed content. |
| 54 |
|
| 55 |
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers |
| 56 |
""" |
| 57 |
return SkillsWithRawResponse(self) |
| 58 |
|
| 59 |
@cached_property |
| 60 |
def with_streaming_response(self) -> SkillsWithStreamingResponse: |
| 61 |
""" |
| 62 |
An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 63 |
|
| 64 |
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response |
| 65 |
""" |
| 66 |
return SkillsWithStreamingResponse(self) |
| 67 |
|
| 68 |
def create( |
| 69 |
self, |
| 70 |
*, |
| 71 |
files: SequenceNotStr[FileTypes], |
| 72 |
display_name: Optional[str] | Omit = omit, |
| 73 |
workspace_id: str | Omit = omit, |
| 74 |
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 75 |
# The extra values given here take precedence over values defined on the client or passed to this method. |
| 76 |
extra_headers: Headers | None = None, |
| 77 |
extra_query: Query | None = None, |
| 78 |
extra_body: Body | None = None, |
| 79 |
timeout: float | httpx2.Timeout | None | NotGiven = not_given, |
| 80 |
) -> Skill: |
| 81 |
""" |
| 82 |
Create Skill |
| 83 |
|
| 84 |
Args: |
| 85 |
files: Files to upload for the skill. |
| 86 |
|
| 87 |
All files must be in the same top-level directory and must include a SKILL.md |
| 88 |
file at the root of that directory. |
| 89 |
|
| 90 |
display_name: Human-readable, single-line label for the Skill. Maximum 255 characters. Always |
| 91 |
set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not |
| 92 |
unique. |
| 93 |
|
| 94 |
workspace_id: Optional header to select the Workspace for this request. The value is a |
| 95 |
Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). |
| 96 |
|
| 97 |
Only needed for credentials that can act on more than one Workspace. A |
| 98 |
credential that belongs to a specific Workspace may omit it; if sent, it must |
| 99 |
match that Workspace. |
| 100 |
|
| 101 |
extra_headers: Send extra headers |
| 102 |
|
| 103 |
extra_query: Add additional query parameters to the request |
| 104 |
|
| 105 |
extra_body: Add additional JSON properties to the request |
| 106 |
|
| 107 |
timeout: Override the client-level default timeout for this request, in seconds |
| 108 |
""" |
| 109 |
extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} |
| 110 |
body = deepcopy_with_paths( |
| 111 |
{ |
| 112 |
"files": files, |
| 113 |
"display_name": display_name, |
| 114 |
}, |
| 115 |
[["files", "<array>"]], |
| 116 |
) |
| 117 |
extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "<array>"]]) |
| 118 |
# It should be noted that the actual Content-Type header that will be |
| 119 |
# sent to the server will contain a `boundary` parameter, e.g. |
| 120 |
# multipart/form-data; boundary=---abc-- |
| 121 |
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} |
| 122 |
return self._post( |
| 123 |
"/v1/skills", |
| 124 |
body=body, |
| 125 |
files=extracted_files, |
| 126 |
options=make_request_options( |
| 127 |
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 128 |
), |
| 129 |
cast_to=Skill, |
| 130 |
) |
| 131 |
|
| 132 |
def retrieve( |
| 133 |
self, |
| 134 |
skill_id: str, |
| 135 |
*, |
| 136 |
workspace_id: str | Omit = omit, |
| 137 |
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 138 |
# The extra values given here take precedence over values defined on the client or passed to this method. |
| 139 |
extra_headers: Headers | None = None, |
| 140 |
extra_query: Query | None = None, |
| 141 |
extra_body: Body | None = None, |
| 142 |
timeout: float | httpx2.Timeout | None | NotGiven = not_given, |
| 143 |
) -> Skill: |
| 144 |
""" |
| 145 |
Get Skill |
| 146 |
|
| 147 |
Args: |
| 148 |
skill_id: Unique identifier for the skill. |
| 149 |
|
| 150 |
The format and length of IDs may change over time. |
| 151 |
|
| 152 |
workspace_id: Optional header to select the Workspace for this request. The value is a |
| 153 |
Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). |
| 154 |
|
| 155 |
Only needed for credentials that can act on more than one Workspace. A |
| 156 |
credential that belongs to a specific Workspace may omit it; if sent, it must |
| 157 |
match that Workspace. |
| 158 |
|
| 159 |
extra_headers: Send extra headers |
| 160 |
|
| 161 |
extra_query: Add additional query parameters to the request |
| 162 |
|
| 163 |
extra_body: Add additional JSON properties to the request |
| 164 |
|
| 165 |
timeout: Override the client-level default timeout for this request, in seconds |
| 166 |
""" |
| 167 |
if not skill_id: |
| 168 |
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") |
| 169 |
extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} |
| 170 |
return self._get( |
| 171 |
path_template("/v1/skills/{skill_id}", skill_id=skill_id), |
| 172 |
options=make_request_options( |
| 173 |
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 174 |
), |
| 175 |
cast_to=Skill, |
| 176 |
) |
| 177 |
|
| 178 |
def list( |
| 179 |
self, |
| 180 |
*, |
| 181 |
limit: int | Omit = omit, |
| 182 |
page: Optional[str] | Omit = omit, |
| 183 |
source: Optional[str] | Omit = omit, |
| 184 |
workspace_id: str | Omit = omit, |
| 185 |
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 186 |
# The extra values given here take precedence over values defined on the client or passed to this method. |
| 187 |
extra_headers: Headers | None = None, |
| 188 |
extra_query: Query | None = None, |
| 189 |
extra_body: Body | None = None, |
| 190 |
timeout: float | httpx2.Timeout | None | NotGiven = not_given, |
| 191 |
) -> SyncPageCursor[Skill]: |
| 192 |
""" |
| 193 |
List Skills |
| 194 |
|
| 195 |
Args: |
| 196 |
limit: Number of results to return per page. |
| 197 |
|
| 198 |
Ranges from `1` to `1000`. Defaults to `20`. |
| 199 |
|
| 200 |
page: Pagination token for fetching a specific page of results. |
| 201 |
|
| 202 |
Pass the value from a previous response's `next_page` field to get the next page |
| 203 |
of results. |
| 204 |
|
| 205 |
source: Filter skills by source. |
| 206 |
|
| 207 |
If provided, only skills from the specified source will be returned: |
| 208 |
|
| 209 |
- `"custom"`: only return user-created skills |
| 210 |
- `"anthropic"`: only return Anthropic-created skills |
| 211 |
|
| 212 |
workspace_id: Optional header to select the Workspace for this request. The value is a |
| 213 |
Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). |
| 214 |
|
| 215 |
Only needed for credentials that can act on more than one Workspace. A |
| 216 |
credential that belongs to a specific Workspace may omit it; if sent, it must |
| 217 |
match that Workspace. |
| 218 |
|
| 219 |
extra_headers: Send extra headers |
| 220 |
|
| 221 |
extra_query: Add additional query parameters to the request |
| 222 |
|
| 223 |
extra_body: Add additional JSON properties to the request |
| 224 |
|
| 225 |
timeout: Override the client-level default timeout for this request, in seconds |
| 226 |
""" |
| 227 |
extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} |
| 228 |
return self._get_api_list( |
| 229 |
"/v1/skills", |
| 230 |
page=SyncPageCursor[Skill], |
| 231 |
options=make_request_options( |
| 232 |
extra_headers=extra_headers, |
| 233 |
extra_query=extra_query, |
| 234 |
extra_body=extra_body, |
| 235 |
timeout=timeout, |
| 236 |
query={ |
| 237 |
"limit": limit, |
| 238 |
"page": page, |
| 239 |
"source": source, |
| 240 |
}, |
| 241 |
), |
| 242 |
model=Skill, |
| 243 |
) |
| 244 |
|
| 245 |
def delete( |
| 246 |
self, |
| 247 |
skill_id: str, |
| 248 |
*, |
| 249 |
workspace_id: str | Omit = omit, |
| 250 |
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 251 |
# The extra values given here take precedence over values defined on the client or passed to this method. |
| 252 |
extra_headers: Headers | None = None, |
| 253 |
extra_query: Query | None = None, |
| 254 |
extra_body: Body | None = None, |
| 255 |
timeout: float | httpx2.Timeout | None | NotGiven = not_given, |
| 256 |
) -> DeletedSkill: |
| 257 |
""" |
| 258 |
Delete Skill |
| 259 |
|
| 260 |
Args: |
| 261 |
skill_id: Unique identifier for the skill. |
| 262 |
|
| 263 |
The format and length of IDs may change over time. |
| 264 |
|
| 265 |
workspace_id: Optional header to select the Workspace for this request. The value is a |
| 266 |
Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). |
| 267 |
|
| 268 |
Only needed for credentials that can act on more than one Workspace. A |
| 269 |
credential that belongs to a specific Workspace may omit it; if sent, it must |
| 270 |
match that Workspace. |
| 271 |
|
| 272 |
extra_headers: Send extra headers |
| 273 |
|
| 274 |
extra_query: Add additional query parameters to the request |
| 275 |
|
| 276 |
extra_body: Add additional JSON properties to the request |
| 277 |
|
| 278 |
timeout: Override the client-level default timeout for this request, in seconds |
| 279 |
""" |
| 280 |
if not skill_id: |
| 281 |
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") |
| 282 |
extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} |
| 283 |
return self._delete( |
| 284 |
path_template("/v1/skills/{skill_id}", skill_id=skill_id), |
| 285 |
options=make_request_options( |
| 286 |
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 287 |
), |
| 288 |
cast_to=DeletedSkill, |
| 289 |
) |
| 290 |
|
| 291 |
|
| 292 |
class AsyncSkills(AsyncAPIResource): |
| 293 |
@cached_property |
| 294 |
def versions(self) -> AsyncVersions: |
| 295 |
return AsyncVersions(self._client) |
| 296 |
|
| 297 |
@cached_property |
| 298 |
def with_raw_response(self) -> AsyncSkillsWithRawResponse: |
| 299 |
""" |
| 300 |
This property can be used as a prefix for any HTTP method call to return |
| 301 |
the raw response object instead of the parsed content. |
| 302 |
|
| 303 |
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers |
| 304 |
""" |
| 305 |
return AsyncSkillsWithRawResponse(self) |
| 306 |
|
| 307 |
@cached_property |
| 308 |
def with_streaming_response(self) -> AsyncSkillsWithStreamingResponse: |
| 309 |
""" |
| 310 |
An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 311 |
|
| 312 |
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response |
| 313 |
""" |
| 314 |
return AsyncSkillsWithStreamingResponse(self) |
| 315 |
|
| 316 |
async def create( |
| 317 |
self, |
| 318 |
*, |
| 319 |
files: SequenceNotStr[FileTypes], |
| 320 |
display_name: Optional[str] | Omit = omit, |
| 321 |
workspace_id: str | Omit = omit, |
| 322 |
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 323 |
# The extra values given here take precedence over values defined on the client or passed to this method. |
| 324 |
extra_headers: Headers | None = None, |
| 325 |
extra_query: Query | None = None, |
| 326 |
extra_body: Body | None = None, |
| 327 |
timeout: float | httpx2.Timeout | None | NotGiven = not_given, |
| 328 |
) -> Skill: |
| 329 |
""" |
| 330 |
Create Skill |
| 331 |
|
| 332 |
Args: |
| 333 |
files: Files to upload for the skill. |
| 334 |
|
| 335 |
All files must be in the same top-level directory and must include a SKILL.md |
| 336 |
file at the root of that directory. |
| 337 |
|
| 338 |
display_name: Human-readable, single-line label for the Skill. Maximum 255 characters. Always |
| 339 |
set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not |
| 340 |
unique. |
| 341 |
|
| 342 |
workspace_id: Optional header to select the Workspace for this request. The value is a |
| 343 |
Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). |
| 344 |
|
| 345 |
Only needed for credentials that can act on more than one Workspace. A |
| 346 |
credential that belongs to a specific Workspace may omit it; if sent, it must |
| 347 |
match that Workspace. |
| 348 |
|
| 349 |
extra_headers: Send extra headers |
| 350 |
|
| 351 |
extra_query: Add additional query parameters to the request |
| 352 |
|
| 353 |
extra_body: Add additional JSON properties to the request |
| 354 |
|
| 355 |
timeout: Override the client-level default timeout for this request, in seconds |
| 356 |
""" |
| 357 |
extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} |
| 358 |
body = deepcopy_with_paths( |
| 359 |
{ |
| 360 |
"files": files, |
| 361 |
"display_name": display_name, |
| 362 |
}, |
| 363 |
[["files", "<array>"]], |
| 364 |
) |
| 365 |
extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "<array>"]]) |
| 366 |
# It should be noted that the actual Content-Type header that will be |
| 367 |
# sent to the server will contain a `boundary` parameter, e.g. |
| 368 |
# multipart/form-data; boundary=---abc-- |
| 369 |
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} |
| 370 |
return await self._post( |
| 371 |
"/v1/skills", |
| 372 |
body=body, |
| 373 |
files=extracted_files, |
| 374 |
options=make_request_options( |
| 375 |
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 376 |
), |
| 377 |
cast_to=Skill, |
| 378 |
) |
| 379 |
|
| 380 |
async def retrieve( |
| 381 |
self, |
| 382 |
skill_id: str, |
| 383 |
*, |
| 384 |
workspace_id: str | Omit = omit, |
| 385 |
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 386 |
# The extra values given here take precedence over values defined on the client or passed to this method. |
| 387 |
extra_headers: Headers | None = None, |
| 388 |
extra_query: Query | None = None, |
| 389 |
extra_body: Body | None = None, |
| 390 |
timeout: float | httpx2.Timeout | None | NotGiven = not_given, |
| 391 |
) -> Skill: |
| 392 |
""" |
| 393 |
Get Skill |
| 394 |
|
| 395 |
Args: |
| 396 |
skill_id: Unique identifier for the skill. |
| 397 |
|
| 398 |
The format and length of IDs may change over time. |
| 399 |
|
| 400 |
workspace_id: Optional header to select the Workspace for this request. The value is a |
| 401 |
Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). |
| 402 |
|
| 403 |
Only needed for credentials that can act on more than one Workspace. A |
| 404 |
credential that belongs to a specific Workspace may omit it; if sent, it must |
| 405 |
match that Workspace. |
| 406 |
|
| 407 |
extra_headers: Send extra headers |
| 408 |
|
| 409 |
extra_query: Add additional query parameters to the request |
| 410 |
|
| 411 |
extra_body: Add additional JSON properties to the request |
| 412 |
|
| 413 |
timeout: Override the client-level default timeout for this request, in seconds |
| 414 |
""" |
| 415 |
if not skill_id: |
| 416 |
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") |
| 417 |
extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} |
| 418 |
return await self._get( |
| 419 |
path_template("/v1/skills/{skill_id}", skill_id=skill_id), |
| 420 |
options=make_request_options( |
| 421 |
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 422 |
), |
| 423 |
cast_to=Skill, |
| 424 |
) |
| 425 |
|
| 426 |
def list( |
| 427 |
self, |
| 428 |
*, |
| 429 |
limit: int | Omit = omit, |
| 430 |
page: Optional[str] | Omit = omit, |
| 431 |
source: Optional[str] | Omit = omit, |
| 432 |
workspace_id: str | Omit = omit, |
| 433 |
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 434 |
# The extra values given here take precedence over values defined on the client or passed to this method. |
| 435 |
extra_headers: Headers | None = None, |
| 436 |
extra_query: Query | None = None, |
| 437 |
extra_body: Body | None = None, |
| 438 |
timeout: float | httpx2.Timeout | None | NotGiven = not_given, |
| 439 |
) -> AsyncPaginator[Skill, AsyncPageCursor[Skill]]: |
| 440 |
""" |
| 441 |
List Skills |
| 442 |
|
| 443 |
Args: |
| 444 |
limit: Number of results to return per page. |
| 445 |
|
| 446 |
Ranges from `1` to `1000`. Defaults to `20`. |
| 447 |
|
| 448 |
page: Pagination token for fetching a specific page of results. |
| 449 |
|
| 450 |
Pass the value from a previous response's `next_page` field to get the next page |
| 451 |
of results. |
| 452 |
|
| 453 |
source: Filter skills by source. |
| 454 |
|
| 455 |
If provided, only skills from the specified source will be returned: |
| 456 |
|
| 457 |
- `"custom"`: only return user-created skills |
| 458 |
- `"anthropic"`: only return Anthropic-created skills |
| 459 |
|
| 460 |
workspace_id: Optional header to select the Workspace for this request. The value is a |
| 461 |
Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). |
| 462 |
|
| 463 |
Only needed for credentials that can act on more than one Workspace. A |
| 464 |
credential that belongs to a specific Workspace may omit it; if sent, it must |
| 465 |
match that Workspace. |
| 466 |
|
| 467 |
extra_headers: Send extra headers |
| 468 |
|
| 469 |
extra_query: Add additional query parameters to the request |
| 470 |
|
| 471 |
extra_body: Add additional JSON properties to the request |
| 472 |
|
| 473 |
timeout: Override the client-level default timeout for this request, in seconds |
| 474 |
""" |
| 475 |
extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} |
| 476 |
return self._get_api_list( |
| 477 |
"/v1/skills", |
| 478 |
page=AsyncPageCursor[Skill], |
| 479 |
options=make_request_options( |
| 480 |
extra_headers=extra_headers, |
| 481 |
extra_query=extra_query, |
| 482 |
extra_body=extra_body, |
| 483 |
timeout=timeout, |
| 484 |
query={ |
| 485 |
"limit": limit, |
| 486 |
"page": page, |
| 487 |
"source": source, |
| 488 |
}, |
| 489 |
), |
| 490 |
model=Skill, |
| 491 |
) |
| 492 |
|
| 493 |
async def delete( |
| 494 |
self, |
| 495 |
skill_id: str, |
| 496 |
*, |
| 497 |
workspace_id: str | Omit = omit, |
| 498 |
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 499 |
# The extra values given here take precedence over values defined on the client or passed to this method. |
| 500 |
extra_headers: Headers | None = None, |
| 501 |
extra_query: Query | None = None, |
| 502 |
extra_body: Body | None = None, |
| 503 |
timeout: float | httpx2.Timeout | None | NotGiven = not_given, |
| 504 |
) -> DeletedSkill: |
| 505 |
""" |
| 506 |
Delete Skill |
| 507 |
|
| 508 |
Args: |
| 509 |
skill_id: Unique identifier for the skill. |
| 510 |
|
| 511 |
The format and length of IDs may change over time. |
| 512 |
|
| 513 |
workspace_id: Optional header to select the Workspace for this request. The value is a |
| 514 |
Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). |
| 515 |
|
| 516 |
Only needed for credentials that can act on more than one Workspace. A |
| 517 |
credential that belongs to a specific Workspace may omit it; if sent, it must |
| 518 |
match that Workspace. |
| 519 |
|
| 520 |
extra_headers: Send extra headers |
| 521 |
|
| 522 |
extra_query: Add additional query parameters to the request |
| 523 |
|
| 524 |
extra_body: Add additional JSON properties to the request |
| 525 |
|
| 526 |
timeout: Override the client-level default timeout for this request, in seconds |
| 527 |
""" |
| 528 |
if not skill_id: |
| 529 |
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}") |
| 530 |
extra_headers = {**strip_not_given({"anthropic-workspace-id": workspace_id}), **(extra_headers or {})} |
| 531 |
return await self._delete( |
| 532 |
path_template("/v1/skills/{skill_id}", skill_id=skill_id), |
| 533 |
options=make_request_options( |
| 534 |
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 535 |
), |
| 536 |
cast_to=DeletedSkill, |
| 537 |
) |
| 538 |
|
| 539 |
|
| 540 |
class SkillsWithRawResponse: |
| 541 |
def __init__(self, skills: Skills) -> None: |
| 542 |
self._skills = skills |
| 543 |
|
| 544 |
self.create = to_raw_response_wrapper( |
| 545 |
skills.create, |
| 546 |
) |
| 547 |
self.retrieve = to_raw_response_wrapper( |
| 548 |
skills.retrieve, |
| 549 |
) |
| 550 |
self.list = to_raw_response_wrapper( |
| 551 |
skills.list, |
| 552 |
) |
| 553 |
self.delete = to_raw_response_wrapper( |
| 554 |
skills.delete, |
| 555 |
) |
| 556 |
|
| 557 |
@cached_property |
| 558 |
def versions(self) -> VersionsWithRawResponse: |
| 559 |
return VersionsWithRawResponse(self._skills.versions) |
| 560 |
|
| 561 |
|
| 562 |
class AsyncSkillsWithRawResponse: |
| 563 |
def __init__(self, skills: AsyncSkills) -> None: |
| 564 |
self._skills = skills |
| 565 |
|
| 566 |
self.create = async_to_raw_response_wrapper( |
| 567 |
skills.create, |
| 568 |
) |
| 569 |
self.retrieve = async_to_raw_response_wrapper( |
| 570 |
skills.retrieve, |
| 571 |
) |
| 572 |
self.list = async_to_raw_response_wrapper( |
| 573 |
skills.list, |
| 574 |
) |
| 575 |
self.delete = async_to_raw_response_wrapper( |
| 576 |
skills.delete, |
| 577 |
) |
| 578 |
|
| 579 |
@cached_property |
| 580 |
def versions(self) -> AsyncVersionsWithRawResponse: |
| 581 |
return AsyncVersionsWithRawResponse(self._skills.versions) |
| 582 |
|
| 583 |
|
| 584 |
class SkillsWithStreamingResponse: |
| 585 |
def __init__(self, skills: Skills) -> None: |
| 586 |
self._skills = skills |
| 587 |
|
| 588 |
self.create = to_streamed_response_wrapper( |
| 589 |
skills.create, |
| 590 |
) |
| 591 |
self.retrieve = to_streamed_response_wrapper( |
| 592 |
skills.retrieve, |
| 593 |
) |
| 594 |
self.list = to_streamed_response_wrapper( |
| 595 |
skills.list, |
| 596 |
) |
| 597 |
self.delete = to_streamed_response_wrapper( |
| 598 |
skills.delete, |
| 599 |
) |
| 600 |
|
| 601 |
@cached_property |
| 602 |
def versions(self) -> VersionsWithStreamingResponse: |
| 603 |
return VersionsWithStreamingResponse(self._skills.versions) |
| 604 |
|
| 605 |
|
| 606 |
class AsyncSkillsWithStreamingResponse: |
| 607 |
def __init__(self, skills: AsyncSkills) -> None: |
| 608 |
self._skills = skills |
| 609 |
|
| 610 |
self.create = async_to_streamed_response_wrapper( |
| 611 |
skills.create, |
| 612 |
) |
| 613 |
self.retrieve = async_to_streamed_response_wrapper( |
| 614 |
skills.retrieve, |
| 615 |
) |
| 616 |
self.list = async_to_streamed_response_wrapper( |
| 617 |
skills.list, |
| 618 |
) |
| 619 |
self.delete = async_to_streamed_response_wrapper( |
| 620 |
skills.delete, |
| 621 |
) |
| 622 |
|
| 623 |
@cached_property |
| 624 |
def versions(self) -> AsyncVersionsWithStreamingResponse: |
| 625 |
return AsyncVersionsWithStreamingResponse(self._skills.versions) |