diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json index 24d57bae7321..500e1584470e 100644 --- a/internal/.repo-metadata-full.json +++ b/internal/.repo-metadata-full.json @@ -1493,6 +1493,15 @@ "release_level": "beta", "library_type": "" }, + "cloud.google.com/go/video/stitcher/apiv1": { + "distribution_name": "cloud.google.com/go/video/stitcher/apiv1", + "description": "Video Stitcher API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/video/latest/stitcher/apiv1", + "release_level": "beta", + "library_type": "" + }, "cloud.google.com/go/video/transcoder/apiv1": { "distribution_name": "cloud.google.com/go/video/transcoder/apiv1", "description": "Transcoder API", diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go index 97067c407349..7ad3f24c9a0a 100644 --- a/internal/gapicgen/generator/config.go +++ b/internal/gapicgen/generator/config.go @@ -1348,6 +1348,15 @@ var microgenGapicConfigs = []*microgenConfig{ // GA after 2022/02/28 releaseLevel: "beta", }, + { + inputDirectoryPath: "google/cloud/video/stitcher/v1", + pkg: "stitcher", + importPath: "cloud.google.com/go/video/stitcher/apiv1", + gRPCServiceConfigPath: "videostitcher_grpc_service_config.json", + apiServiceConfigPath: "videostitcher_v1.yaml", + // GA after 2022/04/02 + releaseLevel: "beta", + }, // Non-Cloud APIs { diff --git a/video/go.mod b/video/go.mod index 7985fbd91c01..740b501653b5 100644 --- a/video/go.mod +++ b/video/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.100.2 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.70.0 - google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf + google.golang.org/genproto v0.0.0-20220302033224-9aa15565e42a google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/video/go.sum b/video/go.sum index eebcbca7b66b..468dfd1bebc2 100644 --- a/video/go.sum +++ b/video/go.sum @@ -524,8 +524,8 @@ google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf h1:SVYXkUz2yZS9FWb2Gm8ivSlbNQzL2Z/NpPKE3RG2jWk= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220302033224-9aa15565e42a h1:uqouglH745GoGeZ1YFZbPBiu961tgi/9Qm5jaorajjQ= +google.golang.org/genproto v0.0.0-20220302033224-9aa15565e42a/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/video/stitcher/apiv1/doc.go b/video/stitcher/apiv1/doc.go new file mode 100644 index 000000000000..5feba16b8939 --- /dev/null +++ b/video/stitcher/apiv1/doc.go @@ -0,0 +1,159 @@ +// Copyright 2022 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. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +// Package stitcher is an auto-generated package for the +// Video Stitcher API. +// +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// +// Example usage +// +// To get started with this package, create a client. +// ctx := context.Background() +// c, err := stitcher.NewVideoStitcherClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// The client will use your default application credentials. Clients should be reused instead of created as needed. +// The methods of Client are safe for concurrent use by multiple goroutines. +// The returned client must be Closed when it is done being used. +// +// Using the Client +// +// The following is an example of making an API call with the newly created client. +// +// ctx := context.Background() +// c, err := stitcher.NewVideoStitcherClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &stitcherpb.CreateCdnKeyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#CreateCdnKeyRequest. +// } +// resp, err := c.CreateCdnKey(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit https://pkg.go.dev/cloud.google.com/go. +package stitcher // import "cloud.google.com/go/video/stitcher/apiv1" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +var versionClient string + +func getVersionClient() string { + if versionClient == "" { + return "UNKNOWN" + } + return versionClient +} + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/video/stitcher/apiv1/gapic_metadata.json b/video/stitcher/apiv1/gapic_metadata.json new file mode 100644 index 000000000000..7d2ab3b62f86 --- /dev/null +++ b/video/stitcher/apiv1/gapic_metadata.json @@ -0,0 +1,118 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.video.stitcher.v1", + "libraryPackage": "cloud.google.com/go/video/stitcher/apiv1", + "services": { + "VideoStitcherService": { + "clients": { + "grpc": { + "libraryClient": "VideoStitcherClient", + "rpcs": { + "CreateCdnKey": { + "methods": [ + "CreateCdnKey" + ] + }, + "CreateLiveSession": { + "methods": [ + "CreateLiveSession" + ] + }, + "CreateSlate": { + "methods": [ + "CreateSlate" + ] + }, + "CreateVodSession": { + "methods": [ + "CreateVodSession" + ] + }, + "DeleteCdnKey": { + "methods": [ + "DeleteCdnKey" + ] + }, + "DeleteSlate": { + "methods": [ + "DeleteSlate" + ] + }, + "GetCdnKey": { + "methods": [ + "GetCdnKey" + ] + }, + "GetLiveAdTagDetail": { + "methods": [ + "GetLiveAdTagDetail" + ] + }, + "GetLiveSession": { + "methods": [ + "GetLiveSession" + ] + }, + "GetSlate": { + "methods": [ + "GetSlate" + ] + }, + "GetVodAdTagDetail": { + "methods": [ + "GetVodAdTagDetail" + ] + }, + "GetVodSession": { + "methods": [ + "GetVodSession" + ] + }, + "GetVodStitchDetail": { + "methods": [ + "GetVodStitchDetail" + ] + }, + "ListCdnKeys": { + "methods": [ + "ListCdnKeys" + ] + }, + "ListLiveAdTagDetails": { + "methods": [ + "ListLiveAdTagDetails" + ] + }, + "ListSlates": { + "methods": [ + "ListSlates" + ] + }, + "ListVodAdTagDetails": { + "methods": [ + "ListVodAdTagDetails" + ] + }, + "ListVodStitchDetails": { + "methods": [ + "ListVodStitchDetails" + ] + }, + "UpdateCdnKey": { + "methods": [ + "UpdateCdnKey" + ] + }, + "UpdateSlate": { + "methods": [ + "UpdateSlate" + ] + } + } + } + } + } + } +} diff --git a/video/stitcher/apiv1/version.go b/video/stitcher/apiv1/version.go new file mode 100644 index 000000000000..fc697c769613 --- /dev/null +++ b/video/stitcher/apiv1/version.go @@ -0,0 +1,23 @@ +// Copyright 2022 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 +// +// http://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. + +// Code generated by gapicgen. DO NOT EDIT. + +package stitcher + +import "cloud.google.com/go/video/internal" + +func init() { + versionClient = internal.Version +} diff --git a/video/stitcher/apiv1/video_stitcher_client.go b/video/stitcher/apiv1/video_stitcher_client.go new file mode 100644 index 000000000000..312ef47d5d3f --- /dev/null +++ b/video/stitcher/apiv1/video_stitcher_client.go @@ -0,0 +1,1133 @@ +// Copyright 2022 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. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package stitcher + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + stitcherpb "google.golang.org/genproto/googleapis/cloud/video/stitcher/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newVideoStitcherClientHook clientHook + +// VideoStitcherCallOptions contains the retry settings for each method of VideoStitcherClient. +type VideoStitcherCallOptions struct { + CreateCdnKey []gax.CallOption + ListCdnKeys []gax.CallOption + GetCdnKey []gax.CallOption + DeleteCdnKey []gax.CallOption + UpdateCdnKey []gax.CallOption + CreateVodSession []gax.CallOption + GetVodSession []gax.CallOption + ListVodStitchDetails []gax.CallOption + GetVodStitchDetail []gax.CallOption + ListVodAdTagDetails []gax.CallOption + GetVodAdTagDetail []gax.CallOption + ListLiveAdTagDetails []gax.CallOption + GetLiveAdTagDetail []gax.CallOption + CreateSlate []gax.CallOption + ListSlates []gax.CallOption + GetSlate []gax.CallOption + UpdateSlate []gax.CallOption + DeleteSlate []gax.CallOption + CreateLiveSession []gax.CallOption + GetLiveSession []gax.CallOption +} + +func defaultVideoStitcherGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("videostitcher.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("videostitcher.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://videostitcher.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultVideoStitcherCallOptions() *VideoStitcherCallOptions { + return &VideoStitcherCallOptions{ + CreateCdnKey: []gax.CallOption{}, + ListCdnKeys: []gax.CallOption{}, + GetCdnKey: []gax.CallOption{}, + DeleteCdnKey: []gax.CallOption{}, + UpdateCdnKey: []gax.CallOption{}, + CreateVodSession: []gax.CallOption{}, + GetVodSession: []gax.CallOption{}, + ListVodStitchDetails: []gax.CallOption{}, + GetVodStitchDetail: []gax.CallOption{}, + ListVodAdTagDetails: []gax.CallOption{}, + GetVodAdTagDetail: []gax.CallOption{}, + ListLiveAdTagDetails: []gax.CallOption{}, + GetLiveAdTagDetail: []gax.CallOption{}, + CreateSlate: []gax.CallOption{}, + ListSlates: []gax.CallOption{}, + GetSlate: []gax.CallOption{}, + UpdateSlate: []gax.CallOption{}, + DeleteSlate: []gax.CallOption{}, + CreateLiveSession: []gax.CallOption{}, + GetLiveSession: []gax.CallOption{}, + } +} + +// internalVideoStitcherClient is an interface that defines the methods availaible from Video Stitcher API. +type internalVideoStitcherClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + CreateCdnKey(context.Context, *stitcherpb.CreateCdnKeyRequest, ...gax.CallOption) (*stitcherpb.CdnKey, error) + ListCdnKeys(context.Context, *stitcherpb.ListCdnKeysRequest, ...gax.CallOption) *CdnKeyIterator + GetCdnKey(context.Context, *stitcherpb.GetCdnKeyRequest, ...gax.CallOption) (*stitcherpb.CdnKey, error) + DeleteCdnKey(context.Context, *stitcherpb.DeleteCdnKeyRequest, ...gax.CallOption) error + UpdateCdnKey(context.Context, *stitcherpb.UpdateCdnKeyRequest, ...gax.CallOption) (*stitcherpb.CdnKey, error) + CreateVodSession(context.Context, *stitcherpb.CreateVodSessionRequest, ...gax.CallOption) (*stitcherpb.VodSession, error) + GetVodSession(context.Context, *stitcherpb.GetVodSessionRequest, ...gax.CallOption) (*stitcherpb.VodSession, error) + ListVodStitchDetails(context.Context, *stitcherpb.ListVodStitchDetailsRequest, ...gax.CallOption) *VodStitchDetailIterator + GetVodStitchDetail(context.Context, *stitcherpb.GetVodStitchDetailRequest, ...gax.CallOption) (*stitcherpb.VodStitchDetail, error) + ListVodAdTagDetails(context.Context, *stitcherpb.ListVodAdTagDetailsRequest, ...gax.CallOption) *VodAdTagDetailIterator + GetVodAdTagDetail(context.Context, *stitcherpb.GetVodAdTagDetailRequest, ...gax.CallOption) (*stitcherpb.VodAdTagDetail, error) + ListLiveAdTagDetails(context.Context, *stitcherpb.ListLiveAdTagDetailsRequest, ...gax.CallOption) *LiveAdTagDetailIterator + GetLiveAdTagDetail(context.Context, *stitcherpb.GetLiveAdTagDetailRequest, ...gax.CallOption) (*stitcherpb.LiveAdTagDetail, error) + CreateSlate(context.Context, *stitcherpb.CreateSlateRequest, ...gax.CallOption) (*stitcherpb.Slate, error) + ListSlates(context.Context, *stitcherpb.ListSlatesRequest, ...gax.CallOption) *SlateIterator + GetSlate(context.Context, *stitcherpb.GetSlateRequest, ...gax.CallOption) (*stitcherpb.Slate, error) + UpdateSlate(context.Context, *stitcherpb.UpdateSlateRequest, ...gax.CallOption) (*stitcherpb.Slate, error) + DeleteSlate(context.Context, *stitcherpb.DeleteSlateRequest, ...gax.CallOption) error + CreateLiveSession(context.Context, *stitcherpb.CreateLiveSessionRequest, ...gax.CallOption) (*stitcherpb.LiveSession, error) + GetLiveSession(context.Context, *stitcherpb.GetLiveSessionRequest, ...gax.CallOption) (*stitcherpb.LiveSession, error) +} + +// VideoStitcherClient is a client for interacting with Video Stitcher API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Video-On-Demand content stitching API allows you to insert ads +// into (VoD) video on demand files. You will be able to render custom +// scrubber bars with highlighted ads, enforce ad policies, allow +// seamless playback and tracking on native players and monetize +// content with any standard VMAP compliant ad server. +type VideoStitcherClient struct { + // The internal transport-dependent client. + internalClient internalVideoStitcherClient + + // The call options for this service. + CallOptions *VideoStitcherCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *VideoStitcherClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *VideoStitcherClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *VideoStitcherClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// CreateCdnKey creates a new CDN key. +func (c *VideoStitcherClient) CreateCdnKey(ctx context.Context, req *stitcherpb.CreateCdnKeyRequest, opts ...gax.CallOption) (*stitcherpb.CdnKey, error) { + return c.internalClient.CreateCdnKey(ctx, req, opts...) +} + +// ListCdnKeys lists all CDN keys in the specified project and location. +func (c *VideoStitcherClient) ListCdnKeys(ctx context.Context, req *stitcherpb.ListCdnKeysRequest, opts ...gax.CallOption) *CdnKeyIterator { + return c.internalClient.ListCdnKeys(ctx, req, opts...) +} + +// GetCdnKey returns the specified CDN key. +func (c *VideoStitcherClient) GetCdnKey(ctx context.Context, req *stitcherpb.GetCdnKeyRequest, opts ...gax.CallOption) (*stitcherpb.CdnKey, error) { + return c.internalClient.GetCdnKey(ctx, req, opts...) +} + +// DeleteCdnKey deletes the specified CDN key. +func (c *VideoStitcherClient) DeleteCdnKey(ctx context.Context, req *stitcherpb.DeleteCdnKeyRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteCdnKey(ctx, req, opts...) +} + +// UpdateCdnKey updates the specified CDN key. Only update fields specified +// in the call method body. +func (c *VideoStitcherClient) UpdateCdnKey(ctx context.Context, req *stitcherpb.UpdateCdnKeyRequest, opts ...gax.CallOption) (*stitcherpb.CdnKey, error) { + return c.internalClient.UpdateCdnKey(ctx, req, opts...) +} + +// CreateVodSession creates a client side playback VOD session and returns the full +// tracking and playback metadata of the session. +func (c *VideoStitcherClient) CreateVodSession(ctx context.Context, req *stitcherpb.CreateVodSessionRequest, opts ...gax.CallOption) (*stitcherpb.VodSession, error) { + return c.internalClient.CreateVodSession(ctx, req, opts...) +} + +// GetVodSession returns the full tracking, playback metadata, and relevant ad-ops +// logs for the specified VOD session. +func (c *VideoStitcherClient) GetVodSession(ctx context.Context, req *stitcherpb.GetVodSessionRequest, opts ...gax.CallOption) (*stitcherpb.VodSession, error) { + return c.internalClient.GetVodSession(ctx, req, opts...) +} + +// ListVodStitchDetails returns a list of detailed stitching information of the specified VOD +// session. +func (c *VideoStitcherClient) ListVodStitchDetails(ctx context.Context, req *stitcherpb.ListVodStitchDetailsRequest, opts ...gax.CallOption) *VodStitchDetailIterator { + return c.internalClient.ListVodStitchDetails(ctx, req, opts...) +} + +// GetVodStitchDetail returns the specified stitching information for the specified VOD session. +func (c *VideoStitcherClient) GetVodStitchDetail(ctx context.Context, req *stitcherpb.GetVodStitchDetailRequest, opts ...gax.CallOption) (*stitcherpb.VodStitchDetail, error) { + return c.internalClient.GetVodStitchDetail(ctx, req, opts...) +} + +// ListVodAdTagDetails return the list of ad tag details for the specified VOD session. +func (c *VideoStitcherClient) ListVodAdTagDetails(ctx context.Context, req *stitcherpb.ListVodAdTagDetailsRequest, opts ...gax.CallOption) *VodAdTagDetailIterator { + return c.internalClient.ListVodAdTagDetails(ctx, req, opts...) +} + +// GetVodAdTagDetail returns the specified ad tag detail for the specified VOD session. +func (c *VideoStitcherClient) GetVodAdTagDetail(ctx context.Context, req *stitcherpb.GetVodAdTagDetailRequest, opts ...gax.CallOption) (*stitcherpb.VodAdTagDetail, error) { + return c.internalClient.GetVodAdTagDetail(ctx, req, opts...) +} + +// ListLiveAdTagDetails return the list of ad tag details for the specified live session. +func (c *VideoStitcherClient) ListLiveAdTagDetails(ctx context.Context, req *stitcherpb.ListLiveAdTagDetailsRequest, opts ...gax.CallOption) *LiveAdTagDetailIterator { + return c.internalClient.ListLiveAdTagDetails(ctx, req, opts...) +} + +// GetLiveAdTagDetail returns the specified ad tag detail for the specified live session. +func (c *VideoStitcherClient) GetLiveAdTagDetail(ctx context.Context, req *stitcherpb.GetLiveAdTagDetailRequest, opts ...gax.CallOption) (*stitcherpb.LiveAdTagDetail, error) { + return c.internalClient.GetLiveAdTagDetail(ctx, req, opts...) +} + +// CreateSlate creates a slate. +func (c *VideoStitcherClient) CreateSlate(ctx context.Context, req *stitcherpb.CreateSlateRequest, opts ...gax.CallOption) (*stitcherpb.Slate, error) { + return c.internalClient.CreateSlate(ctx, req, opts...) +} + +// ListSlates lists all slates in the specified project and location. +func (c *VideoStitcherClient) ListSlates(ctx context.Context, req *stitcherpb.ListSlatesRequest, opts ...gax.CallOption) *SlateIterator { + return c.internalClient.ListSlates(ctx, req, opts...) +} + +// GetSlate returns the specified slate. +func (c *VideoStitcherClient) GetSlate(ctx context.Context, req *stitcherpb.GetSlateRequest, opts ...gax.CallOption) (*stitcherpb.Slate, error) { + return c.internalClient.GetSlate(ctx, req, opts...) +} + +// UpdateSlate updates the specified slate. +func (c *VideoStitcherClient) UpdateSlate(ctx context.Context, req *stitcherpb.UpdateSlateRequest, opts ...gax.CallOption) (*stitcherpb.Slate, error) { + return c.internalClient.UpdateSlate(ctx, req, opts...) +} + +// DeleteSlate deletes the specified slate. +func (c *VideoStitcherClient) DeleteSlate(ctx context.Context, req *stitcherpb.DeleteSlateRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteSlate(ctx, req, opts...) +} + +// CreateLiveSession creates a new live session. +func (c *VideoStitcherClient) CreateLiveSession(ctx context.Context, req *stitcherpb.CreateLiveSessionRequest, opts ...gax.CallOption) (*stitcherpb.LiveSession, error) { + return c.internalClient.CreateLiveSession(ctx, req, opts...) +} + +// GetLiveSession returns the details for the specified live session. +func (c *VideoStitcherClient) GetLiveSession(ctx context.Context, req *stitcherpb.GetLiveSessionRequest, opts ...gax.CallOption) (*stitcherpb.LiveSession, error) { + return c.internalClient.GetLiveSession(ctx, req, opts...) +} + +// videoStitcherGRPCClient is a client for interacting with Video Stitcher API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type videoStitcherGRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing VideoStitcherClient + CallOptions **VideoStitcherCallOptions + + // The gRPC API client. + videoStitcherClient stitcherpb.VideoStitcherServiceClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewVideoStitcherClient creates a new video stitcher service client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Video-On-Demand content stitching API allows you to insert ads +// into (VoD) video on demand files. You will be able to render custom +// scrubber bars with highlighted ads, enforce ad policies, allow +// seamless playback and tracking on native players and monetize +// content with any standard VMAP compliant ad server. +func NewVideoStitcherClient(ctx context.Context, opts ...option.ClientOption) (*VideoStitcherClient, error) { + clientOpts := defaultVideoStitcherGRPCClientOptions() + if newVideoStitcherClientHook != nil { + hookOpts, err := newVideoStitcherClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := VideoStitcherClient{CallOptions: defaultVideoStitcherCallOptions()} + + c := &videoStitcherGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + videoStitcherClient: stitcherpb.NewVideoStitcherServiceClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *videoStitcherGRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *videoStitcherGRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *videoStitcherGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *videoStitcherGRPCClient) CreateCdnKey(ctx context.Context, req *stitcherpb.CreateCdnKeyRequest, opts ...gax.CallOption) (*stitcherpb.CdnKey, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateCdnKey[0:len((*c.CallOptions).CreateCdnKey):len((*c.CallOptions).CreateCdnKey)], opts...) + var resp *stitcherpb.CdnKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.CreateCdnKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) ListCdnKeys(ctx context.Context, req *stitcherpb.ListCdnKeysRequest, opts ...gax.CallOption) *CdnKeyIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListCdnKeys[0:len((*c.CallOptions).ListCdnKeys):len((*c.CallOptions).ListCdnKeys)], opts...) + it := &CdnKeyIterator{} + req = proto.Clone(req).(*stitcherpb.ListCdnKeysRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*stitcherpb.CdnKey, string, error) { + resp := &stitcherpb.ListCdnKeysResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.ListCdnKeys(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetCdnKeys(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +func (c *videoStitcherGRPCClient) GetCdnKey(ctx context.Context, req *stitcherpb.GetCdnKeyRequest, opts ...gax.CallOption) (*stitcherpb.CdnKey, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetCdnKey[0:len((*c.CallOptions).GetCdnKey):len((*c.CallOptions).GetCdnKey)], opts...) + var resp *stitcherpb.CdnKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.GetCdnKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) DeleteCdnKey(ctx context.Context, req *stitcherpb.DeleteCdnKeyRequest, opts ...gax.CallOption) error { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteCdnKey[0:len((*c.CallOptions).DeleteCdnKey):len((*c.CallOptions).DeleteCdnKey)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.videoStitcherClient.DeleteCdnKey(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +func (c *videoStitcherGRPCClient) UpdateCdnKey(ctx context.Context, req *stitcherpb.UpdateCdnKeyRequest, opts ...gax.CallOption) (*stitcherpb.CdnKey, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "cdn_key.name", url.QueryEscape(req.GetCdnKey().GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateCdnKey[0:len((*c.CallOptions).UpdateCdnKey):len((*c.CallOptions).UpdateCdnKey)], opts...) + var resp *stitcherpb.CdnKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.UpdateCdnKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) CreateVodSession(ctx context.Context, req *stitcherpb.CreateVodSessionRequest, opts ...gax.CallOption) (*stitcherpb.VodSession, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateVodSession[0:len((*c.CallOptions).CreateVodSession):len((*c.CallOptions).CreateVodSession)], opts...) + var resp *stitcherpb.VodSession + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.CreateVodSession(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) GetVodSession(ctx context.Context, req *stitcherpb.GetVodSessionRequest, opts ...gax.CallOption) (*stitcherpb.VodSession, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetVodSession[0:len((*c.CallOptions).GetVodSession):len((*c.CallOptions).GetVodSession)], opts...) + var resp *stitcherpb.VodSession + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.GetVodSession(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) ListVodStitchDetails(ctx context.Context, req *stitcherpb.ListVodStitchDetailsRequest, opts ...gax.CallOption) *VodStitchDetailIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListVodStitchDetails[0:len((*c.CallOptions).ListVodStitchDetails):len((*c.CallOptions).ListVodStitchDetails)], opts...) + it := &VodStitchDetailIterator{} + req = proto.Clone(req).(*stitcherpb.ListVodStitchDetailsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*stitcherpb.VodStitchDetail, string, error) { + resp := &stitcherpb.ListVodStitchDetailsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.ListVodStitchDetails(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetVodStitchDetails(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +func (c *videoStitcherGRPCClient) GetVodStitchDetail(ctx context.Context, req *stitcherpb.GetVodStitchDetailRequest, opts ...gax.CallOption) (*stitcherpb.VodStitchDetail, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetVodStitchDetail[0:len((*c.CallOptions).GetVodStitchDetail):len((*c.CallOptions).GetVodStitchDetail)], opts...) + var resp *stitcherpb.VodStitchDetail + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.GetVodStitchDetail(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) ListVodAdTagDetails(ctx context.Context, req *stitcherpb.ListVodAdTagDetailsRequest, opts ...gax.CallOption) *VodAdTagDetailIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListVodAdTagDetails[0:len((*c.CallOptions).ListVodAdTagDetails):len((*c.CallOptions).ListVodAdTagDetails)], opts...) + it := &VodAdTagDetailIterator{} + req = proto.Clone(req).(*stitcherpb.ListVodAdTagDetailsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*stitcherpb.VodAdTagDetail, string, error) { + resp := &stitcherpb.ListVodAdTagDetailsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.ListVodAdTagDetails(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetVodAdTagDetails(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +func (c *videoStitcherGRPCClient) GetVodAdTagDetail(ctx context.Context, req *stitcherpb.GetVodAdTagDetailRequest, opts ...gax.CallOption) (*stitcherpb.VodAdTagDetail, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetVodAdTagDetail[0:len((*c.CallOptions).GetVodAdTagDetail):len((*c.CallOptions).GetVodAdTagDetail)], opts...) + var resp *stitcherpb.VodAdTagDetail + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.GetVodAdTagDetail(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) ListLiveAdTagDetails(ctx context.Context, req *stitcherpb.ListLiveAdTagDetailsRequest, opts ...gax.CallOption) *LiveAdTagDetailIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListLiveAdTagDetails[0:len((*c.CallOptions).ListLiveAdTagDetails):len((*c.CallOptions).ListLiveAdTagDetails)], opts...) + it := &LiveAdTagDetailIterator{} + req = proto.Clone(req).(*stitcherpb.ListLiveAdTagDetailsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*stitcherpb.LiveAdTagDetail, string, error) { + resp := &stitcherpb.ListLiveAdTagDetailsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.ListLiveAdTagDetails(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetLiveAdTagDetails(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +func (c *videoStitcherGRPCClient) GetLiveAdTagDetail(ctx context.Context, req *stitcherpb.GetLiveAdTagDetailRequest, opts ...gax.CallOption) (*stitcherpb.LiveAdTagDetail, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetLiveAdTagDetail[0:len((*c.CallOptions).GetLiveAdTagDetail):len((*c.CallOptions).GetLiveAdTagDetail)], opts...) + var resp *stitcherpb.LiveAdTagDetail + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.GetLiveAdTagDetail(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) CreateSlate(ctx context.Context, req *stitcherpb.CreateSlateRequest, opts ...gax.CallOption) (*stitcherpb.Slate, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateSlate[0:len((*c.CallOptions).CreateSlate):len((*c.CallOptions).CreateSlate)], opts...) + var resp *stitcherpb.Slate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.CreateSlate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) ListSlates(ctx context.Context, req *stitcherpb.ListSlatesRequest, opts ...gax.CallOption) *SlateIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListSlates[0:len((*c.CallOptions).ListSlates):len((*c.CallOptions).ListSlates)], opts...) + it := &SlateIterator{} + req = proto.Clone(req).(*stitcherpb.ListSlatesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*stitcherpb.Slate, string, error) { + resp := &stitcherpb.ListSlatesResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.ListSlates(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetSlates(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +func (c *videoStitcherGRPCClient) GetSlate(ctx context.Context, req *stitcherpb.GetSlateRequest, opts ...gax.CallOption) (*stitcherpb.Slate, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetSlate[0:len((*c.CallOptions).GetSlate):len((*c.CallOptions).GetSlate)], opts...) + var resp *stitcherpb.Slate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.GetSlate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) UpdateSlate(ctx context.Context, req *stitcherpb.UpdateSlateRequest, opts ...gax.CallOption) (*stitcherpb.Slate, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "slate.name", url.QueryEscape(req.GetSlate().GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateSlate[0:len((*c.CallOptions).UpdateSlate):len((*c.CallOptions).UpdateSlate)], opts...) + var resp *stitcherpb.Slate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.UpdateSlate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) DeleteSlate(ctx context.Context, req *stitcherpb.DeleteSlateRequest, opts ...gax.CallOption) error { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteSlate[0:len((*c.CallOptions).DeleteSlate):len((*c.CallOptions).DeleteSlate)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.videoStitcherClient.DeleteSlate(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +func (c *videoStitcherGRPCClient) CreateLiveSession(ctx context.Context, req *stitcherpb.CreateLiveSessionRequest, opts ...gax.CallOption) (*stitcherpb.LiveSession, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateLiveSession[0:len((*c.CallOptions).CreateLiveSession):len((*c.CallOptions).CreateLiveSession)], opts...) + var resp *stitcherpb.LiveSession + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.CreateLiveSession(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *videoStitcherGRPCClient) GetLiveSession(ctx context.Context, req *stitcherpb.GetLiveSessionRequest, opts ...gax.CallOption) (*stitcherpb.LiveSession, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetLiveSession[0:len((*c.CallOptions).GetLiveSession):len((*c.CallOptions).GetLiveSession)], opts...) + var resp *stitcherpb.LiveSession + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.videoStitcherClient.GetLiveSession(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CdnKeyIterator manages a stream of *stitcherpb.CdnKey. +type CdnKeyIterator struct { + items []*stitcherpb.CdnKey + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*stitcherpb.CdnKey, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *CdnKeyIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *CdnKeyIterator) Next() (*stitcherpb.CdnKey, error) { + var item *stitcherpb.CdnKey + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *CdnKeyIterator) bufLen() int { + return len(it.items) +} + +func (it *CdnKeyIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// LiveAdTagDetailIterator manages a stream of *stitcherpb.LiveAdTagDetail. +type LiveAdTagDetailIterator struct { + items []*stitcherpb.LiveAdTagDetail + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*stitcherpb.LiveAdTagDetail, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *LiveAdTagDetailIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *LiveAdTagDetailIterator) Next() (*stitcherpb.LiveAdTagDetail, error) { + var item *stitcherpb.LiveAdTagDetail + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *LiveAdTagDetailIterator) bufLen() int { + return len(it.items) +} + +func (it *LiveAdTagDetailIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// SlateIterator manages a stream of *stitcherpb.Slate. +type SlateIterator struct { + items []*stitcherpb.Slate + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*stitcherpb.Slate, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *SlateIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *SlateIterator) Next() (*stitcherpb.Slate, error) { + var item *stitcherpb.Slate + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *SlateIterator) bufLen() int { + return len(it.items) +} + +func (it *SlateIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// VodAdTagDetailIterator manages a stream of *stitcherpb.VodAdTagDetail. +type VodAdTagDetailIterator struct { + items []*stitcherpb.VodAdTagDetail + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*stitcherpb.VodAdTagDetail, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *VodAdTagDetailIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *VodAdTagDetailIterator) Next() (*stitcherpb.VodAdTagDetail, error) { + var item *stitcherpb.VodAdTagDetail + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *VodAdTagDetailIterator) bufLen() int { + return len(it.items) +} + +func (it *VodAdTagDetailIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// VodStitchDetailIterator manages a stream of *stitcherpb.VodStitchDetail. +type VodStitchDetailIterator struct { + items []*stitcherpb.VodStitchDetail + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*stitcherpb.VodStitchDetail, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *VodStitchDetailIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *VodStitchDetailIterator) Next() (*stitcherpb.VodStitchDetail, error) { + var item *stitcherpb.VodStitchDetail + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *VodStitchDetailIterator) bufLen() int { + return len(it.items) +} + +func (it *VodStitchDetailIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/video/stitcher/apiv1/video_stitcher_client_example_test.go b/video/stitcher/apiv1/video_stitcher_client_example_test.go new file mode 100644 index 000000000000..660d9dc36cde --- /dev/null +++ b/video/stitcher/apiv1/video_stitcher_client_example_test.go @@ -0,0 +1,463 @@ +// Copyright 2022 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. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package stitcher_test + +import ( + "context" + + stitcher "cloud.google.com/go/video/stitcher/apiv1" + "google.golang.org/api/iterator" + stitcherpb "google.golang.org/genproto/googleapis/cloud/video/stitcher/v1" +) + +func ExampleNewVideoStitcherClient() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleVideoStitcherClient_CreateCdnKey() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.CreateCdnKeyRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#CreateCdnKeyRequest. + } + resp, err := c.CreateCdnKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_ListCdnKeys() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.ListCdnKeysRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#ListCdnKeysRequest. + } + it := c.ListCdnKeys(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleVideoStitcherClient_GetCdnKey() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.GetCdnKeyRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#GetCdnKeyRequest. + } + resp, err := c.GetCdnKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_DeleteCdnKey() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.DeleteCdnKeyRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#DeleteCdnKeyRequest. + } + err = c.DeleteCdnKey(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleVideoStitcherClient_UpdateCdnKey() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.UpdateCdnKeyRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#UpdateCdnKeyRequest. + } + resp, err := c.UpdateCdnKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_CreateVodSession() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.CreateVodSessionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#CreateVodSessionRequest. + } + resp, err := c.CreateVodSession(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_GetVodSession() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.GetVodSessionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#GetVodSessionRequest. + } + resp, err := c.GetVodSession(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_ListVodStitchDetails() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.ListVodStitchDetailsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#ListVodStitchDetailsRequest. + } + it := c.ListVodStitchDetails(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleVideoStitcherClient_GetVodStitchDetail() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.GetVodStitchDetailRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#GetVodStitchDetailRequest. + } + resp, err := c.GetVodStitchDetail(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_ListVodAdTagDetails() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.ListVodAdTagDetailsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#ListVodAdTagDetailsRequest. + } + it := c.ListVodAdTagDetails(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleVideoStitcherClient_GetVodAdTagDetail() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.GetVodAdTagDetailRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#GetVodAdTagDetailRequest. + } + resp, err := c.GetVodAdTagDetail(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_ListLiveAdTagDetails() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.ListLiveAdTagDetailsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#ListLiveAdTagDetailsRequest. + } + it := c.ListLiveAdTagDetails(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleVideoStitcherClient_GetLiveAdTagDetail() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.GetLiveAdTagDetailRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#GetLiveAdTagDetailRequest. + } + resp, err := c.GetLiveAdTagDetail(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_CreateSlate() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.CreateSlateRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#CreateSlateRequest. + } + resp, err := c.CreateSlate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_ListSlates() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.ListSlatesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#ListSlatesRequest. + } + it := c.ListSlates(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleVideoStitcherClient_GetSlate() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.GetSlateRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#GetSlateRequest. + } + resp, err := c.GetSlate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_UpdateSlate() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.UpdateSlateRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#UpdateSlateRequest. + } + resp, err := c.UpdateSlate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_DeleteSlate() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.DeleteSlateRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#DeleteSlateRequest. + } + err = c.DeleteSlate(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleVideoStitcherClient_CreateLiveSession() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.CreateLiveSessionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#CreateLiveSessionRequest. + } + resp, err := c.CreateLiveSession(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVideoStitcherClient_GetLiveSession() { + ctx := context.Background() + c, err := stitcher.NewVideoStitcherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &stitcherpb.GetLiveSessionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#GetLiveSessionRequest. + } + resp, err := c.GetLiveSession(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +}