"""
    Stream API v2

    The `stream` service provides the ability to consume data from a stream layer. With this service you can subscribe to a stream layer and consume messages.  # noqa: E501

    The version of the OpenAPI document: 2.1.1
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from here_data_stream_v2_client.api_client import ApiClient, Endpoint as _Endpoint
from here_data_stream_v2_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from here_data_stream_v2_client.model.commit_offsets_request import CommitOffsetsRequest
from here_data_stream_v2_client.model.consume_data_response import ConsumeDataResponse
from here_data_stream_v2_client.model.consumer_subscribe_response import ConsumerSubscribeResponse
from here_data_stream_v2_client.model.error_response import ErrorResponse
from here_data_stream_v2_client.model.inline_response401 import InlineResponse401
from here_data_stream_v2_client.model.inline_response403 import InlineResponse403
from here_data_stream_v2_client.model.seek_offsets_request import SeekOffsetsRequest
from here_data_stream_v2_client.model.stream_layer_endpoint_response import StreamLayerEndpointResponse
from here_data_stream_v2_client.model.subscribe_mode_enum import SubscribeModeEnum
from here_data_stream_v2_client.model.subscription_properties import SubscriptionProperties


class StreamApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

        def __commit_offsets(
            self,
            layer_id,
            commit_offsets_request,
            **kwargs
        ):
            """Commits offsets of the last message read  # noqa: E501

            After reading data, you should commit the offset of the last message read from each partition so that your application can resume reading new messages from the correct partition in the event that there is a disruption to the subscription, such as an application crash. An offset can also be useful if you delete a subscription then recreate a subscription for the same layer, because the new subscription can start reading data from the offset. To read messages already committed, use the /seek endpoint, then use /partitions. The base path to use is the value of 'nodeBaseURL' returned from /subscribe POST request.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.commit_offsets(layer_id, commit_offsets_request, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the stream layers.
                commit_offsets_request (CommitOffsetsRequest): The offsets to commit. It should be same as the offset of the message you wish to commit. Do not pass offset + 1 as mentioned in Kafka Consumer documentation. The service adds one to the offset you specify.

            Keyword Args:
                subscription_id (str): The subscriptionId received in the response of the /subscribe request (required if mode=parallel).. [optional]
                mode (SubscribeModeEnum): The subscription mode of this subscriptionId (as provided in /subscribe POST API).. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                None
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['layer_id'] = \
                layer_id
            kwargs['commit_offsets_request'] = \
                commit_offsets_request
            return self.call_with_http_info(**kwargs)

        self.commit_offsets = _Endpoint(
            settings={
                'response_type': None,
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/offsets',
                'operation_id': 'commit_offsets',
                'http_method': 'PUT',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'commit_offsets_request',
                    'subscription_id',
                    'mode',
                ],
                'required': [
                    'layer_id',
                    'commit_offsets_request',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'commit_offsets_request':
                        (CommitOffsetsRequest,),
                    'subscription_id':
                        (str,),
                    'mode':
                        (SubscribeModeEnum,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'subscription_id': 'subscriptionId',
                    'mode': 'mode',
                },
                'location_map': {
                    'layer_id': 'path',
                    'commit_offsets_request': 'body',
                    'subscription_id': 'query',
                    'mode': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    '*/*'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__commit_offsets
        )

        def __consume_data(
            self,
            layer_id,
            **kwargs
        ):
            """Consumes data from a layer  # noqa: E501

            Consumes data from a layer. Returns messages from a stream layer formatted similar to a [Partition object](https://developer.here.com/olp/documentation/data-client-library/api_reference_scala/index.html#com.here.platform.data.client.javadsl.Partition). If the data size is less than 1 MB, the `data` field will be populated. If the data size is greater than 1 MB, a data handle will be returned pointing to the object stored in the Blob store. The base path to be used is the value of 'nodeBaseURL' returned from /subscribe POST request.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.consume_data(layer_id, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the stream layers.

            Keyword Args:
                subscription_id (str): The subscriptionId received in the response of the /subscribe request (required if mode=parallel).. [optional]
                mode (SubscribeModeEnum): The subscription mode of this subscriptionId (as provided in /subscribe POST API).. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                ConsumeDataResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['layer_id'] = \
                layer_id
            return self.call_with_http_info(**kwargs)

        self.consume_data = _Endpoint(
            settings={
                'response_type': (ConsumeDataResponse,),
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/partitions',
                'operation_id': 'consume_data',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'subscription_id',
                    'mode',
                ],
                'required': [
                    'layer_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'subscription_id':
                        (str,),
                    'mode':
                        (SubscribeModeEnum,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'subscription_id': 'subscriptionId',
                    'mode': 'mode',
                },
                'location_map': {
                    'layer_id': 'path',
                    'subscription_id': 'query',
                    'mode': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    '*/*'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__consume_data
        )

        def __delete_subscription(
            self,
            layer_id,
            **kwargs
        ):
            """Delete subscription to a layer  # noqa: E501

            Deletes a subscription to a layer (topic). This operation removes the subscription from the service. The base path to use is the value of 'nodeBaseURL' returned from /subscribe POST request.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.delete_subscription(layer_id, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the stream layers.

            Keyword Args:
                subscription_id (str): The subscriptionId received in the response of the /subscribe request (required if mode=parallel).. [optional]
                mode (SubscribeModeEnum): The subscription mode of this subscriptionId (as provided in /subscribe POST API).. [optional]
                x_request_id (str): User-provided token that can be used to trace a request or a group of requests sent to the service.. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                None
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['layer_id'] = \
                layer_id
            return self.call_with_http_info(**kwargs)

        self.delete_subscription = _Endpoint(
            settings={
                'response_type': None,
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/subscribe',
                'operation_id': 'delete_subscription',
                'http_method': 'DELETE',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'subscription_id',
                    'mode',
                    'x_request_id',
                ],
                'required': [
                    'layer_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'subscription_id':
                        (str,),
                    'mode':
                        (SubscribeModeEnum,),
                    'x_request_id':
                        (str,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'subscription_id': 'subscriptionId',
                    'mode': 'mode',
                    'x_request_id': 'X-Request-ID',
                },
                'location_map': {
                    'layer_id': 'path',
                    'subscription_id': 'query',
                    'mode': 'query',
                    'x_request_id': 'header',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    '*/*'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__delete_subscription
        )

        def __endpoint(
            self,
            layer_id,
            **kwargs
        ):
            """Expose the endpoint to consume the data of the layer directly  # noqa: E501

            Returns a list of Kafka Broker URL's, client ID (required to enforce quotas), and Group ID prefix. Type is set to a consumer.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.endpoint(layer_id, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the stream layers.

            Keyword Args:
                internal (bool): Specifies whether internal bootstrap servers will be returned in the response.. [optional] if omitted the server will use the default value of False
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                StreamLayerEndpointResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['layer_id'] = \
                layer_id
            return self.call_with_http_info(**kwargs)

        self.endpoint = _Endpoint(
            settings={
                'response_type': (StreamLayerEndpointResponse,),
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/endpoint',
                'operation_id': 'endpoint',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'internal',
                ],
                'required': [
                    'layer_id',
                ],
                'nullable': [
                ],
                'enum': [
                    'internal',
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                    ('internal',): {

                        "TRUE": "true",
                        "FALSE": "false"
                    },
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'internal':
                        (bool,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'internal': 'internal',
                },
                'location_map': {
                    'layer_id': 'path',
                    'internal': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    '*/*'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__endpoint
        )

        def __endpoint_by_consumer(
            self,
            layer_id,
            type,
            **kwargs
        ):
            """Exposes the endpoint to use to produce and consume the data of the layer directly  # noqa: E501

            Exposes the endpoint to use to produce and consume the data of the layer directly, per type of user - consumer or producer. It returns a list of Kafka Broker URL's, client ID (required to enforce quotas), and Group ID prefix.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.endpoint_by_consumer(layer_id, type, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the stream layers.
                type (str): Identifies whether the properties returned in the response are for a producer or consumer.

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                StreamLayerEndpointResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['layer_id'] = \
                layer_id
            kwargs['type'] = \
                type
            return self.call_with_http_info(**kwargs)

        self.endpoint_by_consumer = _Endpoint(
            settings={
                'response_type': (StreamLayerEndpointResponse,),
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/{type}/endpoint',
                'operation_id': 'endpoint_by_consumer',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'type',
                ],
                'required': [
                    'layer_id',
                    'type',
                ],
                'nullable': [
                ],
                'enum': [
                    'type',
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                    ('type',): {

                        "PRODUCER": "producer",
                        "CONSUMER": "consumer"
                    },
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'type':
                        (str,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'type': 'type',
                },
                'location_map': {
                    'layer_id': 'path',
                    'type': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    '*/*'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__endpoint_by_consumer
        )

        def __seek_to_offset(
            self,
            layer_id,
            seek_offsets_request,
            **kwargs
        ):
            """Seek to predefined offset.  # noqa: E501

            Enables you to start reading data from a specified offset. You can move the message pointer to any offset in the layer (topic). Message consumption will start from that offset. Once you seek to an offset, there is no returning to the initial offset, unless the initial offset is saved. The base path to use is the value of 'nodeBaseURL' returned from /subscribe POST request.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.seek_to_offset(layer_id, seek_offsets_request, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the stream layers.
                seek_offsets_request (SeekOffsetsRequest): List of offsets and offset partitions

            Keyword Args:
                subscription_id (str): The subscriptionId received in the response of the /subscribe request (required if mode=parallel).. [optional]
                mode (SubscribeModeEnum): The subscription mode of this subscriptionId (as provided in /subscribe POST API).. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                None
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['layer_id'] = \
                layer_id
            kwargs['seek_offsets_request'] = \
                seek_offsets_request
            return self.call_with_http_info(**kwargs)

        self.seek_to_offset = _Endpoint(
            settings={
                'response_type': None,
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/seek',
                'operation_id': 'seek_to_offset',
                'http_method': 'PUT',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'seek_offsets_request',
                    'subscription_id',
                    'mode',
                ],
                'required': [
                    'layer_id',
                    'seek_offsets_request',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'seek_offsets_request':
                        (SeekOffsetsRequest,),
                    'subscription_id':
                        (str,),
                    'mode':
                        (SubscribeModeEnum,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'subscription_id': 'subscriptionId',
                    'mode': 'mode',
                },
                'location_map': {
                    'layer_id': 'path',
                    'seek_offsets_request': 'body',
                    'subscription_id': 'query',
                    'mode': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    '*/*'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__seek_to_offset
        )

        def __subscribe(
            self,
            layer_id,
            **kwargs
        ):
            """Enable message consumption from a specific stream layer.  # noqa: E501

            Enables message consumption from a specific stream layer (topic). Use the base path returned from the API Lookup service. Note: For **mode = parallel**, one unit of parallelism currently equals 1 MBps inbound or 2 MBps outbound, whichever is greater, rounded up to the nearest integer. The number of subscriptions within the same group cannot exceed the parallelism allowed. For more details see [Get Data from a Stream Layer](https://developer.here.com/olp/documentation/data-store/data_dev_guide/rest/getting-data-stream.html).  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.subscribe(layer_id, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the stream layers.

            Keyword Args:
                mode (SubscribeModeEnum): Specifies whether to use serial or parallel subscription mode. For more details see [Get Data from a Stream Layer](https://developer.here.com/olp/documentation/data-store/data_dev_guide/rest/getting-data-stream.html).. [optional]
                subscription_id (str): Include this parameter if you want to look up the `nodeBaseURL` for a given subscriptionId.. [optional]
                consumer_id (str): The ID to use to identify this consumer. It must be unique within the consumer group. If you do not provide one, the system will generate one.. [optional]
                subscription_properties (SubscriptionProperties): [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                ConsumerSubscribeResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['layer_id'] = \
                layer_id
            return self.call_with_http_info(**kwargs)

        self.subscribe = _Endpoint(
            settings={
                'response_type': (ConsumerSubscribeResponse,),
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/subscribe',
                'operation_id': 'subscribe',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'mode',
                    'subscription_id',
                    'consumer_id',
                    'subscription_properties',
                ],
                'required': [
                    'layer_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'mode':
                        (SubscribeModeEnum,),
                    'subscription_id':
                        (str,),
                    'consumer_id':
                        (str,),
                    'subscription_properties':
                        (SubscriptionProperties,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'mode': 'mode',
                    'subscription_id': 'subscriptionId',
                    'consumer_id': 'consumerId',
                },
                'location_map': {
                    'layer_id': 'path',
                    'mode': 'query',
                    'subscription_id': 'query',
                    'consumer_id': 'query',
                    'subscription_properties': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    '*/*'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__subscribe
        )
