From 142fae258455fa424f126c185634a22e06a5eadd Mon Sep 17 00:00:00 2001 From: szekelyzol Date: Mon, 4 Nov 2024 14:40:06 +0000 Subject: [PATCH] Analytics updates --- CHANGELOG.md | 3 + docs/Api/AnalyticsApi.md | 24 +++--- ...alyticsAggregatedMetricsResponseContext.md | 2 +- ...nalyticsMetricsBreakdownResponseContext.md | 2 +- .../Model/AnalyticsMetricsOverTimeResponse.md | 2 +- ...AnalyticsMetricsOverTimeResponseContext.md | 2 +- docs/Model/FilterBy.md | 1 + docs/Model/FilterBy1.md | 1 + docs/Model/FilterBy2.md | 1 + src/Api/AnalyticsApi.php | 74 ++++++++++++++++--- src/BaseClient.php | 4 +- ...lyticsAggregatedMetricsResponseContext.php | 24 +++++- ...alyticsMetricsBreakdownResponseContext.php | 28 ++++++- .../AnalyticsMetricsOverTimeResponse.php | 2 +- ...nalyticsMetricsOverTimeResponseContext.php | 30 +++++++- src/Model/FilterBy.php | 43 +++++++++-- src/Model/FilterBy1.php | 43 +++++++++-- src/Model/FilterBy2.php | 43 +++++++++-- 18 files changed, 282 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78126bf..6c6419f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [1.4.6] - 2024-11-04 +- Analytics updates (ccv, views, ...) + ## [1.4.5] - 2024-10-21 - Add summary feature diff --git a/docs/Api/AnalyticsApi.md b/docs/Api/AnalyticsApi.md index e76cf53..005006f 100644 --- a/docs/Api/AnalyticsApi.md +++ b/docs/Api/AnalyticsApi.md @@ -20,9 +20,9 @@ Retrieve time-based and countable metrics like average watch time or the number 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. | + `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. - `ccv`: is the number of concurrent viewers, or users watching at the same time. - `view`: the total number of viewers until this point in time. | `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. | + `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. - `peak` shows the highest value of the `ccv` metric in the timeframe of your request. You can use this aggregation only with the `ccv` metric. - `live` shows the highest value of the `ccv` metric from the last 20 seconds. You can use this aggregation only with the `ccv` metric. | `queryParams` | array | (see below) | @@ -32,7 +32,9 @@ 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 30 days ago. - 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` | [**FilterBy2**](../Model/.md)| 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` or `/data/buckets/play-total/media-id`. 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/). You must use the ISO-3166 alpha2 format, for example `EU`. 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/). You must use the ISO-3166 alpha2 format, for example `FR`. - `deviceType`: Returns analytics based on the type of device used by the viewers. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `tag`: Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). | [optional] + `unique` | **bool**| Use this query parameter to control how viewer data is counted: - `true` means that a single user watching multiple times counts as 1 unique viewer - `false` means that all views count, even if from the same user. The API accepts this parameter only when you use the `ccv` or `view` metric. Viewers are unique for 1 day. The API determines uniqueness based on a viewer's `user-agent` and IP address. This means that the API can filter viewers using multiple tabs to watch the same video multiple times, but cannot filter for viewers who use multiple browsers to watch the same content multiple times. | [optional] + `viewDuration` | **string**| Use this query parameter to define how many seconds a view has to last to be counted in analytics data. - You can only use this parameter with the `view` metric. - The accepted values are `3s`, `5s`, `10s`, and `30s`. - If you do not set this parameter, the API defaults to `5s`. | [optional] + `filterBy` | [**FilterBy2**](../Model/.md)| 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` or `/data/buckets/play-total/media-id`. 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/). You must use the ISO-3166 alpha2 format, for example `EU`. 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/). You must use the ISO-3166 alpha2 format, for example `FR`. - `deviceType`: Returns analytics based on the type of device used by the viewers. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `tag`: Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). - `referrer`: Filters data based on the URL where the view is originating from. Accepts an empty string as a value to filter view events where no referrer is available. | [optional] @@ -58,9 +60,9 @@ Retrieve detailed analytics play-rate and number of impressions segmented by dim 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. - `play-total` is the total number of times a specific content has been played. You can only use the `media-id` breakdown with this metric. - `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. | + `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. - `play-total` is the total number of times a specific content has been played. You can only use the `media-id` breakdown with this metric. - `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. - `ccv-peak` is the highest number of concurrent viewers in the timeframe of your request. - `ccv-average` is the average number of concurrent viewers in the timeframe of your request. - `view` is the total number of viewers until this point in time. | `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. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. | + `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. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `referrer`: Returns the URL where the view originates from, for example a website where the video is embedded. View events from Android and iOS return empty strings as the value for `referrer`. | `queryParams` | array | (see below) | @@ -72,7 +74,9 @@ Name | Type | Description | Notes `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] `sortBy` | **string**| Use this parameter to choose which field the API will use to sort the analytics data. These are the available fields to sort by: - `metricValue`: Sorts the results based on the **metric** you selected in your request. - `dimensionValue`: Sorts the results based on the **dimension** you selected in your request. | [optional] `sortOrder` | **string**| Use this parameter to define the sort order of results. These are the available sort orders: - `asc`: Sorts the results in ascending order: `A to Z` and `0 to 9`. - `desc`: Sorts the results in descending order: `Z to A` and `9 to 0`. | [optional] - `filterBy` | [**FilterBy2**](../Model/.md)| 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` or `/data/buckets/play-total/media-id`. 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/). You must use the ISO-3166 alpha2 format, for example `EU`. 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/). You must use the ISO-3166 alpha2 format, for example `FR`. - `deviceType`: Returns analytics based on the type of device used by the viewers. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `tag`: Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). | [optional] + `unique` | **bool**| Use this query parameter to control how viewer data is counted: - `true` means that a single user watching multiple times counts as 1 unique viewer - `false` means that all views count, even if from the same user. The API accepts this parameter only when you use the `ccv-peak`, `ccv-average`, or `view` metric. Viewers are unique for 1 day. The API determines uniqueness based on a viewer's `user-agent` and IP address. This means that the API can filter viewers using multiple tabs to watch the same video multiple times, but cannot filter for viewers who use multiple browsers to watch the same content multiple times. | [optional] + `viewDuration` | **string**| Use this query parameter to define how many seconds a view has to last to be counted in analytics data. - You can only use this parameter together with the `view` metric. - The accepted values are `3s`, `5s`, `10s`, and `30s`. - If you do not set this parameter, the API defaults to `5s`. | [optional] + `filterBy` | [**FilterBy2**](../Model/.md)| 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` or `/data/buckets/play-total/media-id`. 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/). You must use the ISO-3166 alpha2 format, for example `EU`. 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/). You must use the ISO-3166 alpha2 format, for example `FR`. - `deviceType`: Returns analytics based on the type of device used by the viewers. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `tag`: Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). - `referrer`: Filters data based on the URL where the view is originating from. Accepts an empty string as a value to filter view events where no referrer is available. | [optional] `currentPage` | **int**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] `pageSize` | **int**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] @@ -100,7 +104,7 @@ Retrieve countable metrics like the number of plays or impressions, grouped by t 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. | + `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. - `ccv-peak` is the highest number of concurrent viewers in the timeframe of your request. - `ccv-average` is the average number of concurrent viewers in the timeframe of your request. - `view` is the total number of viewers. | `queryParams` | array | (see below) | @@ -110,10 +114,12 @@ 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 30 days ago. - 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` | **string**| 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] + `interval` | **string**| Use this query parameter to define the granularity of the data. Possible values: `minute`, `hour`, `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`. - When you set `minute` as interval, the timeframe you define with the `from` and `to` parameters must be less than 60 minutes. | [optional] `sortBy` | **string**| Use this parameter to choose which field the API will use to sort the analytics data. These are the available fields to sort by: - `metricValue`: Sorts the results based on the **metric** you selected in your request. - `emittedAt`: Sorts the results based on the **timestamp** of the event in ATOM date-time format. | [optional] `sortOrder` | **string**| Use this parameter to define the sort order of results. These are the available sort orders: - `asc`: Sorts the results in ascending order: `A to Z` and `0 to 9`. - `desc`: Sorts the results in descending order: `Z to A` and `9 to 0`. | [optional] - `filterBy` | [**FilterBy2**](../Model/.md)| 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` or `/data/buckets/play-total/media-id`. 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/). You must use the ISO-3166 alpha2 format, for example `EU`. 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/). You must use the ISO-3166 alpha2 format, for example `FR`. - `deviceType`: Returns analytics based on the type of device used by the viewers. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `tag`: Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). | [optional] + `unique` | **bool**| Use this query parameter to control how viewer data is counted: - `true` means that a single user watching multiple times counts as 1 unique viewer - `false` means that all views count, even if from the same user. The API accepts this parameter only when you use the `ccv-peak`, `ccv-average`, or `view` metric. Viewers are unique for 1 day. The API determines uniqueness based on a viewer's `user-agent` and IP address. This means that the API can filter viewers using multiple tabs to watch the same video multiple times, but cannot filter for viewers who use multiple browsers to watch the same content multiple times. | [optional] + `viewDuration` | **string**| Use this query parameter to define how many seconds a view has to last to be counted in analytics data. - You can only use this parameter together with the `view` metric. - The accepted values are `3s`, `5s`, `10s`, and `30s`. - If you do not set this parameter, the API defaults to `5s`. | [optional] + `filterBy` | [**FilterBy2**](../Model/.md)| 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` or `/data/buckets/play-total/media-id`. 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/). You must use the ISO-3166 alpha2 format, for example `EU`. 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/). You must use the ISO-3166 alpha2 format, for example `FR`. - `deviceType`: Returns analytics based on the type of device used by the viewers. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operatingSystem`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `tag`: Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). - `referrer`: Filters data based on the URL where the view is originating from. Accepts an empty string as a value to filter view events where no referrer is available. | [optional] `currentPage` | **int**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] `pageSize` | **int**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] diff --git a/docs/Model/AnalyticsAggregatedMetricsResponseContext.md b/docs/Model/AnalyticsAggregatedMetricsResponseContext.md index 0db5e2e..865eb34 100644 --- a/docs/Model/AnalyticsAggregatedMetricsResponseContext.md +++ b/docs/Model/AnalyticsAggregatedMetricsResponseContext.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**metric** | **string** | Returns the metric you selected. | [optional] +**metric** | **string** | Returns the metric and relevant parameters you selected. | [optional] **aggregation** | **string** | Returns the aggregation you selected. | [optional] **timeframe** | [**\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe**](AnalyticsAggregatedMetricsResponseContextTimeframe.md) | | [optional] diff --git a/docs/Model/AnalyticsMetricsBreakdownResponseContext.md b/docs/Model/AnalyticsMetricsBreakdownResponseContext.md index 6e15192..1bb41f2 100644 --- a/docs/Model/AnalyticsMetricsBreakdownResponseContext.md +++ b/docs/Model/AnalyticsMetricsBreakdownResponseContext.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**metric** | **string** | Returns the metric you selected. | [optional] +**metric** | **string** | Returns the metric and relevant parameters you selected. | [optional] **breakdown** | **string** | Returns the dimension you selected. | [optional] **timeframe** | [**\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe**](AnalyticsAggregatedMetricsResponseContextTimeframe.md) | | [optional] diff --git a/docs/Model/AnalyticsMetricsOverTimeResponse.md b/docs/Model/AnalyticsMetricsOverTimeResponse.md index d57e8b4..c6f60dd 100644 --- a/docs/Model/AnalyticsMetricsOverTimeResponse.md +++ b/docs/Model/AnalyticsMetricsOverTimeResponse.md @@ -5,7 +5,7 @@ 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 . | +**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 index 946fd40..2ed3d82 100644 --- a/docs/Model/AnalyticsMetricsOverTimeResponseContext.md +++ b/docs/Model/AnalyticsMetricsOverTimeResponseContext.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**metric** | **string** | Returns the metric you selected. | [optional] +**metric** | **string** | Returns the metric and relevant parameters you selected. | [optional] **interval** | **string** | Returns the interval you selected. | [optional] **timeframe** | [**\ApiVideo\Client\Model\AnalyticsAggregatedMetricsResponseContextTimeframe**](AnalyticsAggregatedMetricsResponseContextTimeframe.md) | | [optional] diff --git a/docs/Model/FilterBy.md b/docs/Model/FilterBy.md index ced254c..e89481b 100644 --- a/docs/Model/FilterBy.md +++ b/docs/Model/FilterBy.md @@ -12,5 +12,6 @@ Name | Type | Description | Notes **operatingSystem** | **string[]** | Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. | [optional] **browser** | **string[]** | Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. | [optional] **tag** | **string** | Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). | [optional] +**referrer** | **string[]** | Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. - The API filters for exact matches. Include the trailing `/` characters if needed. - The URLs you add must be URL encoded. | [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/FilterBy1.md b/docs/Model/FilterBy1.md index 2bd34f5..f781f31 100644 --- a/docs/Model/FilterBy1.md +++ b/docs/Model/FilterBy1.md @@ -12,5 +12,6 @@ Name | Type | Description | Notes **operatingSystem** | **string[]** | Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. | [optional] **browser** | **string[]** | Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. | [optional] **tag** | **string** | Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). | [optional] +**referrer** | **string[]** | Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. - The API filters for exact matches. Include the trailing `/` characters if needed. - The URLs you add must be URL encoded. | [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/FilterBy2.md b/docs/Model/FilterBy2.md index 96bf935..571eb68 100644 --- a/docs/Model/FilterBy2.md +++ b/docs/Model/FilterBy2.md @@ -12,5 +12,6 @@ Name | Type | Description | Notes **operatingSystem** | **string[]** | Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. | [optional] **browser** | **string[]** | Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. | [optional] **tag** | **string** | Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). | [optional] +**referrer** | **string[]** | Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. - The API filters for exact matches. Include the trailing `/` characters if needed. - The URLs you add must be URL encoded. | [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/AnalyticsApi.php b/src/Api/AnalyticsApi.php index 604f29a..4584f1b 100644 --- a/src/Api/AnalyticsApi.php +++ b/src/Api/AnalyticsApi.php @@ -45,8 +45,8 @@ public function __construct(BaseClient $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 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. - `ccv`: is the number of concurrent viewers, or users watching at the same time. - `view`: the total number of viewers until this point in time. (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. - `peak` shows the highest value of the `ccv` metric in the timeframe of your request. You can use this aggregation only with the `ccv` metric. - `live` shows the highest value of the `ccv` metric from the last 20 seconds. You can use this aggregation only with the `ccv` metric. (required) * @param array $queryParams * * @throws \ApiVideo\Client\ApiException on non-2xx response @@ -65,8 +65,8 @@ public function getAggregatedMetrics(string $metric, string $aggregation, array /** * 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 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. - `ccv`: is the number of concurrent viewers, or users watching at the same time. - `view`: the total number of viewers until this point in time. (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. - `peak` shows the highest value of the `ccv` metric in the timeframe of your request. You can use this aggregation only with the `ccv` metric. - `live` shows the highest value of the `ccv` metric from the last 20 seconds. You can use this aggregation only with the `ccv` metric. (required) * @param array $queryParams * * @throws \InvalidArgumentException @@ -77,6 +77,8 @@ private function buildGetAggregatedMetricsRequest(string $metric, string $aggreg // 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; + $unique = array_key_exists('unique', $queryParams) ? $queryParams['unique'] : null; + $viewDuration = array_key_exists('viewDuration', $queryParams) ? $queryParams['viewDuration'] : null; $filterBy = array_key_exists('filterBy', $queryParams) ? $queryParams['filterBy'] : null; // verify the required parameter 'metric' is set @@ -115,6 +117,22 @@ private function buildGetAggregatedMetricsRequest(string $metric, string $aggreg $queryParams['to'] = $to; } + // unique query params + if (is_array($unique)) { + $unique = ObjectSerializer::serializeCollection($unique, 'form', true); + } + if ($unique !== null) { + $queryParams['unique'] = $unique; + } + + // viewDuration query params + if (is_array($viewDuration)) { + $viewDuration = ObjectSerializer::serializeCollection($viewDuration, 'form', true); + } + if ($viewDuration !== null) { + $queryParams['viewDuration'] = $viewDuration; + } + // filterBy query params if ($filterBy !== null) { if(is_array($filterBy)) { @@ -161,8 +179,8 @@ private function buildGetAggregatedMetricsRequest(string $metric, string $aggreg /** * 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. - `play-total` is the total number of times a specific content has been played. You can only use the `media-id` breakdown with this metric. - `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. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. (required) + * @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. - `play-total` is the total number of times a specific content has been played. You can only use the `media-id` breakdown with this metric. - `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. - `ccv-peak` is the highest number of concurrent viewers in the timeframe of your request. - `ccv-average` is the average number of concurrent viewers in the timeframe of your request. - `view` is the total number of viewers until this point in time. (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. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `referrer`: Returns the URL where the view originates from, for example a website where the video is embedded. View events from Android and iOS return empty strings as the value for `referrer`. (required) * @param array $queryParams * * @throws \ApiVideo\Client\ApiException on non-2xx response @@ -181,8 +199,8 @@ public function getMetricsBreakdown(string $metric, string $breakdown, array $qu /** * 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. - `play-total` is the total number of times a specific content has been played. You can only use the `media-id` breakdown with this metric. - `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. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. (required) + * @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. - `play-total` is the total number of times a specific content has been played. You can only use the `media-id` breakdown with this metric. - `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. - `ccv-peak` is the highest number of concurrent viewers in the timeframe of your request. - `ccv-average` is the average number of concurrent viewers in the timeframe of your request. - `view` is the total number of viewers until this point in time. (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. Response values can include: `computer`, `phone`, `tablet`, `tv`, `console`, `wearable`, `unknown`. - `operating-system`: Returns analytics based on the operating system used by the viewers. Response values can include `windows`, `mac osx`, `android`, `ios`, `linux`. - `browser`: Returns analytics based on the browser used by the viewers. Response values can include `chrome`, `firefox`, `edge`, `opera`. - `referrer`: Returns the URL where the view originates from, for example a website where the video is embedded. View events from Android and iOS return empty strings as the value for `referrer`. (required) * @param array $queryParams * * @throws \InvalidArgumentException @@ -195,6 +213,8 @@ private function buildGetMetricsBreakdownRequest(string $metric, string $breakdo $to = array_key_exists('to', $queryParams) ? $queryParams['to'] : null; $sortBy = array_key_exists('sortBy', $queryParams) ? $queryParams['sortBy'] : null; $sortOrder = array_key_exists('sortOrder', $queryParams) ? $queryParams['sortOrder'] : null; + $unique = array_key_exists('unique', $queryParams) ? $queryParams['unique'] : null; + $viewDuration = array_key_exists('viewDuration', $queryParams) ? $queryParams['viewDuration'] : null; $filterBy = array_key_exists('filterBy', $queryParams) ? $queryParams['filterBy'] : null; $currentPage = array_key_exists('currentPage', $queryParams) ? $queryParams['currentPage'] : 1; $pageSize = array_key_exists('pageSize', $queryParams) ? $queryParams['pageSize'] : 25; @@ -251,6 +271,22 @@ private function buildGetMetricsBreakdownRequest(string $metric, string $breakdo $queryParams['sortOrder'] = $sortOrder; } + // unique query params + if (is_array($unique)) { + $unique = ObjectSerializer::serializeCollection($unique, 'form', true); + } + if ($unique !== null) { + $queryParams['unique'] = $unique; + } + + // viewDuration query params + if (is_array($viewDuration)) { + $viewDuration = ObjectSerializer::serializeCollection($viewDuration, 'form', true); + } + if ($viewDuration !== null) { + $queryParams['viewDuration'] = $viewDuration; + } + // filterBy query params if ($filterBy !== null) { if(is_array($filterBy)) { @@ -307,7 +343,7 @@ private function buildGetMetricsBreakdownRequest(string $metric, string $breakdo /** * 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 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. - `ccv-peak` is the highest number of concurrent viewers in the timeframe of your request. - `ccv-average` is the average number of concurrent viewers in the timeframe of your request. - `view` is the total number of viewers. (required) * @param array $queryParams * * @throws \ApiVideo\Client\ApiException on non-2xx response @@ -326,7 +362,7 @@ public function getMetricsOverTime(string $metric, array $queryParams = []): \Ap /** * 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 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. - `ccv-peak` is the highest number of concurrent viewers in the timeframe of your request. - `ccv-average` is the average number of concurrent viewers in the timeframe of your request. - `view` is the total number of viewers. (required) * @param array $queryParams * * @throws \InvalidArgumentException @@ -340,6 +376,8 @@ private function buildGetMetricsOverTimeRequest(string $metric, array $queryPara $interval = array_key_exists('interval', $queryParams) ? $queryParams['interval'] : null; $sortBy = array_key_exists('sortBy', $queryParams) ? $queryParams['sortBy'] : null; $sortOrder = array_key_exists('sortOrder', $queryParams) ? $queryParams['sortOrder'] : null; + $unique = array_key_exists('unique', $queryParams) ? $queryParams['unique'] : null; + $viewDuration = array_key_exists('viewDuration', $queryParams) ? $queryParams['viewDuration'] : null; $filterBy = array_key_exists('filterBy', $queryParams) ? $queryParams['filterBy'] : null; $currentPage = array_key_exists('currentPage', $queryParams) ? $queryParams['currentPage'] : 1; $pageSize = array_key_exists('pageSize', $queryParams) ? $queryParams['pageSize'] : 25; @@ -398,6 +436,22 @@ private function buildGetMetricsOverTimeRequest(string $metric, array $queryPara $queryParams['sortOrder'] = $sortOrder; } + // unique query params + if (is_array($unique)) { + $unique = ObjectSerializer::serializeCollection($unique, 'form', true); + } + if ($unique !== null) { + $queryParams['unique'] = $unique; + } + + // viewDuration query params + if (is_array($viewDuration)) { + $viewDuration = ObjectSerializer::serializeCollection($viewDuration, 'form', true); + } + if ($viewDuration !== null) { + $queryParams['viewDuration'] = $viewDuration; + } + // filterBy query params if ($filterBy !== null) { if(is_array($filterBy)) { diff --git a/src/BaseClient.php b/src/BaseClient.php index 743ebd6..c87df01 100644 --- a/src/BaseClient.php +++ b/src/BaseClient.php @@ -78,7 +78,7 @@ public function __construct(string $baseUri, ?string $apiKey, ClientInterface $h $this->originSdkHeaderValue = ""; if ($apiKey) { - $this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.5'); + $this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.6'); } } @@ -111,7 +111,7 @@ public function request(Request $commandRequest, bool $skipAuthRequest = false): if($this->originSdkHeaderValue) { $request = $request->withHeader('AV-Origin-Sdk', $this->originSdkHeaderValue); } - $request = $request->withHeader('AV-Origin-Client', 'php:1.4.5'); + $request = $request->withHeader('AV-Origin-Client', 'php:1.4.6'); return $this->sendRequest($request, $skipAuthRequest); } diff --git a/src/Model/AnalyticsAggregatedMetricsResponseContext.php b/src/Model/AnalyticsAggregatedMetricsResponseContext.php index bf1ca3d..2052870 100644 --- a/src/Model/AnalyticsAggregatedMetricsResponseContext.php +++ b/src/Model/AnalyticsAggregatedMetricsResponseContext.php @@ -70,6 +70,17 @@ public static function getDefinition(): ModelDefinition const METRIC_IMPRESSION = 'impression'; const METRIC_IMPRESSION_TIME = 'impression-time'; const METRIC_WATCH_TIME = 'watch-time'; + const METRIC_CCV = 'ccv'; + const METRIC_UNIQUE_CCV = 'unique-ccv'; + const METRIC_VIEW_3 = 'view-3'; + const METRIC_VIEW_5 = 'view-5'; + const METRIC_VIEW_10 = 'view-10'; + const METRIC_VIEW_30 = 'view-30'; + const METRIC_UNIQUE_VIEW = 'unique-view'; + const METRIC_UNIQUE_VIEW_3 = 'unique-view-3'; + const METRIC_UNIQUE_VIEW_5 = 'unique-view-5'; + const METRIC_UNIQUE_VIEW_10 = 'unique-view-10'; + const METRIC_UNIQUE_VIEW_30 = 'unique-view-30'; const AGGREGATION_COUNT = 'count'; const AGGREGATION_RATE = 'rate'; const AGGREGATION_TOTAL = 'total'; @@ -90,6 +101,17 @@ public function getMetricAllowableValues() self::METRIC_IMPRESSION, self::METRIC_IMPRESSION_TIME, self::METRIC_WATCH_TIME, + self::METRIC_CCV, + self::METRIC_UNIQUE_CCV, + self::METRIC_VIEW_3, + self::METRIC_VIEW_5, + self::METRIC_VIEW_10, + self::METRIC_VIEW_30, + self::METRIC_UNIQUE_VIEW, + self::METRIC_UNIQUE_VIEW_3, + self::METRIC_UNIQUE_VIEW_5, + self::METRIC_UNIQUE_VIEW_10, + self::METRIC_UNIQUE_VIEW_30, ]; } @@ -184,7 +206,7 @@ public function getMetric() /** * Sets metric * - * @param string|null $metric Returns the metric you selected. + * @param string|null $metric Returns the metric and relevant parameters you selected. * * @return self */ diff --git a/src/Model/AnalyticsMetricsBreakdownResponseContext.php b/src/Model/AnalyticsMetricsBreakdownResponseContext.php index 09f86cd..743b978 100644 --- a/src/Model/AnalyticsMetricsBreakdownResponseContext.php +++ b/src/Model/AnalyticsMetricsBreakdownResponseContext.php @@ -69,6 +69,19 @@ public static function getDefinition(): ModelDefinition const METRIC_START = 'start'; const METRIC_END = 'end'; const METRIC_IMPRESSION = 'impression'; + const METRIC_CCV_AVERAGE = 'ccv-average'; + const METRIC_CCV_PEAK = 'ccv-peak'; + const METRIC_UNIQUE_CCV_AVERAGE = 'unique-ccv-average'; + const METRIC_UNIQUE_CCV_PEAK = 'unique-ccv-peak'; + const METRIC_VIEW_3 = 'view-3'; + const METRIC_VIEW_5 = 'view-5'; + const METRIC_VIEW_10 = 'view-10'; + const METRIC_VIEW_30 = 'view-30'; + const METRIC_UNIQUE_VIEW = 'unique-view'; + const METRIC_UNIQUE_VIEW_3 = 'unique-view-3'; + const METRIC_UNIQUE_VIEW_5 = 'unique-view-5'; + const METRIC_UNIQUE_VIEW_10 = 'unique-view-10'; + const METRIC_UNIQUE_VIEW_30 = 'unique-view-30'; const BREAKDOWN_MEDIA_ID = 'media-id'; const BREAKDOWN_MEDIA_TYPE = 'media-type'; const BREAKDOWN_CONTINENT = 'continent'; @@ -90,6 +103,19 @@ public function getMetricAllowableValues() self::METRIC_START, self::METRIC_END, self::METRIC_IMPRESSION, + self::METRIC_CCV_AVERAGE, + self::METRIC_CCV_PEAK, + self::METRIC_UNIQUE_CCV_AVERAGE, + self::METRIC_UNIQUE_CCV_PEAK, + self::METRIC_VIEW_3, + self::METRIC_VIEW_5, + self::METRIC_VIEW_10, + self::METRIC_VIEW_30, + self::METRIC_UNIQUE_VIEW, + self::METRIC_UNIQUE_VIEW_3, + self::METRIC_UNIQUE_VIEW_5, + self::METRIC_UNIQUE_VIEW_10, + self::METRIC_UNIQUE_VIEW_30, ]; } @@ -186,7 +212,7 @@ public function getMetric() /** * Sets metric * - * @param string|null $metric Returns the metric you selected. + * @param string|null $metric Returns the metric and relevant parameters you selected. * * @return self */ diff --git a/src/Model/AnalyticsMetricsOverTimeResponse.php b/src/Model/AnalyticsMetricsOverTimeResponse.php index 72ab4fc..adb6b9e 100644 --- a/src/Model/AnalyticsMetricsOverTimeResponse.php +++ b/src/Model/AnalyticsMetricsOverTimeResponse.php @@ -155,7 +155,7 @@ public function getData() /** * Sets data * - * @param \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseData[] $data Returns an array of metrics and the timestamps . + * @param \ApiVideo\Client\Model\AnalyticsMetricsOverTimeResponseData[] $data Returns an array of metrics and the timestamps. * * @return self */ diff --git a/src/Model/AnalyticsMetricsOverTimeResponseContext.php b/src/Model/AnalyticsMetricsOverTimeResponseContext.php index efc843e..247b3df 100644 --- a/src/Model/AnalyticsMetricsOverTimeResponseContext.php +++ b/src/Model/AnalyticsMetricsOverTimeResponseContext.php @@ -69,6 +69,20 @@ public static function getDefinition(): ModelDefinition const METRIC_START = 'start'; const METRIC_END = 'end'; const METRIC_IMPRESSION = 'impression'; + const METRIC_CCV_AVERAGE = 'ccv-average'; + const METRIC_CCV_PEAK = 'ccv-peak'; + const METRIC_UNIQUE_CCV_AVERAGE = 'unique-ccv-average'; + const METRIC_UNIQUE_CCV_PEAK = 'unique-ccv-peak'; + const METRIC_VIEW_3 = 'view-3'; + const METRIC_VIEW_5 = 'view-5'; + const METRIC_VIEW_10 = 'view-10'; + const METRIC_VIEW_30 = 'view-30'; + const METRIC_UNIQUE_VIEW = 'unique-view'; + const METRIC_UNIQUE_VIEW_3 = 'unique-view-3'; + const METRIC_UNIQUE_VIEW_5 = 'unique-view-5'; + const METRIC_UNIQUE_VIEW_10 = 'unique-view-10'; + const METRIC_UNIQUE_VIEW_30 = 'unique-view-30'; + const INTERVAL_MINUTE = 'minute'; const INTERVAL_HOUR = 'hour'; const INTERVAL_DAY = 'day'; @@ -85,6 +99,19 @@ public function getMetricAllowableValues() self::METRIC_START, self::METRIC_END, self::METRIC_IMPRESSION, + self::METRIC_CCV_AVERAGE, + self::METRIC_CCV_PEAK, + self::METRIC_UNIQUE_CCV_AVERAGE, + self::METRIC_UNIQUE_CCV_PEAK, + self::METRIC_VIEW_3, + self::METRIC_VIEW_5, + self::METRIC_VIEW_10, + self::METRIC_VIEW_30, + self::METRIC_UNIQUE_VIEW, + self::METRIC_UNIQUE_VIEW_3, + self::METRIC_UNIQUE_VIEW_5, + self::METRIC_UNIQUE_VIEW_10, + self::METRIC_UNIQUE_VIEW_30, ]; } @@ -96,6 +123,7 @@ public function getMetricAllowableValues() public function getIntervalAllowableValues() { return [ + self::INTERVAL_MINUTE, self::INTERVAL_HOUR, self::INTERVAL_DAY, ]; @@ -176,7 +204,7 @@ public function getMetric() /** * Sets metric * - * @param string|null $metric Returns the metric you selected. + * @param string|null $metric Returns the metric and relevant parameters you selected. * * @return self */ diff --git a/src/Model/FilterBy.php b/src/Model/FilterBy.php index f405c81..18bc4f5 100644 --- a/src/Model/FilterBy.php +++ b/src/Model/FilterBy.php @@ -38,7 +38,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'string[]', 'operatingSystem' => 'string[]', 'browser' => 'string[]', - 'tag' => 'string' + 'tag' => 'string', + 'referrer' => 'string[]' ], [ 'mediaId' => null, @@ -48,7 +49,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => null, 'operatingSystem' => null, 'browser' => null, - 'tag' => null + 'tag' => null, + 'referrer' => 'uri' ], [ 'mediaId' => 'mediaId', @@ -58,7 +60,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'deviceType', 'operatingSystem' => 'operatingSystem', 'browser' => 'browser', - 'tag' => 'tag' + 'tag' => 'tag', + 'referrer' => 'referrer' ], [ 'mediaId' => 'setMediaId', @@ -68,7 +71,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'setDeviceType', 'operatingSystem' => 'setOperatingSystem', 'browser' => 'setBrowser', - 'tag' => 'setTag' + 'tag' => 'setTag', + 'referrer' => 'setReferrer' ], [ 'mediaId' => 'getMediaId', @@ -78,7 +82,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'getDeviceType', 'operatingSystem' => 'getOperatingSystem', 'browser' => 'getBrowser', - 'tag' => 'getTag' + 'tag' => 'getTag', + 'referrer' => 'getReferrer' ], [ 'mediaId' => null, @@ -88,7 +93,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => null, 'operatingSystem' => null, 'browser' => null, - 'tag' => null + 'tag' => null, + 'referrer' => null ], null ); @@ -158,6 +164,7 @@ public function __construct(array $data = null) $this->container['operatingSystem'] = $data['operatingSystem'] ?? null; $this->container['browser'] = $data['browser'] ?? null; $this->container['tag'] = $data['tag'] ?? null; + $this->container['referrer'] = $data['referrer'] ?? null; } /** @@ -404,6 +411,30 @@ public function setTag($tag) return $this; } + /** + * Gets referrer + * + * @return string[]|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param string[]|null $referrer Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. - The API filters for exact matches. Include the trailing `/` characters if needed. - The URLs you add must be URL encoded. + * + * @return self + */ + public function setReferrer($referrer) + { + $this->container['referrer'] = $referrer; + + 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 diff --git a/src/Model/FilterBy1.php b/src/Model/FilterBy1.php index fb0508c..9f42737 100644 --- a/src/Model/FilterBy1.php +++ b/src/Model/FilterBy1.php @@ -38,7 +38,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'string[]', 'operatingSystem' => 'string[]', 'browser' => 'string[]', - 'tag' => 'string' + 'tag' => 'string', + 'referrer' => 'string[]' ], [ 'mediaId' => null, @@ -48,7 +49,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => null, 'operatingSystem' => null, 'browser' => null, - 'tag' => null + 'tag' => null, + 'referrer' => 'uri' ], [ 'mediaId' => 'mediaId', @@ -58,7 +60,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'deviceType', 'operatingSystem' => 'operatingSystem', 'browser' => 'browser', - 'tag' => 'tag' + 'tag' => 'tag', + 'referrer' => 'referrer' ], [ 'mediaId' => 'setMediaId', @@ -68,7 +71,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'setDeviceType', 'operatingSystem' => 'setOperatingSystem', 'browser' => 'setBrowser', - 'tag' => 'setTag' + 'tag' => 'setTag', + 'referrer' => 'setReferrer' ], [ 'mediaId' => 'getMediaId', @@ -78,7 +82,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'getDeviceType', 'operatingSystem' => 'getOperatingSystem', 'browser' => 'getBrowser', - 'tag' => 'getTag' + 'tag' => 'getTag', + 'referrer' => 'getReferrer' ], [ 'mediaId' => null, @@ -88,7 +93,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => null, 'operatingSystem' => null, 'browser' => null, - 'tag' => null + 'tag' => null, + 'referrer' => null ], null ); @@ -158,6 +164,7 @@ public function __construct(array $data = null) $this->container['operatingSystem'] = $data['operatingSystem'] ?? null; $this->container['browser'] = $data['browser'] ?? null; $this->container['tag'] = $data['tag'] ?? null; + $this->container['referrer'] = $data['referrer'] ?? null; } /** @@ -404,6 +411,30 @@ public function setTag($tag) return $this; } + /** + * Gets referrer + * + * @return string[]|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param string[]|null $referrer Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. - The API filters for exact matches. Include the trailing `/` characters if needed. - The URLs you add must be URL encoded. + * + * @return self + */ + public function setReferrer($referrer) + { + $this->container['referrer'] = $referrer; + + 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 diff --git a/src/Model/FilterBy2.php b/src/Model/FilterBy2.php index 9c857ef..ab55726 100644 --- a/src/Model/FilterBy2.php +++ b/src/Model/FilterBy2.php @@ -38,7 +38,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'string[]', 'operatingSystem' => 'string[]', 'browser' => 'string[]', - 'tag' => 'string' + 'tag' => 'string', + 'referrer' => 'string[]' ], [ 'mediaId' => null, @@ -48,7 +49,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => null, 'operatingSystem' => null, 'browser' => null, - 'tag' => null + 'tag' => null, + 'referrer' => 'uri' ], [ 'mediaId' => 'mediaId', @@ -58,7 +60,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'deviceType', 'operatingSystem' => 'operatingSystem', 'browser' => 'browser', - 'tag' => 'tag' + 'tag' => 'tag', + 'referrer' => 'referrer' ], [ 'mediaId' => 'setMediaId', @@ -68,7 +71,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'setDeviceType', 'operatingSystem' => 'setOperatingSystem', 'browser' => 'setBrowser', - 'tag' => 'setTag' + 'tag' => 'setTag', + 'referrer' => 'setReferrer' ], [ 'mediaId' => 'getMediaId', @@ -78,7 +82,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => 'getDeviceType', 'operatingSystem' => 'getOperatingSystem', 'browser' => 'getBrowser', - 'tag' => 'getTag' + 'tag' => 'getTag', + 'referrer' => 'getReferrer' ], [ 'mediaId' => null, @@ -88,7 +93,8 @@ public static function getDefinition(): ModelDefinition 'deviceType' => null, 'operatingSystem' => null, 'browser' => null, - 'tag' => null + 'tag' => null, + 'referrer' => null ], null ); @@ -158,6 +164,7 @@ public function __construct(array $data = null) $this->container['operatingSystem'] = $data['operatingSystem'] ?? null; $this->container['browser'] = $data['browser'] ?? null; $this->container['tag'] = $data['tag'] ?? null; + $this->container['referrer'] = $data['referrer'] ?? null; } /** @@ -404,6 +411,30 @@ public function setTag($tag) return $this; } + /** + * Gets referrer + * + * @return string[]|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param string[]|null $referrer Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. - The API filters for exact matches. Include the trailing `/` characters if needed. - The URLs you add must be URL encoded. + * + * @return self + */ + public function setReferrer($referrer) + { + $this->container['referrer'] = $referrer; + + 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