Skip to content

Commit

Permalink
Update Summary endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
szekelyzol authored Nov 5, 2024
1 parent 19d9474 commit cafa33e
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 26 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 @@
3c9f9d1c48428c25a16b809ddeab072c978d6d1c689903a76e3d66a69a36a233
4ae7edf8587ba07687da3931d634008d47a2232885067a33c603c65c22c82430
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
1 change: 1 addition & 0 deletions docs/VideoUpdatePayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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. - 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 cafa33e

Please sign in to comment.