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 8, 2024
1 parent 681296d commit c6e2ac3
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 87 deletions.
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.4.7] - 2024-11-06
- AI summary updates

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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ $ BASE_URI="" API_KEY="..." vendor/bin/phpunit
```


## Have you gotten use from this API client?
## Have you gotten use from this API client?

Please take a moment to leave a star on the client ⭐

Expand Down
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)
4 changes: 2 additions & 2 deletions src/BaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct(string $baseUri, ?string $apiKey, ClientInterface $h
$this->originSdkHeaderValue = "";

if ($apiKey) {
$this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.6');
$this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.7');
}
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public function request(Request $commandRequest, bool $skipAuthRequest = false):
if($this->originSdkHeaderValue) {
$request = $request->withHeader('AV-Origin-Sdk', $this->originSdkHeaderValue);
}
$request = $request->withHeader('AV-Origin-Client', 'php:1.4.6');
$request = $request->withHeader('AV-Origin-Client', 'php:1.4.7');

return $this->sendRequest($request, $skipAuthRequest);
}
Expand Down
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 c6e2ac3

Please sign in to comment.