Skip to content

Commit 9d23f63

Browse files
Merge pull request #34 from apivideo/date-rage-required-in-analytics
feat(all) Date range param is required in analytics endpoints
2 parents f5958e0 + 1262738 commit 9d23f63

File tree

10 files changed

+36
-33
lines changed

10 files changed

+36
-33
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fa7ac2451c4cf442853cb5c85c8372aa1c7969a3232442adf3109d7346edc5f2
1+
94990465713a14b6421dfb20f4a7e9ad69bcdc31aa22b7789aa907bbb3144304

ApiVideoClient.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Pod::Spec.new do |s|
44
s.osx.deployment_target = '10.12'
55
s.tvos.deployment_target = '10.0'
66
s.watchos.deployment_target = '3.0'
7-
s.version = '1.0.5'
8-
s.source = { :git => 'https://github.com/apivideo/api.video-ios-client', :tag => 'v1.0.5' }
7+
s.version = '1.0.6'
8+
s.source = { :git => 'https://github.com/apivideo/api.video-ios-client', :tag => 'v1.0.6' }
99
s.authors = { 'Ecosystem Team' => 'ecosystem@api.video' }
1010
s.license = { :type => 'MIT' }
1111
s.homepage = 'https://docs.api.video'

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [1.0.6] - 2022-09-13
5+
- period parameter is now mandatory in analytics endpoints
6+
47
## [1.0.5] - 2022-06-30
58
- Add SDK origin header
69

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ api.video's iOS streamlines the coding process. Chunking files is handled for y
4242
Specify it in your `Cartfile`:
4343

4444
```
45-
github "apivideo/api.video-ios-client" ~> 1.0.5
45+
github "apivideo/api.video-ios-client" ~> 1.0.6
4646
```
4747

4848
Run `carthage update`
4949

5050
### CocoaPods
5151

52-
Add `pod 'ApiVideoClient', '1.0.5'` in your `Podfile`
52+
Add `pod 'ApiVideoClient', '1.0.6'` in your `Podfile`
5353

5454
Run `pod install`
5555

Sources/APIs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ enum ApiVideoClientError: Error {
1313
public class ApiVideoClient {
1414
public static var apiKey: String? = nil
1515
public static var basePath = "https://ws.api.video"
16-
internal static var customHeaders:[String: String] = ["AV-Origin-Client": "ios:1.0.5"]
16+
internal static var customHeaders:[String: String] = ["AV-Origin-Client": "ios:1.0.6"]
1717
private static var chunkSize: Int = 50 * 1024 * 1024
1818
internal static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
1919
internal static var credential = ApiVideoCredential()

Sources/APIs/AuthenticationAPI.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import AnyCodable
1313
open class AuthenticationAPI {
1414

1515
/**
16-
Authenticate
16+
Advanced - Authenticate (1/2)
1717

1818
- parameter authenticatePayload: (body)
1919
- parameter apiResponseQueue: The queue on which api response is dispatched.
@@ -33,7 +33,7 @@ open class AuthenticationAPI {
3333

3434

3535
/**
36-
Authenticate
36+
Advanced - Authenticate (1/2)
3737
- POST /auth/api-key
3838
- To get started, submit your API key in the body of your request. api.video returns an access token that is valid for one hour (3600 seconds). A refresh token is also returned. View a [tutorial](https://api.video/blog/tutorials/authentication-tutorial) on authentication. All tutorials using the [authentication endpoint](https://api.video/blog/endpoints/authenticate)
3939
- parameter authenticatePayload: (body)
@@ -59,7 +59,7 @@ open class AuthenticationAPI {
5959

6060

6161
/**
62-
Refresh token
62+
Advanced - Refresh token (2/2)
6363

6464
- parameter refreshTokenPayload: (body)
6565
- parameter apiResponseQueue: The queue on which api response is dispatched.
@@ -79,7 +79,7 @@ open class AuthenticationAPI {
7979

8080

8181
/**
82-
Refresh token
82+
Advanced - Refresh token (2/2)
8383
- POST /auth/refresh
8484
- Use the refresh endpoint with the refresh token you received when you first authenticated using the api-key endpoint. Send the refresh token in the body of your request. The api.video API returns a new access token that is valid for one hour (3600 seconds) and a new refresh token.
8585
- parameter refreshTokenPayload: (body)

Sources/APIs/RawStatisticsAPI.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ open class RawStatisticsAPI {
1616
List live stream player sessions
1717

1818
- parameter liveStreamId: (path) The unique identifier for the live stream you want to retrieve analytics for.
19-
- parameter period: (query) Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a range period: - Date range: \"2018-01-01/2018-01-15\" (optional)
19+
- parameter period: (query) Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a range period: - Date range: \"2018-01-01/2018-01-15\"
2020
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
2121
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
2222
- parameter apiResponseQueue: The queue on which api response is dispatched.
2323
- parameter completion: completion handler to receive the data and the error objects.
2424
*/
2525
@discardableResult
26-
open class func listLiveStreamSessions(liveStreamId: String, period: String? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: RawStatisticsListLiveStreamAnalyticsResponse?, _ error: Error?) -> Void)) -> URLSessionTask? {
26+
open class func listLiveStreamSessions(liveStreamId: String, period: String, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: RawStatisticsListLiveStreamAnalyticsResponse?, _ error: Error?) -> Void)) -> URLSessionTask? {
2727
return listLiveStreamSessionsWithRequestBuilder(liveStreamId: liveStreamId, period: period, currentPage: currentPage, pageSize: pageSize).execute(apiResponseQueue) { result in
2828
switch result {
2929
case let .success(response):
@@ -39,12 +39,12 @@ open class RawStatisticsAPI {
3939
List live stream player sessions
4040
- GET /analytics/live-streams/{liveStreamId}
4141
- parameter liveStreamId: (path) The unique identifier for the live stream you want to retrieve analytics for.
42-
- parameter period: (query) Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a range period: - Date range: \"2018-01-01/2018-01-15\" (optional)
42+
- parameter period: (query) Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a range period: - Date range: \"2018-01-01/2018-01-15\"
4343
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
4444
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
4545
- returns: RequestBuilder<RawStatisticsListLiveStreamAnalyticsResponse>
4646
*/
47-
open class func listLiveStreamSessionsWithRequestBuilder(liveStreamId: String, period: String? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder<RawStatisticsListLiveStreamAnalyticsResponse> {
47+
open class func listLiveStreamSessionsWithRequestBuilder(liveStreamId: String, period: String, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder<RawStatisticsListLiveStreamAnalyticsResponse> {
4848
var localVariablePath = "/analytics/live-streams/{liveStreamId}"
4949
let liveStreamIdPreEscape = "\(APIHelper.mapValueToPathItem(liveStreamId))"
5050
let liveStreamIdPostEscape = liveStreamIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
@@ -54,7 +54,7 @@ open class RawStatisticsAPI {
5454

5555
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
5656
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
57-
"period": period?.encodeToJSON(),
57+
"period": period.encodeToJSON(),
5858
"currentPage": currentPage?.encodeToJSON(),
5959
"pageSize": pageSize?.encodeToJSON(),
6060
])
@@ -132,15 +132,15 @@ open class RawStatisticsAPI {
132132
List video player sessions
133133

134134
- parameter videoId: (path) The unique identifier for the video you want to retrieve session information for.
135-
- parameter period: (query) Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 (optional)
135+
- parameter period: (query) Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15
136136
- parameter metadata: (query) Metadata and [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) filter. Send an array of key value pairs you want to filter sessios with. (optional)
137137
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
138138
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
139139
- parameter apiResponseQueue: The queue on which api response is dispatched.
140140
- parameter completion: completion handler to receive the data and the error objects.
141141
*/
142142
@discardableResult
143-
open class func listVideoSessions(videoId: String, period: String? = nil, metadata: [String: String]? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: RawStatisticsListSessionsResponse?, _ error: Error?) -> Void)) -> URLSessionTask? {
143+
open class func listVideoSessions(videoId: String, period: String, metadata: [String: String]? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: RawStatisticsListSessionsResponse?, _ error: Error?) -> Void)) -> URLSessionTask? {
144144
return listVideoSessionsWithRequestBuilder(videoId: videoId, period: period, metadata: metadata, currentPage: currentPage, pageSize: pageSize).execute(apiResponseQueue) { result in
145145
switch result {
146146
case let .success(response):
@@ -157,13 +157,13 @@ open class RawStatisticsAPI {
157157
- GET /analytics/videos/{videoId}
158158
- Retrieve all available user sessions for a specific video. Tutorials that use the [analytics endpoint](https://api.video/blog/endpoints/analytics).
159159
- parameter videoId: (path) The unique identifier for the video you want to retrieve session information for.
160-
- parameter period: (query) Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 (optional)
160+
- parameter period: (query) Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15
161161
- parameter metadata: (query) Metadata and [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) filter. Send an array of key value pairs you want to filter sessios with. (optional)
162162
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
163163
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
164164
- returns: RequestBuilder<RawStatisticsListSessionsResponse>
165165
*/
166-
open class func listVideoSessionsWithRequestBuilder(videoId: String, period: String? = nil, metadata: [String: String]? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder<RawStatisticsListSessionsResponse> {
166+
open class func listVideoSessionsWithRequestBuilder(videoId: String, period: String, metadata: [String: String]? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder<RawStatisticsListSessionsResponse> {
167167
var localVariablePath = "/analytics/videos/{videoId}"
168168
let videoIdPreEscape = "\(APIHelper.mapValueToPathItem(videoId))"
169169
let videoIdPostEscape = videoIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
@@ -173,7 +173,7 @@ open class RawStatisticsAPI {
173173

174174
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
175175
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
176-
"period": period?.encodeToJSON(),
176+
"period": period.encodeToJSON(),
177177
"metadata": metadata?.encodeToJSON(),
178178
"currentPage": currentPage?.encodeToJSON(),
179179
"pageSize": pageSize?.encodeToJSON(),

docs/AuthenticationAPI.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ All URIs are relative to *https://ws.api.video*
44

55
Method | HTTP request | Description
66
------------- | ------------- | -------------
7-
[**authenticate**](AuthenticationAPI.md#postauthapikey) | **POST** /auth/api-key | Authenticate
8-
[**refresh**](AuthenticationAPI.md#postauthrefresh) | **POST** /auth/refresh | Refresh token
7+
[**authenticate**](AuthenticationAPI.md#postauthapikey) | **POST** /auth/api-key | Advanced - Authenticate (1/2)
8+
[**refresh**](AuthenticationAPI.md#postauthrefresh) | **POST** /auth/refresh | Advanced - Refresh token (2/2)
99

1010

1111
# **authenticate**
1212
```swift
1313
open class func authenticate(authenticatePayload: AuthenticatePayload, completion: @escaping (_ data: AccessToken?, _ error: Error?) -> Void)
1414
```
1515

16-
Authenticate
16+
Advanced - Authenticate (1/2)
1717

1818
To get started, submit your API key in the body of your request. api.video returns an access token that is valid for one hour (3600 seconds). A refresh token is also returned. View a [tutorial](https://api.video/blog/tutorials/authentication-tutorial) on authentication. All tutorials using the [authentication endpoint](https://api.video/blog/endpoints/authenticate)
1919

@@ -25,7 +25,7 @@ import ApiVideoClient
2525

2626
let authenticatePayload = authenticate-payload(apiKey: "apiKey_example") // AuthenticatePayload |
2727

28-
// Authenticate
28+
// Advanced - Authenticate (1/2)
2929
AuthenticationAPI.authenticate(authenticatePayload: authenticatePayload) { (response, error) in
3030
guard error == nil else {
3131
print(error)
@@ -64,7 +64,7 @@ No authorization required
6464
open class func refresh(refreshTokenPayload: RefreshTokenPayload, completion: @escaping (_ data: AccessToken?, _ error: Error?) -> Void)
6565
```
6666

67-
Refresh token
67+
Advanced - Refresh token (2/2)
6868

6969
Use the refresh endpoint with the refresh token you received when you first authenticated using the api-key endpoint. Send the refresh token in the body of your request. The api.video API returns a new access token that is valid for one hour (3600 seconds) and a new refresh token.
7070

@@ -76,7 +76,7 @@ import ApiVideoClient
7676

7777
let refreshTokenPayload = refresh-token-payload(refreshToken: "refreshToken_example") // RefreshTokenPayload |
7878

79-
// Refresh token
79+
// Advanced - Refresh token (2/2)
8080
AuthenticationAPI.refresh(refreshTokenPayload: refreshTokenPayload) { (response, error) in
8181
guard error == nil else {
8282
print(error)

0 commit comments

Comments
 (0)