From 2003ac7f3f0e019f9e3b6efa50705b2b978aa03f Mon Sep 17 00:00:00 2001 From: olivierapivideo Date: Tue, 8 Oct 2024 10:26:44 +0000 Subject: [PATCH] Add transcript feature --- .../oas_apivideo.yaml-defaut-cli.sha256 | 2 +- ApiVideoUploader.podspec | 4 ++-- CHANGELOG.md | 3 +++ README.md | 4 ++-- Sources/APIs.swift | 2 +- Sources/Models/Video.swift | 16 +++++++++++++++- .../uploadWithUploadToken/responses/201.json | 1 + docs/Video.md | 2 ++ project.yml | 2 +- 9 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 b/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 index 0b1c058..16802ac 100644 --- a/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 +++ b/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 @@ -1 +1 @@ -49fece4f39cb92341dc77e0eb7371a152903bf6aebcfa250d289efc9018b0f72 \ No newline at end of file +5ad86d4a6e6bdfede262551219ba43c8a645a86bc20fc9740b6f950e86f99f1d \ No newline at end of file diff --git a/ApiVideoUploader.podspec b/ApiVideoUploader.podspec index 64a0a6d..8b3bc10 100644 --- a/ApiVideoUploader.podspec +++ b/ApiVideoUploader.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.2.3' - s.source = { :git => 'https://github.com/apivideo/api.video-swift-uploader', :tag => 'v1.2.3' } + s.version = '1.2.4' + s.source = { :git => 'https://github.com/apivideo/api.video-swift-uploader', :tag => 'v1.2.4' } 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 08d2140..3c4780f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [1.2.4] - 2024-10-08 +- Add transcript feature + ## [1.2.3] - 2024-04-25 - Add API to get rate limiting headers diff --git a/README.md b/README.md index 00ab6d5..bc65b93 100644 --- a/README.md +++ b/README.md @@ -52,14 +52,14 @@ It allows you to upload videos in two ways: Specify it in your `Cartfile`: ``` -github "apivideo/api.video-swift-uploader" ~> 1.2.3 +github "apivideo/api.video-swift-uploader" ~> 1.2.4 ``` Run `carthage update` #### CocoaPods -Add `pod 'ApiVideoUploader', '1.2.3'` in your `Podfile` +Add `pod 'ApiVideoUploader', '1.2.4'` in your `Podfile` Run `pod install` diff --git a/Sources/APIs.swift b/Sources/APIs.swift index d4b8e9f..e8eaf55 100644 --- a/Sources/APIs.swift +++ b/Sources/APIs.swift @@ -8,7 +8,7 @@ import Foundation public class ApiVideoUploader { public static var apiKey: String? = nil public static var basePath = "https://ws.api.video" - internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift-uploader:1.2.3"] + internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift-uploader:1.2.4"] private static var chunkSize: Int = 50 * 1024 * 1024 internal static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() internal static var credential = ApiVideoCredential() diff --git a/Sources/Models/Video.swift b/Sources/Models/Video.swift index 2204749..9ba9576 100644 --- a/Sources/Models/Video.swift +++ b/Sources/Models/Video.swift @@ -12,6 +12,10 @@ import AnyCodable public struct Video: Codable, Hashable { + public enum LanguageOrigin: String, Codable, CaseIterable { + case api = "api" + case auto = "auto" + } /** The unique identifier of the video object. */ public var videoId: String /** When a video was created, presented in ATOM UTC format. */ @@ -30,6 +34,10 @@ public struct Video: Codable, Hashable { public var deletesAt: Date? /** Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video. */ public var discarded: Bool? + /** Returns the language of a video in [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. You can set the language during video creation via the API, otherwise it is detected automatically. */ + public var language: String? + /** Returns the origin of the last update on the video's `language` attribute. - `api` means that the last update was requested from the API. - `auto` means that the last update was done automatically by the API. */ + public var languageOrigin: LanguageOrigin? /** One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. */ public var tags: [String]? /** Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. */ @@ -45,7 +53,7 @@ public struct Video: Codable, Hashable { /** This lets you know whether mp4 is supported. If enabled, an mp4 URL will be provided in the response for the video. */ public var mp4Support: Bool? - public init(videoId: String, createdAt: Date? = nil, title: String? = nil, description: String? = nil, publishedAt: Date? = nil, updatedAt: Date? = nil, discardedAt: Date? = nil, deletesAt: Date? = nil, discarded: Bool? = nil, tags: [String]? = nil, metadata: [Metadata]? = nil, source: VideoSource? = nil, assets: VideoAssets? = nil, playerId: String? = nil, _public: Bool? = nil, panoramic: Bool? = nil, mp4Support: Bool? = nil) { + public init(videoId: String, createdAt: Date? = nil, title: String? = nil, description: String? = nil, publishedAt: Date? = nil, updatedAt: Date? = nil, discardedAt: Date? = nil, deletesAt: Date? = nil, discarded: Bool? = nil, language: String? = nil, languageOrigin: LanguageOrigin? = nil, tags: [String]? = nil, metadata: [Metadata]? = nil, source: VideoSource? = nil, assets: VideoAssets? = nil, playerId: String? = nil, _public: Bool? = nil, panoramic: Bool? = nil, mp4Support: Bool? = nil) { self.videoId = videoId self.createdAt = createdAt self.title = title @@ -55,6 +63,8 @@ public struct Video: Codable, Hashable { self.discardedAt = discardedAt self.deletesAt = deletesAt self.discarded = discarded + self.language = language + self.languageOrigin = languageOrigin self.tags = tags self.metadata = metadata self.source = source @@ -75,6 +85,8 @@ public struct Video: Codable, Hashable { case discardedAt case deletesAt case discarded + case language + case languageOrigin case tags case metadata case source @@ -98,6 +110,8 @@ public struct Video: Codable, Hashable { try container.encodeIfPresent(discardedAt, forKey: .discardedAt) try container.encodeIfPresent(deletesAt, forKey: .deletesAt) try container.encodeIfPresent(discarded, forKey: .discarded) + try container.encodeIfPresent(language, forKey: .language) + try container.encodeIfPresent(languageOrigin, forKey: .languageOrigin) try container.encodeIfPresent(tags, forKey: .tags) try container.encodeIfPresent(metadata, forKey: .metadata) try container.encodeIfPresent(source, forKey: .source) diff --git a/Tests/TestResources/payloads/videos/uploadWithUploadToken/responses/201.json b/Tests/TestResources/payloads/videos/uploadWithUploadToken/responses/201.json index 8aeb102..37424d1 100644 --- a/Tests/TestResources/payloads/videos/uploadWithUploadToken/responses/201.json +++ b/Tests/TestResources/payloads/videos/uploadWithUploadToken/responses/201.json @@ -3,6 +3,7 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "Maths video", "description" : "An amazing video explaining the string theory", + "language" : "en", "public" : false, "panoramic" : false, "tags" : [ "maths", "string theory", "video" ], diff --git a/docs/Video.md b/docs/Video.md index 2156f95..6d425e8 100644 --- a/docs/Video.md +++ b/docs/Video.md @@ -12,6 +12,8 @@ Name | Type | Description | Notes **discardedAt** | **Date** | The date and time the video was discarded. The API populates this field only if you have the Video Restore feature enabled and discard a video. Date and time are provided using ATOM UTC format. | [optional] **deletesAt** | **Date** | The date and time the video will be permanently deleted. The API populates this field only if you have the Video Restore feature enabled and discard a video. Discarded videos are pemanently deleted after 90 days. Date and time are provided using ATOM UTC format. | [optional] **discarded** | **Bool** | Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video. | [optional] +**language** | **String** | Returns the language of a video in [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. You can set the language during video creation via the API, otherwise it is detected automatically. | [optional] +**languageOrigin** | **String** | Returns the origin of the last update on the video's `language` attribute. - `api` means that the last update was requested from the API. - `auto` means that the last update was done automatically by the API. | [optional] **tags** | **[String]** | One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. | [optional] **metadata** | [Metadata] | Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. | [optional] **source** | [**VideoSource**](VideoSource.md) | | [optional] diff --git a/project.yml b/project.yml index 263c15e..138ffa9 100644 --- a/project.yml +++ b/project.yml @@ -7,7 +7,7 @@ targets: sources: [Sources] info: path: ./Info.plist - version: 1.2.3 + version: 1.2.4 settings: APPLICATION_EXTENSION_API_ONLY: true scheme: {}