|
29 | 29 | */ |
30 | 30 | package com.google.api.gax.httpjson; |
31 | 31 |
|
| 32 | +import com.google.api.core.BetaApi; |
32 | 33 | import com.google.api.core.ObsoleteApi; |
33 | 34 | import com.google.api.gax.longrunning.OperationSnapshot; |
| 35 | +import com.google.api.gax.resumable.ResumableUploadClient; |
34 | 36 | import com.google.api.gax.rpc.BatchingCallSettings; |
35 | 37 | import com.google.api.gax.rpc.Callables; |
36 | 38 | import com.google.api.gax.rpc.ClientContext; |
|
39 | 41 | import com.google.api.gax.rpc.OperationCallSettings; |
40 | 42 | import com.google.api.gax.rpc.OperationCallable; |
41 | 43 | import com.google.api.gax.rpc.PagedCallSettings; |
| 44 | +import com.google.api.gax.rpc.ResumableUploadCallSettings; |
| 45 | +import com.google.api.gax.rpc.ResumableUploadCallable; |
42 | 46 | import com.google.api.gax.rpc.ServerStreamingCallSettings; |
43 | 47 | import com.google.api.gax.rpc.ServerStreamingCallable; |
44 | 48 | import com.google.api.gax.rpc.UnaryCallSettings; |
@@ -221,6 +225,27 @@ ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable( |
221 | 225 | return callable.withDefaultCallContext(clientContext.getDefaultCallContext()); |
222 | 226 | } |
223 | 227 |
|
| 228 | + /** |
| 229 | + * Creates a {@link ResumableUploadCallable} to execute resumable uploads. Designed for use by |
| 230 | + * generated code. |
| 231 | + * |
| 232 | + * @param httpJsonCallSettings the http/json call settings |
| 233 | + * @param callSettings settings configuring chunk size |
| 234 | + * @param clientContext client context providing default call context |
| 235 | + * @return {@link ResumableUploadCallable} callable object |
| 236 | + */ |
| 237 | + @BetaApi |
| 238 | + public static <RequestT, ResponseT> |
| 239 | + ResumableUploadCallable<RequestT, ResponseT> createResumableUploadCallable( |
| 240 | + HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings, |
| 241 | + ResumableUploadCallSettings callSettings, |
| 242 | + ClientContext clientContext) { |
| 243 | + ResumableUploadClient<RequestT, ResponseT> uploadClient = |
| 244 | + HttpJsonResumableUploadClient.create( |
| 245 | + clientContext, httpJsonCallSettings.getMethodDescriptor()); |
| 246 | + return Callables.resumableUpload(uploadClient, callSettings, clientContext); |
| 247 | + } |
| 248 | + |
224 | 249 | static ApiTracerContext getApiTracerContext(ApiMethodDescriptor<?, ?> methodDescriptor) { |
225 | 250 | return ApiTracerContext.newBuilder() |
226 | 251 | .setFullMethodName(methodDescriptor.getFullMethodName()) |
|
0 commit comments