text: # Generated file, please do not change!!!
  import typing
  
  from ...models.error import ErrorResponse
  from ...models.inventory import (
      InventoryEntry,
      InventoryEntryDraft,
      InventoryPagedQueryResponse,
  )
  from .by_project_key_inventory_by_id_request_builder import (
      ByProjectKeyInventoryByIDRequestBuilder,
  )
  
  if typing.TYPE_CHECKING:
      from ...base_client import BaseClient
  
  
  class ByProjectKeyInventoryRequestBuilder:
  
      _client: "BaseClient"
      _project_key: str
  
      def __init__(
          self,
          project_key: str,
          client: "BaseClient",
      ):
          self._project_key = project_key
          self._client = client
  
      def with_id(self, id: str) -> ByProjectKeyInventoryByIDRequestBuilder:
          return ByProjectKeyInventoryByIDRequestBuilder(
              id=id,
              project_key=self._project_key,
              client=self._client,
          )
  
      def get(
          self,
          *,
          expand: typing.List["str"] = None,
          sort: typing.List["str"] = None,
          limit: int = None,
          offset: int = None,
          with_total: bool = None,
          where: typing.List["str"] = None,
          predicate_var: typing.Dict[str, typing.List["str"]] = None,
          headers: typing.Dict[str, str] = None,
          options: typing.Dict[str, typing.Any] = None,
      ) -> typing.Optional["InventoryPagedQueryResponse"]:
          """Query inventory"""
          params = {
              "expand": expand,
              "sort": sort,
              "limit": limit,
              "offset": offset,
              "withTotal": with_total,
              "where": where,
          }
          predicate_var and params.update(
              {f"var.{k}": v for k, v in predicate_var.items()}
          )
          headers = {} if headers is None else headers
          response = self._client._get(
              endpoint=f"/{self._project_key}/inventory",
              params=params,
              headers=headers,
              options=options,
          )
          if response.status_code == 200:
              return InventoryPagedQueryResponse.deserialize(response.json())
          elif response.status_code in (400, 401, 403, 500, 503):
              obj = ErrorResponse.deserialize(response.json())
              raise self._client._create_exception(obj, response)
          elif response.status_code == 404:
              return None
          raise ValueError("Unhandled status code %s", response.status_code)
  
      def post(
          self,
          body: "InventoryEntryDraft",
          *,
          expand: typing.List["str"] = None,
          headers: typing.Dict[str, str] = None,
          options: typing.Dict[str, typing.Any] = None,
      ) -> typing.Optional["InventoryEntry"]:
          """Create InventoryEntry"""
          headers = {} if headers is None else headers
          response = self._client._post(
              endpoint=f"/{self._project_key}/inventory",
              params={"expand": expand},
              json=body.serialize(),
              headers={"Content-Type": "application/json", **headers},
              options=options,
          )
          if response.status_code == 201:
              return InventoryEntry.deserialize(response.json())
          elif response.status_code in (400, 401, 403, 500, 503):
              obj = ErrorResponse.deserialize(response.json())
              raise self._client._create_exception(obj, response)
          elif response.status_code == 404:
              return None
          elif response.status_code == 200:
              return None
          raise ValueError("Unhandled status code %s", response.status_code)
  