From 798a142fcbb7e4e4fc6e8ac822a94c52d47a9992 Mon Sep 17 00:00:00 2001 From: szekelyzol Date: Wed, 29 May 2024 22:02:36 +0000 Subject: [PATCH] [DO NOT MERGE] Add Watch Data endpoints to OpenAPI spec --- README.md | 24 +- docs/Api/AnalyticsApi.md | 12 + docs/Api/AnalyticsV20BetaApi.md | 123 ++++++ .../AnalyticsAggregatedMetricsResponse.md | 10 + ...alyticsAggregatedMetricsResponseContext.md | 11 + ...gregatedMetricsResponseContextTimeframe.md | 10 + .../AnalyticsMetricsBreakdownResponse.md | 11 + ...nalyticsMetricsBreakdownResponseContext.md | 11 + .../AnalyticsMetricsBreakdownResponseData.md | 10 + .../Model/AnalyticsMetricsOverTimeResponse.md | 11 + ...AnalyticsMetricsOverTimeResponseContext.md | 11 + .../AnalyticsMetricsOverTimeResponseData.md | 10 + docs/Model/UnrecognizedRequestUrl.md | 11 + src/Api/AnalyticsV20BetaApi.php | 362 ++++++++++++++++++ src/Client.php | 12 + .../AnalyticsAggregatedMetricsResponse.php | 186 +++++++++ ...lyticsAggregatedMetricsResponseContext.php | 293 ++++++++++++++ ...regatedMetricsResponseContextTimeframe.php | 181 +++++++++ .../AnalyticsMetricsBreakdownResponse.php | 220 +++++++++++ ...alyticsMetricsBreakdownResponseContext.php | 295 ++++++++++++++ .../AnalyticsMetricsBreakdownResponseData.php | 180 +++++++++ .../AnalyticsMetricsOverTimeResponse.php | 220 +++++++++++ ...nalyticsMetricsOverTimeResponseContext.php | 285 ++++++++++++++ .../AnalyticsMetricsOverTimeResponseData.php | 180 +++++++++ src/Model/UnrecognizedRequestUrl.php | 211 ++++++++++ 25 files changed, 2888 insertions(+), 2 deletions(-) create mode 100644 docs/Api/AnalyticsV20BetaApi.md create mode 100644 docs/Model/AnalyticsAggregatedMetricsResponse.md create mode 100644 docs/Model/AnalyticsAggregatedMetricsResponseContext.md create mode 100644 docs/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.md create mode 100644 docs/Model/AnalyticsMetricsBreakdownResponse.md create mode 100644 docs/Model/AnalyticsMetricsBreakdownResponseContext.md create mode 100644 docs/Model/AnalyticsMetricsBreakdownResponseData.md create mode 100644 docs/Model/AnalyticsMetricsOverTimeResponse.md create mode 100644 docs/Model/AnalyticsMetricsOverTimeResponseContext.md create mode 100644 docs/Model/AnalyticsMetricsOverTimeResponseData.md create mode 100644 docs/Model/UnrecognizedRequestUrl.md create mode 100644 src/Api/AnalyticsV20BetaApi.php create mode 100644 src/Model/AnalyticsAggregatedMetricsResponse.php create mode 100644 src/Model/AnalyticsAggregatedMetricsResponseContext.php create mode 100644 src/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.php create mode 100644 src/Model/AnalyticsMetricsBreakdownResponse.php create mode 100644 src/Model/AnalyticsMetricsBreakdownResponseContext.php create mode 100644 src/Model/AnalyticsMetricsBreakdownResponseData.php create mode 100644 src/Model/AnalyticsMetricsOverTimeResponse.php create mode 100644 src/Model/AnalyticsMetricsOverTimeResponseContext.php create mode 100644 src/Model/AnalyticsMetricsOverTimeResponseData.php create mode 100644 src/Model/UnrecognizedRequestUrl.php diff --git a/README.md b/README.md index eb1e566..6e2c808 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ - [Documentation](#documentation) - [API Endpoints](#api-endpoints) - [AnalyticsApi](#analyticsapi) + - [AnalyticsV20BetaApi](#analyticsv20betaapi) - [CaptionsApi](#captionsapi) - [ChaptersApi](#chaptersapi) - [LiveStreamsApi](#livestreamsapi) @@ -132,8 +133,17 @@ $client->videos()->upload( Method | Description | HTTP request ------------- | ------------- | ------------- -[**getLiveStreamsPlays()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/AnalyticsApi.md#getLiveStreamsPlays) | Get play events for live stream | **GET** `/analytics/live-streams/plays` -[**getVideosPlays()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/AnalyticsApi.md#getVideosPlays) | Get play events for video | **GET** `/analytics/videos/plays` +**(deprecated)** [**getLiveStreamsPlays()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/AnalyticsApi.md#getLiveStreamsPlays) | Get play events for live stream | **GET** `/analytics/live-streams/plays` +**(deprecated)** [**getVideosPlays()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/AnalyticsApi.md#getVideosPlays) | Get play events for video | **GET** `/analytics/videos/plays` + + +#### AnalyticsV20BetaApi + +Method | Description | HTTP request +------------- | ------------- | ------------- +[**getAggregatedMetrics()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/AnalyticsV20BetaApi.md#getAggregatedMetrics) | Retrieve aggregated metrics | **GET** `/data/metrics/{metric}/{aggregation}` +[**getMetricsBreakdown()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/AnalyticsV20BetaApi.md#getMetricsBreakdown) | Retrieve metrics in a breakdown of dimensions | **GET** `/data/buckets/{metric}/{breakdown}` +[**getMetricsOverTime()**](https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/AnalyticsV20BetaApi.md#getMetricsOverTime) | Retrieve metrics over time | **GET** `/data/timeseries/{metric}` #### CaptionsApi @@ -233,7 +243,16 @@ Method | Description | HTTP request - [AccessToken](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AccessToken.md) - [AdditionalBadRequestErrors](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AdditionalBadRequestErrors.md) + - [AnalyticsAggregatedMetricsResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsAggregatedMetricsResponse.md) + - [AnalyticsAggregatedMetricsResponseContext](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsAggregatedMetricsResponseContext.md) + - [AnalyticsAggregatedMetricsResponseContextTimeframe](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.md) - [AnalyticsData](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsData.md) + - [AnalyticsMetricsBreakdownResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsMetricsBreakdownResponse.md) + - [AnalyticsMetricsBreakdownResponseContext](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsMetricsBreakdownResponseContext.md) + - [AnalyticsMetricsBreakdownResponseData](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsMetricsBreakdownResponseData.md) + - [AnalyticsMetricsOverTimeResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsMetricsOverTimeResponse.md) + - [AnalyticsMetricsOverTimeResponseContext](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsMetricsOverTimeResponseContext.md) + - [AnalyticsMetricsOverTimeResponseData](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsMetricsOverTimeResponseData.md) - [AnalyticsPlays400Error](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsPlays400Error.md) - [AnalyticsPlaysResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AnalyticsPlaysResponse.md) - [AuthenticatePayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/AuthenticatePayload.md) @@ -274,6 +293,7 @@ Method | Description | HTTP request - [TokenCreationPayload](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/TokenCreationPayload.md) - [TokenListResponse](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/TokenListResponse.md) - [TooManyRequests](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/TooManyRequests.md) + - [UnrecognizedRequestUrl](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/UnrecognizedRequestUrl.md) - [UploadToken](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/UploadToken.md) - [Video](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/Video.md) - [VideoAssets](https://github.com/apivideo/api.video-php-client/blob/main/docs/Model/VideoAssets.md) diff --git a/docs/Api/AnalyticsApi.md b/docs/Api/AnalyticsApi.md index 8606f8c..7e612a1 100644 --- a/docs/Api/AnalyticsApi.md +++ b/docs/Api/AnalyticsApi.md @@ -14,6 +14,12 @@ Method | Description | HTTP request Retrieve filtered analytics about the number of plays for your live streams in a project. + + +This endpoint will be deprecated with the release of Analytics v2.0. + + + ### Arguments @@ -50,6 +56,12 @@ Name | Type | Description | Notes Retrieve filtered analytics about the number of plays for your videos in a project. + + +This endpoint will be deprecated with the release of Analytics v2.0. + + + ### Arguments diff --git a/docs/Api/AnalyticsV20BetaApi.md b/docs/Api/AnalyticsV20BetaApi.md new file mode 100644 index 0000000..60d9b28 --- /dev/null +++ b/docs/Api/AnalyticsV20BetaApi.md @@ -0,0 +1,123 @@ +# ApiVideo\Client\Api\AnalyticsV20BetaApi + +All URIs are relative to https://ws.api.video. + +Method | Description | HTTP request +------------- | ------------- | ------------- +[**getAggregatedMetrics()**](AnalyticsV20BetaApi.md#getAggregatedMetrics) | Retrieve aggregated metrics | **GET** `/data/metrics/{metric}/{aggregation}` +[**getMetricsBreakdown()**](AnalyticsV20BetaApi.md#getMetricsBreakdown) | Retrieve metrics in a breakdown of dimensions | **GET** `/data/buckets/{metric}/{breakdown}` +[**getMetricsOverTime()**](AnalyticsV20BetaApi.md#getMetricsOverTime) | Retrieve metrics over time | **GET** `/data/timeseries/{metric}` + + +## **`getAggregatedMetrics()` - Retrieve aggregated metrics** + + + +Retrieve time-based and countable metrics like average watch time or the number of impressions over a certain period of time. + +### Arguments + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `metric` | **string**| Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. You can use the aggregations `count`, `rate`, and `total` with the `play` metric. - `start` is the number of times playback was started. You can use the aggregation `count` with this metric. - `end` is the number of times playback has ended with the content watch until the end. You can use the aggregation `count` with this metric. - `impression` is the number of times your content has been loaded and was ready for playback. You can use the aggregation `count` with this metric. - `impression-time` is the time in milliseconds that your content was loading for until the first video frame is displayed. You can use the aggregations `average` and `sum` with this metric. - `watch-time` is the cumulative time in seconds that the user has spent watching your content. You can use the aggregations `average` and `sum` with this metric. | +`queryParams` | array | (see below) | + `aggregation` | **string**| Use this path parameter to define a way of collecting data for the metric that you want analytics for. - `count` returns the overall number of events for the `play` metric. - `rate` returns the ratio that calculates the number of plays your content receives divided by its impressions. This aggregation can be used only with the `play` metric. - `total` calculates the total number of events for the `play` metric. - `average` calculates an average value for the selected metric. - `sum` adds up the total value of the select metric. | +`queryParams` | array | (see below) | + + +Note: `queryParams` argument is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `from` | **\DateTime**| Use this query parameter to define the starting date-time of the period you want analytics for. - If you do not set a value for `from`, the default assigned value is 1 day ago, based on the `to` parameter. - The maximum value is 365 days ago, and April 1st 2024. - The value you provide should follow the ATOM date-time format: `2024-02-05T00:00:00+01:00` - The API ignores this parameter when you call `/data/metrics/play/total`. | [optional] + `to` | **\DateTime**| Use this query parameter to define the ending date-time of the period you want analytics for. - If you do not set a value for `to`, the default assigned value is `now`. - The API ignores this parameter when you call `/data/metrics/play/total`. - The value for `to` is a non-inclusive value: the API returns data **before** the date-time that you set. | [optional] + `filterBy` | **string**| Use this parameter to filter the API's response based on different data dimensions. You can serialize filters in your query to receive more detailed breakdowns of your analytics. - If you do not set a value for `filterBy`, the API returns the full dataset for your project. - The API only accepts the `mediaId` and `mediaType` filters when you call `/data/metrics/play/total`. These are the available breakdown dimensions: - `mediaId`: Returns analytics based on the unique identifiers of a video or a live stream. - `mediaType`: Returns analytics based on the type of content. Possible values: `video` and `live-stream`. - `continent`: Returns analytics based on the viewers' continent. The list of supported continents names are based on the [GeoNames public database](https://www.geonames.org/countries/). Possible values are: `AS`, `AF`, `NA`, `SA`, `AN`, `EU`, `AZ`. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `deviceType`: Returns analytics based on the type of device used by the viewers. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values include `chrome`, `firefox`, `edge`, `opera`. | [optional] + + + + + + +### Return type + +[**\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponse**](../Model/AnalyticsAggregatedMetricsResponse.md) + + + + + +## **`getMetricsBreakdown()` - Retrieve metrics in a breakdown of dimensions** + + + +Retrieve detailed analytics play-rate and number of impressions segmented by dimensions like country or device type. + +### Arguments + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `metric` | **string**| Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. - `play-rate` is the ratio that calculates the number of plays your content receives divided by its impressions. - `start` is the number of times playback was started. - `end` is the number of times playback has ended with the content watch until the end. - `impression` is the number of times your content has been loaded and was ready for playback. | +`queryParams` | array | (see below) | + `breakdown` | **string**| Use this path parameter to define a dimension for segmenting analytics data. You must use `kebab-case` for path parameters. These are the available dimensions: - `media-id`: Returns analytics based on the unique identifiers of a video or a live stream. - `media-type`: Returns analytics based on the type of content. Possible values: `video` and `live-stream`. - `continent`: Returns analytics based on the viewers' continent. The list of supported continents names are based on the [GeoNames public database](https://www.geonames.org/countries/). Possible values are: `AS`, `AF`, `NA`, `SA`, `AN`, `EU`, `AZ`. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `device-type`: Returns analytics based on the type of device used by the viewers. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values include `chrome`, `firefox`, `edge`, `opera`. | +`queryParams` | array | (see below) | + + +Note: `queryParams` argument is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `from` | **\DateTime**| Use this query parameter to define the starting date-time of the period you want analytics for. - If you do not set a value for `from`, the default assigned value is 1 day ago, based on the `to` parameter. - The maximum value is 365 days ago, and April 1st 2024. - The value you provide should follow the ATOM date-time format: `2024-02-05T00:00:00+01:00` | [optional] + `to` | **\DateTime**| Use this query parameter to define the ending date-time of the period you want analytics for. - If you do not set a value for `to`, the default assigned value is `now`. - The value for `to` is a non-inclusive value: the API returns data **before** the date-time that you set. | [optional] + `filterBy` | **string**| Use this parameter to filter the API's response based on different data dimensions. You can serialize filters in your query to receive more detailed breakdowns of your analytics. You must use `camelCase` for query parameters. - If you do not set a value for `filterBy`, the API returns the full dataset for your project. These are the available breakdown dimensions: - `mediaId`: Returns analytics based on the unique identifiers of a video or a live stream. - `mediaType`: Returns analytics based on the type of content. Possible values: `video` and `live-stream`. - `continent`: Returns analytics based on the viewers' continent. The list of supported continents names are based on the [GeoNames public database](https://www.geonames.org/countries/). Possible values are: `AS`, `AF`, `NA`, `SA`, `AN`, `EU`, `AZ`. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `deviceType`: Returns analytics based on the type of device used by the viewers. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values include `chrome`, `firefox`, `edge`, `opera`. | [optional] + + + + + + +### Return type + +[**\ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponse**](../Model/AnalyticsMetricsBreakdownResponse.md) + + + + + +## **`getMetricsOverTime()` - Retrieve metrics over time** + + + +Retrieve countable metrics like the number of plays or impressions, grouped by the time at which they occurred + +### Arguments + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `metric` | **string**| Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. - `play-rate` is the ratio that calculates the number of plays your content receives divided by its impressions. - `start` is the number of times playback was started. - `end` is the number of times playback has ended with the content watch until the end. - `impression` is the number of times your content has been loaded and was ready for playback. | +`queryParams` | array | (see below) | + + +Note: `queryParams` argument is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + `from` | **\DateTime**| Use this query parameter to define the starting date-time of the period you want analytics for. - If you do not set a value for `from`, the default assigned value is 1 day ago, based on the `to` parameter. - The maximum value is 365 days ago, and April 1st 2024. - The value you provide should follow the ATOM date-time format: `2024-02-05T00:00:00+01:00` | [optional] + `to` | **\DateTime**| Use this query parameter to define the ending date-time of the period you want analytics for. - If you do not set a value for `to`, the default assigned value is `now`. - The value for `to` is a non-inclusive value: the API returns data **before** the date-time that you set. | [optional] + `interval` | **\DateTime**| Use this query parameter to define how granularity of the data. Possible values: `hour`, `day`. - Default: If no interval specified and the period (different between from and to) ≤ 2 days then hour, otherwise day. - If you do not set a value for `interval`, and the period you set using the `from` and `to` parameters is less than or equals to 2 days, then the default assigned value is `hour`. Otherwise the API sets it to `day`. | [optional] + `filterBy` | **string**| Use this parameter to filter the API's response based on different data dimensions. You can serialize filters in your query to receive more detailed breakdowns of your analytics. You must use `camelCase` for query parameters. - If you do not set a value for `filterBy`, the API returns the full dataset for your project. These are the available breakdown dimensions: - `mediaId`: Returns analytics based on the unique identifiers of a video or a live stream. - `mediaType`: Returns analytics based on the type of content. Possible values: `video` and `live-stream`. - `continent`: Returns analytics based on the viewers' continent. The list of supported continents names are based on the [GeoNames public database](https://www.geonames.org/countries/). Possible values are: `AS`, `AF`, `NA`, `SA`, `AN`, `EU`, `AZ`. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `deviceType`: Returns analytics based on the type of device used by the viewers. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values include `chrome`, `firefox`, `edge`, `opera`. | [optional] + + + + + + +### Return type + +[**\ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponse**](../Model/AnalyticsMetricsOverTimeResponse.md) + + + + diff --git a/docs/Model/AnalyticsAggregatedMetricsResponse.md b/docs/Model/AnalyticsAggregatedMetricsResponse.md new file mode 100644 index 0000000..9674396 --- /dev/null +++ b/docs/Model/AnalyticsAggregatedMetricsResponse.md @@ -0,0 +1,10 @@ +# # AnalyticsAggregatedMetricsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**context** | [**\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContext**](AnalyticsAggregatedMetricsResponseContext.md) | | +**data** | **float** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnalyticsAggregatedMetricsResponseContext.md b/docs/Model/AnalyticsAggregatedMetricsResponseContext.md new file mode 100644 index 0000000..0db5e2e --- /dev/null +++ b/docs/Model/AnalyticsAggregatedMetricsResponseContext.md @@ -0,0 +1,11 @@ +# # AnalyticsAggregatedMetricsResponseContext + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metric** | **string** | Returns the metric you selected. | [optional] +**aggregation** | **string** | Returns the aggregation you selected. | [optional] +**timeframe** | [**\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe**](AnalyticsAggregatedMetricsResponseContextTimeframe.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.md b/docs/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.md new file mode 100644 index 0000000..8b65775 --- /dev/null +++ b/docs/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.md @@ -0,0 +1,10 @@ +# # AnalyticsAggregatedMetricsResponseContextTimeframe + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | [**\DateTime**](\DateTime.md) | Returns the starting date-time of the period you want analytics for in ATOM date-time format. | [optional] +**to** | [**\DateTime**](\DateTime.md) | Returns the starting date-time of the period you want analytics for in ATOM date-time format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnalyticsMetricsBreakdownResponse.md b/docs/Model/AnalyticsMetricsBreakdownResponse.md new file mode 100644 index 0000000..ecd483d --- /dev/null +++ b/docs/Model/AnalyticsMetricsBreakdownResponse.md @@ -0,0 +1,11 @@ +# # AnalyticsMetricsBreakdownResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**context** | [**\ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponseContext**](AnalyticsMetricsBreakdownResponseContext.md) | | +**data** | [**\ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponseData[]**](AnalyticsMetricsBreakdownResponseData.md) | Returns an array of dimensions and their respective metrics. | +**pagination** | [**\ApiVideo\Client\Model\Pagination**](Pagination.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnalyticsMetricsBreakdownResponseContext.md b/docs/Model/AnalyticsMetricsBreakdownResponseContext.md new file mode 100644 index 0000000..6e15192 --- /dev/null +++ b/docs/Model/AnalyticsMetricsBreakdownResponseContext.md @@ -0,0 +1,11 @@ +# # AnalyticsMetricsBreakdownResponseContext + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metric** | **string** | Returns the metric you selected. | [optional] +**breakdown** | **string** | Returns the dimension you selected. | [optional] +**timeframe** | [**\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe**](AnalyticsAggregatedMetricsResponseContextTimeframe.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnalyticsMetricsBreakdownResponseData.md b/docs/Model/AnalyticsMetricsBreakdownResponseData.md new file mode 100644 index 0000000..f28eb6d --- /dev/null +++ b/docs/Model/AnalyticsMetricsBreakdownResponseData.md @@ -0,0 +1,10 @@ +# # AnalyticsMetricsBreakdownResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dimensionValue** | **string** | Returns a specific value for the dimension you selected, based on the data. For example if you select `continent` as a dimension, then `dimensionValue` returns values like `EU` or \"AZ\". | [optional] +**metricValue** | **float** | Returns the data for a specific dimension value. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnalyticsMetricsOverTimeResponse.md b/docs/Model/AnalyticsMetricsOverTimeResponse.md new file mode 100644 index 0000000..d57e8b4 --- /dev/null +++ b/docs/Model/AnalyticsMetricsOverTimeResponse.md @@ -0,0 +1,11 @@ +# # AnalyticsMetricsOverTimeResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**context** | [**\ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseContext**](AnalyticsMetricsOverTimeResponseContext.md) | | +**data** | [**\ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseData[]**](AnalyticsMetricsOverTimeResponseData.md) | Returns an array of metrics and the timestamps . | +**pagination** | [**\ApiVideo\Client\Model\Pagination**](Pagination.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnalyticsMetricsOverTimeResponseContext.md b/docs/Model/AnalyticsMetricsOverTimeResponseContext.md new file mode 100644 index 0000000..946fd40 --- /dev/null +++ b/docs/Model/AnalyticsMetricsOverTimeResponseContext.md @@ -0,0 +1,11 @@ +# # AnalyticsMetricsOverTimeResponseContext + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metric** | **string** | Returns the metric you selected. | [optional] +**interval** | **string** | Returns the interval you selected. | [optional] +**timeframe** | [**\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe**](AnalyticsAggregatedMetricsResponseContextTimeframe.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnalyticsMetricsOverTimeResponseData.md b/docs/Model/AnalyticsMetricsOverTimeResponseData.md new file mode 100644 index 0000000..4814d65 --- /dev/null +++ b/docs/Model/AnalyticsMetricsOverTimeResponseData.md @@ -0,0 +1,10 @@ +# # AnalyticsMetricsOverTimeResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**emittedAt** | **string** | Returns the timestamp of the event that belongs to a specific metric in ATOM date-time format. For example, if you set `play` with an `hour` interval in your request, then `emittedAt` returns the hourly timestamps of every play event within the timeframe you defined. | [optional] +**metricValue** | **float** | Returns the data for a specific metric value. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UnrecognizedRequestUrl.md b/docs/Model/UnrecognizedRequestUrl.md new file mode 100644 index 0000000..710f4c9 --- /dev/null +++ b/docs/Model/UnrecognizedRequestUrl.md @@ -0,0 +1,11 @@ +# # UnrecognizedRequestUrl + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | A link to the error documentation. | [optional] +**title** | **string** | A description of the error that occurred. | [optional] +**status** | **int** | The HTTP status code. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Api/AnalyticsV20BetaApi.php b/src/Api/AnalyticsV20BetaApi.php new file mode 100644 index 0000000..68922df --- /dev/null +++ b/src/Api/AnalyticsV20BetaApi.php @@ -0,0 +1,362 @@ +client = $client; + } + + /** + * Retrieve aggregated metrics + * + * @param string $metric Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. You can use the aggregations `count`, `rate`, and `total` with the `play` metric. - `start` is the number of times playback was started. You can use the aggregation `count` with this metric. - `end` is the number of times playback has ended with the content watch until the end. You can use the aggregation `count` with this metric. - `impression` is the number of times your content has been loaded and was ready for playback. You can use the aggregation `count` with this metric. - `impression-time` is the time in milliseconds that your content was loading for until the first video frame is displayed. You can use the aggregations `average` and `sum` with this metric. - `watch-time` is the cumulative time in seconds that the user has spent watching your content. You can use the aggregations `average` and `sum` with this metric. (required) + * @param string $aggregation Use this path parameter to define a way of collecting data for the metric that you want analytics for. - `count` returns the overall number of events for the `play` metric. - `rate` returns the ratio that calculates the number of plays your content receives divided by its impressions. This aggregation can be used only with the `play` metric. - `total` calculates the total number of events for the `play` metric. - `average` calculates an average value for the selected metric. - `sum` adds up the total value of the select metric. (required) + * @param array $queryParams + * + * @throws \ApiVideo\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponse|\ApiVideo\Client\Model\AnalyticsPlays400Error|\ApiVideo\Client\Model\UnrecognizedRequestUrl|\ApiVideo\Client\Model\TooManyRequests + */ + public function getAggregatedMetrics(string $metric, string $aggregation, array $queryParams = []): \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponse + { + $request = $this->buildGetAggregatedMetricsRequest($metric, $aggregation, $queryParams); + + $model = new \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponse($this->client->request($request)); + + return $model; + } + + /** + * Create request for operation 'getAggregatedMetrics' + * + * @param string $metric Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. You can use the aggregations `count`, `rate`, and `total` with the `play` metric. - `start` is the number of times playback was started. You can use the aggregation `count` with this metric. - `end` is the number of times playback has ended with the content watch until the end. You can use the aggregation `count` with this metric. - `impression` is the number of times your content has been loaded and was ready for playback. You can use the aggregation `count` with this metric. - `impression-time` is the time in milliseconds that your content was loading for until the first video frame is displayed. You can use the aggregations `average` and `sum` with this metric. - `watch-time` is the cumulative time in seconds that the user has spent watching your content. You can use the aggregations `average` and `sum` with this metric. (required) + * @param string $aggregation Use this path parameter to define a way of collecting data for the metric that you want analytics for. - `count` returns the overall number of events for the `play` metric. - `rate` returns the ratio that calculates the number of plays your content receives divided by its impressions. This aggregation can be used only with the `play` metric. - `total` calculates the total number of events for the `play` metric. - `average` calculates an average value for the selected metric. - `sum` adds up the total value of the select metric. (required) + * @param array $queryParams + * + * @throws \InvalidArgumentException + * @return Request + */ + private function buildGetAggregatedMetricsRequest(string $metric, string $aggregation, array $queryParams = []): Request + { + // unbox the parameters from the associative array + $from = array_key_exists('from', $queryParams) ? $queryParams['from'] : null; + $to = array_key_exists('to', $queryParams) ? $queryParams['to'] : null; + $filterBy = array_key_exists('filterBy', $queryParams) ? $queryParams['filterBy'] : null; + + // verify the required parameter 'metric' is set + if ($metric === null || (is_array($metric) && count($metric) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $metric when calling ' + ); + } + // verify the required parameter 'aggregation' is set + if ($aggregation === null || (is_array($aggregation) && count($aggregation) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $aggregation when calling ' + ); + } + + $resourcePath = '/data/metrics/{metric}/{aggregation}'; + $formParams = []; + $queryParams = []; + $headers = []; + $httpBody = ''; + $multipart = false; + + // from query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, 'form', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + + // to query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, 'form', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + // filterBy query params + if ($filterBy !== null) { + $queryParams['filterBy'] = $filterBy; + } + + // path params + if ($metric !== null) { + $resourcePath = str_replace( + '{' . 'metric' . '}', + ObjectSerializer::toPathValue($metric), + $resourcePath + ); + } + // path params + if ($aggregation !== null) { + $resourcePath = str_replace( + '{' . 'aggregation' . '}', + ObjectSerializer::toPathValue($aggregation), + $resourcePath + ); + } + + + + $query = \http_build_query($queryParams); + + return new Request( + 'GET', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + + /** + * Retrieve metrics in a breakdown of dimensions + * + * @param string $metric Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. - `play-rate` is the ratio that calculates the number of plays your content receives divided by its impressions. - `start` is the number of times playback was started. - `end` is the number of times playback has ended with the content watch until the end. - `impression` is the number of times your content has been loaded and was ready for playback. (required) + * @param string $breakdown Use this path parameter to define a dimension for segmenting analytics data. You must use `kebab-case` for path parameters. These are the available dimensions: - `media-id`: Returns analytics based on the unique identifiers of a video or a live stream. - `media-type`: Returns analytics based on the type of content. Possible values: `video` and `live-stream`. - `continent`: Returns analytics based on the viewers' continent. The list of supported continents names are based on the [GeoNames public database](https://www.geonames.org/countries/). Possible values are: `AS`, `AF`, `NA`, `SA`, `AN`, `EU`, `AZ`. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `device-type`: Returns analytics based on the type of device used by the viewers. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values include `chrome`, `firefox`, `edge`, `opera`. (required) + * @param array $queryParams + * + * @throws \ApiVideo\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponse|\ApiVideo\Client\Model\AnalyticsPlays400Error|\ApiVideo\Client\Model\UnrecognizedRequestUrl|\ApiVideo\Client\Model\TooManyRequests + */ + public function getMetricsBreakdown(string $metric, string $breakdown, array $queryParams = []): \ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponse + { + $request = $this->buildGetMetricsBreakdownRequest($metric, $breakdown, $queryParams); + + $model = new \ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponse($this->client->request($request)); + + return $model; + } + + /** + * Create request for operation 'getMetricsBreakdown' + * + * @param string $metric Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. - `play-rate` is the ratio that calculates the number of plays your content receives divided by its impressions. - `start` is the number of times playback was started. - `end` is the number of times playback has ended with the content watch until the end. - `impression` is the number of times your content has been loaded and was ready for playback. (required) + * @param string $breakdown Use this path parameter to define a dimension for segmenting analytics data. You must use `kebab-case` for path parameters. These are the available dimensions: - `media-id`: Returns analytics based on the unique identifiers of a video or a live stream. - `media-type`: Returns analytics based on the type of content. Possible values: `video` and `live-stream`. - `continent`: Returns analytics based on the viewers' continent. The list of supported continents names are based on the [GeoNames public database](https://www.geonames.org/countries/). Possible values are: `AS`, `AF`, `NA`, `SA`, `AN`, `EU`, `AZ`. - `country`: Returns analytics based on the viewers' country. The list of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/). - `device-type`: Returns analytics based on the type of device used by the viewers. Possible response values are: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values include `chrome`, `firefox`, `edge`, `opera`. (required) + * @param array $queryParams + * + * @throws \InvalidArgumentException + * @return Request + */ + private function buildGetMetricsBreakdownRequest(string $metric, string $breakdown, array $queryParams = []): Request + { + // unbox the parameters from the associative array + $from = array_key_exists('from', $queryParams) ? $queryParams['from'] : null; + $to = array_key_exists('to', $queryParams) ? $queryParams['to'] : null; + $filterBy = array_key_exists('filterBy', $queryParams) ? $queryParams['filterBy'] : null; + + // verify the required parameter 'metric' is set + if ($metric === null || (is_array($metric) && count($metric) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $metric when calling ' + ); + } + // verify the required parameter 'breakdown' is set + if ($breakdown === null || (is_array($breakdown) && count($breakdown) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $breakdown when calling ' + ); + } + + $resourcePath = '/data/buckets/{metric}/{breakdown}'; + $formParams = []; + $queryParams = []; + $headers = []; + $httpBody = ''; + $multipart = false; + + // from query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, 'form', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + + // to query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, 'form', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + // filterBy query params + if ($filterBy !== null) { + $queryParams['filterBy'] = $filterBy; + } + + // path params + if ($metric !== null) { + $resourcePath = str_replace( + '{' . 'metric' . '}', + ObjectSerializer::toPathValue($metric), + $resourcePath + ); + } + // path params + if ($breakdown !== null) { + $resourcePath = str_replace( + '{' . 'breakdown' . '}', + ObjectSerializer::toPathValue($breakdown), + $resourcePath + ); + } + + + + $query = \http_build_query($queryParams); + + return new Request( + 'GET', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + + /** + * Retrieve metrics over time + * + * @param string $metric Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. - `play-rate` is the ratio that calculates the number of plays your content receives divided by its impressions. - `start` is the number of times playback was started. - `end` is the number of times playback has ended with the content watch until the end. - `impression` is the number of times your content has been loaded and was ready for playback. (required) + * @param array $queryParams + * + * @throws \ApiVideo\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponse|\ApiVideo\Client\Model\AnalyticsPlays400Error|\ApiVideo\Client\Model\UnrecognizedRequestUrl|\ApiVideo\Client\Model\TooManyRequests + */ + public function getMetricsOverTime(string $metric, array $queryParams = []): \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponse + { + $request = $this->buildGetMetricsOverTimeRequest($metric, $queryParams); + + $model = new \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponse($this->client->request($request)); + + return $model; + } + + /** + * Create request for operation 'getMetricsOverTime' + * + * @param string $metric Use this path parameter to select a metric that you want analytics for. - `play` is the number of times your content has been played. - `play-rate` is the ratio that calculates the number of plays your content receives divided by its impressions. - `start` is the number of times playback was started. - `end` is the number of times playback has ended with the content watch until the end. - `impression` is the number of times your content has been loaded and was ready for playback. (required) + * @param array $queryParams + * + * @throws \InvalidArgumentException + * @return Request + */ + private function buildGetMetricsOverTimeRequest(string $metric, array $queryParams = []): Request + { + // unbox the parameters from the associative array + $from = array_key_exists('from', $queryParams) ? $queryParams['from'] : null; + $to = array_key_exists('to', $queryParams) ? $queryParams['to'] : null; + $interval = array_key_exists('interval', $queryParams) ? $queryParams['interval'] : null; + $filterBy = array_key_exists('filterBy', $queryParams) ? $queryParams['filterBy'] : null; + + // verify the required parameter 'metric' is set + if ($metric === null || (is_array($metric) && count($metric) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $metric when calling ' + ); + } + + $resourcePath = '/data/timeseries/{metric}'; + $formParams = []; + $queryParams = []; + $headers = []; + $httpBody = ''; + $multipart = false; + + // from query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, 'form', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + + // to query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, 'form', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + // interval query params + if (is_array($interval)) { + $interval = ObjectSerializer::serializeCollection($interval, 'form', true); + } + if ($interval !== null) { + $queryParams['interval'] = $interval; + } + + // filterBy query params + if ($filterBy !== null) { + $queryParams['filterBy'] = $filterBy; + } + + // path params + if ($metric !== null) { + $resourcePath = str_replace( + '{' . 'metric' . '}', + ObjectSerializer::toPathValue($metric), + $resourcePath + ); + } + + + + $query = \http_build_query($queryParams); + + return new Request( + 'GET', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + +} diff --git a/src/Client.php b/src/Client.php index ed9196c..0e26f7f 100644 --- a/src/Client.php +++ b/src/Client.php @@ -84,6 +84,18 @@ public function analytics(): \ApiVideo\Client\Api\AnalyticsApi return $this->services['analytics']; } + /** + * @return \ApiVideo\Client\Api\AnalyticsV20BetaApi + */ + public function analyticsV20Beta(): \ApiVideo\Client\Api\AnalyticsV20BetaApi + { + if (!array_key_exists('analyticsV20Beta', $this->services)) { + $this->services['analyticsV20Beta'] = new \ApiVideo\Client\Api\AnalyticsV20BetaApi($this->baseClient); + } + + return $this->services['analyticsV20Beta']; + } + /** * @return \ApiVideo\Client\Api\CaptionsApi */ diff --git a/src/Model/AnalyticsAggregatedMetricsResponse.php b/src/Model/AnalyticsAggregatedMetricsResponse.php new file mode 100644 index 0000000..a64326f --- /dev/null +++ b/src/Model/AnalyticsAggregatedMetricsResponse.php @@ -0,0 +1,186 @@ + '\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContext', + 'data' => 'float' + ], + [ + 'context' => null, + 'data' => 'float' + ], + [ + 'context' => 'context', + 'data' => 'data' + ], + [ + 'context' => 'setContext', + 'data' => 'setData' + ], + [ + 'context' => 'getContext', + 'data' => 'getData' + ], + [ + 'context' => null, + 'data' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['context'] = isset($data['context']) ? new AnalyticsAggregatedMetricsResponseContext($data['context']) : null; + $this->container['data'] = $data['data'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['context'] === null) { + $invalidProperties[] = "'context' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets context + * + * @return \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContext + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContext $context context + * + * @return self + */ + public function setContext($context) + { + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets data + * + * @return float + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param float $data data + * + * @return self + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/AnalyticsAggregatedMetricsResponseContext.php b/src/Model/AnalyticsAggregatedMetricsResponseContext.php new file mode 100644 index 0000000..bf1ca3d --- /dev/null +++ b/src/Model/AnalyticsAggregatedMetricsResponseContext.php @@ -0,0 +1,293 @@ + 'string', + 'aggregation' => 'string', + 'timeframe' => '\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe' + ], + [ + 'metric' => null, + 'aggregation' => null, + 'timeframe' => null + ], + [ + 'metric' => 'metric', + 'aggregation' => 'aggregation', + 'timeframe' => 'timeframe' + ], + [ + 'metric' => 'setMetric', + 'aggregation' => 'setAggregation', + 'timeframe' => 'setTimeframe' + ], + [ + 'metric' => 'getMetric', + 'aggregation' => 'getAggregation', + 'timeframe' => 'getTimeframe' + ], + [ + 'metric' => null, + 'aggregation' => null, + 'timeframe' => null + ], + null + ); + } + + const METRIC_PLAY = 'play'; + const METRIC_START = 'start'; + const METRIC_END = 'end'; + const METRIC_IMPRESSION = 'impression'; + const METRIC_IMPRESSION_TIME = 'impression-time'; + const METRIC_WATCH_TIME = 'watch-time'; + const AGGREGATION_COUNT = 'count'; + const AGGREGATION_RATE = 'rate'; + const AGGREGATION_TOTAL = 'total'; + const AGGREGATION_AVERAGE = 'average'; + const AGGREGATION_SUM = 'sum'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMetricAllowableValues() + { + return [ + self::METRIC_PLAY, + self::METRIC_START, + self::METRIC_END, + self::METRIC_IMPRESSION, + self::METRIC_IMPRESSION_TIME, + self::METRIC_WATCH_TIME, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAggregationAllowableValues() + { + return [ + self::AGGREGATION_COUNT, + self::AGGREGATION_RATE, + self::AGGREGATION_TOTAL, + self::AGGREGATION_AVERAGE, + self::AGGREGATION_SUM, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['metric'] = $data['metric'] ?? null; + $this->container['aggregation'] = $data['aggregation'] ?? null; + $this->container['timeframe'] = isset($data['timeframe']) ? new AnalyticsAggregatedMetricsResponseContextTimeframe($data['timeframe']) : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getMetricAllowableValues(); + if (!is_null($this->container['metric']) && !in_array($this->container['metric'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'metric', must be one of '%s'", + $this->container['metric'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getAggregationAllowableValues(); + if (!is_null($this->container['aggregation']) && !in_array($this->container['aggregation'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'aggregation', must be one of '%s'", + $this->container['aggregation'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets metric + * + * @return string|null + */ + public function getMetric() + { + return $this->container['metric']; + } + + /** + * Sets metric + * + * @param string|null $metric Returns the metric you selected. + * + * @return self + */ + public function setMetric($metric) + { + $allowedValues = $this->getMetricAllowableValues(); + if (!is_null($metric) && !in_array($metric, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'metric', must be one of '%s'", + $metric, + implode("', '", $allowedValues) + ) + ); + } + $this->container['metric'] = $metric; + + return $this; + } + + /** + * Gets aggregation + * + * @return string|null + */ + public function getAggregation() + { + return $this->container['aggregation']; + } + + /** + * Sets aggregation + * + * @param string|null $aggregation Returns the aggregation you selected. + * + * @return self + */ + public function setAggregation($aggregation) + { + $allowedValues = $this->getAggregationAllowableValues(); + if (!is_null($aggregation) && !in_array($aggregation, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'aggregation', must be one of '%s'", + $aggregation, + implode("', '", $allowedValues) + ) + ); + } + $this->container['aggregation'] = $aggregation; + + return $this; + } + + /** + * Gets timeframe + * + * @return \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe|null + */ + public function getTimeframe() + { + return $this->container['timeframe']; + } + + /** + * Sets timeframe + * + * @param \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe|null $timeframe timeframe + * + * @return self + */ + public function setTimeframe($timeframe) + { + $this->container['timeframe'] = $timeframe; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.php b/src/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.php new file mode 100644 index 0000000..3f3bc4b --- /dev/null +++ b/src/Model/AnalyticsAggregatedMetricsResponseContextTimeframe.php @@ -0,0 +1,181 @@ + '\DateTime', + 'to' => '\DateTime' + ], + [ + 'from' => 'date-time', + 'to' => 'date-time' + ], + [ + 'from' => 'from', + 'to' => 'to' + ], + [ + 'from' => 'setFrom', + 'to' => 'setTo' + ], + [ + 'from' => 'getFrom', + 'to' => 'getTo' + ], + [ + 'from' => null, + 'to' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['from'] = isset($data['from']) ? new \DateTime($data['from']) : null; + $this->container['to'] = isset($data['to']) ? new \DateTime($data['to']) : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return \DateTime|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \DateTime|null $from Returns the starting date-time of the period you want analytics for in ATOM date-time format. + * + * @return self + */ + public function setFrom($from) + { + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return \DateTime|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \DateTime|null $to Returns the starting date-time of the period you want analytics for in ATOM date-time format. + * + * @return self + */ + public function setTo($to) + { + $this->container['to'] = $to; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/AnalyticsMetricsBreakdownResponse.php b/src/Model/AnalyticsMetricsBreakdownResponse.php new file mode 100644 index 0000000..bac8751 --- /dev/null +++ b/src/Model/AnalyticsMetricsBreakdownResponse.php @@ -0,0 +1,220 @@ + '\ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponseContext', + 'data' => '\ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponseData[]', + 'pagination' => '\ApiVideo\Client\Model\Pagination' + ], + [ + 'context' => null, + 'data' => null, + 'pagination' => null + ], + [ + 'context' => 'context', + 'data' => 'data', + 'pagination' => 'pagination' + ], + [ + 'context' => 'setContext', + 'data' => 'setData', + 'pagination' => 'setPagination' + ], + [ + 'context' => 'getContext', + 'data' => 'getData', + 'pagination' => 'getPagination' + ], + [ + 'context' => null, + 'data' => null, + 'pagination' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['context'] = isset($data['context']) ? new AnalyticsMetricsBreakdownResponseContext($data['context']) : null; + $this->container['data'] = isset($data['data']) ? array_map(function(array $value): AnalyticsMetricsBreakdownResponseData { return new AnalyticsMetricsBreakdownResponseData($value); }, $data['data']) : null; + $this->container['pagination'] = isset($data['pagination']) ? new Pagination($data['pagination']) : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['context'] === null) { + $invalidProperties[] = "'context' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['pagination'] === null) { + $invalidProperties[] = "'pagination' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets context + * + * @return \ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponseContext + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param \ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponseContext $context context + * + * @return self + */ + public function setContext($context) + { + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets data + * + * @return \ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponseData[] + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \ApiVideo\Client\Model\AnalyticsMetricsBreakdownResponseData[] $data Returns an array of dimensions and their respective metrics. + * + * @return self + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets pagination + * + * @return \ApiVideo\Client\Model\Pagination + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \ApiVideo\Client\Model\Pagination $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + $this->container['pagination'] = $pagination; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/AnalyticsMetricsBreakdownResponseContext.php b/src/Model/AnalyticsMetricsBreakdownResponseContext.php new file mode 100644 index 0000000..09f86cd --- /dev/null +++ b/src/Model/AnalyticsMetricsBreakdownResponseContext.php @@ -0,0 +1,295 @@ + 'string', + 'breakdown' => 'string', + 'timeframe' => '\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe' + ], + [ + 'metric' => null, + 'breakdown' => null, + 'timeframe' => null + ], + [ + 'metric' => 'metric', + 'breakdown' => 'breakdown', + 'timeframe' => 'timeframe' + ], + [ + 'metric' => 'setMetric', + 'breakdown' => 'setBreakdown', + 'timeframe' => 'setTimeframe' + ], + [ + 'metric' => 'getMetric', + 'breakdown' => 'getBreakdown', + 'timeframe' => 'getTimeframe' + ], + [ + 'metric' => null, + 'breakdown' => null, + 'timeframe' => null + ], + null + ); + } + + const METRIC_PLAY = 'play'; + const METRIC_PLAY_RATE = 'play-rate'; + const METRIC_START = 'start'; + const METRIC_END = 'end'; + const METRIC_IMPRESSION = 'impression'; + const BREAKDOWN_MEDIA_ID = 'media-id'; + const BREAKDOWN_MEDIA_TYPE = 'media-type'; + const BREAKDOWN_CONTINENT = 'continent'; + const BREAKDOWN_COUNTRY = 'country'; + const BREAKDOWN_DEVICE_TYPE = 'device-type'; + const BREAKDOWN_OPERATING_SYSTEM = 'operating-system'; + const BREAKDOWN_BROWSER = 'browser'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMetricAllowableValues() + { + return [ + self::METRIC_PLAY, + self::METRIC_PLAY_RATE, + self::METRIC_START, + self::METRIC_END, + self::METRIC_IMPRESSION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBreakdownAllowableValues() + { + return [ + self::BREAKDOWN_MEDIA_ID, + self::BREAKDOWN_MEDIA_TYPE, + self::BREAKDOWN_CONTINENT, + self::BREAKDOWN_COUNTRY, + self::BREAKDOWN_DEVICE_TYPE, + self::BREAKDOWN_OPERATING_SYSTEM, + self::BREAKDOWN_BROWSER, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['metric'] = $data['metric'] ?? null; + $this->container['breakdown'] = $data['breakdown'] ?? null; + $this->container['timeframe'] = isset($data['timeframe']) ? new AnalyticsAggregatedMetricsResponseContextTimeframe($data['timeframe']) : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getMetricAllowableValues(); + if (!is_null($this->container['metric']) && !in_array($this->container['metric'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'metric', must be one of '%s'", + $this->container['metric'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getBreakdownAllowableValues(); + if (!is_null($this->container['breakdown']) && !in_array($this->container['breakdown'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'breakdown', must be one of '%s'", + $this->container['breakdown'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets metric + * + * @return string|null + */ + public function getMetric() + { + return $this->container['metric']; + } + + /** + * Sets metric + * + * @param string|null $metric Returns the metric you selected. + * + * @return self + */ + public function setMetric($metric) + { + $allowedValues = $this->getMetricAllowableValues(); + if (!is_null($metric) && !in_array($metric, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'metric', must be one of '%s'", + $metric, + implode("', '", $allowedValues) + ) + ); + } + $this->container['metric'] = $metric; + + return $this; + } + + /** + * Gets breakdown + * + * @return string|null + */ + public function getBreakdown() + { + return $this->container['breakdown']; + } + + /** + * Sets breakdown + * + * @param string|null $breakdown Returns the dimension you selected. + * + * @return self + */ + public function setBreakdown($breakdown) + { + $allowedValues = $this->getBreakdownAllowableValues(); + if (!is_null($breakdown) && !in_array($breakdown, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'breakdown', must be one of '%s'", + $breakdown, + implode("', '", $allowedValues) + ) + ); + } + $this->container['breakdown'] = $breakdown; + + return $this; + } + + /** + * Gets timeframe + * + * @return \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe|null + */ + public function getTimeframe() + { + return $this->container['timeframe']; + } + + /** + * Sets timeframe + * + * @param \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe|null $timeframe timeframe + * + * @return self + */ + public function setTimeframe($timeframe) + { + $this->container['timeframe'] = $timeframe; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/AnalyticsMetricsBreakdownResponseData.php b/src/Model/AnalyticsMetricsBreakdownResponseData.php new file mode 100644 index 0000000..9d1874f --- /dev/null +++ b/src/Model/AnalyticsMetricsBreakdownResponseData.php @@ -0,0 +1,180 @@ + 'string', + 'metricValue' => 'float' + ], + [ + 'dimensionValue' => null, + 'metricValue' => 'float' + ], + [ + 'dimensionValue' => 'dimensionValue', + 'metricValue' => 'metricValue' + ], + [ + 'dimensionValue' => 'setDimensionValue', + 'metricValue' => 'setMetricValue' + ], + [ + 'dimensionValue' => 'getDimensionValue', + 'metricValue' => 'getMetricValue' + ], + [ + 'dimensionValue' => null, + 'metricValue' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['dimensionValue'] = $data['dimensionValue'] ?? null; + $this->container['metricValue'] = $data['metricValue'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets dimensionValue + * + * @return string|null + */ + public function getDimensionValue() + { + return $this->container['dimensionValue']; + } + + /** + * Sets dimensionValue + * + * @param string|null $dimensionValue Returns a specific value for the dimension you selected, based on the data. For example if you select `continent` as a dimension, then `dimensionValue` returns values like `EU` or \"AZ\". + * + * @return self + */ + public function setDimensionValue($dimensionValue) + { + $this->container['dimensionValue'] = $dimensionValue; + + return $this; + } + + /** + * Gets metricValue + * + * @return float|null + */ + public function getMetricValue() + { + return $this->container['metricValue']; + } + + /** + * Sets metricValue + * + * @param float|null $metricValue Returns the data for a specific dimension value. + * + * @return self + */ + public function setMetricValue($metricValue) + { + $this->container['metricValue'] = $metricValue; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/AnalyticsMetricsOverTimeResponse.php b/src/Model/AnalyticsMetricsOverTimeResponse.php new file mode 100644 index 0000000..72ab4fc --- /dev/null +++ b/src/Model/AnalyticsMetricsOverTimeResponse.php @@ -0,0 +1,220 @@ + '\ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseContext', + 'data' => '\ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseData[]', + 'pagination' => '\ApiVideo\Client\Model\Pagination' + ], + [ + 'context' => null, + 'data' => null, + 'pagination' => null + ], + [ + 'context' => 'context', + 'data' => 'data', + 'pagination' => 'pagination' + ], + [ + 'context' => 'setContext', + 'data' => 'setData', + 'pagination' => 'setPagination' + ], + [ + 'context' => 'getContext', + 'data' => 'getData', + 'pagination' => 'getPagination' + ], + [ + 'context' => null, + 'data' => null, + 'pagination' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['context'] = isset($data['context']) ? new AnalyticsMetricsOverTimeResponseContext($data['context']) : null; + $this->container['data'] = isset($data['data']) ? array_map(function(array $value): AnalyticsMetricsOverTimeResponseData { return new AnalyticsMetricsOverTimeResponseData($value); }, $data['data']) : null; + $this->container['pagination'] = isset($data['pagination']) ? new Pagination($data['pagination']) : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['context'] === null) { + $invalidProperties[] = "'context' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['pagination'] === null) { + $invalidProperties[] = "'pagination' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets context + * + * @return \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseContext + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseContext $context context + * + * @return self + */ + public function setContext($context) + { + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets data + * + * @return \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseData[] + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseData[] $data Returns an array of metrics and the timestamps . + * + * @return self + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets pagination + * + * @return \ApiVideo\Client\Model\Pagination + */ + public function getPagination() + { + return $this->container['pagination']; + } + + /** + * Sets pagination + * + * @param \ApiVideo\Client\Model\Pagination $pagination pagination + * + * @return self + */ + public function setPagination($pagination) + { + $this->container['pagination'] = $pagination; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/AnalyticsMetricsOverTimeResponseContext.php b/src/Model/AnalyticsMetricsOverTimeResponseContext.php new file mode 100644 index 0000000..efc843e --- /dev/null +++ b/src/Model/AnalyticsMetricsOverTimeResponseContext.php @@ -0,0 +1,285 @@ + 'string', + 'interval' => 'string', + 'timeframe' => '\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe' + ], + [ + 'metric' => null, + 'interval' => null, + 'timeframe' => null + ], + [ + 'metric' => 'metric', + 'interval' => 'interval', + 'timeframe' => 'timeframe' + ], + [ + 'metric' => 'setMetric', + 'interval' => 'setInterval', + 'timeframe' => 'setTimeframe' + ], + [ + 'metric' => 'getMetric', + 'interval' => 'getInterval', + 'timeframe' => 'getTimeframe' + ], + [ + 'metric' => null, + 'interval' => null, + 'timeframe' => null + ], + null + ); + } + + const METRIC_PLAY = 'play'; + const METRIC_PLAY_RATE = 'play-rate'; + const METRIC_START = 'start'; + const METRIC_END = 'end'; + const METRIC_IMPRESSION = 'impression'; + const INTERVAL_HOUR = 'hour'; + const INTERVAL_DAY = 'day'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMetricAllowableValues() + { + return [ + self::METRIC_PLAY, + self::METRIC_PLAY_RATE, + self::METRIC_START, + self::METRIC_END, + self::METRIC_IMPRESSION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIntervalAllowableValues() + { + return [ + self::INTERVAL_HOUR, + self::INTERVAL_DAY, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['metric'] = $data['metric'] ?? null; + $this->container['interval'] = $data['interval'] ?? null; + $this->container['timeframe'] = isset($data['timeframe']) ? new AnalyticsAggregatedMetricsResponseContextTimeframe($data['timeframe']) : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getMetricAllowableValues(); + if (!is_null($this->container['metric']) && !in_array($this->container['metric'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'metric', must be one of '%s'", + $this->container['metric'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getIntervalAllowableValues(); + if (!is_null($this->container['interval']) && !in_array($this->container['interval'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'interval', must be one of '%s'", + $this->container['interval'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets metric + * + * @return string|null + */ + public function getMetric() + { + return $this->container['metric']; + } + + /** + * Sets metric + * + * @param string|null $metric Returns the metric you selected. + * + * @return self + */ + public function setMetric($metric) + { + $allowedValues = $this->getMetricAllowableValues(); + if (!is_null($metric) && !in_array($metric, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'metric', must be one of '%s'", + $metric, + implode("', '", $allowedValues) + ) + ); + } + $this->container['metric'] = $metric; + + return $this; + } + + /** + * Gets interval + * + * @return string|null + */ + public function getInterval() + { + return $this->container['interval']; + } + + /** + * Sets interval + * + * @param string|null $interval Returns the interval you selected. + * + * @return self + */ + public function setInterval($interval) + { + $allowedValues = $this->getIntervalAllowableValues(); + if (!is_null($interval) && !in_array($interval, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'interval', must be one of '%s'", + $interval, + implode("', '", $allowedValues) + ) + ); + } + $this->container['interval'] = $interval; + + return $this; + } + + /** + * Gets timeframe + * + * @return \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe|null + */ + public function getTimeframe() + { + return $this->container['timeframe']; + } + + /** + * Sets timeframe + * + * @param \ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe|null $timeframe timeframe + * + * @return self + */ + public function setTimeframe($timeframe) + { + $this->container['timeframe'] = $timeframe; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/AnalyticsMetricsOverTimeResponseData.php b/src/Model/AnalyticsMetricsOverTimeResponseData.php new file mode 100644 index 0000000..dc2c9f5 --- /dev/null +++ b/src/Model/AnalyticsMetricsOverTimeResponseData.php @@ -0,0 +1,180 @@ + 'string', + 'metricValue' => 'float' + ], + [ + 'emittedAt' => null, + 'metricValue' => 'float' + ], + [ + 'emittedAt' => 'emittedAt', + 'metricValue' => 'metricValue' + ], + [ + 'emittedAt' => 'setEmittedAt', + 'metricValue' => 'setMetricValue' + ], + [ + 'emittedAt' => 'getEmittedAt', + 'metricValue' => 'getMetricValue' + ], + [ + 'emittedAt' => null, + 'metricValue' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['emittedAt'] = $data['emittedAt'] ?? null; + $this->container['metricValue'] = $data['metricValue'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets emittedAt + * + * @return string|null + */ + public function getEmittedAt() + { + return $this->container['emittedAt']; + } + + /** + * Sets emittedAt + * + * @param string|null $emittedAt Returns the timestamp of the event that belongs to a specific metric in ATOM date-time format. For example, if you set `play` with an `hour` interval in your request, then `emittedAt` returns the hourly timestamps of every play event within the timeframe you defined. + * + * @return self + */ + public function setEmittedAt($emittedAt) + { + $this->container['emittedAt'] = $emittedAt; + + return $this; + } + + /** + * Gets metricValue + * + * @return float|null + */ + public function getMetricValue() + { + return $this->container['metricValue']; + } + + /** + * Sets metricValue + * + * @param float|null $metricValue Returns the data for a specific metric value. + * + * @return self + */ + public function setMetricValue($metricValue) + { + $this->container['metricValue'] = $metricValue; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/src/Model/UnrecognizedRequestUrl.php b/src/Model/UnrecognizedRequestUrl.php new file mode 100644 index 0000000..69053ed --- /dev/null +++ b/src/Model/UnrecognizedRequestUrl.php @@ -0,0 +1,211 @@ + 'string', + 'title' => 'string', + 'status' => 'int' + ], + [ + 'type' => null, + 'title' => null, + 'status' => null + ], + [ + 'type' => 'type', + 'title' => 'title', + 'status' => 'status' + ], + [ + 'type' => 'setType', + 'title' => 'setTitle', + 'status' => 'setStatus' + ], + [ + 'type' => 'getType', + 'title' => 'getTitle', + 'status' => 'getStatus' + ], + [ + 'type' => null, + 'title' => null, + 'status' => null + ], + null + ); + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['type'] = $data['type'] ?? null; + $this->container['title'] = $data['title'] ?? null; + $this->container['status'] = $data['status'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type A link to the error documentation. + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title A description of the error that occurred. + * + * @return self + */ + public function setTitle($title) + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets status + * + * @return int|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int|null $status The HTTP status code. + * + * @return self + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + +