Skip to content

Commit

Permalink
Update Summary endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierapivideo authored Nov 6, 2024
1 parent 630c1a6 commit 56ae4a4
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 32 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 @@
589578120105165c9f58683fbe2fb917dabfaf9392187865f30956f8e4964d5a
f2258a85e4233a4243aa1514697cbb72ab9568d8bc147a0ba046e979c1e7bcf9
4 changes: 2 additions & 2 deletions ApiVideoClient.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.6'
s.source = { :git => 'https://github.com/apivideo/api.video-swift-client', :tag => 'v1.3.6' }
s.version = '1.3.7'
s.source = { :git => 'https://github.com/apivideo/api.video-swift-client', :tag => 'v1.3.7' }
s.authors = { 'Ecosystem Team' => '[email protected]' }
s.license = { :type => 'MIT' }
s.homepage = 'https://docs.api.video'
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All changes to this project will be documented in this file.

## [1.3.7] - 2024-11-06
- AI summary updates

## [1.3.6] - 2024-11-04
- Analytics updates (ccv, views, ...)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ api.video's Swift API client for iOS, macOS and tvOS streamlines the coding proc
Specify it in your `Cartfile`:

```
github "apivideo/api.video-swift-client" ~> 1.3.6
github "apivideo/api.video-swift-client" ~> 1.3.7
```

Run `carthage update`

#### CocoaPods

Add `pod 'ApiVideoClient', '1.3.6'` in your `Podfile`
Add `pod 'ApiVideoClient', '1.3.7'` in your `Podfile`

Run `pod install`

Expand Down
2 changes: 1 addition & 1 deletion Sources/APIs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Foundation
public class ApiVideoClient {
public static var apiKey: String? = nil
public static var basePath = "https://ws.api.video"
internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift:1.3.6"]
internal static var customHeaders:[String: String] = ["AV-Origin-Client": "swift:1.3.7"]
private static var chunkSize: Int = 50 * 1024 * 1024
internal static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
internal static var credential = ApiVideoCredential()
Expand Down
4 changes: 2 additions & 2 deletions Sources/APIs/SummariesAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ open class SummariesAPI {
/**
Generate video summary
- POST /summaries
- Generate a title, abstract, and key takeaways for a video.
- Generate an abstract and key takeaways for a video.
- responseHeaders: [X-RateLimit-Limit(Int), X-RateLimit-Remaining(Int), X-RateLimit-Retry-After(Int)]
- parameter summaryCreationPayload: (body)
- returns: RequestBuilder<Summary>
Expand Down Expand Up @@ -108,7 +108,7 @@ open class SummariesAPI {
/**
Update summary details
- PATCH /summaries/{summaryId}/source
- Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`.
- Update details for a summary.
- responseHeaders: [X-RateLimit-Limit(Int), X-RateLimit-Remaining(Int), X-RateLimit-Retry-After(Int)]
- parameter summaryId: (path) The unique identifier of the summary source you want to update.
- parameter summaryUpdatePayload: (body)
Expand Down
11 changes: 10 additions & 1 deletion Sources/Models/SummaryCreationPayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,27 @@ public struct SummaryCreationPayload: Codable, Hashable {
public enum Origin: String, Codable, CaseIterable {
case auto = "auto"
}
public enum Attributes: String, Codable, CaseIterable {
case abstract = "abstract"
case takeaways = "takeaways"
}
/** Create a summary of a video using the video ID. */
public var videoId: String
/** 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. */
public var origin: Origin?
/** 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. */
public var attributes: [Attributes]?

public init(videoId: String, origin: Origin? = nil) {
public init(videoId: String, origin: Origin? = nil, attributes: [Attributes]? = nil) {
self.videoId = videoId
self.origin = origin
self.attributes = attributes
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case videoId
case origin
case attributes
}

// Encodable protocol methods
Expand All @@ -36,6 +44,7 @@ public struct SummaryCreationPayload: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(videoId, forKey: .videoId)
try container.encodeIfPresent(origin, forKey: .origin)
try container.encodeIfPresent(attributes, forKey: .attributes)
}
}

7 changes: 1 addition & 6 deletions Sources/Models/SummarySource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@ import AnyCodable

public struct SummarySource: Codable, Hashable {

/** A video title, based on the contents of the video. */
public var title: String?
/** 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. */
public var abstract: String?
/** A list of 3 key points from the video, in chronological order. */
public var takeaways: [String]?

public init(title: String? = nil, abstract: String? = nil, takeaways: [String]? = nil) {
self.title = title
public init(abstract: String? = nil, takeaways: [String]? = nil) {
self.abstract = abstract
self.takeaways = takeaways
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case title
case abstract
case takeaways
}
Expand All @@ -35,7 +31,6 @@ public struct SummarySource: Codable, Hashable {

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(title, forKey: .title)
try container.encodeIfPresent(abstract, forKey: .abstract)
try container.encodeIfPresent(takeaways, forKey: .takeaways)
}
Expand Down
7 changes: 1 addition & 6 deletions Sources/Models/SummaryUpdatePayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@ import AnyCodable

public struct SummaryUpdatePayload: Codable, Hashable {

/** A video title, based on the contents of the video. */
public var title: String?
/** A short outline of the contents of the video. */
public var abstract: String?
/** A list of 3 key points from the video, in chronological order. */
public var takeaways: [String]?

public init(title: String? = nil, abstract: String? = nil, takeaways: [String]? = nil) {
self.title = title
public init(abstract: String? = nil, takeaways: [String]? = nil) {
self.abstract = abstract
self.takeaways = takeaways
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case title
case abstract
case takeaways
}
Expand All @@ -35,7 +31,6 @@ public struct SummaryUpdatePayload: Codable, Hashable {

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(title, forKey: .title)
try container.encodeIfPresent(abstract, forKey: .abstract)
try container.encodeIfPresent(takeaways, forKey: .takeaways)
}
Expand Down
11 changes: 10 additions & 1 deletion Sources/Models/VideoCreationPayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public struct VideoCreationPayload: Codable, Hashable {
case vi = "vi"
case zh = "zh"
}
public enum TranscriptSummaryAttributes: String, Codable, CaseIterable {
case abstract = "abstract"
case takeaways = "takeaways"
}
/** The title of your new video. */
public var title: String
/** A brief description of your video. */
Expand All @@ -73,8 +77,10 @@ public struct VideoCreationPayload: Codable, Hashable {
public var transcript: Bool?
/** 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. */
public var transcriptSummary: Bool?
/** 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. */
public var transcriptSummaryAttributes: [TranscriptSummaryAttributes]?

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) {
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) {
self.title = title
self.description = description
self.source = source
Expand All @@ -89,6 +95,7 @@ public struct VideoCreationPayload: Codable, Hashable {
self.language = language
self.transcript = transcript
self.transcriptSummary = transcriptSummary
self.transcriptSummaryAttributes = transcriptSummaryAttributes
}

public enum CodingKeys: String, CodingKey, CaseIterable {
Expand All @@ -106,6 +113,7 @@ public struct VideoCreationPayload: Codable, Hashable {
case language
case transcript
case transcriptSummary
case transcriptSummaryAttributes
}

// Encodable protocol methods
Expand All @@ -126,6 +134,7 @@ public struct VideoCreationPayload: Codable, Hashable {
try container.encodeIfPresent(language, forKey: .language)
try container.encodeIfPresent(transcript, forKey: .transcript)
try container.encodeIfPresent(transcriptSummary, forKey: .transcriptSummary)
try container.encodeIfPresent(transcriptSummaryAttributes, forKey: .transcriptSummaryAttributes)
}
}

11 changes: 10 additions & 1 deletion Sources/Models/VideoUpdatePayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public struct VideoUpdatePayload: Codable, Hashable {
case vi = "vi"
case zh = "zh"
}
public enum TranscriptSummaryAttributes: String, Codable, CaseIterable {
case abstract = "abstract"
case takeaways = "takeaways"
}
/** The unique ID for the player you want to associate with your video. */
public var playerId: NullableString?
/** The title you want to use for your video. */
Expand All @@ -69,8 +73,10 @@ public struct VideoUpdatePayload: Codable, Hashable {
public var transcript: Bool?
/** Use this parameter to enable summarization. - 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. */
public var transcriptSummary: Bool?
/** 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. */
public var transcriptSummaryAttributes: [TranscriptSummaryAttributes]?

public init(playerId: NullableString? = nil, title: String? = nil, description: String? = nil, _public: Bool? = nil, panoramic: Bool? = nil, mp4Support: Bool? = nil, tags: [String]? = nil, metadata: [Metadata]? = nil, language: Language? = nil, transcript: Bool? = nil, transcriptSummary: Bool? = nil) {
public init(playerId: NullableString? = nil, title: String? = nil, description: String? = nil, _public: Bool? = nil, panoramic: Bool? = nil, mp4Support: Bool? = nil, tags: [String]? = nil, metadata: [Metadata]? = nil, language: Language? = nil, transcript: Bool? = nil, transcriptSummary: Bool? = nil, transcriptSummaryAttributes: [TranscriptSummaryAttributes]? = nil) {
self.playerId = playerId
self.title = title
self.description = description
Expand All @@ -82,6 +88,7 @@ public struct VideoUpdatePayload: Codable, Hashable {
self.language = language
self.transcript = transcript
self.transcriptSummary = transcriptSummary
self.transcriptSummaryAttributes = transcriptSummaryAttributes
}

public enum CodingKeys: String, CodingKey, CaseIterable {
Expand All @@ -96,6 +103,7 @@ public struct VideoUpdatePayload: Codable, Hashable {
case language
case transcript
case transcriptSummary
case transcriptSummaryAttributes
}

// Encodable protocol methods
Expand All @@ -113,6 +121,7 @@ public struct VideoUpdatePayload: Codable, Hashable {
try container.encodeIfPresent(language, forKey: .language)
try container.encodeIfPresent(transcript, forKey: .transcript)
try container.encodeIfPresent(transcriptSummary, forKey: .transcriptSummary)
try container.encodeIfPresent(transcriptSummaryAttributes, forKey: .transcriptSummaryAttributes)
}
}

8 changes: 4 additions & 4 deletions docs/SummariesAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Method | HTTP request | Description

Generate video summary

Generate a title, abstract, and key takeaways for a video.
Generate an abstract and key takeaways for a video.


### Example
```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import ApiVideoClient

let summaryCreationPayload = SummaryCreationPayload(videoId: "videoId_example", origin: "origin_example") // SummaryCreationPayload |
let summaryCreationPayload = SummaryCreationPayload(videoId: "videoId_example", origin: "origin_example", attributes: ["attributes_example"]) // SummaryCreationPayload |

// Generate video summary
SummariesAPI.create(summaryCreationPayload: summaryCreationPayload) { (response, error) in
Expand Down Expand Up @@ -71,7 +71,7 @@ Name | Type | Description | Notes

Update summary details

Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`.
Update details for a summary.


### Example
Expand All @@ -80,7 +80,7 @@ Update details for a summary. Note that this operation is only allowed for summa
import ApiVideoClient

let summaryId = "summaryId_example" // String | The unique identifier of the summary source you want to update.
let summaryUpdatePayload = SummaryUpdatePayload(title: "title_example", abstract: "abstract_example", takeaways: ["takeaways_example"]) // SummaryUpdatePayload |
let summaryUpdatePayload = SummaryUpdatePayload(abstract: "abstract_example", takeaways: ["takeaways_example"]) // SummaryUpdatePayload |

// Update summary details
SummariesAPI.update(summaryId: summaryId, summaryUpdatePayload: summaryUpdatePayload) { (response, error) in
Expand Down
1 change: 1 addition & 0 deletions docs/SummaryCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**videoId** | **String** | Create a summary of a video using the video ID. |
**origin** | **String** | Use this parameter to define how the API generates the summary. The only allowed value is &#x60;auto&#x60;, 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, &#x60;sourceStatus&#x60; will return &#x60;missing&#x60;, and you have to manually add a summary using the &#x60;PATCH /summaries/{summaryId}/source&#x60; endpoint operation. | [optional]
**attributes** | **[String]** | 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. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
1 change: 0 additions & 1 deletion docs/SummarySource.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**title** | **String** | A video title, based on the contents of the video. | [optional]
**abstract** | **String** | A short outline of the contents of the video. The length of an &#x60;abstract&#x60; depends on the amount of content in a video that can be transcribed. The API condenses the contents into minimum 20, maximum 300 words. | [optional]
**takeaways** | **[String]** | A list of 3 key points from the video, in chronological order. | [optional]

Expand Down
1 change: 0 additions & 1 deletion docs/SummaryUpdatePayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**title** | **String** | A video title, based on the contents of the video. | [optional]
**abstract** | **String** | A short outline of the contents of the video. | [optional]
**takeaways** | **[String]** | A list of 3 key points from the video, in chronological order. | [optional]

Expand Down
1 change: 1 addition & 0 deletions docs/VideoCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Name | Type | Description | Notes
**language** | **String** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. &#x60;language&#x60; is a permanent attribute of the video. You can update it to another language using the [&#x60;PATCH /videos/{videoId}&#x60;](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional]
**transcript** | **Bool** | Use this parameter to enable transcription. - When &#x60;true&#x60;, the API generates a transcript for the video. - The default value is &#x60;false&#x60;. - If you define a video language using the &#x60;language&#x60; parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional]
**transcriptSummary** | **Bool** | Use this parameter to enable summarization. We recommend using this parameter together with &#x60;transcript: true&#x60;. - When &#x60;true&#x60;, the API generates a summary for the video, based on the transcription. - The default value is &#x60;false&#x60;. - If you define a video language using the &#x60;language&#x60; 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. | [optional]
**transcriptSummaryAttributes** | **[String]** | 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. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
Loading

0 comments on commit 56ae4a4

Please sign in to comment.