Class YouTubeVideoUploadServiceClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
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().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedConstructs an instance of YouTubeVideoUploadServiceClient, using the given settings. -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final YouTubeVideoUploadServiceClientcreate()Constructs an instance of YouTubeVideoUploadServiceClient with default settings.static final YouTubeVideoUploadServiceClientConstructs an instance of YouTubeVideoUploadServiceClient, using the given stub for making calls.static final YouTubeVideoUploadServiceClientcreate(YouTubeVideoUploadServiceSettings settings) Constructs an instance of YouTubeVideoUploadServiceClient, using the given settings.Uploads a video to Google-managed or advertiser owned (brand) YouTube channel.createYouTubeVideoUpload(String customerId, YouTubeVideoUpload youTubeVideoUpload) Uploads a video to Google-managed or advertiser owned (brand) YouTube channel.final com.google.api.gax.rpc.UnaryCallable<CreateYouTubeVideoUploadRequest,CreateYouTubeVideoUploadResponse> Uploads a video to Google-managed or advertiser owned (brand) YouTube channel.getStub()booleanbooleanRemoves YouTube videos uploaded using this API.removeYouTubeVideoUpload(String customerId) Removes YouTube videos uploaded using this API.final com.google.api.gax.rpc.UnaryCallable<RemoveYouTubeVideoUploadRequest,RemoveYouTubeVideoUploadResponse> Removes YouTube videos uploaded using this API.voidshutdown()voidUpdates YouTube video's metadata, but only for videos uploaded using this API.updateYouTubeVideoUpload(String customerId, YouTubeVideoUpload youTubeVideoUpload, com.google.protobuf.FieldMask updateMask) Updates YouTube video's metadata, but only for videos uploaded using this API.final com.google.api.gax.rpc.UnaryCallable<UpdateYouTubeVideoUploadRequest,UpdateYouTubeVideoUploadResponse> Updates YouTube video's metadata, but only for videos uploaded using this API.
-
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
-
-
Method Details
-
create
Constructs an instance of YouTubeVideoUploadServiceClient with default settings.- Throws:
IOException
-
create
public static final YouTubeVideoUploadServiceClient create(YouTubeVideoUploadServiceSettings settings) throws IOException 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
-
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
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:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-