Class YouTubeVideoUploadServiceClient

java.lang.Object
com.google.ads.googleads.v23.services.YouTubeVideoUploadServiceClient
All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class YouTubeVideoUploadServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Service to manage YouTube video uploads.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
     YouTubeVideoUploadServiceClient.create()) {
   String customerId = "customerId-1581184615";
   YouTubeVideoUpload youTubeVideoUpload = YouTubeVideoUpload.newBuilder().build();
   CreateYouTubeVideoUploadResponse response =
       youTubeVideoUploadServiceClient.createYouTubeVideoUpload(customerId, youTubeVideoUpload);
 }
 

Note: close() needs to be called on the YouTubeVideoUploadServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

CreateYouTubeVideoUpload

Uploads a video to Google-managed or advertiser owned (brand) YouTube channel.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createYouTubeVideoUpload(CreateYouTubeVideoUploadRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createYouTubeVideoUpload(String customerId, YouTubeVideoUpload youTubeVideoUpload)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createYouTubeVideoUploadCallable()

UpdateYouTubeVideoUpload

Updates YouTube video's metadata, but only for videos uploaded using this API.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateYouTubeVideoUpload(UpdateYouTubeVideoUploadRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateYouTubeVideoUpload(String customerId, YouTubeVideoUpload youTubeVideoUpload, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateYouTubeVideoUploadCallable()

RemoveYouTubeVideoUpload

Removes YouTube videos uploaded using this API.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • removeYouTubeVideoUpload(RemoveYouTubeVideoUploadRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • removeYouTubeVideoUpload(String customerId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • removeYouTubeVideoUploadCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of YouTubeVideoUploadServiceSettings to create(). For example:

To customize credentials:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 YouTubeVideoUploadServiceSettings youTubeVideoUploadServiceSettings =
     YouTubeVideoUploadServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
     YouTubeVideoUploadServiceClient.create(youTubeVideoUploadServiceSettings);
 

To customize the endpoint:


 // This snippet 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 as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 YouTubeVideoUploadServiceSettings youTubeVideoUploadServiceSettings =
     YouTubeVideoUploadServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
     YouTubeVideoUploadServiceClient.create(youTubeVideoUploadServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • YouTubeVideoUploadServiceClient

      protected YouTubeVideoUploadServiceClient(YouTubeVideoUploadServiceSettings settings) throws IOException
      Constructs an instance of YouTubeVideoUploadServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
      Throws:
      IOException
    • YouTubeVideoUploadServiceClient

      protected YouTubeVideoUploadServiceClient(YouTubeVideoUploadServiceStub stub)
  • Method Details

    • create

      public static final YouTubeVideoUploadServiceClient create() throws IOException
      Constructs an instance of YouTubeVideoUploadServiceClient with default settings.
      Throws:
      IOException
    • create

      Constructs an instance of YouTubeVideoUploadServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      Constructs an instance of YouTubeVideoUploadServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(YouTubeVideoUploadServiceSettings).
    • getSettings

      public final YouTubeVideoUploadServiceSettings getSettings()
    • getStub

    • createYouTubeVideoUpload

      public final CreateYouTubeVideoUploadResponse createYouTubeVideoUpload(String customerId, YouTubeVideoUpload youTubeVideoUpload)
      Uploads a video to Google-managed or advertiser owned (brand) YouTube channel.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         String customerId = "customerId-1581184615";
         YouTubeVideoUpload youTubeVideoUpload = YouTubeVideoUpload.newBuilder().build();
         CreateYouTubeVideoUploadResponse response =
             youTubeVideoUploadServiceClient.createYouTubeVideoUpload(customerId, youTubeVideoUpload);
       }
       
      Parameters:
      customerId - Required. The customer ID requesting the upload. Required.
      youTubeVideoUpload - Required. The initial details of the video to upload. Required.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createYouTubeVideoUpload

      public final CreateYouTubeVideoUploadResponse createYouTubeVideoUpload(CreateYouTubeVideoUploadRequest request)
      Uploads a video to Google-managed or advertiser owned (brand) YouTube channel.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         CreateYouTubeVideoUploadRequest request =
             CreateYouTubeVideoUploadRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setYouTubeVideoUpload(YouTubeVideoUpload.newBuilder().build())
                 .build();
         CreateYouTubeVideoUploadResponse response =
             youTubeVideoUploadServiceClient.createYouTubeVideoUpload(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createYouTubeVideoUploadCallable

      public final com.google.api.gax.rpc.UnaryCallable<CreateYouTubeVideoUploadRequest,CreateYouTubeVideoUploadResponse> createYouTubeVideoUploadCallable()
      Uploads a video to Google-managed or advertiser owned (brand) YouTube channel.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         CreateYouTubeVideoUploadRequest request =
             CreateYouTubeVideoUploadRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setYouTubeVideoUpload(YouTubeVideoUpload.newBuilder().build())
                 .build();
         ApiFuture<CreateYouTubeVideoUploadResponse> future =
             youTubeVideoUploadServiceClient.createYouTubeVideoUploadCallable().futureCall(request);
         // Do something.
         CreateYouTubeVideoUploadResponse response = future.get();
       }
       
    • updateYouTubeVideoUpload

      public final UpdateYouTubeVideoUploadResponse updateYouTubeVideoUpload(String customerId, YouTubeVideoUpload youTubeVideoUpload, com.google.protobuf.FieldMask updateMask)
      Updates YouTube video's metadata, but only for videos uploaded using this API.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         String customerId = "customerId-1581184615";
         YouTubeVideoUpload youTubeVideoUpload = YouTubeVideoUpload.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         UpdateYouTubeVideoUploadResponse response =
             youTubeVideoUploadServiceClient.updateYouTubeVideoUpload(
                 customerId, youTubeVideoUpload, updateMask);
       }
       
      Parameters:
      customerId - Required. The customer ID requesting the YouTube video upload update. Required.
      youTubeVideoUpload - Required. The YouTube video upload resource to be updated. It's expected to have a valid resource name. Required.
      updateMask - Required. FieldMask that determines which resource fields are modified in an update.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • updateYouTubeVideoUpload

      public final UpdateYouTubeVideoUploadResponse updateYouTubeVideoUpload(UpdateYouTubeVideoUploadRequest request)
      Updates YouTube video's metadata, but only for videos uploaded using this API.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         UpdateYouTubeVideoUploadRequest request =
             UpdateYouTubeVideoUploadRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setYouTubeVideoUpload(YouTubeVideoUpload.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         UpdateYouTubeVideoUploadResponse response =
             youTubeVideoUploadServiceClient.updateYouTubeVideoUpload(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • updateYouTubeVideoUploadCallable

      public final com.google.api.gax.rpc.UnaryCallable<UpdateYouTubeVideoUploadRequest,UpdateYouTubeVideoUploadResponse> updateYouTubeVideoUploadCallable()
      Updates YouTube video's metadata, but only for videos uploaded using this API.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         UpdateYouTubeVideoUploadRequest request =
             UpdateYouTubeVideoUploadRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .setYouTubeVideoUpload(YouTubeVideoUpload.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<UpdateYouTubeVideoUploadResponse> future =
             youTubeVideoUploadServiceClient.updateYouTubeVideoUploadCallable().futureCall(request);
         // Do something.
         UpdateYouTubeVideoUploadResponse response = future.get();
       }
       
    • removeYouTubeVideoUpload

      public final RemoveYouTubeVideoUploadResponse removeYouTubeVideoUpload(String customerId)
      Removes YouTube videos uploaded using this API.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         String customerId = "customerId-1581184615";
         RemoveYouTubeVideoUploadResponse response =
             youTubeVideoUploadServiceClient.removeYouTubeVideoUpload(customerId);
       }
       
      Parameters:
      customerId - Required. The customer ID requesting the YouTube video upload deletion. Required.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • removeYouTubeVideoUpload

      public final RemoveYouTubeVideoUploadResponse removeYouTubeVideoUpload(RemoveYouTubeVideoUploadRequest request)
      Removes YouTube videos uploaded using this API.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         RemoveYouTubeVideoUploadRequest request =
             RemoveYouTubeVideoUploadRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .addAllResourceNames(new ArrayList<String>())
                 .build();
         RemoveYouTubeVideoUploadResponse response =
             youTubeVideoUploadServiceClient.removeYouTubeVideoUpload(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • removeYouTubeVideoUploadCallable

      public final com.google.api.gax.rpc.UnaryCallable<RemoveYouTubeVideoUploadRequest,RemoveYouTubeVideoUploadResponse> removeYouTubeVideoUploadCallable()
      Removes YouTube videos uploaded using this API.

      Sample code:

      
       // This snippet 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 as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (YouTubeVideoUploadServiceClient youTubeVideoUploadServiceClient =
           YouTubeVideoUploadServiceClient.create()) {
         RemoveYouTubeVideoUploadRequest request =
             RemoveYouTubeVideoUploadRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .addAllResourceNames(new ArrayList<String>())
                 .build();
         ApiFuture<RemoveYouTubeVideoUploadResponse> future =
             youTubeVideoUploadServiceClient.removeYouTubeVideoUploadCallable().futureCall(request);
         // Do something.
         RemoveYouTubeVideoUploadResponse response = future.get();
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface com.google.api.gax.core.BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface com.google.api.gax.core.BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface com.google.api.gax.core.BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface com.google.api.gax.core.BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface com.google.api.gax.core.BackgroundResource
      Throws:
      InterruptedException