diff --git a/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 b/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 index e8d9ed5..2e7113e 100644 --- a/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 +++ b/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 @@ -1 +1 @@ -763a77f01ff94798c9e89e6ecf462452a7e293ca1e1ba3ba2ce4fffc0d19fc22 \ No newline at end of file +556142515beaa4559b8d36d0a79da4eb97d8bbde136804d887f5115dc651930a \ No newline at end of file diff --git a/Sources/APIs/AnalyticsAPI.swift b/Sources/APIs/AnalyticsAPI.swift index 311db01..be09763 100644 --- a/Sources/APIs/AnalyticsAPI.swift +++ b/Sources/APIs/AnalyticsAPI.swift @@ -22,6 +22,8 @@ open class AnalyticsAPI { case impression = "impression" case impressionTime = "impression-time" case watchTime = "watch-time" + case ccv = "ccv" + case view = "view" } /** @@ -33,22 +35,36 @@ open class AnalyticsAPI { case total = "total" case average = "average" case sum = "sum" + case peak = "peak" + case live = "live" + } + + /** + * enum for parameter viewDuration + */ + public enum ViewDurationGetAggregatedMetrics: String, CaseIterable { + case _3s = "3s" + case _5s = "5s" + case _10s = "10s" + case _30s = "30s" } /** Retrieve aggregated metrics - - parameter metric: (path) 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. - - parameter aggregation: (path) 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. + - parameter metric: (path) 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` TODO - `view` TODO + - parameter aggregation: (path) 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` TODO - `live` TODO - parameter from: (query) 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) - parameter to: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects. */ @discardableResult - open class func getAggregatedMetrics(metric: MetricGetAggregatedMetrics, aggregation: AggregationGetAggregatedMetrics, from: Date? = nil, to: Date? = nil, filterBy: FilterBy2? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: AnalyticsAggregatedMetricsResponse?, _ error: Error?) -> Void)) -> RequestTask { - return getAggregatedMetrics(metric: metric, aggregation: aggregation, from: from, to: to, filterBy: filterBy, apiResponseQueue: apiResponseQueue) { result in + open class func getAggregatedMetrics(metric: MetricGetAggregatedMetrics, aggregation: AggregationGetAggregatedMetrics, from: Date? = nil, to: Date? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetAggregatedMetrics? = nil, filterBy: FilterBy2? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: AnalyticsAggregatedMetricsResponse?, _ error: Error?) -> Void)) -> RequestTask { + return getAggregatedMetrics(metric: metric, aggregation: aggregation, from: from, to: to, unique: unique, viewDuration: viewDuration, filterBy: filterBy, apiResponseQueue: apiResponseQueue) { result in switch result { case let .success(response): completion(response.body, nil) @@ -61,17 +77,19 @@ open class AnalyticsAPI { /** Retrieve aggregated metrics - - parameter metric: (path) 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. - - parameter aggregation: (path) 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. + - parameter metric: (path) 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` TODO - `view` TODO + - parameter aggregation: (path) 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` TODO - `live` TODO - parameter from: (query) 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) - parameter to: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result of the request (incl. headers). */ @discardableResult - open class func getAggregatedMetrics(metric: MetricGetAggregatedMetrics, aggregation: AggregationGetAggregatedMetrics, from: Date? = nil, to: Date? = nil, filterBy: FilterBy2? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { - return getAggregatedMetricsWithRequestBuilder(metric: metric, aggregation: aggregation, from: from, to: to, filterBy: filterBy).execute(apiResponseQueue, completion) + open class func getAggregatedMetrics(metric: MetricGetAggregatedMetrics, aggregation: AggregationGetAggregatedMetrics, from: Date? = nil, to: Date? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetAggregatedMetrics? = nil, filterBy: FilterBy2? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return getAggregatedMetricsWithRequestBuilder(metric: metric, aggregation: aggregation, from: from, to: to, unique: unique, viewDuration: viewDuration, filterBy: filterBy).execute(apiResponseQueue, completion) } @@ -80,14 +98,16 @@ open class AnalyticsAPI { - GET /data/metrics/{metric}/{aggregation} - Retrieve time-based and countable metrics like average watch time or the number of impressions over a certain period of time. - responseHeaders: [X-RateLimit-Limit(Int), X-RateLimit-Remaining(Int), X-RateLimit-Retry-After(Int)] - - parameter metric: (path) 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. - - parameter aggregation: (path) 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. + - parameter metric: (path) 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` TODO - `view` TODO + - parameter aggregation: (path) 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` TODO - `live` TODO - parameter from: (query) 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) - parameter to: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - returns: RequestBuilder */ - internal class func getAggregatedMetricsWithRequestBuilder(metric: MetricGetAggregatedMetrics, aggregation: AggregationGetAggregatedMetrics, from: Date? = nil, to: Date? = nil, filterBy: FilterBy2? = nil) -> RequestBuilder { + internal class func getAggregatedMetricsWithRequestBuilder(metric: MetricGetAggregatedMetrics, aggregation: AggregationGetAggregatedMetrics, from: Date? = nil, to: Date? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetAggregatedMetrics? = nil, filterBy: FilterBy2? = nil) -> RequestBuilder { var localVariablePath = "/data/metrics/{metric}/{aggregation}" let metricPreEscape = "\(metric.rawValue)" let metricPostEscape = metricPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -102,6 +122,8 @@ open class AnalyticsAPI { localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ "from": from?.encodeToJSON(), "to": to?.encodeToJSON(), + "unique": unique?.encodeToJSON(), + "viewDuration": viewDuration?.encodeToJSON(), ]) localVariableUrlComponents?.queryItems?.append(contentsOf: filterBy?.encodeToQueryParams() ?? []) @@ -129,6 +151,9 @@ open class AnalyticsAPI { case start = "start" case end = "end" case impression = "impression" + case ccvPeak = "ccv-peak" + case ccvAverage = "ccv-average" + case view = "view" } /** @@ -142,6 +167,7 @@ open class AnalyticsAPI { case deviceType = "device-type" case operatingSystem = "operating-system" case browser = "browser" + case referrer = "referrer" } /** @@ -160,15 +186,27 @@ open class AnalyticsAPI { case desc = "desc" } + /** + * enum for parameter viewDuration + */ + public enum ViewDurationGetMetricsBreakdown: String, CaseIterable { + case _3s = "3s" + case _5s = "5s" + case _10s = "10s" + case _30s = "30s" + } + /** Retrieve metrics in a breakdown of dimensions - - parameter metric: (path) 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. - - parameter breakdown: (path) 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`. + - parameter metric: (path) 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` TODO - `ccv-average` TODO + - parameter breakdown: (path) 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`: TODO - parameter from: (query) 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) - parameter to: (query) 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) - parameter sortBy: (query) 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) - parameter sortOrder: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25) @@ -176,8 +214,8 @@ open class AnalyticsAPI { - parameter completion: completion handler to receive the data and the error objects. */ @discardableResult - open class func getMetricsBreakdown(metric: MetricGetMetricsBreakdown, breakdown: BreakdownGetMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortByGetMetricsBreakdown? = nil, sortOrder: SortOrderGetMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: AnalyticsMetricsBreakdownResponse?, _ error: Error?) -> Void)) -> RequestTask { - return getMetricsBreakdown(metric: metric, breakdown: breakdown, from: from, to: to, sortBy: sortBy, sortOrder: sortOrder, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize, apiResponseQueue: apiResponseQueue) { result in + open class func getMetricsBreakdown(metric: MetricGetMetricsBreakdown, breakdown: BreakdownGetMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortByGetMetricsBreakdown? = nil, sortOrder: SortOrderGetMetricsBreakdown? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: AnalyticsMetricsBreakdownResponse?, _ error: Error?) -> Void)) -> RequestTask { + return getMetricsBreakdown(metric: metric, breakdown: breakdown, from: from, to: to, sortBy: sortBy, sortOrder: sortOrder, unique: unique, viewDuration: viewDuration, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize, apiResponseQueue: apiResponseQueue) { result in switch result { case let .success(response): completion(response.body, nil) @@ -190,12 +228,14 @@ open class AnalyticsAPI { /** Retrieve metrics in a breakdown of dimensions - - parameter metric: (path) 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. - - parameter breakdown: (path) 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`. + - parameter metric: (path) 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` TODO - `ccv-average` TODO + - parameter breakdown: (path) 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`: TODO - parameter from: (query) 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) - parameter to: (query) 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) - parameter sortBy: (query) 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) - parameter sortOrder: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25) @@ -203,8 +243,8 @@ open class AnalyticsAPI { - parameter completion: completion handler to receive the result of the request (incl. headers). */ @discardableResult - open class func getMetricsBreakdown(metric: MetricGetMetricsBreakdown, breakdown: BreakdownGetMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortByGetMetricsBreakdown? = nil, sortOrder: SortOrderGetMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { - return getMetricsBreakdownWithRequestBuilder(metric: metric, breakdown: breakdown, from: from, to: to, sortBy: sortBy, sortOrder: sortOrder, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize).execute(apiResponseQueue, completion) + open class func getMetricsBreakdown(metric: MetricGetMetricsBreakdown, breakdown: BreakdownGetMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortByGetMetricsBreakdown? = nil, sortOrder: SortOrderGetMetricsBreakdown? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return getMetricsBreakdownWithRequestBuilder(metric: metric, breakdown: breakdown, from: from, to: to, sortBy: sortBy, sortOrder: sortOrder, unique: unique, viewDuration: viewDuration, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize).execute(apiResponseQueue, completion) } @@ -213,18 +253,20 @@ open class AnalyticsAPI { - GET /data/buckets/{metric}/{breakdown} - Retrieve detailed analytics play-rate and number of impressions segmented by dimensions like country or device type. - responseHeaders: [X-RateLimit-Limit(Int), X-RateLimit-Remaining(Int), X-RateLimit-Retry-After(Int)] - - parameter metric: (path) 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. - - parameter breakdown: (path) 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`. + - parameter metric: (path) 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` TODO - `ccv-average` TODO + - parameter breakdown: (path) 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`: TODO - parameter from: (query) 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) - parameter to: (query) 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) - parameter sortBy: (query) 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) - parameter sortOrder: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25) - returns: RequestBuilder */ - internal class func getMetricsBreakdownWithRequestBuilder(metric: MetricGetMetricsBreakdown, breakdown: BreakdownGetMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortByGetMetricsBreakdown? = nil, sortOrder: SortOrderGetMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder { + internal class func getMetricsBreakdownWithRequestBuilder(metric: MetricGetMetricsBreakdown, breakdown: BreakdownGetMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortByGetMetricsBreakdown? = nil, sortOrder: SortOrderGetMetricsBreakdown? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder { var localVariablePath = "/data/buckets/{metric}/{breakdown}" let metricPreEscape = "\(metric.rawValue)" let metricPostEscape = metricPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -241,6 +283,8 @@ open class AnalyticsAPI { "to": to?.encodeToJSON(), "sortBy": sortBy?.encodeToJSON(), "sortOrder": sortOrder?.encodeToJSON(), + "unique": unique?.encodeToJSON(), + "viewDuration": viewDuration?.encodeToJSON(), "currentPage": currentPage?.encodeToJSON(), "pageSize": pageSize?.encodeToJSON(), ]) @@ -269,12 +313,16 @@ open class AnalyticsAPI { case start = "start" case end = "end" case impression = "impression" + case ccvPeak = "ccv-peak" + case ccvAverage = "ccv-average" + case view = "view" } /** * enum for parameter interval */ public enum IntervalGetMetricsOverTime: String, CaseIterable { + case minute = "minute" case hour = "hour" case day = "day" } @@ -295,15 +343,27 @@ open class AnalyticsAPI { case desc = "desc" } + /** + * enum for parameter viewDuration + */ + public enum ViewDurationGetMetricsOverTime: String, CaseIterable { + case _3s = "3s" + case _5s = "5s" + case _10s = "10s" + case _30s = "30s" + } + /** Retrieve metrics over time - parameter metric: (path) 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. - parameter from: (query) 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) - parameter to: (query) 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) - - parameter interval: (query) 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) + - parameter interval: (query) Use this query parameter to define how granularity of the data. Possible values: `minute`, `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) - parameter sortBy: (query) 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) - parameter sortOrder: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25) @@ -311,8 +371,8 @@ open class AnalyticsAPI { - parameter completion: completion handler to receive the data and the error objects. */ @discardableResult - open class func getMetricsOverTime(metric: MetricGetMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: IntervalGetMetricsOverTime? = nil, sortBy: SortByGetMetricsOverTime? = nil, sortOrder: SortOrderGetMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: AnalyticsMetricsOverTimeResponse?, _ error: Error?) -> Void)) -> RequestTask { - return getMetricsOverTime(metric: metric, from: from, to: to, interval: interval, sortBy: sortBy, sortOrder: sortOrder, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize, apiResponseQueue: apiResponseQueue) { result in + open class func getMetricsOverTime(metric: MetricGetMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: IntervalGetMetricsOverTime? = nil, sortBy: SortByGetMetricsOverTime? = nil, sortOrder: SortOrderGetMetricsOverTime? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: AnalyticsMetricsOverTimeResponse?, _ error: Error?) -> Void)) -> RequestTask { + return getMetricsOverTime(metric: metric, from: from, to: to, interval: interval, sortBy: sortBy, sortOrder: sortOrder, unique: unique, viewDuration: viewDuration, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize, apiResponseQueue: apiResponseQueue) { result in switch result { case let .success(response): completion(response.body, nil) @@ -328,9 +388,11 @@ open class AnalyticsAPI { - parameter metric: (path) 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. - parameter from: (query) 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) - parameter to: (query) 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) - - parameter interval: (query) 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) + - parameter interval: (query) Use this query parameter to define how granularity of the data. Possible values: `minute`, `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) - parameter sortBy: (query) 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) - parameter sortOrder: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25) @@ -338,8 +400,8 @@ open class AnalyticsAPI { - parameter completion: completion handler to receive the result of the request (incl. headers). */ @discardableResult - open class func getMetricsOverTime(metric: MetricGetMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: IntervalGetMetricsOverTime? = nil, sortBy: SortByGetMetricsOverTime? = nil, sortOrder: SortOrderGetMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { - return getMetricsOverTimeWithRequestBuilder(metric: metric, from: from, to: to, interval: interval, sortBy: sortBy, sortOrder: sortOrder, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize).execute(apiResponseQueue, completion) + open class func getMetricsOverTime(metric: MetricGetMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: IntervalGetMetricsOverTime? = nil, sortBy: SortByGetMetricsOverTime? = nil, sortOrder: SortOrderGetMetricsOverTime? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return getMetricsOverTimeWithRequestBuilder(metric: metric, from: from, to: to, interval: interval, sortBy: sortBy, sortOrder: sortOrder, unique: unique, viewDuration: viewDuration, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize).execute(apiResponseQueue, completion) } @@ -351,15 +413,17 @@ open class AnalyticsAPI { - parameter metric: (path) 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. - parameter from: (query) 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) - parameter to: (query) 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) - - parameter interval: (query) 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) + - parameter interval: (query) Use this query parameter to define how granularity of the data. Possible values: `minute`, `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) - parameter sortBy: (query) 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) - parameter sortOrder: (query) 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) + - parameter unique: (query) TODO (optional) + - parameter viewDuration: (query) TODO (optional) - parameter filterBy: (query) 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) - parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25) - returns: RequestBuilder */ - internal class func getMetricsOverTimeWithRequestBuilder(metric: MetricGetMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: IntervalGetMetricsOverTime? = nil, sortBy: SortByGetMetricsOverTime? = nil, sortOrder: SortOrderGetMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder { + internal class func getMetricsOverTimeWithRequestBuilder(metric: MetricGetMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: IntervalGetMetricsOverTime? = nil, sortBy: SortByGetMetricsOverTime? = nil, sortOrder: SortOrderGetMetricsOverTime? = nil, unique: Bool? = nil, viewDuration: ViewDurationGetMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder { var localVariablePath = "/data/timeseries/{metric}" let metricPreEscape = "\(metric.rawValue)" let metricPostEscape = metricPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -374,6 +438,8 @@ open class AnalyticsAPI { "interval": interval?.encodeToJSON(), "sortBy": sortBy?.encodeToJSON(), "sortOrder": sortOrder?.encodeToJSON(), + "unique": unique?.encodeToJSON(), + "viewDuration": viewDuration?.encodeToJSON(), "currentPage": currentPage?.encodeToJSON(), "pageSize": pageSize?.encodeToJSON(), ]) diff --git a/docs/AnalyticsAPI.md b/docs/AnalyticsAPI.md index 29dc6f9..42518c0 100644 --- a/docs/AnalyticsAPI.md +++ b/docs/AnalyticsAPI.md @@ -11,8 +11,8 @@ Method | HTTP request | Description # **getAggregatedMetrics** ```swift - open class func getAggregatedMetrics(metric: Metric_getAggregatedMetrics, aggregation: Aggregation_getAggregatedMetrics, from: Date? = nil, to: Date? = nil, filterBy: FilterBy2? = nil, completion: @escaping (_ data: AnalyticsAggregatedMetricsResponse?, _ error: Error?) -> Void) - open class func getAggregatedMetrics(metric: Metric_getAggregatedMetrics, aggregation: Aggregation_getAggregatedMetrics, from: Date? = nil, to: Date? = nil, filterBy: FilterBy2? = nil, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) + open class func getAggregatedMetrics(metric: Metric_getAggregatedMetrics, aggregation: Aggregation_getAggregatedMetrics, from: Date? = nil, to: Date? = nil, unique: Bool? = nil, viewDuration: ViewDuration_getAggregatedMetrics? = nil, filterBy: FilterBy2? = nil, completion: @escaping (_ data: AnalyticsAggregatedMetricsResponse?, _ error: Error?) -> Void) + open class func getAggregatedMetrics(metric: Metric_getAggregatedMetrics, aggregation: Aggregation_getAggregatedMetrics, from: Date? = nil, to: Date? = nil, unique: Bool? = nil, viewDuration: ViewDuration_getAggregatedMetrics? = nil, filterBy: FilterBy2? = nil, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) ``` Retrieve aggregated metrics @@ -25,14 +25,16 @@ Retrieve time-based and countable metrics like average watch time or the number // The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new import ApiVideoClient -let metric = "metric_example" // 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. -let aggregation = "aggregation_example" // 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. +let metric = "metric_example" // 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` TODO - `view` TODO +let aggregation = "aggregation_example" // 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` TODO - `live` TODO let from = Date() // Date | 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) let to = Date() // Date | 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) +let unique = true // Bool | TODO (optional) +let viewDuration = "viewDuration_example" // String | TODO (optional) let filterBy = "TODO" // FilterBy2 | 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) // Retrieve aggregated metrics -AnalyticsAPI.getAggregatedMetrics(metric: metric, aggregation: aggregation, from: from, to: to, filterBy: filterBy) { (response, error) in +AnalyticsAPI.getAggregatedMetrics(metric: metric, aggregation: aggregation, from: from, to: to, unique: unique, viewDuration: viewDuration, filterBy: filterBy) { (response, error) in guard error == nil else { print(error) return @@ -48,10 +50,12 @@ AnalyticsAPI.getAggregatedMetrics(metric: metric, aggregation: aggregation, from 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. | - **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. | + **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` TODO - `view` TODO | + **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` TODO - `live` TODO | **from** | **Date** | 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** | **Date** | 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] + **unique** | **Bool** | TODO | [optional] + **viewDuration** | **String** | TODO | [optional] **filterBy** | [**FilterBy2**](.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] ### Return type @@ -71,8 +75,8 @@ Name | Type | Description | Notes # **getMetricsBreakdown** ```swift - open class func getMetricsBreakdown(metric: Metric_getMetricsBreakdown, breakdown: Breakdown_getMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortBy_getMetricsBreakdown? = nil, sortOrder: SortOrder_getMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ data: AnalyticsMetricsBreakdownResponse?, _ error: Error?) -> Void) - open class func getMetricsBreakdown(metric: Metric_getMetricsBreakdown, breakdown: Breakdown_getMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortBy_getMetricsBreakdown? = nil, sortOrder: SortOrder_getMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) + open class func getMetricsBreakdown(metric: Metric_getMetricsBreakdown, breakdown: Breakdown_getMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortBy_getMetricsBreakdown? = nil, sortOrder: SortOrder_getMetricsBreakdown? = nil, unique: Bool? = nil, viewDuration: ViewDuration_getMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ data: AnalyticsMetricsBreakdownResponse?, _ error: Error?) -> Void) + open class func getMetricsBreakdown(metric: Metric_getMetricsBreakdown, breakdown: Breakdown_getMetricsBreakdown, from: Date? = nil, to: Date? = nil, sortBy: SortBy_getMetricsBreakdown? = nil, sortOrder: SortOrder_getMetricsBreakdown? = nil, unique: Bool? = nil, viewDuration: ViewDuration_getMetricsBreakdown? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) ``` Retrieve metrics in a breakdown of dimensions @@ -85,18 +89,20 @@ Retrieve detailed analytics play-rate and number of impressions segmented by dim // The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new import ApiVideoClient -let metric = "metric_example" // 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. -let breakdown = "breakdown_example" // 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`. +let metric = "metric_example" // 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` TODO - `ccv-average` TODO +let breakdown = "breakdown_example" // 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`: TODO let from = Date() // Date | 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) let to = Date() // Date | 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) let sortBy = "sortBy_example" // 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) let sortOrder = "sortOrder_example" // 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) +let unique = true // Bool | TODO (optional) +let viewDuration = "viewDuration_example" // String | TODO (optional) let filterBy = "TODO" // FilterBy2 | 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) let currentPage = 987 // Int | Choose the number of search results to return per page. Minimum value: 1 (optional) (default to 1) let pageSize = 987 // Int | Results per page. Allowed values 1-100, default is 25. (optional) (default to 25) // Retrieve metrics in a breakdown of dimensions -AnalyticsAPI.getMetricsBreakdown(metric: metric, breakdown: breakdown, from: from, to: to, sortBy: sortBy, sortOrder: sortOrder, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize) { (response, error) in +AnalyticsAPI.getMetricsBreakdown(metric: metric, breakdown: breakdown, from: from, to: to, sortBy: sortBy, sortOrder: sortOrder, unique: unique, viewDuration: viewDuration, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize) { (response, error) in guard error == nil else { print(error) return @@ -112,12 +118,14 @@ AnalyticsAPI.getMetricsBreakdown(metric: metric, breakdown: breakdown, from: fro 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. | - **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`. | + **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` TODO - `ccv-average` TODO | + **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`: TODO | **from** | **Date** | 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** | **Date** | 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] + **unique** | **Bool** | TODO | [optional] + **viewDuration** | **String** | TODO | [optional] **filterBy** | [**FilterBy2**](.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] **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] @@ -139,8 +147,8 @@ Name | Type | Description | Notes # **getMetricsOverTime** ```swift - open class func getMetricsOverTime(metric: Metric_getMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: Interval_getMetricsOverTime? = nil, sortBy: SortBy_getMetricsOverTime? = nil, sortOrder: SortOrder_getMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ data: AnalyticsMetricsOverTimeResponse?, _ error: Error?) -> Void) - open class func getMetricsOverTime(metric: Metric_getMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: Interval_getMetricsOverTime? = nil, sortBy: SortBy_getMetricsOverTime? = nil, sortOrder: SortOrder_getMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) + open class func getMetricsOverTime(metric: Metric_getMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: Interval_getMetricsOverTime? = nil, sortBy: SortBy_getMetricsOverTime? = nil, sortOrder: SortOrder_getMetricsOverTime? = nil, unique: Bool? = nil, viewDuration: ViewDuration_getMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ data: AnalyticsMetricsOverTimeResponse?, _ error: Error?) -> Void) + open class func getMetricsOverTime(metric: Metric_getMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: Interval_getMetricsOverTime? = nil, sortBy: SortBy_getMetricsOverTime? = nil, sortOrder: SortOrder_getMetricsOverTime? = nil, unique: Bool? = nil, viewDuration: ViewDuration_getMetricsOverTime? = nil, filterBy: FilterBy2? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) ``` Retrieve metrics over time @@ -156,15 +164,17 @@ import ApiVideoClient let metric = "metric_example" // 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. let from = Date() // Date | 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) let to = Date() // Date | 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) -let interval = "interval_example" // 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) +let interval = "interval_example" // String | Use this query parameter to define how granularity of the data. Possible values: `minute`, `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) let sortBy = "sortBy_example" // 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) let sortOrder = "sortOrder_example" // 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) +let unique = true // Bool | TODO (optional) +let viewDuration = "viewDuration_example" // String | TODO (optional) let filterBy = "TODO" // FilterBy2 | 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) let currentPage = 987 // Int | Choose the number of search results to return per page. Minimum value: 1 (optional) (default to 1) let pageSize = 987 // Int | Results per page. Allowed values 1-100, default is 25. (optional) (default to 25) // Retrieve metrics over time -AnalyticsAPI.getMetricsOverTime(metric: metric, from: from, to: to, interval: interval, sortBy: sortBy, sortOrder: sortOrder, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize) { (response, error) in +AnalyticsAPI.getMetricsOverTime(metric: metric, from: from, to: to, interval: interval, sortBy: sortBy, sortOrder: sortOrder, unique: unique, viewDuration: viewDuration, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize) { (response, error) in guard error == nil else { print(error) return @@ -183,9 +193,11 @@ 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. | **from** | **Date** | 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** | **Date** | 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 how granularity of the data. Possible values: `minute`, `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] **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] + **unique** | **Bool** | TODO | [optional] + **viewDuration** | **String** | TODO | [optional] **filterBy** | [**FilterBy2**](.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] **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]