1818 async_to_streamed_response_wrapper ,
1919)
2020from ..._wrappers import ResultWrapper
21- from ..._base_client import make_request_options
22- from ...types .registrar import registration_edit_params , registration_create_params
21+ from ...pagination import SyncCursorPagination , AsyncCursorPagination
22+ from ..._base_client import AsyncPaginator , make_request_options
23+ from ...types .registrar import registration_edit_params , registration_list_params , registration_create_params
2324from ...types .registrar .registration import Registration
2425from ...types .registrar .workflow_status import WorkflowStatus
2526
@@ -193,6 +194,74 @@ def create(
193194 cast_to = cast (Type [WorkflowStatus ], ResultWrapper [WorkflowStatus ]),
194195 )
195196
197+ def list (
198+ self ,
199+ * ,
200+ account_id : str ,
201+ cursor : str | Omit = omit ,
202+ direction : Literal ["asc" , "desc" ] | Omit = omit ,
203+ per_page : int | Omit = omit ,
204+ sort_by : Literal ["registry_created_at" , "registry_expires_at" , "name" ] | Omit = omit ,
205+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
206+ # The extra values given here take precedence over values defined on the client or passed to this method.
207+ extra_headers : Headers | None = None ,
208+ extra_query : Query | None = None ,
209+ extra_body : Body | None = None ,
210+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
211+ ) -> SyncCursorPagination [Registration ]:
212+ """
213+ Returns a paginated list of domain registrations owned by the account.
214+
215+ This endpoint uses cursor-based pagination. Results are ordered by registration
216+ date by default. To fetch the next page, pass the `cursor` value from the
217+ `result_info` object in the response as the `cursor` query parameter in your
218+ next request. An empty `cursor` string indicates there are no more pages.
219+
220+ Args:
221+ account_id: Identifier
222+
223+ cursor: Opaque token from a previous response's `result_info.cursor`. Pass this value to
224+ fetch the next page of results. Omit (or pass an empty string) for the first
225+ page.
226+
227+ direction: Sort direction for results. Defaults to ascending order.
228+
229+ per_page: Number of items to return per page.
230+
231+ sort_by: Column to sort results by. Defaults to registration date (`registry_created_at`)
232+ when omitted.
233+
234+ extra_headers: Send extra headers
235+
236+ extra_query: Add additional query parameters to the request
237+
238+ extra_body: Add additional JSON properties to the request
239+
240+ timeout: Override the client-level default timeout for this request, in seconds
241+ """
242+ if not account_id :
243+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
244+ return self ._get_api_list (
245+ f"/accounts/{ account_id } /registrar/registrations" ,
246+ page = SyncCursorPagination [Registration ],
247+ options = make_request_options (
248+ extra_headers = extra_headers ,
249+ extra_query = extra_query ,
250+ extra_body = extra_body ,
251+ timeout = timeout ,
252+ query = maybe_transform (
253+ {
254+ "cursor" : cursor ,
255+ "direction" : direction ,
256+ "per_page" : per_page ,
257+ "sort_by" : sort_by ,
258+ },
259+ registration_list_params .RegistrationListParams ,
260+ ),
261+ ),
262+ model = Registration ,
263+ )
264+
196265 def edit (
197266 self ,
198267 domain_name : str ,
@@ -483,6 +552,74 @@ async def create(
483552 cast_to = cast (Type [WorkflowStatus ], ResultWrapper [WorkflowStatus ]),
484553 )
485554
555+ def list (
556+ self ,
557+ * ,
558+ account_id : str ,
559+ cursor : str | Omit = omit ,
560+ direction : Literal ["asc" , "desc" ] | Omit = omit ,
561+ per_page : int | Omit = omit ,
562+ sort_by : Literal ["registry_created_at" , "registry_expires_at" , "name" ] | Omit = omit ,
563+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
564+ # The extra values given here take precedence over values defined on the client or passed to this method.
565+ extra_headers : Headers | None = None ,
566+ extra_query : Query | None = None ,
567+ extra_body : Body | None = None ,
568+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
569+ ) -> AsyncPaginator [Registration , AsyncCursorPagination [Registration ]]:
570+ """
571+ Returns a paginated list of domain registrations owned by the account.
572+
573+ This endpoint uses cursor-based pagination. Results are ordered by registration
574+ date by default. To fetch the next page, pass the `cursor` value from the
575+ `result_info` object in the response as the `cursor` query parameter in your
576+ next request. An empty `cursor` string indicates there are no more pages.
577+
578+ Args:
579+ account_id: Identifier
580+
581+ cursor: Opaque token from a previous response's `result_info.cursor`. Pass this value to
582+ fetch the next page of results. Omit (or pass an empty string) for the first
583+ page.
584+
585+ direction: Sort direction for results. Defaults to ascending order.
586+
587+ per_page: Number of items to return per page.
588+
589+ sort_by: Column to sort results by. Defaults to registration date (`registry_created_at`)
590+ when omitted.
591+
592+ extra_headers: Send extra headers
593+
594+ extra_query: Add additional query parameters to the request
595+
596+ extra_body: Add additional JSON properties to the request
597+
598+ timeout: Override the client-level default timeout for this request, in seconds
599+ """
600+ if not account_id :
601+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
602+ return self ._get_api_list (
603+ f"/accounts/{ account_id } /registrar/registrations" ,
604+ page = AsyncCursorPagination [Registration ],
605+ options = make_request_options (
606+ extra_headers = extra_headers ,
607+ extra_query = extra_query ,
608+ extra_body = extra_body ,
609+ timeout = timeout ,
610+ query = maybe_transform (
611+ {
612+ "cursor" : cursor ,
613+ "direction" : direction ,
614+ "per_page" : per_page ,
615+ "sort_by" : sort_by ,
616+ },
617+ registration_list_params .RegistrationListParams ,
618+ ),
619+ ),
620+ model = Registration ,
621+ )
622+
486623 async def edit (
487624 self ,
488625 domain_name : str ,
@@ -615,6 +752,9 @@ def __init__(self, registrations: RegistrationsResource) -> None:
615752 self .create = to_raw_response_wrapper (
616753 registrations .create ,
617754 )
755+ self .list = to_raw_response_wrapper (
756+ registrations .list ,
757+ )
618758 self .edit = to_raw_response_wrapper (
619759 registrations .edit ,
620760 )
@@ -630,6 +770,9 @@ def __init__(self, registrations: AsyncRegistrationsResource) -> None:
630770 self .create = async_to_raw_response_wrapper (
631771 registrations .create ,
632772 )
773+ self .list = async_to_raw_response_wrapper (
774+ registrations .list ,
775+ )
633776 self .edit = async_to_raw_response_wrapper (
634777 registrations .edit ,
635778 )
@@ -645,6 +788,9 @@ def __init__(self, registrations: RegistrationsResource) -> None:
645788 self .create = to_streamed_response_wrapper (
646789 registrations .create ,
647790 )
791+ self .list = to_streamed_response_wrapper (
792+ registrations .list ,
793+ )
648794 self .edit = to_streamed_response_wrapper (
649795 registrations .edit ,
650796 )
@@ -660,6 +806,9 @@ def __init__(self, registrations: AsyncRegistrationsResource) -> None:
660806 self .create = async_to_streamed_response_wrapper (
661807 registrations .create ,
662808 )
809+ self .list = async_to_streamed_response_wrapper (
810+ registrations .list ,
811+ )
663812 self .edit = async_to_streamed_response_wrapper (
664813 registrations .edit ,
665814 )
0 commit comments