# here-data-stream-v2-client
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.

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 2.1.1
- Package version: 1.2.107
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Python >= 3.6

## Installation & Usage
### pip install

If the python package is hosted on a repository, you can install directly using:

```sh
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)

Then import the package:
```python
import here_data_stream_v2_client
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import here_data_stream_v2_client
```

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python

import time
import here_data_stream_v2_client
from pprint import pprint
from here_data_stream_v2_client.api import stream_api
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
# Defining the host is optional and defaults to https://use.apilookup.for.a.base.url/stream/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = here_data_stream_v2_client.Configuration(
    host = "https://use.apilookup.for.a.base.url/stream/v2"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (JWT): Bearer
configuration = here_data_stream_v2_client.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)


# Enter a context with an instance of the API client
with here_data_stream_v2_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = stream_api.StreamApi(api_client)
    layer_id = "layerId_example" # str | The ID of the stream layers.
commit_offsets_request = CommitOffsetsRequest(
        offsets=[
            StreamOffset(
                partition=7,
                offset=38562,
            ),
        ],
    ) # 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.
subscription_id = "serial = -1920183912, parallel = -1920183912.123e4567-e89b-12d3-a456-556642440000" # str | The subscriptionId received in the response of the /subscribe request (required if mode=parallel). (optional)
mode = SubscribeModeEnum("serial") # SubscribeModeEnum | The subscription mode of this subscriptionId (as provided in /subscribe POST API). (optional)

    try:
        # Commits offsets of the last message read
        api_instance.commit_offsets(layer_id, commit_offsets_request, subscription_id=subscription_id, mode=mode)
    except here_data_stream_v2_client.ApiException as e:
        print("Exception when calling StreamApi->commit_offsets: %s\n" % e)
```

## Documentation for API Endpoints

All URIs are relative to *https://use.apilookup.for.a.base.url/stream/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*StreamApi* | [**commit_offsets**](docs/StreamApi.md#commit_offsets) | **PUT** /layers/{layerId}/offsets | Commits offsets of the last message read
*StreamApi* | [**consume_data**](docs/StreamApi.md#consume_data) | **GET** /layers/{layerId}/partitions | Consumes data from a layer
*StreamApi* | [**delete_subscription**](docs/StreamApi.md#delete_subscription) | **DELETE** /layers/{layerId}/subscribe | Delete subscription to a layer
*StreamApi* | [**endpoint**](docs/StreamApi.md#endpoint) | **GET** /layers/{layerId}/endpoint | Expose the endpoint to consume the data of the layer directly
*StreamApi* | [**endpoint_by_consumer**](docs/StreamApi.md#endpoint_by_consumer) | **GET** /layers/{layerId}/{type}/endpoint | Exposes the endpoint to use to produce and consume the data of the layer directly
*StreamApi* | [**seek_to_offset**](docs/StreamApi.md#seek_to_offset) | **PUT** /layers/{layerId}/seek | Seek to predefined offset.
*StreamApi* | [**subscribe**](docs/StreamApi.md#subscribe) | **POST** /layers/{layerId}/subscribe | Enable message consumption from a specific stream layer.


## Documentation For Models

 - [BootstrapServer](docs/BootstrapServer.md)
 - [CommitOffsetsRequest](docs/CommitOffsetsRequest.md)
 - [ConsumeDataResponse](docs/ConsumeDataResponse.md)
 - [ConsumerSubscribeResponse](docs/ConsumerSubscribeResponse.md)
 - [ErrorResponse](docs/ErrorResponse.md)
 - [InlineResponse401](docs/InlineResponse401.md)
 - [InlineResponse403](docs/InlineResponse403.md)
 - [KafkaConsumerProperties](docs/KafkaConsumerProperties.md)
 - [Message](docs/Message.md)
 - [Metadata](docs/Metadata.md)
 - [SeekOffsetsRequest](docs/SeekOffsetsRequest.md)
 - [StreamLayerEndpointResponse](docs/StreamLayerEndpointResponse.md)
 - [StreamOffset](docs/StreamOffset.md)
 - [SubscribeModeEnum](docs/SubscribeModeEnum.md)
 - [SubscriptionNotFoundErrorForAPIsOtherThanUnSubscribe](docs/SubscriptionNotFoundErrorForAPIsOtherThanUnSubscribe.md)
 - [SubscriptionNotFoundErrorForUnSubscribe](docs/SubscriptionNotFoundErrorForUnSubscribe.md)
 - [SubscriptionProperties](docs/SubscriptionProperties.md)


## Documentation For Authorization


## Bearer

- **Type**: Bearer authentication (JWT)


## Author




## Notes for Large OpenAPI documents
If the OpenAPI document is large, imports in here_data_stream_v2_client.apis and here_data_stream_v2_client.models may fail with a
RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1:
Use specific imports for apis and models like:
- `from here_data_stream_v2_client.api.default_api import DefaultApi`
- `from here_data_stream_v2_client.model.pet import Pet`

Solution 2:
Before importing the package, adjust the maximum recursion limit as shown below:
```
import sys
sys.setrecursionlimit(1500)
import here_data_stream_v2_client
from here_data_stream_v2_client.apis import *
from here_data_stream_v2_client.models import *
```

