From 7a80b01605d681eccdacac128c55fb792fdec2b6 Mon Sep 17 00:00:00 2001 From: Vicente Louvet III Date: Thu, 11 Jan 2024 10:07:39 -0700 Subject: [PATCH] searchMoreWithId functionality to SOAP interface (#71) * Update index.md add REST API example in Programmatic use section * Update SOAP client.py to include searchMoreWithId Added searchMoreWithId function in SOAP interface to be able to paginate results when more than 1000 returns. See the following docs for more information. https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3523074.html#searchMoreWithId * Update SOAP client.py to include searchMoreWithId Added searchMoreWithId function in SOAP interface to be able to paginate results when more than 1000 returns. See the following docs for more information. https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3523074.html#searchMoreWithId * formatted code with Black * removed duplicate function definition --------- Co-authored-by: Cameron Lofy --- netsuite/soap_api/client.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/netsuite/soap_api/client.py b/netsuite/soap_api/client.py index e3ac6c0..0525b41 100644 --- a/netsuite/soap_api/client.py +++ b/netsuite/soap_api/client.py @@ -467,6 +467,18 @@ async def search( "search", searchRecord=record, additionalHeaders=additionalHeaders ) + @WebServiceCall( + "body.searchResult", + extract=lambda resp: resp["recordList"]["record"], + ) + async def searchMoreWithId( + self, searchId: str, pageIndex: int + ) -> List[zeep.xsd.CompoundValue]: + """Search records with pagination""" + return await self.request( + "searchMoreWithId", searchId=searchId, pageIndex=pageIndex + ) + @WebServiceCall( "body.writeResponseList", extract=lambda resp: [record["baseRef"] for record in resp],