Skip to content

Commit

Permalink
feat: add apis for Create, Read, Update, Delete for VODConfigs (#7332)
Browse files Browse the repository at this point in the history
feat: allowed usage for VODConfigs in VODSession
feat: added token config for MediaCdnKey
feat: added targetting parameter support to Livesession
feat: added adtracking to Livesession
feat: added fetchoptions with custom headers for Live and VODConfigs

docs: Added apis for Create, Read, Update, Delete For VODConfigs. Added vodConfig usage in VODSession. Added TokenConfig for MediaCdnKey. Added targeting_parameter and ad_tracking for Livesession. Added FetchOptions for Live and VOD configs.
PiperOrigin-RevId: 636368401
Source-Link: googleapis/googleapis@30717c0
Source-Link: googleapis/googleapis-gen@cc30711
Copy-Tag: eyJwIjoiVmlkZW9TdGl0Y2hlci8uT3dsQm90LnlhbWwiLCJoIjoiY2MzMDcxMWVmOGUxNmQ0ODg3ZDE5ZjY3N2I5MzgyZGYwYWU2MGVkOCJ9
  • Loading branch information
gcf-owl-bot[bot] committed May 24, 2024
1 parent 4210698 commit 2758508
Show file tree
Hide file tree
Showing 41 changed files with 4,894 additions and 206 deletions.
Binary file modified VideoStitcher/metadata/V1/CdnKeys.php
Binary file not shown.
32 changes: 32 additions & 0 deletions VideoStitcher/metadata/V1/FetchOptions.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified VideoStitcher/metadata/V1/LiveConfigs.php
Binary file not shown.
Binary file modified VideoStitcher/metadata/V1/Sessions.php
Binary file not shown.
54 changes: 49 additions & 5 deletions VideoStitcher/metadata/V1/VideoStitcherService.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added VideoStitcher/metadata/V1/VodConfigs.php
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
* {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
* @param string $liveConfigId The unique identifier ID to use for the live config.
* @param string $liveConfigSourceUri Source URI for the live stream manifest.
* @param int $liveConfigAdTracking Determines how the ads are tracked. If
* [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config]
* is set, the value must be `CLIENT` because the IMA SDK handles ad tracking.
* @param int $liveConfigAdTracking Determines how the ads are tracked.
*/
function create_live_config_sample(
string $formattedParent,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START videostitcher_v1_generated_VideoStitcherService_CreateVodConfig_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\CreateVodConfigRequest;
use Google\Cloud\Video\Stitcher\V1\VodConfig;
use Google\Rpc\Status;

/**
* Registers the VOD config with the provided unique ID in
* the specified region.
*
* @param string $formattedParent The project in which the VOD config should be created, in
* the form of `projects/{project_number}/locations/{location}`. Please see
* {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
* @param string $vodConfigId The unique identifier ID to use for the VOD config.
* @param string $vodConfigSourceUri Source URI for the VOD stream manifest.
* @param string $vodConfigAdTagUri The default ad tag associated with this VOD config.
*/
function create_vod_config_sample(
string $formattedParent,
string $vodConfigId,
string $vodConfigSourceUri,
string $vodConfigAdTagUri
): void {
// Create a client.
$videoStitcherServiceClient = new VideoStitcherServiceClient();

// Prepare the request message.
$vodConfig = (new VodConfig())
->setSourceUri($vodConfigSourceUri)
->setAdTagUri($vodConfigAdTagUri);
$request = (new CreateVodConfigRequest())
->setParent($formattedParent)
->setVodConfigId($vodConfigId)
->setVodConfig($vodConfig);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $videoStitcherServiceClient->createVodConfig($request);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var VodConfig $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');
$vodConfigId = '[VOD_CONFIG_ID]';
$vodConfigSourceUri = '[SOURCE_URI]';
$vodConfigAdTagUri = '[AD_TAG_URI]';

create_vod_config_sample($formattedParent, $vodConfigId, $vodConfigSourceUri, $vodConfigAdTagUri);
}
// [END videostitcher_v1_generated_VideoStitcherService_CreateVodConfig_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,15 @@
* @param string $formattedParent The project and location in which the VOD session should be
* created, in the form of `projects/{project_number}/locations/{location}`. Please see
* {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
* @param string $vodSessionSourceUri URI of the media to stitch.
* @param string $vodSessionAdTagUri Ad tag URI.
* @param int $vodSessionAdTracking Determines how the ad should be tracked.
*/
function create_vod_session_sample(
string $formattedParent,
string $vodSessionSourceUri,
string $vodSessionAdTagUri,
int $vodSessionAdTracking
): void {
function create_vod_session_sample(string $formattedParent, int $vodSessionAdTracking): void
{
// Create a client.
$videoStitcherServiceClient = new VideoStitcherServiceClient();

// Prepare the request message.
$vodSession = (new VodSession())
->setSourceUri($vodSessionSourceUri)
->setAdTagUri($vodSessionAdTagUri)
->setAdTracking($vodSessionAdTracking);
$request = (new CreateVodSessionRequest())
->setParent($formattedParent)
Expand Down Expand Up @@ -80,15 +72,8 @@ function create_vod_session_sample(
function callSample(): void
{
$formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');
$vodSessionSourceUri = '[SOURCE_URI]';
$vodSessionAdTagUri = '[AD_TAG_URI]';
$vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED;

create_vod_session_sample(
$formattedParent,
$vodSessionSourceUri,
$vodSessionAdTagUri,
$vodSessionAdTracking
);
create_vod_session_sample($formattedParent, $vodSessionAdTracking);
}
// [END videostitcher_v1_generated_VideoStitcherService_CreateVodSession_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START videostitcher_v1_generated_VideoStitcherService_DeleteVodConfig_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\DeleteVodConfigRequest;
use Google\Rpc\Status;

/**
* Deletes the specified VOD config.
*
* @param string $formattedName The name of the VOD config to be deleted, in the form of
* `projects/{project_number}/locations/{location}/vodConfigs/{id}`. Please see
* {@see VideoStitcherServiceClient::vodConfigName()} for help formatting this field.
*/
function delete_vod_config_sample(string $formattedName): void
{
// Create a client.
$videoStitcherServiceClient = new VideoStitcherServiceClient();

// Prepare the request message.
$request = (new DeleteVodConfigRequest())
->setName($formattedName);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $videoStitcherServiceClient->deleteVodConfig($request);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = VideoStitcherServiceClient::vodConfigName(
'[PROJECT]',
'[LOCATION]',
'[VOD_CONFIG]'
);

delete_vod_config_sample($formattedName);
}
// [END videostitcher_v1_generated_VideoStitcherService_DeleteVodConfig_sync]
Loading

0 comments on commit 2758508

Please sign in to comment.