Skip to content

Commit e8ce368

Browse files
Merge pull request #89 from apivideo/add-video-tags-endpoint
Add video tags endpoint
2 parents b716f83 + aa34032 commit e8ce368

File tree

18 files changed

+360
-20
lines changed

18 files changed

+360
-20
lines changed

.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Sources/APIs/CaptionsAPI.swift
1111
Sources/APIs/ChaptersAPI.swift
1212
Sources/APIs/LiveStreamsAPI.swift
1313
Sources/APIs/PlayerThemesAPI.swift
14+
Sources/APIs/TagsAPI.swift
1415
Sources/APIs/UploadTokensAPI.swift
1516
Sources/APIs/VideosAPI.swift
1617
Sources/APIs/WatermarksAPI.swift
@@ -52,6 +53,8 @@ Sources/Models/FilterBy.swift
5253
Sources/Models/FilterBy1.swift
5354
Sources/Models/FilterBy2.swift
5455
Sources/Models/Link.swift
56+
Sources/Models/ListTagsResponse.swift
57+
Sources/Models/ListTagsResponseData.swift
5558
Sources/Models/LiveStream.swift
5659
Sources/Models/LiveStreamAssets.swift
5760
Sources/Models/LiveStreamCreationPayload.swift
@@ -136,6 +139,8 @@ docs/FilterBy.md
136139
docs/FilterBy1.md
137140
docs/FilterBy2.md
138141
docs/Link.md
142+
docs/ListTagsResponse.md
143+
docs/ListTagsResponseData.md
139144
docs/LiveStream.md
140145
docs/LiveStreamAssets.md
141146
docs/LiveStreamCreationPayload.md
@@ -158,6 +163,7 @@ docs/Quality.md
158163
docs/RefreshTokenPayload.md
159164
docs/RestreamsRequestObject.md
160165
docs/RestreamsResponseObject.md
166+
docs/TagsAPI.md
161167
docs/TokenCreationPayload.md
162168
docs/TokenListResponse.md
163169
docs/TooManyRequests.md
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17ac0a7b292afb851962592fd7280e7727bb901d5d4e2a3f75808aa76a1ecdf5
1+
49fece4f39cb92341dc77e0eb7371a152903bf6aebcfa250d289efc9018b0f72

ApiVideoClient.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Pod::Spec.new do |s|
55
s.tvos.deployment_target = '10.0'
66
# Add back when CocoaPods/CocoaPods#11558 is released
77
#s.watchos.deployment_target = '3.0'
8-
s.version = '1.3.2'
9-
s.source = { :git => 'https://github.com/apivideo/api.video-swift-client', :tag => 'v1.3.2' }
8+
s.version = '1.3.3'
9+
s.source = { :git => 'https://github.com/apivideo/api.video-swift-client', :tag => 'v1.3.3' }
1010
s.authors = { 'Ecosystem Team' => 'ecosystem@api.video' }
1111
s.license = { :type => 'MIT' }
1212
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.3.3] - 2024-09-30
5+
- Add /tags API endpoint
6+
47
## [1.3.2] - 2024-09-16
58
- Add discarded video endpoints
69

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [ChaptersAPI](#ChaptersAPI)
2121
- [LiveStreamsAPI](#LiveStreamsAPI)
2222
- [PlayerThemesAPI](#PlayerThemesAPI)
23+
- [TagsAPI](#TagsAPI)
2324
- [UploadTokensAPI](#UploadTokensAPI)
2425
- [VideosAPI](#VideosAPI)
2526
- [WatermarksAPI](#WatermarksAPI)
@@ -55,14 +56,14 @@ api.video's Swift API client for iOS, macOS and tvOS streamlines the coding proc
5556
Specify it in your `Cartfile`:
5657

5758
```
58-
github "apivideo/api.video-swift-client" ~> 1.3.2
59+
github "apivideo/api.video-swift-client" ~> 1.3.3
5960
```
6061

6162
Run `carthage update`
6263

6364
#### CocoaPods
6465

65-
Add `pod 'ApiVideoClient', '1.3.2'` in your `Podfile`
66+
Add `pod 'ApiVideoClient', '1.3.3'` in your `Podfile`
6667

6768
Run `pod install`
6869

@@ -189,6 +190,21 @@ Method | HTTP request | Description
189190
[**deleteLogo**](https://github.com/apivideo/api.video-swift-client/blob/main/docs/PlayerThemesAPI.md#deleteLogo) | **DELETE** `/players/{playerId}/logo` | Delete logo
190191

191192

193+
#### TagsAPI
194+
195+
##### Retrieve an instance of TagsAPI:
196+
197+
```swift
198+
TagsAPI
199+
```
200+
201+
##### Endpoints
202+
203+
Method | HTTP request | Description
204+
------------- | ------------- | -------------
205+
[**list**](https://github.com/apivideo/api.video-swift-client/blob/main/docs/TagsAPI.md#list) | **GET** `/tags` | List all video tags
206+
207+
192208
#### UploadTokensAPI
193209

194210
##### Retrieve an instance of UploadTokensAPI:
@@ -299,6 +315,8 @@ Method | HTTP request | Description
299315
- [FilterBy1](https://github.com/apivideo/api.video-swift-client/blob/main/docs/FilterBy1.md)
300316
- [FilterBy2](https://github.com/apivideo/api.video-swift-client/blob/main/docs/FilterBy2.md)
301317
- [Link](https://github.com/apivideo/api.video-swift-client/blob/main/docs/Link.md)
318+
- [ListTagsResponse](https://github.com/apivideo/api.video-swift-client/blob/main/docs/ListTagsResponse.md)
319+
- [ListTagsResponseData](https://github.com/apivideo/api.video-swift-client/blob/main/docs/ListTagsResponseData.md)
302320
- [LiveStream](https://github.com/apivideo/api.video-swift-client/blob/main/docs/LiveStream.md)
303321
- [LiveStreamAssets](https://github.com/apivideo/api.video-swift-client/blob/main/docs/LiveStreamAssets.md)
304322
- [LiveStreamCreationPayload](https://github.com/apivideo/api.video-swift-client/blob/main/docs/LiveStreamCreationPayload.md)

Sources/APIs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Foundation
88
public class ApiVideoClient {
99
public static var apiKey: String? = nil
1010
public static var basePath = "https://ws.api.video"
11-
internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift:1.3.2"]
11+
internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift:1.3.3"]
1212
private static var chunkSize: Int = 50 * 1024 * 1024
1313
internal static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
1414
internal static var credential = ApiVideoCredential()

Sources/APIs/TagsAPI.swift

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
//
2+
// TagsAPI.swift
3+
//
4+
// Generated by openapi-generator
5+
// https://openapi-generator.tech
6+
//
7+
8+
import Foundation
9+
#if canImport(AnyCodable)
10+
import AnyCodable
11+
#endif
12+
13+
open class TagsAPI {
14+
15+
/**
16+
* enum for parameter sortBy
17+
*/
18+
public enum SortByList: String, CaseIterable {
19+
case value = "value"
20+
case videocount = "videoCount"
21+
}
22+
23+
/**
24+
* enum for parameter sortOrder
25+
*/
26+
public enum SortOrderList: String, CaseIterable {
27+
case asc = "asc"
28+
case desc = "desc"
29+
}
30+
31+
/**
32+
List all video tags
33+
34+
- parameter value: (query) Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase. (optional)
35+
- parameter sortBy: (query) Use this parameter to choose which field the API will use to sort the response data. The default is `value`. These are the available fields to sort by: - `value`: Sorts the results based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the number of times a video tag is used. (optional)
36+
- parameter sortOrder: (query) Use this parameter to sort results. `asc` is ascending and sorts from A to Z. `desc` is descending and sorts from Z to A. (optional)
37+
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
38+
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
39+
- parameter apiResponseQueue: The queue on which api response is dispatched.
40+
- parameter completion: completion handler to receive the data and the error objects.
41+
*/
42+
@discardableResult
43+
open class func list(value: String? = nil, sortBy: SortByList? = nil, sortOrder: SortOrderList? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: ListTagsResponse?, _ error: Error?) -> Void)) -> RequestTask {
44+
return list(value: value, sortBy: sortBy, sortOrder: sortOrder, currentPage: currentPage, pageSize: pageSize, apiResponseQueue: apiResponseQueue) { result in
45+
switch result {
46+
case let .success(response):
47+
completion(response.body, nil)
48+
case let .failure(error):
49+
completion(nil, error)
50+
}
51+
}
52+
}
53+
54+
/**
55+
List all video tags
56+
57+
- parameter value: (query) Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase. (optional)
58+
- parameter sortBy: (query) Use this parameter to choose which field the API will use to sort the response data. The default is `value`. These are the available fields to sort by: - `value`: Sorts the results based on tag values in alphabetic order. - `videoCount`: Sorts the results based on the number of times a video tag is used. (optional)
59+
- parameter sortOrder: (query) Use this parameter to sort results. `asc` is ascending and sorts from A to Z. `desc` is descending and sorts from Z to A. (optional)
60+
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
61+
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
62+
- parameter apiResponseQueue: The queue on which api response is dispatched.
63+
- parameter completion: completion handler to receive the result of the request (incl. headers).
64+
*/
65+
@discardableResult
66+
open class func list(value: String? = nil, sortBy: SortByList? = nil, sortOrder: SortOrderList? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping (_ result: Swift.Result<Response<ListTagsResponse>, ErrorResponse>) -> Void) -> RequestTask {
67+
return listWithRequestBuilder(value: value, sortBy: sortBy, sortOrder: sortOrder, currentPage: currentPage, pageSize: pageSize).execute(apiResponseQueue, completion)
68+
}
69+
70+
71+
/**
72+
List all video tags
73+
- GET /tags
74+
- This endpoint enables you to search for video tags in a project and see how many videos are tagged with them. If you do not define any query parameters, the endpoint lists all video tags and the numbers of times they are used in a project.
75+
- responseHeaders: [X-RateLimit-Limit(Int), X-RateLimit-Remaining(Int), X-RateLimit-Retry-After(Int)]
76+
- parameter value: (query) Use this parameter to search for specific video tags. The API filters results even on partial values, and ignores accents, uppercase, and lowercase. (optional)
77+
- parameter sortBy: (query) Use this parameter to choose which field the API will use to sort the response data. The default is &#x60;value&#x60;. These are the available fields to sort by: - &#x60;value&#x60;: Sorts the results based on tag values in alphabetic order. - &#x60;videoCount&#x60;: Sorts the results based on the number of times a video tag is used. (optional)
78+
- parameter sortOrder: (query) Use this parameter to sort results. &#x60;asc&#x60; is ascending and sorts from A to Z. &#x60;desc&#x60; is descending and sorts from Z to A. (optional)
79+
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
80+
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
81+
- returns: RequestBuilder<ListTagsResponse>
82+
*/
83+
internal class func listWithRequestBuilder(value: String? = nil, sortBy: SortByList? = nil, sortOrder: SortOrderList? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder<ListTagsResponse> {
84+
let localVariablePath = "/tags"
85+
let localVariableURLString = ApiVideoClient.basePath + localVariablePath
86+
let localVariableParameters: [String: Any]? = nil
87+
88+
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
89+
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
90+
"value": value?.encodeToJSON(),
91+
"sortBy": sortBy?.encodeToJSON(),
92+
"sortOrder": sortOrder?.encodeToJSON(),
93+
"currentPage": currentPage?.encodeToJSON(),
94+
"pageSize": pageSize?.encodeToJSON(),
95+
])
96+
97+
98+
let localVariableNillableHeaders: [String: Any?] = [
99+
:
100+
]
101+
102+
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
103+
104+
let localVariableRequestBuilder: RequestBuilder<ListTagsResponse>.Type = ApiVideoClient.requestBuilderFactory.getBuilder()
105+
106+
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
107+
}
108+
109+
}

Sources/Models/ListTagsResponse.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// ListTagsResponse.swift
3+
//
4+
// Generated by openapi-generator
5+
// https://openapi-generator.tech
6+
//
7+
8+
import Foundation
9+
#if canImport(AnyCodable)
10+
import AnyCodable
11+
#endif
12+
13+
public struct ListTagsResponse: Codable, Hashable {
14+
15+
public var data: [ListTagsResponseData]?
16+
public var pagination: Pagination?
17+
18+
public init(data: [ListTagsResponseData]? = nil, pagination: Pagination? = nil) {
19+
self.data = data
20+
self.pagination = pagination
21+
}
22+
23+
public enum CodingKeys: String, CodingKey, CaseIterable {
24+
case data
25+
case pagination
26+
}
27+
28+
// Encodable protocol methods
29+
30+
public func encode(to encoder: Encoder) throws {
31+
var container = encoder.container(keyedBy: CodingKeys.self)
32+
try container.encodeIfPresent(data, forKey: .data)
33+
try container.encodeIfPresent(pagination, forKey: .pagination)
34+
}
35+
}
36+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// ListTagsResponseData.swift
3+
//
4+
// Generated by openapi-generator
5+
// https://openapi-generator.tech
6+
//
7+
8+
import Foundation
9+
#if canImport(AnyCodable)
10+
import AnyCodable
11+
#endif
12+
13+
public struct ListTagsResponseData: Codable, Hashable {
14+
15+
/** Returns the value of a video tag used in your project. */
16+
public var value: String?
17+
/** Returns the number of times a video tag is used. */
18+
public var videoCount: Int?
19+
20+
public init(value: String? = nil, videoCount: Int? = nil) {
21+
self.value = value
22+
self.videoCount = videoCount
23+
}
24+
25+
public enum CodingKeys: String, CodingKey, CaseIterable {
26+
case value
27+
case videoCount
28+
}
29+
30+
// Encodable protocol methods
31+
32+
public func encode(to encoder: Encoder) throws {
33+
var container = encoder.container(keyedBy: CodingKeys.self)
34+
try container.encodeIfPresent(value, forKey: .value)
35+
try container.encodeIfPresent(videoCount, forKey: .videoCount)
36+
}
37+
}
38+

Sources/Models/Webhook.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,31 @@ import AnyCodable
1212

1313
public struct Webhook: Codable, Hashable {
1414

15-
/** Unique identifier of the webhook */
15+
/** A unique identifier of the webhook you subscribed to. */
1616
public var webhookId: String?
17-
/** When an webhook was created, presented in ATOM UTC format. */
17+
/** The time and date when you created this webhook subscription, in ATOM UTC format. */
1818
public var createdAt: Date?
19-
/** A list of events that will trigger the webhook. */
19+
/** A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided. */
2020
public var events: [String]?
21-
/** URL of the webhook */
21+
/** The URL where the API sends the webhook. */
2222
public var url: String?
23+
/** A secret key for the webhook you subscribed to. You can use it to verify the origin of the webhook call that you receive. */
24+
public var signatureSecret: String?
2325

24-
public init(webhookId: String? = nil, createdAt: Date? = nil, events: [String]? = nil, url: String? = nil) {
26+
public init(webhookId: String? = nil, createdAt: Date? = nil, events: [String]? = nil, url: String? = nil, signatureSecret: String? = nil) {
2527
self.webhookId = webhookId
2628
self.createdAt = createdAt
2729
self.events = events
2830
self.url = url
31+
self.signatureSecret = signatureSecret
2932
}
3033

3134
public enum CodingKeys: String, CodingKey, CaseIterable {
3235
case webhookId
3336
case createdAt
3437
case events
3538
case url
39+
case signatureSecret
3640
}
3741

3842
// Encodable protocol methods
@@ -43,6 +47,7 @@ public struct Webhook: Codable, Hashable {
4347
try container.encodeIfPresent(createdAt, forKey: .createdAt)
4448
try container.encodeIfPresent(events, forKey: .events)
4549
try container.encodeIfPresent(url, forKey: .url)
50+
try container.encodeIfPresent(signatureSecret, forKey: .signatureSecret)
4651
}
4752
}
4853

0 commit comments

Comments
 (0)