Skip to content

Commit

Permalink
Analytics updates
Browse files Browse the repository at this point in the history
  • Loading branch information
szekelyzol authored Oct 31, 2024
1 parent 19d9474 commit 467552a
Show file tree
Hide file tree
Showing 25 changed files with 286 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .openapi-generator/oas_apivideo.yaml-defaut-cli.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3c9f9d1c48428c25a16b809ddeab072c978d6d1c689903a76e3d66a69a36a233
60f0244bcbcbd6ac38a5878a1e8b801934e4014b4417fdccad9b5ad7d8ac7f35
150 changes: 108 additions & 42 deletions Sources/APIs/AnalyticsAPI.swift

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion Sources/Models/AnalyticsAggregatedMetricsResponseContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ public struct AnalyticsAggregatedMetricsResponseContext: Codable, Hashable {
case impression = "impression"
case impressionTime = "impression-time"
case watchTime = "watch-time"
case ccv = "ccv"
case uniqueCcv = "unique-ccv"
case view3 = "view-3"
case view5 = "view-5"
case view10 = "view-10"
case view30 = "view-30"
case uniqueView = "unique-view"
case uniqueView3 = "unique-view-3"
case uniqueView5 = "unique-view-5"
case uniqueView10 = "unique-view-10"
case uniqueView30 = "unique-view-30"
}
public enum Aggregation: String, Codable, CaseIterable {
case count = "count"
Expand All @@ -27,7 +38,7 @@ public struct AnalyticsAggregatedMetricsResponseContext: Codable, Hashable {
case average = "average"
case sum = "sum"
}
/** Returns the metric you selected. */
/** Returns the metric and relevant parameters you selected. */
public var metric: Metric?
/** Returns the aggregation you selected. */
public var aggregation: Aggregation?
Expand Down
15 changes: 14 additions & 1 deletion Sources/Models/AnalyticsMetricsBreakdownResponseContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ public struct AnalyticsMetricsBreakdownResponseContext: Codable, Hashable {
case start = "start"
case end = "end"
case impression = "impression"
case ccvAverage = "ccv-average"
case ccvPeak = "ccv-peak"
case uniqueCcvAverage = "unique-ccv-average"
case uniqueCcvPeak = "unique-ccv-peak"
case view3 = "view-3"
case view5 = "view-5"
case view10 = "view-10"
case view30 = "view-30"
case uniqueView = "unique-view"
case uniqueView3 = "unique-view-3"
case uniqueView5 = "unique-view-5"
case uniqueView10 = "unique-view-10"
case uniqueView30 = "unique-view-30"
}
public enum Breakdown: String, Codable, CaseIterable {
case mediaId = "media-id"
Expand All @@ -28,7 +41,7 @@ public struct AnalyticsMetricsBreakdownResponseContext: Codable, Hashable {
case operatingSystem = "operating-system"
case browser = "browser"
}
/** Returns the metric you selected. */
/** Returns the metric and relevant parameters you selected. */
public var metric: Metric?
/** Returns the dimension you selected. */
public var breakdown: Breakdown?
Expand Down
2 changes: 1 addition & 1 deletion Sources/Models/AnalyticsMetricsOverTimeResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import AnyCodable
public struct AnalyticsMetricsOverTimeResponse: Codable, Hashable {

public var context: AnalyticsMetricsOverTimeResponseContext
/** Returns an array of metrics and the timestamps . */
/** Returns an array of metrics and the timestamps. */
public var data: [AnalyticsMetricsOverTimeResponseData]
public var pagination: Pagination

Expand Down
16 changes: 15 additions & 1 deletion Sources/Models/AnalyticsMetricsOverTimeResponseContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,26 @@ public struct AnalyticsMetricsOverTimeResponseContext: Codable, Hashable {
case start = "start"
case end = "end"
case impression = "impression"
case ccvAverage = "ccv-average"
case ccvPeak = "ccv-peak"
case uniqueCcvAverage = "unique-ccv-average"
case uniqueCcvPeak = "unique-ccv-peak"
case view3 = "view-3"
case view5 = "view-5"
case view10 = "view-10"
case view30 = "view-30"
case uniqueView = "unique-view"
case uniqueView3 = "unique-view-3"
case uniqueView5 = "unique-view-5"
case uniqueView10 = "unique-view-10"
case uniqueView30 = "unique-view-30"
}
public enum Interval: String, Codable, CaseIterable {
case minute = "minute"
case hour = "hour"
case day = "day"
}
/** Returns the metric you selected. */
/** Returns the metric and relevant parameters you selected. */
public var metric: Metric?
/** Returns the interval you selected. */
public var interval: Interval?
Expand Down
12 changes: 11 additions & 1 deletion Sources/Models/FilterBy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public struct FilterBy: Codable, Hashable {
public var browser: [String]?
/** Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). */
public var tag: String?
/** Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. */
public var referrer: [String]?

public init(mediaId: [String]? = nil, mediaType: MediaType? = nil, continent: [Continent]? = nil, country: [String]? = nil, deviceType: [String]? = nil, operatingSystem: [String]? = nil, browser: [String]? = nil, tag: String? = nil) {
public init(mediaId: [String]? = nil, mediaType: MediaType? = nil, continent: [Continent]? = nil, country: [String]? = nil, deviceType: [String]? = nil, operatingSystem: [String]? = nil, browser: [String]? = nil, tag: String? = nil, referrer: [String]? = nil) {
self.mediaId = mediaId
self.mediaType = mediaType
self.continent = continent
Expand All @@ -50,6 +52,7 @@ public struct FilterBy: Codable, Hashable {
self.operatingSystem = operatingSystem
self.browser = browser
self.tag = tag
self.referrer = referrer
}

public enum CodingKeys: String, CodingKey, CaseIterable {
Expand All @@ -61,6 +64,7 @@ public struct FilterBy: Codable, Hashable {
case operatingSystem
case browser
case tag
case referrer
}

public func encodeToQueryParams() -> [URLQueryItem] {
Expand Down Expand Up @@ -102,6 +106,11 @@ public struct FilterBy: Codable, Hashable {
if let tag = tag {
queryItems.append(URLQueryItem(name: "filterBy[tag]", value: tag))
}
if let referrer = referrer, !referrer.isEmpty {
for (index, val) in referrer.enumerated() {
queryItems.append(URLQueryItem(name: "filterBy[referrer][\(index)]", value: val))
}
}

return queryItems
}
Expand All @@ -117,6 +126,7 @@ public struct FilterBy: Codable, Hashable {
try container.encodeIfPresent(operatingSystem, forKey: .operatingSystem)
try container.encodeIfPresent(browser, forKey: .browser)
try container.encodeIfPresent(tag, forKey: .tag)
try container.encodeIfPresent(referrer, forKey: .referrer)
}
}

12 changes: 11 additions & 1 deletion Sources/Models/FilterBy1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public struct FilterBy1: Codable, Hashable {
public var browser: [String]?
/** Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). */
public var tag: String?
/** Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. */
public var referrer: [String]?

public init(mediaId: [String]? = nil, mediaType: MediaType? = nil, continent: [Continent]? = nil, country: [String]? = nil, deviceType: [String]? = nil, operatingSystem: [String]? = nil, browser: [String]? = nil, tag: String? = nil) {
public init(mediaId: [String]? = nil, mediaType: MediaType? = nil, continent: [Continent]? = nil, country: [String]? = nil, deviceType: [String]? = nil, operatingSystem: [String]? = nil, browser: [String]? = nil, tag: String? = nil, referrer: [String]? = nil) {
self.mediaId = mediaId
self.mediaType = mediaType
self.continent = continent
Expand All @@ -50,6 +52,7 @@ public struct FilterBy1: Codable, Hashable {
self.operatingSystem = operatingSystem
self.browser = browser
self.tag = tag
self.referrer = referrer
}

public enum CodingKeys: String, CodingKey, CaseIterable {
Expand All @@ -61,6 +64,7 @@ public struct FilterBy1: Codable, Hashable {
case operatingSystem
case browser
case tag
case referrer
}

public func encodeToQueryParams() -> [URLQueryItem] {
Expand Down Expand Up @@ -102,6 +106,11 @@ public struct FilterBy1: Codable, Hashable {
if let tag = tag {
queryItems.append(URLQueryItem(name: "filterBy[tag]", value: tag))
}
if let referrer = referrer, !referrer.isEmpty {
for (index, val) in referrer.enumerated() {
queryItems.append(URLQueryItem(name: "filterBy[referrer][\(index)]", value: val))
}
}

return queryItems
}
Expand All @@ -117,6 +126,7 @@ public struct FilterBy1: Codable, Hashable {
try container.encodeIfPresent(operatingSystem, forKey: .operatingSystem)
try container.encodeIfPresent(browser, forKey: .browser)
try container.encodeIfPresent(tag, forKey: .tag)
try container.encodeIfPresent(referrer, forKey: .referrer)
}
}

12 changes: 11 additions & 1 deletion Sources/Models/FilterBy2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public struct FilterBy2: Codable, Hashable {
public var browser: [String]?
/** Returns analytics for videos using this tag. This filter only accepts a single value and is case sensitive. Read more about tagging your videos [here](https://docs.api.video/vod/tags-metadata). */
public var tag: String?
/** Filters data based on the URL where the view is originating from. This filter parameter accepts an empty string to filter view events where no referrer is available. */
public var referrer: [String]?

public init(mediaId: [String]? = nil, mediaType: MediaType? = nil, continent: [Continent]? = nil, country: [String]? = nil, deviceType: [String]? = nil, operatingSystem: [String]? = nil, browser: [String]? = nil, tag: String? = nil) {
public init(mediaId: [String]? = nil, mediaType: MediaType? = nil, continent: [Continent]? = nil, country: [String]? = nil, deviceType: [String]? = nil, operatingSystem: [String]? = nil, browser: [String]? = nil, tag: String? = nil, referrer: [String]? = nil) {
self.mediaId = mediaId
self.mediaType = mediaType
self.continent = continent
Expand All @@ -50,6 +52,7 @@ public struct FilterBy2: Codable, Hashable {
self.operatingSystem = operatingSystem
self.browser = browser
self.tag = tag
self.referrer = referrer
}

public enum CodingKeys: String, CodingKey, CaseIterable {
Expand All @@ -61,6 +64,7 @@ public struct FilterBy2: Codable, Hashable {
case operatingSystem
case browser
case tag
case referrer
}

public func encodeToQueryParams() -> [URLQueryItem] {
Expand Down Expand Up @@ -102,6 +106,11 @@ public struct FilterBy2: Codable, Hashable {
if let tag = tag {
queryItems.append(URLQueryItem(name: "filterBy[tag]", value: tag))
}
if let referrer = referrer, !referrer.isEmpty {
for (index, val) in referrer.enumerated() {
queryItems.append(URLQueryItem(name: "filterBy[referrer][\(index)]", value: val))
}
}

return queryItems
}
Expand All @@ -117,6 +126,7 @@ public struct FilterBy2: Codable, Hashable {
try container.encodeIfPresent(operatingSystem, forKey: .operatingSystem)
try container.encodeIfPresent(browser, forKey: .browser)
try container.encodeIfPresent(tag, forKey: .tag)
try container.encodeIfPresent(referrer, forKey: .referrer)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/request-invalid-query-parameter",
"title" : "A query parameter is invalid.",
"status" : 400,
"detail" : "This value should not contain more than 2048 characters.",
"name" : "filterBy[referrer]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/request-invalid-query-parameter",
"title" : "A query parameter is invalid.",
"status" : 400,
"detail" : "This view duration is invalid. Use one of \"3s\", \"5s\", \"10s\", \"30s\".",
"name" : "viewDuration"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/request-invalid-query-parameter",
"title" : "A query parameter is invalid.",
"status" : 400,
"detail" : "This value should not contain more than 2048 characters.",
"name" : "filterBy[referrer]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/request-invalid-query-parameter",
"title" : "A query parameter is invalid.",
"status" : 400,
"detail" : "This view duration is invalid. Use one of \"3s\", \"5s\", \"10s\", \"30s\".",
"name" : "viewDuration"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/request-invalid-query-parameter",
"title" : "A query parameter is invalid.",
"status" : 400,
"detail" : "This interval is invalid. Use one of \"minute\", \"hour\", \"day\".",
"name" : "interval"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/request-invalid-query-parameter",
"title" : "A query parameter is invalid.",
"status" : 400,
"detail" : "This interval cannot be used with a timeframe over 60 minutes.",
"name" : "interval"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/request-invalid-query-parameter",
"title" : "A query parameter is invalid.",
"status" : 400,
"detail" : "This value should not contain more than 2048 characters.",
"name" : "filterBy[referrer]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/request-invalid-query-parameter",
"title" : "A query parameter is invalid.",
"status" : 400,
"detail" : "This view duration is invalid. Use one of \"3s\", \"5s\", \"10s\", \"30s\".",
"name" : "viewDuration"
}
Loading

0 comments on commit 467552a

Please sign in to comment.