diff --git a/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 b/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 index 8370c20..c8d66fb 100644 --- a/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 +++ b/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 @@ -1 +1 @@ -3637a70fc3b7f045b2927373115f2132767e3ea4ee8f19f7ffd324bb9f8eb7bf \ No newline at end of file +b89163ac996bc8f2bcaf0a054a6a9c28de9b0cf52e16fbcb17055f42852e2a57 \ No newline at end of file diff --git a/ApiVideoClient.podspec b/ApiVideoClient.podspec index cbd4b7a..fd94628 100644 --- a/ApiVideoClient.podspec +++ b/ApiVideoClient.podspec @@ -5,8 +5,8 @@ Pod::Spec.new do |s| s.tvos.deployment_target = '10.0' # Add back when CocoaPods/CocoaPods#11558 is released #s.watchos.deployment_target = '3.0' - s.version = '1.3.0' - s.source = { :git => 'https://github.com/apivideo/api.video-swift-client', :tag => 'v1.3.0' } + s.version = '1.3.1' + s.source = { :git => 'https://github.com/apivideo/api.video-swift-client', :tag => 'v1.3.1' } s.authors = { 'Ecosystem Team' => 'ecosystem@api.video' } s.license = { :type => 'MIT' } s.homepage = 'https://docs.api.video' diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aa2426..a7baa86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [1.3.1] - 2024-09-05 +- Add sort parameters in analytics endpoints + ## [1.3.0] - 2024-07-29 - Add new analytics methods - Add livestream complete() method diff --git a/README.md b/README.md index cf478ee..1119784 100644 --- a/README.md +++ b/README.md @@ -55,14 +55,14 @@ api.video's Swift API client for iOS, macOS and tvOS streamlines the coding proc Specify it in your `Cartfile`: ``` -github "apivideo/api.video-swift-client" ~> 1.3.0 +github "apivideo/api.video-swift-client" ~> 1.3.1 ``` Run `carthage update` #### CocoaPods -Add `pod 'ApiVideoClient', '1.3.0'` in your `Podfile` +Add `pod 'ApiVideoClient', '1.3.1'` in your `Podfile` Run `pod install` diff --git a/Sources/APIs.swift b/Sources/APIs.swift index cb8dfd8..d3a96a3 100644 --- a/Sources/APIs.swift +++ b/Sources/APIs.swift @@ -8,7 +8,7 @@ import Foundation public class ApiVideoClient { public static var apiKey: String? = nil public static var basePath = "https://ws.api.video" - internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift:1.3.0"] + internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift:1.3.1"] private static var chunkSize: Int = 50 * 1024 * 1024 internal static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() internal static var credential = ApiVideoCredential() diff --git a/Sources/APIs/AnalyticsAPI.swift b/Sources/APIs/AnalyticsAPI.swift index 6e7f23e..311db01 100644 --- a/Sources/APIs/AnalyticsAPI.swift +++ b/Sources/APIs/AnalyticsAPI.swift @@ -144,6 +144,22 @@ open class AnalyticsAPI { case browser = "browser" } + /** + * enum for parameter sortBy + */ + public enum SortByGetMetricsBreakdown: String, CaseIterable { + case metricvalue = "metricValue" + case dimensionvalue = "dimensionValue" + } + + /** + * enum for parameter sortOrder + */ + public enum SortOrderGetMetricsBreakdown: String, CaseIterable { + case asc = "asc" + case desc = "desc" + } + /** Retrieve metrics in a breakdown of dimensions @@ -151,6 +167,8 @@ open class AnalyticsAPI { - 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 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 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) @@ -158,8 +176,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, 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, 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, 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 switch result { case let .success(response): completion(response.body, nil) @@ -176,6 +194,8 @@ open class AnalyticsAPI { - 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 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 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) @@ -183,8 +203,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, 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, 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, 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) } @@ -197,12 +217,14 @@ open class AnalyticsAPI { - 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 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 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, 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, 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) ?? "" @@ -217,6 +239,8 @@ open class AnalyticsAPI { localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ "from": from?.encodeToJSON(), "to": to?.encodeToJSON(), + "sortBy": sortBy?.encodeToJSON(), + "sortOrder": sortOrder?.encodeToJSON(), "currentPage": currentPage?.encodeToJSON(), "pageSize": pageSize?.encodeToJSON(), ]) @@ -255,6 +279,22 @@ open class AnalyticsAPI { case day = "day" } + /** + * enum for parameter sortBy + */ + public enum SortByGetMetricsOverTime: String, CaseIterable { + case metricvalue = "metricValue" + case emittedat = "emittedAt" + } + + /** + * enum for parameter sortOrder + */ + public enum SortOrderGetMetricsOverTime: String, CaseIterable { + case asc = "asc" + case desc = "desc" + } + /** Retrieve metrics over time @@ -262,6 +302,8 @@ open class AnalyticsAPI { - 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 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 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) @@ -269,8 +311,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, 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, 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, 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 switch result { case let .success(response): completion(response.body, nil) @@ -287,6 +329,8 @@ open class AnalyticsAPI { - 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 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 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) @@ -294,8 +338,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, 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, 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, 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) } @@ -308,12 +352,14 @@ open class AnalyticsAPI { - 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 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 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, 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, 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) ?? "" @@ -326,6 +372,8 @@ open class AnalyticsAPI { "from": from?.encodeToJSON(), "to": to?.encodeToJSON(), "interval": interval?.encodeToJSON(), + "sortBy": sortBy?.encodeToJSON(), + "sortOrder": sortOrder?.encodeToJSON(), "currentPage": currentPage?.encodeToJSON(), "pageSize": pageSize?.encodeToJSON(), ]) diff --git a/docs/AnalyticsAPI.md b/docs/AnalyticsAPI.md index a28b144..29dc6f9 100644 --- a/docs/AnalyticsAPI.md +++ b/docs/AnalyticsAPI.md @@ -71,8 +71,8 @@ Name | Type | Description | Notes # **getMetricsBreakdown** ```swift - open class func getMetricsBreakdown(metric: Metric_getMetricsBreakdown, breakdown: Breakdown_getMetricsBreakdown, from: Date? = nil, to: Date? = 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, 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, 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) ``` Retrieve metrics in a breakdown of dimensions @@ -89,12 +89,14 @@ let metric = "metric_example" // String | Use this path parameter to select a me 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 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 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, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize) { (response, error) in +AnalyticsAPI.getMetricsBreakdown(metric: metric, breakdown: breakdown, from: from, to: to, sortBy: sortBy, sortOrder: sortOrder, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize) { (response, error) in guard error == nil else { print(error) return @@ -114,6 +116,8 @@ Name | Type | Description | Notes **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`. | **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] **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] @@ -135,8 +139,8 @@ Name | Type | Description | Notes # **getMetricsOverTime** ```swift - open class func getMetricsOverTime(metric: Metric_getMetricsOverTime, from: Date? = nil, to: Date? = nil, interval: Interval_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, 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, 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) ``` Retrieve metrics over time @@ -153,12 +157,14 @@ let metric = "metric_example" // String | Use this path parameter to select a me 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 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 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, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize) { (response, error) in +AnalyticsAPI.getMetricsOverTime(metric: metric, from: from, to: to, interval: interval, sortBy: sortBy, sortOrder: sortOrder, filterBy: filterBy, currentPage: currentPage, pageSize: pageSize) { (response, error) in guard error == nil else { print(error) return @@ -178,6 +184,8 @@ Name | Type | Description | Notes **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] + **sortBy** | **String** | Use this parameter to choose which field the API will use to sort the analytics data. These are the available fields to sort by: - `metricValue`: Sorts the results based on the **metric** you selected in your request. - `emittedAt`: Sorts the results based on the **timestamp** of the event in ATOM date-time format. | [optional] + **sortOrder** | **String** | Use this parameter to define the sort order of results. These are the available sort orders: - `asc`: Sorts the results in ascending order: `A to Z` and `0 to 9`. - `desc`: Sorts the results in descending order: `Z to A` and `9 to 0`. | [optional] **filterBy** | [**FilterBy2**](.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] diff --git a/project.yml b/project.yml index 6dd9638..8deeb69 100644 --- a/project.yml +++ b/project.yml @@ -7,7 +7,7 @@ targets: sources: [Sources] info: path: ./Info.plist - version: 1.3.0 + version: 1.3.1 settings: APPLICATION_EXTENSION_API_ONLY: true scheme: {}