# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from sensory_cloud.generated.common import common_pb2 as common_dot_common__pb2
from sensory_cloud.generated.oauth import oauth_pb2 as oauth_dot_oauth__pb2


class OauthServiceStub(object):
    """Service for OAuth function
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.GetToken = channel.unary_unary(
                '/sensory.api.oauth.OauthService/GetToken',
                request_serializer=oauth_dot_oauth__pb2.TokenRequest.SerializeToString,
                response_deserializer=common_dot_common__pb2.TokenResponse.FromString,
                )
        self.SignToken = channel.unary_unary(
                '/sensory.api.oauth.OauthService/SignToken',
                request_serializer=oauth_dot_oauth__pb2.SignTokenRequest.SerializeToString,
                response_deserializer=common_dot_common__pb2.TokenResponse.FromString,
                )
        self.GetWhoAmI = channel.unary_unary(
                '/sensory.api.oauth.OauthService/GetWhoAmI',
                request_serializer=oauth_dot_oauth__pb2.WhoAmIRequest.SerializeToString,
                response_deserializer=oauth_dot_oauth__pb2.WhoAmIResponse.FromString,
                )
        self.GetPublicKey = channel.unary_unary(
                '/sensory.api.oauth.OauthService/GetPublicKey',
                request_serializer=oauth_dot_oauth__pb2.PublicKeyRequest.SerializeToString,
                response_deserializer=oauth_dot_oauth__pb2.PublicKeyResponse.FromString,
                )


class OauthServiceServicer(object):
    """Service for OAuth function
    """

    def GetToken(self, request, context):
        """Obtain an OAuth token for the given credentials
        Endpoint does not require an authorization token
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SignToken(self, request, context):
        """Sign and return an OAuth token. The passed authorization token must have the SignToken authority.
        Therefore, Devices are not allowed to make this request.
        Sign does not validate credentials, and therefore should be used in specific circumstances where credentials are not required.
        One common usecase for the Sign request is an Io server issuing a user-scoped token after a successful authentication.
        Only a limited subset of of scopes may be requested from the SignToken request.
        Authorization metadata is required {"authorization": "Bearer <TOKEN>"}
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetWhoAmI(self, request, context):
        """Obtain information about oneself based on the passed OAuth token
        Authorization metadata is required {"authorization": "Bearer <TOKEN>"}
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetPublicKey(self, request, context):
        """Retrieve a public key by ID. Public keys retrieved by this endpoint can be used
        to validate tokens signed by the Sensory cloud.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_OauthServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetToken': grpc.unary_unary_rpc_method_handler(
                    servicer.GetToken,
                    request_deserializer=oauth_dot_oauth__pb2.TokenRequest.FromString,
                    response_serializer=common_dot_common__pb2.TokenResponse.SerializeToString,
            ),
            'SignToken': grpc.unary_unary_rpc_method_handler(
                    servicer.SignToken,
                    request_deserializer=oauth_dot_oauth__pb2.SignTokenRequest.FromString,
                    response_serializer=common_dot_common__pb2.TokenResponse.SerializeToString,
            ),
            'GetWhoAmI': grpc.unary_unary_rpc_method_handler(
                    servicer.GetWhoAmI,
                    request_deserializer=oauth_dot_oauth__pb2.WhoAmIRequest.FromString,
                    response_serializer=oauth_dot_oauth__pb2.WhoAmIResponse.SerializeToString,
            ),
            'GetPublicKey': grpc.unary_unary_rpc_method_handler(
                    servicer.GetPublicKey,
                    request_deserializer=oauth_dot_oauth__pb2.PublicKeyRequest.FromString,
                    response_serializer=oauth_dot_oauth__pb2.PublicKeyResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'sensory.api.oauth.OauthService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class OauthService(object):
    """Service for OAuth function
    """

    @staticmethod
    def GetToken(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/sensory.api.oauth.OauthService/GetToken',
            oauth_dot_oauth__pb2.TokenRequest.SerializeToString,
            common_dot_common__pb2.TokenResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def SignToken(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/sensory.api.oauth.OauthService/SignToken',
            oauth_dot_oauth__pb2.SignTokenRequest.SerializeToString,
            common_dot_common__pb2.TokenResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetWhoAmI(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/sensory.api.oauth.OauthService/GetWhoAmI',
            oauth_dot_oauth__pb2.WhoAmIRequest.SerializeToString,
            oauth_dot_oauth__pb2.WhoAmIResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetPublicKey(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/sensory.api.oauth.OauthService/GetPublicKey',
            oauth_dot_oauth__pb2.PublicKeyRequest.SerializeToString,
            oauth_dot_oauth__pb2.PublicKeyResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
