#
# Autogenerated by Thrift
#
# DO NOT EDIT
#  @generated
#

from __future__ import annotations

import typing as _typing

import apache.thrift.metadata.thrift_types as _fbthrift_metadata
import folly.iobuf as _fbthrift_iobuf
from thrift.python.client import (
    AsyncClient as _fbthrift_python_AsyncClient,
    SyncClient as _fbthrift_python_SyncClient,
    Client as _fbthrift_python_Client,
)
from thrift.python.client.omni_client import InteractionMethodPosition as _fbthrift_InteractionMethodPosition, FunctionQualifier as _fbthrift_FunctionQualifier
from thrift.python.common import RpcOptions
import thrift.python.mutable_exceptions as _fbthrift_python_mutable_exceptions
import thrift.python.mutable_types as _fbthrift_python_mutable_types
import thrift.python.exceptions as _fbthrift_python_exceptions
import thrift.python.types as _fbthrift_python_types
import module.thrift_mutable_types
import module.thrift_metadata
import include.thrift_mutable_types

class PrimitivesService(_fbthrift_python_Client["PrimitivesService.Async", "PrimitivesService.Sync"]):
    @staticmethod
    def __get_thrift_name__() -> str:
        return "module.PrimitivesService"
    
    @staticmethod
    def __get_thrift_uri__() -> _typing.Optional[str]:
        return None
    
    @staticmethod
    def __get_thrift_unstructured_annotations_DEPRECATED__() -> _typing.Mapping[str, str]:
        return {
        }
    
    @staticmethod
    def __get_metadata__() -> _fbthrift_metadata.ThriftMetadata:
        return module.thrift_metadata.gen_metadata_service_PrimitivesService()
    
    class Async(_fbthrift_python_AsyncClient):
        @staticmethod
        def __get_thrift_name__() -> str:
            return "module.PrimitivesService"
    
        @staticmethod
        def __get_thrift_uri__() -> _typing.Optional[str]:
            return None
    
        @staticmethod
        def __get_metadata__() -> _fbthrift_metadata.ThriftMetadata:
            return module.thrift_metadata.gen_metadata_service_PrimitivesService()
    
        async def init(
            self,
            param0: int,
            param1: int,
            *,
            rpc_options: _typing.Optional[RpcOptions] = None,
        ) -> int:
            _fbthrift_resp = await self._send_request(
                "PrimitivesService",
                "init",
                module.thrift_mutable_types._fbthrift_PrimitivesService_init_args(
                    param0=param0,
                    param1=param1,),
                module.thrift_mutable_types._fbthrift_PrimitivesService_init_result,
                qualifier = _fbthrift_FunctionQualifier.Unspecified,
                uri_or_name="PrimitivesService",
                rpc_options=rpc_options,
                is_mutable_types=True,
            )
            # shortcut to success path for non-void returns
            if _fbthrift_resp.success is not None:
                return _fbthrift_resp.success
            raise _fbthrift_python_exceptions.ApplicationError(
                _fbthrift_python_exceptions.ApplicationErrorType.MISSING_RESULT,
                "Empty Response",
            )
    
        async def method_that_throws(
            self,
            *,
            rpc_options: _typing.Optional[RpcOptions] = None,
        ) -> module.thrift_mutable_types.Result:
            _fbthrift_resp = await self._send_request(
                "PrimitivesService",
                "method_that_throws",
                module.thrift_mutable_types._fbthrift_PrimitivesService_method_that_throws_args(),
                module.thrift_mutable_types._fbthrift_PrimitivesService_method_that_throws_result,
                qualifier = _fbthrift_FunctionQualifier.Unspecified,
                uri_or_name="PrimitivesService",
                rpc_options=rpc_options,
                is_mutable_types=True,
            )
            # shortcut to success path for non-void returns
            if _fbthrift_resp.success is not None:
                return _fbthrift_resp.success
            if _fbthrift_resp.e is not None:
                raise _fbthrift_resp.e
            raise _fbthrift_python_exceptions.ApplicationError(
                _fbthrift_python_exceptions.ApplicationErrorType.MISSING_RESULT,
                "Empty Response",
            )
    
        async def return_void_method(
            self,
            id: int,
            *,
            rpc_options: _typing.Optional[RpcOptions] = None,
        ) -> None:
            _fbthrift_resp = await self._send_request(
                "PrimitivesService",
                "return_void_method",
                module.thrift_mutable_types._fbthrift_PrimitivesService_return_void_method_args(
                    id=id,),
                module.thrift_mutable_types._fbthrift_PrimitivesService_return_void_method_result,
                qualifier = _fbthrift_FunctionQualifier.Unspecified,
                uri_or_name="PrimitivesService",
                rpc_options=rpc_options,
                is_mutable_types=True,
            )
    
    class Sync(_fbthrift_python_SyncClient):
        @staticmethod
        def __get_thrift_name__() -> str:
            return "module.PrimitivesService"
    
        @staticmethod
        def __get_thrift_uri__() -> _typing.Optional[str]:
            return None
    
        @staticmethod
        def __get_metadata__() -> _fbthrift_metadata.ThriftMetadata:
            return module.thrift_metadata.gen_metadata_service_PrimitivesService()
    
        def init(
            self,
            param0: int,
            param1: int,
            *,
            rpc_options: _typing.Optional[RpcOptions] = None,
        ) -> int:
            _fbthrift_resp = self._send_request(
                "PrimitivesService",
                "init",
                module.thrift_mutable_types._fbthrift_PrimitivesService_init_args(
                    param0=param0,
                    param1=param1,),
                module.thrift_mutable_types._fbthrift_PrimitivesService_init_result,
                uri_or_name="PrimitivesService",
                rpc_options=rpc_options,
                is_mutable_types=True,
            )
            # shortcut to success path for non-void returns
            if _fbthrift_resp.success is not None:
                return _fbthrift_resp.success
            raise _fbthrift_python_exceptions.ApplicationError(
                _fbthrift_python_exceptions.ApplicationErrorType.MISSING_RESULT,
                "Empty Response",
            )
    
        def method_that_throws(
            self,
            *,
            rpc_options: _typing.Optional[RpcOptions] = None,
        ) -> module.thrift_mutable_types.Result:
            _fbthrift_resp = self._send_request(
                "PrimitivesService",
                "method_that_throws",
                module.thrift_mutable_types._fbthrift_PrimitivesService_method_that_throws_args(),
                module.thrift_mutable_types._fbthrift_PrimitivesService_method_that_throws_result,
                uri_or_name="PrimitivesService",
                rpc_options=rpc_options,
                is_mutable_types=True,
            )
            # shortcut to success path for non-void returns
            if _fbthrift_resp.success is not None:
                return _fbthrift_resp.success
            if _fbthrift_resp.e is not None:
                raise _fbthrift_resp.e
            raise _fbthrift_python_exceptions.ApplicationError(
                _fbthrift_python_exceptions.ApplicationErrorType.MISSING_RESULT,
                "Empty Response",
            )
    
        def return_void_method(
            self,
            id: int,
            *,
            rpc_options: _typing.Optional[RpcOptions] = None,
        ) -> None:
            _fbthrift_resp = self._send_request(
                "PrimitivesService",
                "return_void_method",
                module.thrift_mutable_types._fbthrift_PrimitivesService_return_void_method_args(
                    id=id,),
                module.thrift_mutable_types._fbthrift_PrimitivesService_return_void_method_result,
                uri_or_name="PrimitivesService",
                rpc_options=rpc_options,
                is_mutable_types=True,
            )

