|
| 1 | +/** |
| 2 | + * This file was auto-generated by Fern from our API Definition. |
| 3 | + */ |
| 4 | +package com.vapi.api; |
| 5 | + |
| 6 | +import com.vapi.api.core.ClientOptions; |
| 7 | +import com.vapi.api.core.RequestOptions; |
| 8 | +import com.vapi.api.core.Suppliers; |
| 9 | +import com.vapi.api.resources.analytics.AsyncAnalyticsClient; |
| 10 | +import com.vapi.api.resources.assistants.AsyncAssistantsClient; |
| 11 | +import com.vapi.api.resources.calls.AsyncCallsClient; |
| 12 | +import com.vapi.api.resources.files.AsyncFilesClient; |
| 13 | +import com.vapi.api.resources.knowledgebases.AsyncKnowledgeBasesClient; |
| 14 | +import com.vapi.api.resources.logs.AsyncLogsClient; |
| 15 | +import com.vapi.api.resources.phonenumbers.AsyncPhoneNumbersClient; |
| 16 | +import com.vapi.api.resources.squads.AsyncSquadsClient; |
| 17 | +import com.vapi.api.resources.testsuiteruns.AsyncTestSuiteRunsClient; |
| 18 | +import com.vapi.api.resources.testsuites.AsyncTestSuitesClient; |
| 19 | +import com.vapi.api.resources.testsuitetests.AsyncTestSuiteTestsClient; |
| 20 | +import com.vapi.api.resources.tools.AsyncToolsClient; |
| 21 | +import com.vapi.api.resources.workflow.AsyncWorkflowClient; |
| 22 | +import java.util.concurrent.CompletableFuture; |
| 23 | +import java.util.function.Supplier; |
| 24 | + |
| 25 | +public class AsyncVapi { |
| 26 | + protected final ClientOptions clientOptions; |
| 27 | + |
| 28 | + private final AsyncRawVapi rawClient; |
| 29 | + |
| 30 | + protected final Supplier<AsyncCallsClient> callsClient; |
| 31 | + |
| 32 | + protected final Supplier<AsyncAssistantsClient> assistantsClient; |
| 33 | + |
| 34 | + protected final Supplier<AsyncPhoneNumbersClient> phoneNumbersClient; |
| 35 | + |
| 36 | + protected final Supplier<AsyncToolsClient> toolsClient; |
| 37 | + |
| 38 | + protected final Supplier<AsyncFilesClient> filesClient; |
| 39 | + |
| 40 | + protected final Supplier<AsyncKnowledgeBasesClient> knowledgeBasesClient; |
| 41 | + |
| 42 | + protected final Supplier<AsyncWorkflowClient> workflowClient; |
| 43 | + |
| 44 | + protected final Supplier<AsyncSquadsClient> squadsClient; |
| 45 | + |
| 46 | + protected final Supplier<AsyncTestSuitesClient> testSuitesClient; |
| 47 | + |
| 48 | + protected final Supplier<AsyncTestSuiteTestsClient> testSuiteTestsClient; |
| 49 | + |
| 50 | + protected final Supplier<AsyncTestSuiteRunsClient> testSuiteRunsClient; |
| 51 | + |
| 52 | + protected final Supplier<AsyncAnalyticsClient> analyticsClient; |
| 53 | + |
| 54 | + protected final Supplier<AsyncLogsClient> logsClient; |
| 55 | + |
| 56 | + public AsyncVapi(ClientOptions clientOptions) { |
| 57 | + this.clientOptions = clientOptions; |
| 58 | + this.rawClient = new AsyncRawVapi(clientOptions); |
| 59 | + this.callsClient = Suppliers.memoize(() -> new AsyncCallsClient(clientOptions)); |
| 60 | + this.assistantsClient = Suppliers.memoize(() -> new AsyncAssistantsClient(clientOptions)); |
| 61 | + this.phoneNumbersClient = Suppliers.memoize(() -> new AsyncPhoneNumbersClient(clientOptions)); |
| 62 | + this.toolsClient = Suppliers.memoize(() -> new AsyncToolsClient(clientOptions)); |
| 63 | + this.filesClient = Suppliers.memoize(() -> new AsyncFilesClient(clientOptions)); |
| 64 | + this.knowledgeBasesClient = Suppliers.memoize(() -> new AsyncKnowledgeBasesClient(clientOptions)); |
| 65 | + this.workflowClient = Suppliers.memoize(() -> new AsyncWorkflowClient(clientOptions)); |
| 66 | + this.squadsClient = Suppliers.memoize(() -> new AsyncSquadsClient(clientOptions)); |
| 67 | + this.testSuitesClient = Suppliers.memoize(() -> new AsyncTestSuitesClient(clientOptions)); |
| 68 | + this.testSuiteTestsClient = Suppliers.memoize(() -> new AsyncTestSuiteTestsClient(clientOptions)); |
| 69 | + this.testSuiteRunsClient = Suppliers.memoize(() -> new AsyncTestSuiteRunsClient(clientOptions)); |
| 70 | + this.analyticsClient = Suppliers.memoize(() -> new AsyncAnalyticsClient(clientOptions)); |
| 71 | + this.logsClient = Suppliers.memoize(() -> new AsyncLogsClient(clientOptions)); |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * Get responses with HTTP metadata like headers |
| 76 | + */ |
| 77 | + public AsyncRawVapi withRawResponse() { |
| 78 | + return this.rawClient; |
| 79 | + } |
| 80 | + |
| 81 | + public CompletableFuture<Void> prometheusControllerIndex() { |
| 82 | + return this.rawClient.prometheusControllerIndex().thenApply(response -> response.body()); |
| 83 | + } |
| 84 | + |
| 85 | + public CompletableFuture<Void> prometheusControllerIndex(RequestOptions requestOptions) { |
| 86 | + return this.rawClient.prometheusControllerIndex(requestOptions).thenApply(response -> response.body()); |
| 87 | + } |
| 88 | + |
| 89 | + public AsyncCallsClient calls() { |
| 90 | + return this.callsClient.get(); |
| 91 | + } |
| 92 | + |
| 93 | + public AsyncAssistantsClient assistants() { |
| 94 | + return this.assistantsClient.get(); |
| 95 | + } |
| 96 | + |
| 97 | + public AsyncPhoneNumbersClient phoneNumbers() { |
| 98 | + return this.phoneNumbersClient.get(); |
| 99 | + } |
| 100 | + |
| 101 | + public AsyncToolsClient tools() { |
| 102 | + return this.toolsClient.get(); |
| 103 | + } |
| 104 | + |
| 105 | + public AsyncFilesClient files() { |
| 106 | + return this.filesClient.get(); |
| 107 | + } |
| 108 | + |
| 109 | + public AsyncKnowledgeBasesClient knowledgeBases() { |
| 110 | + return this.knowledgeBasesClient.get(); |
| 111 | + } |
| 112 | + |
| 113 | + public AsyncWorkflowClient workflow() { |
| 114 | + return this.workflowClient.get(); |
| 115 | + } |
| 116 | + |
| 117 | + public AsyncSquadsClient squads() { |
| 118 | + return this.squadsClient.get(); |
| 119 | + } |
| 120 | + |
| 121 | + public AsyncTestSuitesClient testSuites() { |
| 122 | + return this.testSuitesClient.get(); |
| 123 | + } |
| 124 | + |
| 125 | + public AsyncTestSuiteTestsClient testSuiteTests() { |
| 126 | + return this.testSuiteTestsClient.get(); |
| 127 | + } |
| 128 | + |
| 129 | + public AsyncTestSuiteRunsClient testSuiteRuns() { |
| 130 | + return this.testSuiteRunsClient.get(); |
| 131 | + } |
| 132 | + |
| 133 | + public AsyncAnalyticsClient analytics() { |
| 134 | + return this.analyticsClient.get(); |
| 135 | + } |
| 136 | + |
| 137 | + public AsyncLogsClient logs() { |
| 138 | + return this.logsClient.get(); |
| 139 | + } |
| 140 | + |
| 141 | + public static AsyncVapiBuilder builder() { |
| 142 | + return new AsyncVapiBuilder(); |
| 143 | + } |
| 144 | +} |
0 commit comments