# AnalyticsApi

All URIs are relative to *http://localhost:8080/api/v1*

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**analyticsEventsPost**](#analyticseventspost) | **POST** /analytics/events | Record Analytics Event|
|[**analyticsGet**](#analyticsget) | **GET** /analytics | Get Analytics Data|
|[**analyticsTracksIdGet**](#analyticstracksidget) | **GET** /analytics/tracks/{id} | Get Track Analytics Dashboard|
|[**analyticsTracksTopGet**](#analyticstrackstopget) | **GET** /analytics/tracks/top | Get top tracks|
|[**tracksIdAnalyticsPlaysGet**](#tracksidanalyticsplaysget) | **GET** /tracks/{id}/analytics/plays | Get plays over time|
|[**tracksIdPlayPost**](#tracksidplaypost) | **POST** /tracks/{id}/play | Record play|
|[**tracksIdStatsGet**](#tracksidstatsget) | **GET** /tracks/{id}/stats | Get track statistics|
|[**usersIdAnalyticsStatsGet**](#usersidanalyticsstatsget) | **GET** /users/{id}/analytics/stats | Get user statistics|

# **analyticsEventsPost**
> AnalyticsEventsPost200Response analyticsEventsPost(request)

Record a custom analytics event

### Example

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

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

let request: InternalHandlersRecordEventRequest; //Event Data

const { status, data } = await apiInstance.analyticsEventsPost(
    request
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **request** | **InternalHandlersRecordEventRequest**| Event Data | |


### Return type

**AnalyticsEventsPost200Response**

### Authorization

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

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |
|**400** | Validation Error |  -  |
|**401** | Unauthorized |  -  |
|**500** | Internal Error |  -  |

[[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)

# **analyticsGet**
> AnalyticsGet200Response analyticsGet()

Get aggregated analytics data for tracks and playlists

### Example

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

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

let days: number; //Number of days (default: 30) (optional) (default to undefined)
let startDate: string; //Start date (ISO 8601) (optional) (default to undefined)
let endDate: string; //End date (ISO 8601) (optional) (default to undefined)

const { status, data } = await apiInstance.analyticsGet(
    days,
    startDate,
    endDate
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **days** | [**number**] | Number of days (default: 30) | (optional) defaults to undefined|
| **startDate** | [**string**] | Start date (ISO 8601) | (optional) defaults to undefined|
| **endDate** | [**string**] | End date (ISO 8601) | (optional) defaults to undefined|


### Return type

**AnalyticsGet200Response**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |
|**401** | Unauthorized |  -  |
|**500** | Internal Error |  -  |

[[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)

# **analyticsTracksIdGet**
> AnalyticsTracksIdGet200Response analyticsTracksIdGet()

Get comprehensive analytics dashboard for a track

### Example

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

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

let id: string; //Track ID (default to undefined)

const { status, data } = await apiInstance.analyticsTracksIdGet(
    id
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**string**] | Track ID | defaults to undefined|


### Return type

**AnalyticsTracksIdGet200Response**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |
|**400** | Validation Error |  -  |
|**404** | Track not found |  -  |
|**500** | Internal Error |  -  |

[[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)

# **analyticsTracksTopGet**
> AnalyticsTracksTopGet200Response analyticsTracksTopGet()

Get list of top tracks by play count, optionally filtered by date range

### Example

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

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

let limit: number; //Number of tracks to return (optional) (default to 10)
let startDate: string; //Start date filter (RFC3339 format) (optional) (default to undefined)
let endDate: string; //End date filter (RFC3339 format) (optional) (default to undefined)

const { status, data } = await apiInstance.analyticsTracksTopGet(
    limit,
    startDate,
    endDate
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **limit** | [**number**] | Number of tracks to return | (optional) defaults to 10|
| **startDate** | [**string**] | Start date filter (RFC3339 format) | (optional) defaults to undefined|
| **endDate** | [**string**] | End date filter (RFC3339 format) | (optional) defaults to undefined|


### Return type

**AnalyticsTracksTopGet200Response**

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |
|**400** | Validation error |  -  |
|**500** | Internal server error |  -  |

[[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)

# **tracksIdAnalyticsPlaysGet**
> TracksIdAnalyticsPlaysGet200Response tracksIdAnalyticsPlaysGet()

Get play statistics over time for a track, grouped by time period

### Example

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

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

let id: string; //Track ID (UUID) (default to undefined)
let startDate: string; //Start date (RFC3339 format) (optional) (default to undefined)
let endDate: string; //End date (RFC3339 format) (optional) (default to undefined)
let interval: string; //Time period grouping (hour, day, week, month) (optional) (default to 'day')

const { status, data } = await apiInstance.tracksIdAnalyticsPlaysGet(
    id,
    startDate,
    endDate,
    interval
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**string**] | Track ID (UUID) | defaults to undefined|
| **startDate** | [**string**] | Start date (RFC3339 format) | (optional) defaults to undefined|
| **endDate** | [**string**] | End date (RFC3339 format) | (optional) defaults to undefined|
| **interval** | [**string**] | Time period grouping (hour, day, week, month) | (optional) defaults to 'day'|


### Return type

**TracksIdAnalyticsPlaysGet200Response**

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |
|**400** | Validation error |  -  |
|**404** | Track not found |  -  |
|**500** | Internal server error |  -  |

[[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)

# **tracksIdPlayPost**
> AnalyticsEventsPost200Response tracksIdPlayPost(request)

Record a play event for a track. Can be called anonymously or with authentication.

### Example

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

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

let id: string; //Track ID (UUID) (default to undefined)
let request: InternalHandlersRecordPlayRequest; //Play event data

const { status, data } = await apiInstance.tracksIdPlayPost(
    id,
    request
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **request** | **InternalHandlersRecordPlayRequest**| Play event data | |
| **id** | [**string**] | Track ID (UUID) | defaults to undefined|


### Return type

**AnalyticsEventsPost200Response**

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |
|**400** | Validation error |  -  |
|**404** | Track not found |  -  |
|**500** | Internal server error |  -  |

[[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)

# **tracksIdStatsGet**
> AuditStatsGet200Response tracksIdStatsGet()

Get statistics for a track (plays, likes, etc.)

### Example

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

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

let id: string; //Track ID (UUID) (default to undefined)

const { status, data } = await apiInstance.tracksIdStatsGet(
    id
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**string**] | Track ID (UUID) | defaults to undefined|


### Return type

**AuditStatsGet200Response**

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |
|**400** | Validation error |  -  |
|**404** | Track not found |  -  |
|**500** | Internal server error |  -  |

[[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)

# **usersIdAnalyticsStatsGet**
> AuditStatsGet200Response usersIdAnalyticsStatsGet()

Get analytics statistics for a user (total plays, tracks, etc.)

### Example

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

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

let id: string; //User ID (UUID) (default to undefined)

const { status, data } = await apiInstance.usersIdAnalyticsStatsGet(
    id
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**string**] | User ID (UUID) | defaults to undefined|


### Return type

**AuditStatsGet200Response**

### Authorization

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

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |
|**400** | Validation error |  -  |
|**401** | Unauthorized |  -  |
|**403** | Forbidden - can only view own stats |  -  |
|**404** | User not found |  -  |
|**500** | Internal server error |  -  |

[[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)

