44
55import 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
88from .._types import Body , Omit , Query , Headers , NoneType , NotGiven , omit , not_given
99from .._utils import path_template , maybe_transform , async_maybe_transform
1010from .._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 )
0 commit comments