# SubscriptionApi

All URIs are relative to *http://localhost:8889/api*

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**commitCursors**](#commitcursors) | **POST** /subscriptions/{subscriptionId}/cursors | Commits offsets of the subscription|
|[**createOrGetSubscription**](#createorgetsubscription) | **POST** /subscriptions | Allows the creation of a streaming events subscription|
|[**deleteSubscription**](#deletesubscription) | **DELETE** /subscriptions/{subscriptionId} | Allows the deletion of a streaming events subscription|
|[**getSubscriptionEvents**](#getsubscriptionevents) | **GET** /subscriptions/{subscriptionId}/events | Get subscription events|
|[**getSubscriptionStats**](#getsubscriptionstats) | **GET** /subscriptions/{subscriptionId}/stats | Get subscription statistics|

# **commitCursors**
> CursorCommitResponse commitCursors(listOfItems)


### Example

```typescript
import {
    SubscriptionApi,
    Configuration,
    ListOfItems
} from './api';

const configuration = new Configuration();
const apiInstance = new SubscriptionApi(configuration);

let subscriptionId: string; //The Id of subscription. (default to undefined)
let listOfItems: ListOfItems; //List of cursors that the consumer acknowledges to have successfully processed.
let idempotencyKey: string; //Key that can be used to support idempotency on this POST. Must be a valid UUID(version 4 is recommended) string and can only be used with the exact same request. Can be used in retry mechanisms to prevent double posting. (optional) (default to undefined)

const { status, data } = await apiInstance.commitCursors(
    subscriptionId,
    listOfItems,
    idempotencyKey
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **listOfItems** | **ListOfItems**| List of cursors that the consumer acknowledges to have successfully processed. | |
| **subscriptionId** | [**string**] | The Id of subscription. | defaults to undefined|
| **idempotencyKey** | [**string**] | Key that can be used to support idempotency on this POST. Must be a valid UUID(version 4 is recommended) string and can only be used with the exact same request. Can be used in retry mechanisms to prevent double posting. | (optional) defaults to undefined|


### Return type

**CursorCommitResponse**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/vnd.mambu.v2+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Offsets were committed |  -  |
|**204** | Offsets were committed |  -  |
|**400** | Bad request |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Subscription not found |  -  |
|**422** | A validation error occurred |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **createOrGetSubscription**
> SubscriptionResponse createOrGetSubscription(subscriptionRequest)


### Example

```typescript
import {
    SubscriptionApi,
    Configuration,
    SubscriptionRequest
} from './api';

const configuration = new Configuration();
const apiInstance = new SubscriptionApi(configuration);

let subscriptionRequest: SubscriptionRequest; //
let idempotencyKey: string; // (optional) (default to undefined)

const { status, data } = await apiInstance.createOrGetSubscription(
    subscriptionRequest,
    idempotencyKey
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **subscriptionRequest** | **SubscriptionRequest**|  | |
| **idempotencyKey** | [**string**] |  | (optional) defaults to undefined|


### Return type

**SubscriptionResponse**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/vnd.mambu.v2+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**102** | Your idempotent request was already submitted and is currently being processed, try again later. |  -  |
|**200** | Subscription already exists. Returns subscription object that already existed. |  -  |
|**201** | Subscription was successfully created. Returns subscription object that was created. |  -  |
|**400** | Bad Request |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**422** | Unprocessable Entity |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **deleteSubscription**
> deleteSubscription()


### Example

```typescript
import {
    SubscriptionApi,
    Configuration
} from './api';

const configuration = new Configuration();
const apiInstance = new SubscriptionApi(configuration);

let subscriptionId: string; //The Id of subscription. (default to undefined)

const { status, data } = await apiInstance.deleteSubscription(
    subscriptionId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **subscriptionId** | [**string**] | The Id of subscription. | defaults to undefined|


### Return type

void (empty response body)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/vnd.mambu.v2+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**204** | Subscription was successfully deleted. |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Subscription not found |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **getSubscriptionEvents**
> ChunkedOutput getSubscriptionEvents()


### Example

```typescript
import {
    SubscriptionApi,
    Configuration
} from './api';

const configuration = new Configuration();
const apiInstance = new SubscriptionApi(configuration);

let subscriptionId: string; //The Id of subscription. (default to undefined)
let batchLimit: number; //Maximum number of events in each chunk (optional) (default to undefined)
let streamKeepAliveLimit: number; //Maximum number of empty keep-alive batches to receive in a row before closing the connection. (optional) (default to undefined)
let maxUncommittedEvents: number; //The maximum number of uncommitted events that Mambu will stream before pausing the stream. (optional) (default to undefined)
let streamLimit: number; //Maximum number of events in this stream (over all partitions being streamed in this connection). (optional) (default to undefined)
let batchFlushTimeout: number; //Maximum time in seconds to wait for the flushing of each chunk (per partition). (optional) (default to undefined)
let streamTimeout: number; //Maximum time in seconds a stream will live before connection is closed by the server. (optional) (default to undefined)
let commitTimeout: number; //Maximum amount of seconds that Mambu will be waiting for commit after sending a batch to a client. (optional) (default to undefined)

const { status, data } = await apiInstance.getSubscriptionEvents(
    subscriptionId,
    batchLimit,
    streamKeepAliveLimit,
    maxUncommittedEvents,
    streamLimit,
    batchFlushTimeout,
    streamTimeout,
    commitTimeout
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **subscriptionId** | [**string**] | The Id of subscription. | defaults to undefined|
| **batchLimit** | [**number**] | Maximum number of events in each chunk | (optional) defaults to undefined|
| **streamKeepAliveLimit** | [**number**] | Maximum number of empty keep-alive batches to receive in a row before closing the connection. | (optional) defaults to undefined|
| **maxUncommittedEvents** | [**number**] | The maximum number of uncommitted events that Mambu will stream before pausing the stream. | (optional) defaults to undefined|
| **streamLimit** | [**number**] | Maximum number of events in this stream (over all partitions being streamed in this connection). | (optional) defaults to undefined|
| **batchFlushTimeout** | [**number**] | Maximum time in seconds to wait for the flushing of each chunk (per partition). | (optional) defaults to undefined|
| **streamTimeout** | [**number**] | Maximum time in seconds a stream will live before connection is closed by the server. | (optional) defaults to undefined|
| **commitTimeout** | [**number**] | Maximum amount of seconds that Mambu will be waiting for commit after sending a batch to a client. | (optional) defaults to undefined|


### Return type

**ChunkedOutput**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/vnd.mambu.v2+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Subscription events successfully retrieved |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Subscription not found |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **getSubscriptionStats**
> SubscriptionStatsResponse getSubscriptionStats()


### Example

```typescript
import {
    SubscriptionApi,
    Configuration
} from './api';

const configuration = new Configuration();
const apiInstance = new SubscriptionApi(configuration);

let subscriptionId: string; //The Id of subscription. (default to undefined)

const { status, data } = await apiInstance.getSubscriptionStats(
    subscriptionId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **subscriptionId** | [**string**] | The Id of subscription. | defaults to undefined|


### Return type

**SubscriptionStatsResponse**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/vnd.mambu.v2+json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Subscription statistics successfully retrieved |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden |  -  |
|**404** | Subscription not found |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

