@@ -17,6 +17,43 @@ export class Operations extends BaseModule {
17
17
super ( ) ;
18
18
}
19
19
20
+ /**
21
+ * Gets the status of a long-running operation.
22
+ *
23
+ * @param operation The Operation object returned by a previous API call.
24
+ * @return The updated Operation object, with the latest status or result.
25
+ */
26
+ async get (
27
+ parameters : types . OperationGetParameters ,
28
+ ) : Promise < types . GenerateVideosOperation > {
29
+ const operation = parameters . operation ;
30
+ const config = parameters . config ;
31
+
32
+ if ( operation . name === undefined || operation . name === '' ) {
33
+ throw new Error ( 'Operation name is required.' ) ;
34
+ }
35
+
36
+ if ( this . apiClient . isVertexAI ( ) ) {
37
+ const resourceName = operation . name . split ( '/operations/' ) [ 0 ] ;
38
+ var httpOptions : types . HttpOptions | undefined = undefined ;
39
+
40
+ if ( config && 'httpOptions' in config ) {
41
+ httpOptions = config . httpOptions ;
42
+ }
43
+
44
+ return this . fetchPredictVideosOperationInternal ( {
45
+ operationName : operation . name ,
46
+ resourceName : resourceName ,
47
+ config : { httpOptions : httpOptions } ,
48
+ } ) ;
49
+ } else {
50
+ return this . getVideosOperationInternal ( {
51
+ operationName : operation . name ,
52
+ config : config ,
53
+ } ) ;
54
+ }
55
+ }
56
+
20
57
private async getVideosOperationInternal (
21
58
params : types . GetOperationParameters ,
22
59
) : Promise < types . GenerateVideosOperation > {
0 commit comments