# Path: kiel/protocol/request.py
# class Request(Part):
#     """
#     Base class for all requests sent to brokers.
# 
#     A specialized subclass of ``Part`` with attributes for correlating
#     responses and prefacing payloads with client/api metadata.
#     """
#     api = None
# 
#     def __init__(self, **kwargs):
#         super(Request, self).__init__(**kwargs)
# 
#         self.client_id = CLIENT_ID
#         self.api_key = API_KEYS[self.api]
#         self.api_version = API_VERSION
#         self.correlation_id = generate_correlation_id()
# 
#     def serialize(self):
#         """
#         Returns a bytesring representation of the request instance.
# 
#         Prefaces the output with certain information::
# 
#           api_key => Int16
#           api_version => Int16
#           correlation_id => Int32
#           client_id => String
# 
#         Since this is a ``Part`` subclass the rest is a matter of
#         appending the result of a ``render()`` call.
#         """
#         buff = BytesIO()
# 
#         preamble_parts = (
#             ("api_key", Int16),
#             ("api_version", Int16),
#             ("correlation_id", Int32),
#             ("client_id", String),
#         )
# 
#         preamble_format, data = self.render(preamble_parts)
# 
#         payload_format, payload_data = self.render()
# 
#         fmt = "".join(["!", preamble_format, payload_format])
#         data.extend(payload_data)
# 
#         buff.write(struct.pack(fmt, *data))
# 
#         return buff.getvalue()
# 
# Path: kiel/protocol/response.py
# class Response(Part):
#     """
#     Base class for all api response classes.
# 
#     A simple class, has only an ``api`` attribute expected to be defined by
#     subclasses, and a `deserialize()` classmethod.
#     """
#     api = None
# 
#     @classmethod
#     def deserialize(cls, raw_bytes):
#         """
#         Deserializes the given raw bytes into an instance.
# 
#         Since this is a subclass of ``Part`` but a top-level one (i.e. no other
#         subclass of ``Part`` would have a ``Response`` as a part) this merely
#         has to parse the raw bytes and discard the resulting offset.
#         """
#         instance, _ = cls.parse(raw_bytes, offset=0)
# 
#         return instance
# 
# Path: kiel/protocol/primitives.py
# class String(VariablePrimitive):
#     """
#     Represents a string value, length denoted by a 16-bit signed integer.
#     """
#     size_primitive = Int16
# 
#     def __repr__(self):
#         return repr(self.value)
# 
# class Int16(Primitive):
#     """
#     Represents an 16-bit signed integer.
#     """
#     fmt = "h"
# 
# class Int32(Primitive):
#     """
#     Represents an 32-bit signed integer.
#     """
#     fmt = "i"


from .request import Request
from .response import Response
from .primitives import String, Int16, Int32


api_name = "heartbeat"


__all__ = [
    "HeartbeatRequest",
    "HeartbeatResponse"
]


class HeartbeatRequest(Request):
    """
    ::

      HeartbeatRequest =>
        group_id => String
        generation_id = Int32
        member_id => String
    """
    api = "heartbeat"

    parts = (
        "group_id", String,
        "generation_id", Int32,

# Path: kiel/protocol/request.py
# class Request(Part):
#     """
#     Base class for all requests sent to brokers.
# 
#     A specialized subclass of ``Part`` with attributes for correlating
#     responses and prefacing payloads with client/api metadata.
#     """
#     api = None
# 
#     def __init__(self, **kwargs):
#         super(Request, self).__init__(**kwargs)
# 
#         self.client_id = CLIENT_ID
#         self.api_key = API_KEYS[self.api]
#         self.api_version = API_VERSION
#         self.correlation_id = generate_correlation_id()
# 
#     def serialize(self):
#         """
#         Returns a bytesring representation of the request instance.
# 
#         Prefaces the output with certain information::
# 
#           api_key => Int16
#           api_version => Int16
#           correlation_id => Int32
#           client_id => String
# 
#         Since this is a ``Part`` subclass the rest is a matter of
#         appending the result of a ``render()`` call.
#         """
#         buff = BytesIO()
# 
#         preamble_parts = (
#             ("api_key", Int16),
#             ("api_version", Int16),
#             ("correlation_id", Int32),
#             ("client_id", String),
#         )
# 
#         preamble_format, data = self.render(preamble_parts)
# 
#         payload_format, payload_data = self.render()
# 
#         fmt = "".join(["!", preamble_format, payload_format])
#         data.extend(payload_data)
# 
#         buff.write(struct.pack(fmt, *data))
# 
#         return buff.getvalue()
# 
# Path: kiel/protocol/response.py
# class Response(Part):
#     """
#     Base class for all api response classes.
# 
#     A simple class, has only an ``api`` attribute expected to be defined by
#     subclasses, and a `deserialize()` classmethod.
#     """
#     api = None
# 
#     @classmethod
#     def deserialize(cls, raw_bytes):
#         """
#         Deserializes the given raw bytes into an instance.
# 
#         Since this is a subclass of ``Part`` but a top-level one (i.e. no other
#         subclass of ``Part`` would have a ``Response`` as a part) this merely
#         has to parse the raw bytes and discard the resulting offset.
#         """
#         instance, _ = cls.parse(raw_bytes, offset=0)
# 
#         return instance
# 
# Path: kiel/protocol/primitives.py
# class String(VariablePrimitive):
#     """
#     Represents a string value, length denoted by a 16-bit signed integer.
#     """
#     size_primitive = Int16
# 
#     def __repr__(self):
#         return repr(self.value)
# 
# class Int16(Primitive):
#     """
#     Represents an 16-bit signed integer.
#     """
#     fmt = "h"
# 
# class Int32(Primitive):
#     """
#     Represents an 32-bit signed integer.
#     """
#     fmt = "i"


# Path: kiel/protocol/heartbeat.py
from .request import Request
from .response import Response
from .primitives import String, Int16, Int32



api_name = "heartbeat"


__all__ = [
    "HeartbeatRequest",
    "HeartbeatResponse"
]


class HeartbeatRequest(Request):
    """
    ::

      HeartbeatRequest =>
        group_id => String
        generation_id = Int32
        member_id => String
    """
    api = "heartbeat"

    parts = (
        "group_id", String,
        "generation_id", Int32,

        "member_id", String,