Skip to content

Commit 1d38266

Browse files
feat: Add name-only rename for profiles and proxies
1 parent 8c85318 commit 1d38266

11 files changed

Lines changed: 571 additions & 9 deletions

File tree

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 125
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-db45aab5b114bc0848eab997c85bfc02a653be9f929f8d090ec24187462733ee.yml
3-
openapi_spec_hash: 82f4282312699f8d54bec207e981efe8
4-
config_hash: 06186eb40e0058a2a87ac251fc07415d
1+
configured_endpoints: 127
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-bc33d13e669972493e9ab0da82a71999822dc049eb14b113f446753c917ffcdb.yml
3+
openapi_spec_hash: 133a2e0d0cdc4023f98b3c2e589cf5d8
4+
config_hash: 77ee715aa17061166f9a02b264a21b8d

api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ Methods:
285285

286286
- <code title="post /profiles">client.profiles.<a href="./src/kernel/resources/profiles.py">create</a>(\*\*<a href="src/kernel/types/profile_create_params.py">params</a>) -> <a href="./src/kernel/types/profile.py">Profile</a></code>
287287
- <code title="get /profiles/{id_or_name}">client.profiles.<a href="./src/kernel/resources/profiles.py">retrieve</a>(id_or_name) -> <a href="./src/kernel/types/profile.py">Profile</a></code>
288+
- <code title="patch /profiles/{id_or_name}">client.profiles.<a href="./src/kernel/resources/profiles.py">update</a>(id_or_name, \*\*<a href="src/kernel/types/profile_update_params.py">params</a>) -> <a href="./src/kernel/types/profile.py">Profile</a></code>
288289
- <code title="get /profiles">client.profiles.<a href="./src/kernel/resources/profiles.py">list</a>(\*\*<a href="src/kernel/types/profile_list_params.py">params</a>) -> <a href="./src/kernel/types/profile.py">SyncOffsetPagination[Profile]</a></code>
289290
- <code title="delete /profiles/{id_or_name}">client.profiles.<a href="./src/kernel/resources/profiles.py">delete</a>(id_or_name) -> None</code>
290291
- <code title="get /profiles/{id_or_name}/download">client.profiles.<a href="./src/kernel/resources/profiles.py">download</a>(id_or_name) -> BinaryAPIResponse</code>
@@ -328,6 +329,7 @@ Types:
328329
from kernel.types import (
329330
ProxyCreateResponse,
330331
ProxyRetrieveResponse,
332+
ProxyUpdateResponse,
331333
ProxyListResponse,
332334
ProxyCheckResponse,
333335
)
@@ -337,6 +339,7 @@ Methods:
337339

338340
- <code title="post /proxies">client.proxies.<a href="./src/kernel/resources/proxies.py">create</a>(\*\*<a href="src/kernel/types/proxy_create_params.py">params</a>) -> <a href="./src/kernel/types/proxy_create_response.py">ProxyCreateResponse</a></code>
339341
- <code title="get /proxies/{id}">client.proxies.<a href="./src/kernel/resources/proxies.py">retrieve</a>(id) -> <a href="./src/kernel/types/proxy_retrieve_response.py">ProxyRetrieveResponse</a></code>
342+
- <code title="patch /proxies/{id}">client.proxies.<a href="./src/kernel/resources/proxies.py">update</a>(id, \*\*<a href="src/kernel/types/proxy_update_params.py">params</a>) -> <a href="./src/kernel/types/proxy_update_response.py">ProxyUpdateResponse</a></code>
340343
- <code title="get /proxies">client.proxies.<a href="./src/kernel/resources/proxies.py">list</a>(\*\*<a href="src/kernel/types/proxy_list_params.py">params</a>) -> <a href="./src/kernel/types/proxy_list_response.py">SyncOffsetPagination[ProxyListResponse]</a></code>
341344
- <code title="delete /proxies/{id}">client.proxies.<a href="./src/kernel/resources/proxies.py">delete</a>(id) -> None</code>
342345
- <code title="post /proxies/{id}/check">client.proxies.<a href="./src/kernel/resources/proxies.py">check</a>(id, \*\*<a href="src/kernel/types/proxy_check_params.py">params</a>) -> <a href="./src/kernel/types/proxy_check_response.py">ProxyCheckResponse</a></code>

src/kernel/resources/profiles.py

Lines changed: 111 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import httpx
66

7-
from ..types import profile_list_params, profile_create_params
7+
from ..types import profile_list_params, profile_create_params, profile_update_params
88
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
99
from .._utils import path_template, maybe_transform, async_maybe_transform
1010
from .._compat import cached_property
@@ -68,7 +68,9 @@ def create(
6868
sessions.
6969
7070
Args:
71-
name: Optional name of the profile. Must be unique within the project.
71+
name: Optional name of the profile. Must be unique within the logical project; during
72+
the default-project migration, unscoped profiles and profiles in the org default
73+
project are treated as the same project.
7274
7375
extra_headers: Send extra headers
7476
@@ -120,6 +122,52 @@ def retrieve(
120122
cast_to=Profile,
121123
)
122124

125+
def update(
126+
self,
127+
id_or_name: str,
128+
*,
129+
name: str,
130+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
131+
# The extra values given here take precedence over values defined on the client or passed to this method.
132+
extra_headers: Headers | None = None,
133+
extra_query: Query | None = None,
134+
extra_body: Body | None = None,
135+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
136+
) -> Profile:
137+
"""Update a profile's name.
138+
139+
Names must be unique within the logical project; during
140+
the default-project migration, unscoped profiles and profiles in the org default
141+
project are treated as the same project. Duplicate-name conflicts are checked
142+
before update but are best-effort because there is no backing unique index.
143+
Renaming a profile while a browser session references it by name may prevent
144+
that session's changes from saving; prefer renaming when the profile is not in
145+
use.
146+
147+
Args:
148+
name: New profile name. Must be unique within the logical project; during the
149+
default-project migration, unscoped profiles and profiles in the org default
150+
project are treated as the same project.
151+
152+
extra_headers: Send extra headers
153+
154+
extra_query: Add additional query parameters to the request
155+
156+
extra_body: Add additional JSON properties to the request
157+
158+
timeout: Override the client-level default timeout for this request, in seconds
159+
"""
160+
if not id_or_name:
161+
raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}")
162+
return self._patch(
163+
path_template("/profiles/{id_or_name}", id_or_name=id_or_name),
164+
body=maybe_transform({"name": name}, profile_update_params.ProfileUpdateParams),
165+
options=make_request_options(
166+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
167+
),
168+
cast_to=Profile,
169+
)
170+
123171
def list(
124172
self,
125173
*,
@@ -278,7 +326,9 @@ async def create(
278326
sessions.
279327
280328
Args:
281-
name: Optional name of the profile. Must be unique within the project.
329+
name: Optional name of the profile. Must be unique within the logical project; during
330+
the default-project migration, unscoped profiles and profiles in the org default
331+
project are treated as the same project.
282332
283333
extra_headers: Send extra headers
284334
@@ -330,6 +380,52 @@ async def retrieve(
330380
cast_to=Profile,
331381
)
332382

383+
async def update(
384+
self,
385+
id_or_name: str,
386+
*,
387+
name: str,
388+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
389+
# The extra values given here take precedence over values defined on the client or passed to this method.
390+
extra_headers: Headers | None = None,
391+
extra_query: Query | None = None,
392+
extra_body: Body | None = None,
393+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
394+
) -> Profile:
395+
"""Update a profile's name.
396+
397+
Names must be unique within the logical project; during
398+
the default-project migration, unscoped profiles and profiles in the org default
399+
project are treated as the same project. Duplicate-name conflicts are checked
400+
before update but are best-effort because there is no backing unique index.
401+
Renaming a profile while a browser session references it by name may prevent
402+
that session's changes from saving; prefer renaming when the profile is not in
403+
use.
404+
405+
Args:
406+
name: New profile name. Must be unique within the logical project; during the
407+
default-project migration, unscoped profiles and profiles in the org default
408+
project are treated as the same project.
409+
410+
extra_headers: Send extra headers
411+
412+
extra_query: Add additional query parameters to the request
413+
414+
extra_body: Add additional JSON properties to the request
415+
416+
timeout: Override the client-level default timeout for this request, in seconds
417+
"""
418+
if not id_or_name:
419+
raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}")
420+
return await self._patch(
421+
path_template("/profiles/{id_or_name}", id_or_name=id_or_name),
422+
body=await async_maybe_transform({"name": name}, profile_update_params.ProfileUpdateParams),
423+
options=make_request_options(
424+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
425+
),
426+
cast_to=Profile,
427+
)
428+
333429
def list(
334430
self,
335431
*,
@@ -460,6 +556,9 @@ def __init__(self, profiles: ProfilesResource) -> None:
460556
self.retrieve = to_raw_response_wrapper(
461557
profiles.retrieve,
462558
)
559+
self.update = to_raw_response_wrapper(
560+
profiles.update,
561+
)
463562
self.list = to_raw_response_wrapper(
464563
profiles.list,
465564
)
@@ -482,6 +581,9 @@ def __init__(self, profiles: AsyncProfilesResource) -> None:
482581
self.retrieve = async_to_raw_response_wrapper(
483582
profiles.retrieve,
484583
)
584+
self.update = async_to_raw_response_wrapper(
585+
profiles.update,
586+
)
485587
self.list = async_to_raw_response_wrapper(
486588
profiles.list,
487589
)
@@ -504,6 +606,9 @@ def __init__(self, profiles: ProfilesResource) -> None:
504606
self.retrieve = to_streamed_response_wrapper(
505607
profiles.retrieve,
506608
)
609+
self.update = to_streamed_response_wrapper(
610+
profiles.update,
611+
)
507612
self.list = to_streamed_response_wrapper(
508613
profiles.list,
509614
)
@@ -526,6 +631,9 @@ def __init__(self, profiles: AsyncProfilesResource) -> None:
526631
self.retrieve = async_to_streamed_response_wrapper(
527632
profiles.retrieve,
528633
)
634+
self.update = async_to_streamed_response_wrapper(
635+
profiles.update,
636+
)
529637
self.list = async_to_streamed_response_wrapper(
530638
profiles.list,
531639
)

src/kernel/resources/proxies.py

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import httpx
88

9-
from ..types import proxy_list_params, proxy_check_params, proxy_create_params
9+
from ..types import proxy_list_params, proxy_check_params, proxy_create_params, proxy_update_params
1010
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given
1111
from .._utils import path_template, maybe_transform, async_maybe_transform
1212
from .._compat import cached_property
@@ -22,6 +22,7 @@
2222
from ..types.proxy_list_response import ProxyListResponse
2323
from ..types.proxy_check_response import ProxyCheckResponse
2424
from ..types.proxy_create_response import ProxyCreateResponse
25+
from ..types.proxy_update_response import ProxyUpdateResponse
2526
from ..types.proxy_retrieve_response import ProxyRetrieveResponse
2627

2728
__all__ = ["ProxiesResource", "AsyncProxiesResource"]
@@ -138,6 +139,48 @@ def retrieve(
138139
cast_to=ProxyRetrieveResponse,
139140
)
140141

142+
def update(
143+
self,
144+
id: str,
145+
*,
146+
name: str,
147+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
148+
# The extra values given here take precedence over values defined on the client or passed to this method.
149+
extra_headers: Headers | None = None,
150+
extra_query: Query | None = None,
151+
extra_body: Body | None = None,
152+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
153+
) -> ProxyUpdateResponse:
154+
"""Update a proxy's name.
155+
156+
Proxy names are not unique and are not ID-or-name
157+
addressable on this endpoint; duplicate names are allowed. Name-based
158+
session-create lookups can remain ambiguous until callers resolve proxies by ID
159+
or the API adds a stronger uniqueness contract.
160+
161+
Args:
162+
name: New proxy name. Proxy names are trimmed and length-checked only; duplicates are
163+
allowed because proxies are updated by ID, not by name.
164+
165+
extra_headers: Send extra headers
166+
167+
extra_query: Add additional query parameters to the request
168+
169+
extra_body: Add additional JSON properties to the request
170+
171+
timeout: Override the client-level default timeout for this request, in seconds
172+
"""
173+
if not id:
174+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
175+
return self._patch(
176+
path_template("/proxies/{id}", id=id),
177+
body=maybe_transform({"name": name}, proxy_update_params.ProxyUpdateParams),
178+
options=make_request_options(
179+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
180+
),
181+
cast_to=ProxyUpdateResponse,
182+
)
183+
141184
def list(
142185
self,
143186
*,
@@ -390,6 +433,48 @@ async def retrieve(
390433
cast_to=ProxyRetrieveResponse,
391434
)
392435

436+
async def update(
437+
self,
438+
id: str,
439+
*,
440+
name: str,
441+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
442+
# The extra values given here take precedence over values defined on the client or passed to this method.
443+
extra_headers: Headers | None = None,
444+
extra_query: Query | None = None,
445+
extra_body: Body | None = None,
446+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
447+
) -> ProxyUpdateResponse:
448+
"""Update a proxy's name.
449+
450+
Proxy names are not unique and are not ID-or-name
451+
addressable on this endpoint; duplicate names are allowed. Name-based
452+
session-create lookups can remain ambiguous until callers resolve proxies by ID
453+
or the API adds a stronger uniqueness contract.
454+
455+
Args:
456+
name: New proxy name. Proxy names are trimmed and length-checked only; duplicates are
457+
allowed because proxies are updated by ID, not by name.
458+
459+
extra_headers: Send extra headers
460+
461+
extra_query: Add additional query parameters to the request
462+
463+
extra_body: Add additional JSON properties to the request
464+
465+
timeout: Override the client-level default timeout for this request, in seconds
466+
"""
467+
if not id:
468+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
469+
return await self._patch(
470+
path_template("/proxies/{id}", id=id),
471+
body=await async_maybe_transform({"name": name}, proxy_update_params.ProxyUpdateParams),
472+
options=make_request_options(
473+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
474+
),
475+
cast_to=ProxyUpdateResponse,
476+
)
477+
393478
def list(
394479
self,
395480
*,
@@ -541,6 +626,9 @@ def __init__(self, proxies: ProxiesResource) -> None:
541626
self.retrieve = to_raw_response_wrapper(
542627
proxies.retrieve,
543628
)
629+
self.update = to_raw_response_wrapper(
630+
proxies.update,
631+
)
544632
self.list = to_raw_response_wrapper(
545633
proxies.list,
546634
)
@@ -562,6 +650,9 @@ def __init__(self, proxies: AsyncProxiesResource) -> None:
562650
self.retrieve = async_to_raw_response_wrapper(
563651
proxies.retrieve,
564652
)
653+
self.update = async_to_raw_response_wrapper(
654+
proxies.update,
655+
)
565656
self.list = async_to_raw_response_wrapper(
566657
proxies.list,
567658
)
@@ -583,6 +674,9 @@ def __init__(self, proxies: ProxiesResource) -> None:
583674
self.retrieve = to_streamed_response_wrapper(
584675
proxies.retrieve,
585676
)
677+
self.update = to_streamed_response_wrapper(
678+
proxies.update,
679+
)
586680
self.list = to_streamed_response_wrapper(
587681
proxies.list,
588682
)
@@ -604,6 +698,9 @@ def __init__(self, proxies: AsyncProxiesResource) -> None:
604698
self.retrieve = async_to_streamed_response_wrapper(
605699
proxies.retrieve,
606700
)
701+
self.update = async_to_streamed_response_wrapper(
702+
proxies.update,
703+
)
607704
self.list = async_to_streamed_response_wrapper(
608705
proxies.list,
609706
)

src/kernel/types/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from .project_list_params import ProjectListParams as ProjectListParams
3939
from .proxy_create_params import ProxyCreateParams as ProxyCreateParams
4040
from .proxy_list_response import ProxyListResponse as ProxyListResponse
41+
from .proxy_update_params import ProxyUpdateParams as ProxyUpdateParams
4142
from .proxy_check_response import ProxyCheckResponse as ProxyCheckResponse
4243
from .api_key_create_params import APIKeyCreateParams as APIKeyCreateParams
4344
from .api_key_rotate_params import APIKeyRotateParams as APIKeyRotateParams
@@ -49,9 +50,11 @@
4950
from .browser_update_params import BrowserUpdateParams as BrowserUpdateParams
5051
from .extension_list_params import ExtensionListParams as ExtensionListParams
5152
from .profile_create_params import ProfileCreateParams as ProfileCreateParams
53+
from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams
5254
from .project_create_params import ProjectCreateParams as ProjectCreateParams
5355
from .project_update_params import ProjectUpdateParams as ProjectUpdateParams
5456
from .proxy_create_response import ProxyCreateResponse as ProxyCreateResponse
57+
from .proxy_update_response import ProxyUpdateResponse as ProxyUpdateResponse
5558
from .credential_list_params import CredentialListParams as CredentialListParams
5659
from .deployment_list_params import DeploymentListParams as DeploymentListParams
5760
from .deployment_state_event import DeploymentStateEvent as DeploymentStateEvent

src/kernel/types/profile_create_params.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@
99

1010
class ProfileCreateParams(TypedDict, total=False):
1111
name: str
12-
"""Optional name of the profile. Must be unique within the project."""
12+
"""Optional name of the profile.
13+
14+
Must be unique within the logical project; during the default-project migration,
15+
unscoped profiles and profiles in the org default project are treated as the
16+
same project.
17+
"""

0 commit comments

Comments
 (0)