Skip to content

Commit d6a78e1

Browse files
Merge pull request #101 from apivideo/ai-summary-updates
Update Summary endpoints
2 parents 630c1a6 + 56ae4a4 commit d6a78e1

19 files changed

+53
-32
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
589578120105165c9f58683fbe2fb917dabfaf9392187865f30956f8e4964d5a
1+
f2258a85e4233a4243aa1514697cbb72ab9568d8bc147a0ba046e979c1e7bcf9

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.6'
9-
s.source = { :git => 'https://github.com/apivideo/api.video-swift-client', :tag => 'v1.3.6' }
8+
s.version = '1.3.7'
9+
s.source = { :git => 'https://github.com/apivideo/api.video-swift-client', :tag => 'v1.3.7' }
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.7] - 2024-11-06
5+
- AI summary updates
6+
47
## [1.3.6] - 2024-11-04
58
- Analytics updates (ccv, views, ...)
69

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ api.video's Swift API client for iOS, macOS and tvOS streamlines the coding proc
5757
Specify it in your `Cartfile`:
5858

5959
```
60-
github "apivideo/api.video-swift-client" ~> 1.3.6
60+
github "apivideo/api.video-swift-client" ~> 1.3.7
6161
```
6262

6363
Run `carthage update`
6464

6565
#### CocoaPods
6666

67-
Add `pod 'ApiVideoClient', '1.3.6'` in your `Podfile`
67+
Add `pod 'ApiVideoClient', '1.3.7'` in your `Podfile`
6868

6969
Run `pod install`
7070

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.6"]
11+
internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift:1.3.7"]
1212
private static var chunkSize: Int = 50 * 1024 * 1024
1313
internal static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
1414
internal static var credential = ApiVideoCredential()

Sources/APIs/SummariesAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ open class SummariesAPI {
4747
/**
4848
Generate video summary
4949
- POST /summaries
50-
- Generate a title, abstract, and key takeaways for a video.
50+
- Generate an abstract and key takeaways for a video.
5151
- responseHeaders: [X-RateLimit-Limit(Int), X-RateLimit-Remaining(Int), X-RateLimit-Retry-After(Int)]
5252
- parameter summaryCreationPayload: (body)
5353
- returns: RequestBuilder<Summary>
@@ -108,7 +108,7 @@ open class SummariesAPI {
108108
/**
109109
Update summary details
110110
- PATCH /summaries/{summaryId}/source
111-
- Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`.
111+
- Update details for a summary.
112112
- responseHeaders: [X-RateLimit-Limit(Int), X-RateLimit-Remaining(Int), X-RateLimit-Retry-After(Int)]
113113
- parameter summaryId: (path) The unique identifier of the summary source you want to update.
114114
- parameter summaryUpdatePayload: (body)

Sources/Models/SummaryCreationPayload.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,27 @@ public struct SummaryCreationPayload: Codable, Hashable {
1515
public enum Origin: String, Codable, CaseIterable {
1616
case auto = "auto"
1717
}
18+
public enum Attributes: String, Codable, CaseIterable {
19+
case abstract = "abstract"
20+
case takeaways = "takeaways"
21+
}
1822
/** Create a summary of a video using the video ID. */
1923
public var videoId: String
2024
/** Use this parameter to define how the API generates the summary. The only allowed value is `auto`, which means that the API generates a summary automatically. If you do not set this parameter, **the API will not generate a summary automatically**. In this case, `sourceStatus` will return `missing`, and you have to manually add a summary using the `PATCH /summaries/{summaryId}/source` endpoint operation. */
2125
public var origin: Origin?
26+
/** Use this parameter to define the elements of a summary that you want to generate. If you do not define this parameter, the API generates a full summary with all attributes. */
27+
public var attributes: [Attributes]?
2228

23-
public init(videoId: String, origin: Origin? = nil) {
29+
public init(videoId: String, origin: Origin? = nil, attributes: [Attributes]? = nil) {
2430
self.videoId = videoId
2531
self.origin = origin
32+
self.attributes = attributes
2633
}
2734

2835
public enum CodingKeys: String, CodingKey, CaseIterable {
2936
case videoId
3037
case origin
38+
case attributes
3139
}
3240

3341
// Encodable protocol methods
@@ -36,6 +44,7 @@ public struct SummaryCreationPayload: Codable, Hashable {
3644
var container = encoder.container(keyedBy: CodingKeys.self)
3745
try container.encode(videoId, forKey: .videoId)
3846
try container.encodeIfPresent(origin, forKey: .origin)
47+
try container.encodeIfPresent(attributes, forKey: .attributes)
3948
}
4049
}
4150

Sources/Models/SummarySource.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,17 @@ import AnyCodable
1212

1313
public struct SummarySource: Codable, Hashable {
1414

15-
/** A video title, based on the contents of the video. */
16-
public var title: String?
1715
/** A short outline of the contents of the video. The length of an `abstract` depends on the amount of content in a video that can be transcribed. The API condenses the contents into minimum 20, maximum 300 words. */
1816
public var abstract: String?
1917
/** A list of 3 key points from the video, in chronological order. */
2018
public var takeaways: [String]?
2119

22-
public init(title: String? = nil, abstract: String? = nil, takeaways: [String]? = nil) {
23-
self.title = title
20+
public init(abstract: String? = nil, takeaways: [String]? = nil) {
2421
self.abstract = abstract
2522
self.takeaways = takeaways
2623
}
2724

2825
public enum CodingKeys: String, CodingKey, CaseIterable {
29-
case title
3026
case abstract
3127
case takeaways
3228
}
@@ -35,7 +31,6 @@ public struct SummarySource: Codable, Hashable {
3531

3632
public func encode(to encoder: Encoder) throws {
3733
var container = encoder.container(keyedBy: CodingKeys.self)
38-
try container.encodeIfPresent(title, forKey: .title)
3934
try container.encodeIfPresent(abstract, forKey: .abstract)
4035
try container.encodeIfPresent(takeaways, forKey: .takeaways)
4136
}

Sources/Models/SummaryUpdatePayload.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,17 @@ import AnyCodable
1212

1313
public struct SummaryUpdatePayload: Codable, Hashable {
1414

15-
/** A video title, based on the contents of the video. */
16-
public var title: String?
1715
/** A short outline of the contents of the video. */
1816
public var abstract: String?
1917
/** A list of 3 key points from the video, in chronological order. */
2018
public var takeaways: [String]?
2119

22-
public init(title: String? = nil, abstract: String? = nil, takeaways: [String]? = nil) {
23-
self.title = title
20+
public init(abstract: String? = nil, takeaways: [String]? = nil) {
2421
self.abstract = abstract
2522
self.takeaways = takeaways
2623
}
2724

2825
public enum CodingKeys: String, CodingKey, CaseIterable {
29-
case title
3026
case abstract
3127
case takeaways
3228
}
@@ -35,7 +31,6 @@ public struct SummaryUpdatePayload: Codable, Hashable {
3531

3632
public func encode(to encoder: Encoder) throws {
3733
var container = encoder.container(keyedBy: CodingKeys.self)
38-
try container.encodeIfPresent(title, forKey: .title)
3934
try container.encodeIfPresent(abstract, forKey: .abstract)
4035
try container.encodeIfPresent(takeaways, forKey: .takeaways)
4136
}

Sources/Models/VideoCreationPayload.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public struct VideoCreationPayload: Codable, Hashable {
4747
case vi = "vi"
4848
case zh = "zh"
4949
}
50+
public enum TranscriptSummaryAttributes: String, Codable, CaseIterable {
51+
case abstract = "abstract"
52+
case takeaways = "takeaways"
53+
}
5054
/** The title of your new video. */
5155
public var title: String
5256
/** A brief description of your video. */
@@ -73,8 +77,10 @@ public struct VideoCreationPayload: Codable, Hashable {
7377
public var transcript: Bool?
7478
/** Use this parameter to enable summarization. We recommend using this parameter together with `transcript: true`. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. */
7579
public var transcriptSummary: Bool?
80+
/** Use this parameter to define the elements of a summary that you want to generate. If you do not define this parameter, the API generates a full summary with all attributes. */
81+
public var transcriptSummaryAttributes: [TranscriptSummaryAttributes]?
7682

77-
public init(title: String, description: String? = nil, source: String? = nil, _public: Bool? = true, panoramic: Bool? = false, mp4Support: Bool? = true, playerId: String? = nil, tags: [String]? = nil, metadata: [Metadata]? = nil, clip: VideoClip? = nil, watermark: VideoWatermark? = nil, language: Language? = nil, transcript: Bool? = nil, transcriptSummary: Bool? = nil) {
83+
public init(title: String, description: String? = nil, source: String? = nil, _public: Bool? = true, panoramic: Bool? = false, mp4Support: Bool? = true, playerId: String? = nil, tags: [String]? = nil, metadata: [Metadata]? = nil, clip: VideoClip? = nil, watermark: VideoWatermark? = nil, language: Language? = nil, transcript: Bool? = nil, transcriptSummary: Bool? = nil, transcriptSummaryAttributes: [TranscriptSummaryAttributes]? = nil) {
7884
self.title = title
7985
self.description = description
8086
self.source = source
@@ -89,6 +95,7 @@ public struct VideoCreationPayload: Codable, Hashable {
8995
self.language = language
9096
self.transcript = transcript
9197
self.transcriptSummary = transcriptSummary
98+
self.transcriptSummaryAttributes = transcriptSummaryAttributes
9299
}
93100

94101
public enum CodingKeys: String, CodingKey, CaseIterable {
@@ -106,6 +113,7 @@ public struct VideoCreationPayload: Codable, Hashable {
106113
case language
107114
case transcript
108115
case transcriptSummary
116+
case transcriptSummaryAttributes
109117
}
110118

111119
// Encodable protocol methods
@@ -126,6 +134,7 @@ public struct VideoCreationPayload: Codable, Hashable {
126134
try container.encodeIfPresent(language, forKey: .language)
127135
try container.encodeIfPresent(transcript, forKey: .transcript)
128136
try container.encodeIfPresent(transcriptSummary, forKey: .transcriptSummary)
137+
try container.encodeIfPresent(transcriptSummaryAttributes, forKey: .transcriptSummaryAttributes)
129138
}
130139
}
131140

0 commit comments

Comments
 (0)