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 df0f7e8 commit 8b52f2c
Show file tree
Hide file tree
Showing 11 changed files with 188 additions and 84 deletions.
4 changes: 2 additions & 2 deletions docs/Api/SummariesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Method | Description | HTTP request



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

### Arguments

Expand All @@ -40,7 +40,7 @@ Name | Type | Description | Notes



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

### Arguments

Expand Down
1 change: 1 addition & 0 deletions docs/Model/SummaryCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ 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 `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. | [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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
1 change: 0 additions & 1 deletion docs/Model/SummarySource.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

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 `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. | [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/Model/SummaryUpdatePayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

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/Model/VideoCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ 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. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](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 `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` 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 `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. | [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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
1 change: 1 addition & 0 deletions docs/Model/VideoUpdatePayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ 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. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](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 `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` 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 `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. | [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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
67 changes: 61 additions & 6 deletions src/Model/SummaryCreationPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,41 @@ public static function getDefinition(): ModelDefinition
'summary-creation-payload',
[
'videoId' => 'string',
'origin' => 'string'
'origin' => 'string',
'attributes' => 'string[]'
],
[
'videoId' => null,
'origin' => null
'origin' => null,
'attributes' => null
],
[
'videoId' => 'videoId',
'origin' => 'origin'
'origin' => 'origin',
'attributes' => 'attributes'
],
[
'videoId' => 'setVideoId',
'origin' => 'setOrigin'
'origin' => 'setOrigin',
'attributes' => 'setAttributes'
],
[
'videoId' => 'getVideoId',
'origin' => 'getOrigin'
'origin' => 'getOrigin',
'attributes' => 'getAttributes'
],
[
'videoId' => null,
'origin' => null
'origin' => null,
'attributes' => null
],
null
);
}

const ORIGIN_AUTO = 'auto';
const ATTRIBUTES__ABSTRACT = 'abstract';
const ATTRIBUTES_TAKEAWAYS = 'takeaways';

/**
* Gets allowable values of the enum
Expand All @@ -72,6 +80,19 @@ public function getOriginAllowableValues()
];
}

/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getAttributesAllowableValues()
{
return [
self::ATTRIBUTES__ABSTRACT,
self::ATTRIBUTES_TAKEAWAYS,
];
}

/**
* Associative array for storing property values
*
Expand All @@ -89,6 +110,7 @@ public function __construct(array $data = null)
{
$this->container['videoId'] = $data['videoId'] ?? null;
$this->container['origin'] = $data['origin'] ?? null;
$this->container['attributes'] = $data['attributes'] ?? null;
}

/**
Expand Down Expand Up @@ -185,6 +207,39 @@ public function setOrigin($origin)
return $this;
}

/**
* Gets attributes
*
* @return string[]|null
*/
public function getAttributes()
{
return $this->container['attributes'];
}

/**
* Sets attributes
*
* @param string[]|null $attributes 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.
*
* @return self
*/
public function setAttributes($attributes)
{
$allowedValues = $this->getAttributesAllowableValues();
if (!is_null($attributes) && array_diff($attributes, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'attributes', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
$this->container['attributes'] = $attributes;

return $this;
}

/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
Expand Down
31 changes: 0 additions & 31 deletions src/Model/SummarySource.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,26 @@ public static function getDefinition(): ModelDefinition
return new ModelDefinition(
'summary-source',
[
'title' => 'string',
'abstract' => 'string',
'takeaways' => 'string[]'
],
[
'title' => null,
'abstract' => null,
'takeaways' => null
],
[
'title' => 'title',
'abstract' => 'abstract',
'takeaways' => 'takeaways'
],
[
'title' => 'setTitle',
'abstract' => 'setAbstract',
'takeaways' => 'setTakeaways'
],
[
'title' => 'getTitle',
'abstract' => 'getAbstract',
'takeaways' => 'getTakeaways'
],
[
'title' => null,
'abstract' => null,
'takeaways' => null
],
Expand All @@ -80,7 +74,6 @@ public static function getDefinition(): ModelDefinition
*/
public function __construct(array $data = null)
{
$this->container['title'] = $data['title'] ?? null;
$this->container['abstract'] = $data['abstract'] ?? null;
$this->container['takeaways'] = $data['takeaways'] ?? null;
}
Expand Down Expand Up @@ -113,30 +106,6 @@ public function valid()
}


/**
* Gets title
*
* @return string|null
*/
public function getTitle()
{
return $this->container['title'];
}

/**
* Sets title
*
* @param string|null $title A video title, based on the contents of the video.
*
* @return self
*/
public function setTitle($title)
{
$this->container['title'] = $title;

return $this;
}

/**
* Gets abstract
*
Expand Down
31 changes: 0 additions & 31 deletions src/Model/SummaryUpdatePayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,26 @@ public static function getDefinition(): ModelDefinition
return new ModelDefinition(
'summary-update-payload',
[
'title' => 'string',
'abstract' => 'string',
'takeaways' => 'string[]'
],
[
'title' => null,
'abstract' => null,
'takeaways' => null
],
[
'title' => 'title',
'abstract' => 'abstract',
'takeaways' => 'takeaways'
],
[
'title' => 'setTitle',
'abstract' => 'setAbstract',
'takeaways' => 'setTakeaways'
],
[
'title' => 'getTitle',
'abstract' => 'getAbstract',
'takeaways' => 'getTakeaways'
],
[
'title' => null,
'abstract' => null,
'takeaways' => null
],
Expand All @@ -80,7 +74,6 @@ public static function getDefinition(): ModelDefinition
*/
public function __construct(array $data = null)
{
$this->container['title'] = $data['title'] ?? null;
$this->container['abstract'] = $data['abstract'] ?? null;
$this->container['takeaways'] = $data['takeaways'] ?? null;
}
Expand Down Expand Up @@ -113,30 +106,6 @@ public function valid()
}


/**
* Gets title
*
* @return string|null
*/
public function getTitle()
{
return $this->container['title'];
}

/**
* Sets title
*
* @param string|null $title A video title, based on the contents of the video.
*
* @return self
*/
public function setTitle($title)
{
$this->container['title'] = $title;

return $this;
}

/**
* Gets abstract
*
Expand Down
Loading

0 comments on commit 8b52f2c

Please sign in to comment.