|
| 1 | +/** |
| 2 | + * Speech API |
| 3 | + * The OCI Speech Service harnesses the power of spoken language by allowing developers to easily convert file-based data containing human speech into highly accurate text transcriptions. |
| 4 | + * OpenAPI spec version: 20220101 |
| 5 | + * |
| 6 | + * |
| 7 | + * NOTE: This class is auto generated by OracleSDKGenerator. |
| 8 | + * Do not edit the class manually. |
| 9 | + * |
| 10 | + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. |
| 11 | + * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. |
| 12 | + */ |
| 13 | + |
| 14 | +import * as serviceRequests from "./request"; |
| 15 | +import * as serviceResponses from "./response"; |
| 16 | +import * as models from "./model"; |
| 17 | +import { AIServiceSpeechClient } from "./client"; |
| 18 | +import { genericWaiter, genericTerminalConditionWaiter, WaiterConfiguration } from "oci-common"; |
| 19 | + |
| 20 | +export class AIServiceSpeechWaiter { |
| 21 | + public constructor( |
| 22 | + private client: AIServiceSpeechClient, |
| 23 | + private readonly config?: WaiterConfiguration |
| 24 | + ) {} |
| 25 | + |
| 26 | + /** |
| 27 | + * Waits forTranscriptionJob till it reaches any of the provided states |
| 28 | + * |
| 29 | + * @param request the request to send |
| 30 | + * @param targetStates the desired states to wait for. The waiter will return once the resource reaches any of the provided states |
| 31 | + * @return response returns GetTranscriptionJobResponse |
| 32 | + */ |
| 33 | + public async forTranscriptionJob( |
| 34 | + request: serviceRequests.GetTranscriptionJobRequest, |
| 35 | + ...targetStates: models.TranscriptionJob.LifecycleState[] |
| 36 | + ): Promise<serviceResponses.GetTranscriptionJobResponse> { |
| 37 | + return genericWaiter( |
| 38 | + this.config, |
| 39 | + () => this.client.getTranscriptionJob(request), |
| 40 | + response => targetStates.includes(response.transcriptionJob.lifecycleState!) |
| 41 | + ); |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * Waits forTranscriptionTask till it reaches any of the provided states |
| 46 | + * |
| 47 | + * @param request the request to send |
| 48 | + * @param targetStates the desired states to wait for. The waiter will return once the resource reaches any of the provided states |
| 49 | + * @return response returns GetTranscriptionTaskResponse |
| 50 | + */ |
| 51 | + public async forTranscriptionTask( |
| 52 | + request: serviceRequests.GetTranscriptionTaskRequest, |
| 53 | + ...targetStates: models.TranscriptionTask.LifecycleState[] |
| 54 | + ): Promise<serviceResponses.GetTranscriptionTaskResponse> { |
| 55 | + return genericWaiter( |
| 56 | + this.config, |
| 57 | + () => this.client.getTranscriptionTask(request), |
| 58 | + response => targetStates.includes(response.transcriptionTask.lifecycleState!) |
| 59 | + ); |
| 60 | + } |
| 61 | +} |
0 commit comments