Skip to content

Commit

Permalink
docs: additional rest api documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Jan 24, 2024
1 parent 896be6f commit 81b629c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions netsuite/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ async def delete(self, subpath: str, **request_kw):
return await self._request("DELETE", subpath, **request_kw)

async def suiteql(self, q: str, limit: int = 10, offset: int = 0, **request_kw):
"""
suiteql(q="SELECT * FROM Transaction", limit=10, offset=0)
"""
return await self._request(
"POST",
# https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_156257799794.html#Using-SuiteQL
"/query/v1/suiteql",
headers={"Prefer": "transient", **request_kw.pop("headers", {})},
json={"q": q, **request_kw.pop("json", {})},
Expand All @@ -70,6 +74,17 @@ async def jsonschema(self, record_type: str, **request_kw):
)

async def openapi(self, record_types: Sequence[str] = (), **request_kw):
"""
Retrieves the OpenAPI specification (metadata catalog) for the Netsuite REST API.
Args:
record_types (Sequence[str]): Optional. List of record types to include in the OpenAPI specification.
**request_kw: Optional keyword arguments to be passed to the underlying request.
Returns:
The OpenAPI specification as a JSON object.
"""

headers = {
"Accept": "application/swagger+json",
**request_kw.pop("headers", {}),
Expand Down

0 comments on commit 81b629c

Please sign in to comment.