diff --git a/.github/workflows/intgtest.yml b/.github/workflows/intgtest.yml index 642420d8..d46c68ae 100644 --- a/.github/workflows/intgtest.yml +++ b/.github/workflows/intgtest.yml @@ -15,21 +15,21 @@ jobs: name: Integration Tests steps: - name: Checkout - uses: actions/checkout@v3 - - name: Set up Zulu JDK 11 + uses: actions/checkout@v4 + - name: Set up Zulu JDK 17 uses: actions/setup-java@v3 with: distribution: "zulu" - java-version: "11" + java-version: "17" - name: Build and run tests run: | hostname echo "host is $HOSTNAME" ./gradlew clean test env: - SDK_INTEGRATION_TESTS_SERVER_API_URL: ${{ secrets.SDK_INTEGRATION_TESTS_SERVER_API_URL }} - SDK_INTEGRATION_TESTS_SERVER_KEY_ID: ${{ secrets.SDK_INTEGRATION_TESTS_SERVER_KEY_ID }} - SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET: ${{ secrets.SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET }} + CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }} + CONDUCTOR_SERVER_AUTH_KEY: ${{ secrets.CONDUCTOR_SERVER_AUTH_KEY }} + CONDUCTOR_SERVER_AUTH_SECRET: ${{ secrets.CONDUCTOR_SERVER_AUTH_SECRET }} USER1_APPLICATION_ID: ${{ secrets.USER1_APPLICATION_ID }} USER1_KEY_ID: ${{ secrets.USER1_KEY_ID }} USER1_SECRET: ${{ secrets.USER1_SECRET }} diff --git a/.github/workflows/oss.yml b/.github/workflows/oss.yml index c8f4fdeb..439176c3 100644 --- a/.github/workflows/oss.yml +++ b/.github/workflows/oss.yml @@ -17,11 +17,11 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v3 - - name: Set up Zulu JDK 11 - uses: actions/setup-java@v3 + - name: Set up Zulu JDK 17 + uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - name: Publish run: | export CONDUCTOR_VERSION=${{ github.event.inputs.version }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 3f7d9690..f12f4f47 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -18,11 +18,11 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v3 - - name: Set up Zulu JDK 11 - uses: actions/setup-java@v3 + - name: Set up Zulu JDK 17 + uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - name: Publish run: | export VERSION="${{github.ref_name}}" diff --git a/build.gradle b/build.gradle index 25a7f546..574621fe 100644 --- a/build.gradle +++ b/build.gradle @@ -30,10 +30,9 @@ ext { azureIdentity : '1.3.7', eureka : '1.10.17', wiremock : '2.33.2', - ioGRPC : '1.49.0', - ioGRPC : '1.49.0', - protoBuf : '3.19.4', - lombok : '1.18.24', + ioGRPC : '1.63.1', + protoBuf : '3.25.3', + lombok : '1.18.30', revJAXRS : '2.1.1', log4j : '2.17.1', netty : '4.1.77.Final' @@ -203,9 +202,14 @@ jacocoTestReport { dependsOn test // tests are required to run before generating the report } +allprojects { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } +} compileJava { - sourceCompatibility = 11 - targetCompatibility = 11 + sourceCompatibility = 17 + targetCompatibility = 17 } configurations.implementation { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 69a97150..a5952066 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/netflix/conductor/client/http/TaskClient.java b/src/main/java/com/netflix/conductor/client/http/TaskClient.java index e1fcbc8d..673e8ec8 100644 --- a/src/main/java/com/netflix/conductor/client/http/TaskClient.java +++ b/src/main/java/com/netflix/conductor/client/http/TaskClient.java @@ -22,6 +22,7 @@ import com.netflix.conductor.common.metadata.tasks.TaskResult; import com.netflix.conductor.common.run.SearchResult; import com.netflix.conductor.common.utils.ExternalPayloadStorage; + import io.orkes.conductor.client.model.TaskSummary; /** Client for conductor task management including polling for task, updating task status etc. */ diff --git a/src/main/java/io/orkes/conductor/client/IntegrationClient.java b/src/main/java/io/orkes/conductor/client/IntegrationClient.java new file mode 100644 index 00000000..4667c4ae --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/IntegrationClient.java @@ -0,0 +1,77 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client; + +import java.util.List; +import java.util.Map; + +import io.orkes.conductor.client.model.TagObject; +import io.orkes.conductor.client.model.integration.Integration; +import io.orkes.conductor.client.model.integration.IntegrationApi; +import io.orkes.conductor.client.model.integration.IntegrationApiUpdate; +import io.orkes.conductor.client.model.integration.IntegrationUpdate; +import io.orkes.conductor.client.model.integration.ai.PromptTemplate; + +public interface IntegrationClient { + /** + * Client for managing integrations with external systems. Some examples of integrations are: + * 1. AI/LLM providers (e.g. OpenAI, HuggingFace) + * 2. Vector DBs (Pinecone, Weaviate etc.) + * 3. Kafka + * 4. Relational databases + * + * Integrations are configured as integration -> api with 1->N cardinality. + * APIs are the underlying resources for an integration and depending on the type of integration they represent underlying resources. + * Examples: + * LLM integrations + * The integration specifies the name of the integration unique to your environment, api keys and endpoint used. + * APIs are the models (e.g. text-davinci-003, or text-embedding-ada-002) + * + * Vector DB integrations, + * The integration represents the cluster, specifies the name of the integration unique to your environment, api keys and endpoint used. + * APIs are the indexes (e.g. pinecone) or class (e.g. for weaviate) + * + * Kafka + * The integration represents the cluster, specifies the name of the integration unique to your environment, api keys and endpoint used. + * APIs are the topics that are configured for use within this kafka cluster + */ + + void associatePromptWithIntegration(String aiIntegration, String modelName, String promptName); + + void deleteIntegrationApi(String apiName, String integrationName); + + void deleteIntegration(String integrationName); + + IntegrationApi getIntegrationApi(String apiName, String integrationName); + + List getIntegrationApis(String integrationName); + + Integration getIntegration(String integrationName); + + List getIntegrations(String category, Boolean activeOnly); + + List getPromptsWithIntegration(String aiIntegration, String modelName); + + int getTokenUsageForIntegration(String name, String integrationName); + + Map getTokenUsageForIntegrationProvider(String name); + + void saveIntegrationApi(String integrationName, String apiName, IntegrationApiUpdate apiDetails); + + void saveIntegration(String integrationName, IntegrationUpdate integrationDetails); + + // Tags + void deleteTagForIntegrationProvider(List tags, String name); + void saveTagForIntegrationProvider(List tags, String name); + List getTagsForIntegrationProvider(String name); +} diff --git a/src/main/java/io/orkes/conductor/client/OrkesClients.java b/src/main/java/io/orkes/conductor/client/OrkesClients.java index 216160e5..867221ff 100644 --- a/src/main/java/io/orkes/conductor/client/OrkesClients.java +++ b/src/main/java/io/orkes/conductor/client/OrkesClients.java @@ -12,6 +12,8 @@ */ package io.orkes.conductor.client; +import com.netflix.conductor.sdk.workflow.executor.WorkflowExecutor; + import io.orkes.conductor.client.http.*; public class OrkesClients { @@ -49,4 +51,16 @@ public SecretClient getSecretClient() { public TaskClient getTaskClient() { return new OrkesTaskClient(apiClient); } + + public IntegrationClient getIntegrationClient() { + return new OrkesIntegrationClient(apiClient); + } + + public PromptClient getPromptClient() { + return new OrkesPromptClient(apiClient); + } + + public WorkflowExecutor getWorkflowExecutor() { + return new WorkflowExecutor(getTaskClient(), getWorkflowClient(), getMetadataClient(), 100); + } } diff --git a/src/main/java/io/orkes/conductor/client/OrkesPromptClient.java b/src/main/java/io/orkes/conductor/client/OrkesPromptClient.java new file mode 100644 index 00000000..38d60003 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/OrkesPromptClient.java @@ -0,0 +1,79 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client; + +import java.util.List; +import java.util.Map; + +import io.orkes.conductor.client.http.api.PromptResourceApi; +import io.orkes.conductor.client.model.TagObject; +import io.orkes.conductor.client.model.integration.PromptTemplateTestRequest; +import io.orkes.conductor.client.model.integration.ai.PromptTemplate; + +public class OrkesPromptClient implements PromptClient { + + private final PromptResourceApi promptResourceApi; + + public OrkesPromptClient(ApiClient apiClient) { + this.promptResourceApi = new PromptResourceApi(apiClient); + } + + @Override + public void savePrompt(String promptName, String description, String promptTemplate) { + promptResourceApi.savePromptTemplate(promptTemplate, description, promptName, List.of()); + } + + @Override + public PromptTemplate getPrompt(String promptName) { + return promptResourceApi.getPromptTemplate(promptName); + } + + @Override + public List getPrompts() { + return promptResourceApi.getPromptTemplates(); + } + + @Override + public void deletePrompt(String promptName) { + promptResourceApi.deletePromptTemplate(promptName); + } + + @Override + public List getTagsForPromptTemplate(String promptName) { + return promptResourceApi.getTagsForPromptTemplate(promptName); + } + + @Override + public void updateTagForPromptTemplate(String promptName, List tags) { + promptResourceApi.putTagForPromptTemplate(tags, promptName); + } + + @Override + public void deleteTagForPromptTemplate(String promptName, List tags) { + promptResourceApi.deleteTagForPromptTemplate(tags, promptName); + } + + @Override + public String testPrompt(String promptText, Map variables, String aiIntegration, String textCompleteModel, float temperature, float topP, + List stopWords) { + PromptTemplateTestRequest request = new PromptTemplateTestRequest(); + request.setPrompt(promptText); + request.setLlmProvider(aiIntegration); + request.setModel(textCompleteModel); + request.setTemperature((double) temperature); + request.setTopP((double) topP); + request.setStopWords(stopWords == null ? List.of() : stopWords); + request.setPromptVariables(variables); + return promptResourceApi.testMessageTemplate(request); + } +} diff --git a/src/main/java/io/orkes/conductor/client/PromptClient.java b/src/main/java/io/orkes/conductor/client/PromptClient.java new file mode 100644 index 00000000..cbee63f7 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/PromptClient.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client; + +import java.util.List; +import java.util.Map; + +import io.orkes.conductor.client.model.TagObject; +import io.orkes.conductor.client.model.integration.ai.PromptTemplate; + +public interface PromptClient { + + void savePrompt(String promptName, String description, String promptTemplate); + + PromptTemplate getPrompt(String promptName); + + List getPrompts(); + + void deletePrompt(String promptName); + + List getTagsForPromptTemplate(String promptName); + + void updateTagForPromptTemplate(String promptName, List tags); + + void deleteTagForPromptTemplate(String promptName, List tags); + + /** + * Tests a prompt template by substituting variables and processing through the specified AI model. + * + * @param promptText the text of the prompt template + * @param variables a map containing variables to be replaced in the template + * @param aiIntegration the AI integration context + * @param textCompleteModel the AI model used for completing text + * @param temperature the randomness of the output (optional, default is 0.1) + * @param topP the probability mass to consider from the output distribution (optional, default is 0.9) + * @param stopWords a list of words to stop generating further (can be null) + * @return the processed prompt text + */ + String testPrompt(String promptText, Map variables, String aiIntegration, + String textCompleteModel, float temperature, float topP, List stopWords); +} diff --git a/src/main/java/io/orkes/conductor/client/SchedulerClient.java b/src/main/java/io/orkes/conductor/client/SchedulerClient.java index 86eb1137..67ce4d3b 100644 --- a/src/main/java/io/orkes/conductor/client/SchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/SchedulerClient.java @@ -15,6 +15,7 @@ import java.util.List; import io.orkes.conductor.client.model.SaveScheduleRequest; +import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecution; import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel; import io.orkes.conductor.client.model.TagObject; import io.orkes.conductor.client.model.WorkflowSchedule; @@ -41,8 +42,9 @@ List getNextFewSchedules( void saveSchedule(SaveScheduleRequest saveScheduleRequest); - SearchResultWorkflowScheduleExecutionModel searchV22( - Integer start, Integer size, String sort, String freeText, String query); + @Deprecated + SearchResultWorkflowScheduleExecutionModel searchV22(Integer start, Integer size, String sort, String freeText, String query); + SearchResultWorkflowScheduleExecution search(Integer start, Integer size, String sort, String freeText, String query); void setSchedulerTags(List body, String name); diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesIntegrationClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesIntegrationClient.java new file mode 100644 index 00000000..edbac4c9 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/http/OrkesIntegrationClient.java @@ -0,0 +1,110 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.http; + +import java.util.List; +import java.util.Map; + +import io.orkes.conductor.client.ApiClient; +import io.orkes.conductor.client.IntegrationClient; +import io.orkes.conductor.client.http.api.IntegrationResourceApi; +import io.orkes.conductor.client.model.TagObject; +import io.orkes.conductor.client.model.integration.Integration; +import io.orkes.conductor.client.model.integration.IntegrationApi; +import io.orkes.conductor.client.model.integration.IntegrationApiUpdate; +import io.orkes.conductor.client.model.integration.IntegrationUpdate; +import io.orkes.conductor.client.model.integration.ai.PromptTemplate; + +public class OrkesIntegrationClient extends OrkesClient implements IntegrationClient { + private IntegrationResourceApi integrationApi; + + public OrkesIntegrationClient(ApiClient apiClient) { + super(apiClient); + this.integrationApi = new IntegrationResourceApi(apiClient); + } + + public void associatePromptWithIntegration(String aiIntegration, String modelName, String promptName) { + integrationApi.associatePromptWithIntegration(aiIntegration, modelName, promptName); + } + + public void deleteIntegrationApi(String apiName, String integrationName) { + integrationApi.deleteIntegrationApi(apiName, integrationName); + } + + public void deleteIntegration(String integrationName) { + integrationApi.deleteIntegrationProvider(integrationName); + } + + public IntegrationApi getIntegrationApi(String apiName, String integrationName) throws ApiException { + try { + return integrationApi.getIntegrationApi(apiName, integrationName); + } catch (ApiException e) { + if (e.getStatusCode() == 404) { + return null; + } + throw e; + } + } + + public List getIntegrationApis(String integrationName) { + return integrationApi.getIntegrationApis(integrationName, true); + } + + public Integration getIntegration(String integrationName) throws ApiException { + try { + return integrationApi.getIntegrationProvider(integrationName); + } catch (ApiException e) { + if (e.getStatusCode() == 404) { + return null; + } + throw e; + } + } + + public List getIntegrations(String category, Boolean activeOnly) { + return integrationApi.getIntegrationProviders(category, activeOnly); + } + + public List getPromptsWithIntegration(String aiIntegration, String modelName) { + return integrationApi.getPromptsWithIntegration(aiIntegration, modelName); + } + + public void saveIntegrationApi(String integrationName, String apiName, IntegrationApiUpdate apiDetails) { + integrationApi.saveIntegrationApi(apiDetails, integrationName, apiName); + } + + public void saveIntegration(String integrationName, IntegrationUpdate integrationDetails) { + integrationApi.saveIntegrationProvider(integrationDetails, integrationName); + } + + public int getTokenUsageForIntegration(String name, String integrationName) { + return integrationApi.getTokenUsageForIntegration(name, integrationName); + } + + public Map getTokenUsageForIntegrationProvider(String name) { + return integrationApi.getTokenUsageForIntegrationProvider(name); + } + + // Tags - Implementations are assumed to be placeholders + + public void deleteTagForIntegrationProvider(List tags, String name) { + integrationApi.deleteTagForIntegrationProvider(tags, name); + } + public void saveTagForIntegrationProvider(List tags, String name) { + integrationApi.putTagForIntegrationProvider(tags, name); + } + + public List getTagsForIntegrationProvider(String name) { + return integrationApi.getTagsForIntegrationProvider(name); + } +} diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java index 5b42c0d1..f740849f 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesSchedulerClient.java @@ -18,6 +18,7 @@ import io.orkes.conductor.client.SchedulerClient; import io.orkes.conductor.client.http.api.SchedulerResourceApi; import io.orkes.conductor.client.model.SaveScheduleRequest; +import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecution; import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel; import io.orkes.conductor.client.model.TagObject; import io.orkes.conductor.client.model.WorkflowSchedule; @@ -90,6 +91,11 @@ public SearchResultWorkflowScheduleExecutionModel searchV22( throws ApiException { return schedulerResourceApi.searchV22(start, size, sort, freeText, query); } + @Override + public SearchResultWorkflowScheduleExecution search(Integer start, Integer size, String sort, String freeText, String query) + throws ApiException { + return schedulerResourceApi.search(start, size, sort, freeText, query); + } @Override public void setSchedulerTags(List body, String name) { diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesTaskClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesTaskClient.java index 2a7d53ad..35d813a1 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesTaskClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesTaskClient.java @@ -29,9 +29,9 @@ import io.orkes.conductor.client.TaskClient; import io.orkes.conductor.client.grpc.GrpcTaskClient; import io.orkes.conductor.client.http.api.TaskResourceApi; +import io.orkes.conductor.client.model.TaskSummary; import com.fasterxml.jackson.databind.ObjectMapper; -import io.orkes.conductor.client.model.TaskSummary; public class OrkesTaskClient extends TaskClient implements AutoCloseable { diff --git a/src/main/java/io/orkes/conductor/client/http/api/IntegrationResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/IntegrationResourceApi.java new file mode 100644 index 00000000..feb6ace9 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/http/api/IntegrationResourceApi.java @@ -0,0 +1,3011 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.http.api; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import io.orkes.conductor.client.ApiClient; +import io.orkes.conductor.client.http.ApiCallback; +import io.orkes.conductor.client.http.ApiException; +import io.orkes.conductor.client.http.ApiResponse; +import io.orkes.conductor.client.http.Pair; +import io.orkes.conductor.client.http.ProgressRequestBody; +import io.orkes.conductor.client.http.ProgressResponseBody; +import io.orkes.conductor.client.model.TagObject; +import io.orkes.conductor.client.model.integration.Integration; +import io.orkes.conductor.client.model.integration.IntegrationApi; +import io.orkes.conductor.client.model.integration.IntegrationApiUpdate; +import io.orkes.conductor.client.model.integration.IntegrationDef; +import io.orkes.conductor.client.model.integration.IntegrationUpdate; +import io.orkes.conductor.client.model.integration.ai.PromptTemplate; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.squareup.okhttp.Call; + +public class IntegrationResourceApi { + + private ApiClient apiClient; + + + + public IntegrationResourceApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for associatePromptWithIntegration + * @param integrationProvider (required) + * @param integrationName (required) + * @param promptName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call associatePromptWithIntegrationCall(String integrationProvider, String integrationName, String promptName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{integration_provider}/integration/{integration_name}/prompt/{prompt_name}".replaceAll( + "\\{" + "integration_provider" + "\\}", apiClient.escapeString(integrationProvider)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)) + .replaceAll("\\{" + "prompt_name" + "\\}", apiClient.escapeString(promptName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call associatePromptWithIntegrationValidateBeforeCall(String integrationProvider, String integrationName, String promptName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'integrationProvider' is set + if (integrationProvider == null) { + throw new ApiException("Missing the required parameter 'integrationProvider' when calling associatePromptWithIntegration(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling associatePromptWithIntegration(Async)"); + } + // verify the required parameter 'promptName' is set + if (promptName == null) { + throw new ApiException("Missing the required parameter 'promptName' when calling associatePromptWithIntegration(Async)"); + } + + Call call = associatePromptWithIntegrationCall(integrationProvider, integrationName, promptName, progressListener, progressRequestListener); + return call; + + } + + /** + * Associate a Prompt Template with an Integration + * + * @param integrationProvider (required) + * @param integrationName (required) + * @param promptName (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void associatePromptWithIntegration(String integrationProvider, String integrationName, String promptName) throws ApiException { + associatePromptWithIntegrationWithHttpInfo(integrationProvider, integrationName, promptName); + } + + /** + * Associate a Prompt Template with an Integration + * + * @param integrationProvider (required) + * @param integrationName (required) + * @param promptName (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse associatePromptWithIntegrationWithHttpInfo(String integrationProvider, String integrationName, String promptName) + throws ApiException { + Call call = associatePromptWithIntegrationValidateBeforeCall(integrationProvider, integrationName, promptName, null, null); + return apiClient.execute(call); + } + + /** + * Associate a Prompt Template with an Integration (asynchronously) + * + * @param integrationProvider (required) + * @param integrationName (required) + * @param promptName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call associatePromptWithIntegrationAsync(String integrationProvider, String integrationName, String promptName, final ApiCallback callback) + throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = associatePromptWithIntegrationValidateBeforeCall(integrationProvider, integrationName, promptName, progressListener, + progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for deleteIntegrationApi + * @param name (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call deleteIntegrationApiCall(String name, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/{integration_name}".replaceAll("\\{" + "name" + "\\}", + apiClient.escapeString(name)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call deleteIntegrationApiValidateBeforeCall(String name, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling deleteIntegrationApi(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling deleteIntegrationApi(Async)"); + } + + Call call = deleteIntegrationApiCall(name, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete an Integration + * + * @param name (required) + * @param integrationName (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteIntegrationApi(String name, String integrationName) throws ApiException { + deleteIntegrationApiWithHttpInfo(name, integrationName); + } + + /** + * Delete an Integration + * + * @param name (required) + * @param integrationName (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteIntegrationApiWithHttpInfo(String name, String integrationName) throws ApiException { + Call call = deleteIntegrationApiValidateBeforeCall(name, integrationName, null, null); + return apiClient.execute(call); + } + + /** + * Delete an Integration (asynchronously) + * + * @param name (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteIntegrationApiAsync(String name, String integrationName, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deleteIntegrationApiValidateBeforeCall(name, integrationName, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for deleteIntegrationProvider + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call deleteIntegrationProviderCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call deleteIntegrationProviderValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling deleteIntegrationProvider(Async)"); + } + + Call call = deleteIntegrationProviderCall(name, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete an Integration Provider + * + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteIntegrationProvider(String name) throws ApiException { + deleteIntegrationProviderWithHttpInfo(name); + } + + /** + * Delete an Integration Provider + * + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteIntegrationProviderWithHttpInfo(String name) throws ApiException { + Call call = deleteIntegrationProviderValidateBeforeCall(name, null, null); + return apiClient.execute(call); + } + + /** + * Delete an Integration Provider (asynchronously) + * + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteIntegrationProviderAsync(String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deleteIntegrationProviderValidateBeforeCall(name, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for deleteTagForIntegration + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call deleteTagForIntegrationCall(List body, String name, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/{integration_name}/tags".replaceAll("\\{" + "name" + "\\}", + apiClient.escapeString(name)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call deleteTagForIntegrationValidateBeforeCall(List body, String name, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling deleteTagForIntegration(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling deleteTagForIntegration(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling deleteTagForIntegration(Async)"); + } + + Call call = deleteTagForIntegrationCall(body, name, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete a tag for Integration + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteTagForIntegration(List body, String name, String integrationName) throws ApiException { + deleteTagForIntegrationWithHttpInfo(body, name, integrationName); + } + + /** + * Delete a tag for Integration + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteTagForIntegrationWithHttpInfo(List body, String name, String integrationName) throws ApiException { + Call call = deleteTagForIntegrationValidateBeforeCall(body, name, integrationName, null, null); + return apiClient.execute(call); + } + + /** + * Delete a tag for Integration (asynchronously) + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteTagForIntegrationAsync(List body, String name, String integrationName, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deleteTagForIntegrationValidateBeforeCall(body, name, integrationName, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for deleteTagForIntegrationProvider + * @param body (required) + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call deleteTagForIntegrationProviderCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/tags".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call deleteTagForIntegrationProviderValidateBeforeCall(List body, String name, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling deleteTagForIntegrationProvider(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling deleteTagForIntegrationProvider(Async)"); + } + + Call call = deleteTagForIntegrationProviderCall(body, name, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete a tag for Integration Provider + * + * @param body (required) + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteTagForIntegrationProvider(List body, String name) throws ApiException { + deleteTagForIntegrationProviderWithHttpInfo(body, name); + } + + /** + * Delete a tag for Integration Provider + * + * @param body (required) + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteTagForIntegrationProviderWithHttpInfo(List body, String name) throws ApiException { + Call call = deleteTagForIntegrationProviderValidateBeforeCall(body, name, null, null); + return apiClient.execute(call); + } + + /** + * Delete a tag for Integration Provider (asynchronously) + * + * @param body (required) + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteTagForIntegrationProviderAsync(List body, String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deleteTagForIntegrationProviderValidateBeforeCall(body, name, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for getIntegrationApi + * @param name (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getIntegrationApiCall(String name, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/{integration_name}".replaceAll("\\{" + "name" + "\\}", + apiClient.escapeString(name)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getIntegrationApiValidateBeforeCall(String name, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getIntegrationApi(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling getIntegrationApi(Async)"); + } + + Call call = getIntegrationApiCall(name, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Integration details + * + * @param name (required) + * @param integrationName (required) + * @return IntegrationApi + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public IntegrationApi getIntegrationApi(String name, String integrationName) throws ApiException { + ApiResponse resp = getIntegrationApiWithHttpInfo(name, integrationName); + return resp.getData(); + } + + /** + * Get Integration details + * + * @param name (required) + * @param integrationName (required) + * @return ApiResponse<IntegrationApi> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getIntegrationApiWithHttpInfo(String name, String integrationName) throws ApiException { + Call call = getIntegrationApiValidateBeforeCall(name, integrationName, null, null); + Type localVarReturnType = new TypeReference() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Integration details (asynchronously) + * + * @param name (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getIntegrationApiAsync(String name, String integrationName, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getIntegrationApiValidateBeforeCall(name, integrationName, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getIntegrationApis + * @param name (required) + * @param activeOnly (optional, default to true) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getIntegrationApisCall(String name, Boolean activeOnly, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (activeOnly != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("activeOnly", activeOnly)); + } + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getIntegrationApisValidateBeforeCall(String name, Boolean activeOnly, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getIntegrationApis(Async)"); + } + + Call call = getIntegrationApisCall(name, activeOnly, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Integrations of an Integration Provider + * + * @param name (required) + * @param activeOnly (optional, default to true) + * @return List<IntegrationApi> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getIntegrationApis(String name, Boolean activeOnly) throws ApiException { + ApiResponse> resp = getIntegrationApisWithHttpInfo(name, activeOnly); + return resp.getData(); + } + + /** + * Get Integrations of an Integration Provider + * + * @param name (required) + * @param activeOnly (optional, default to true) + * @return ApiResponse<List<IntegrationApi>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getIntegrationApisWithHttpInfo(String name, Boolean activeOnly) throws ApiException { + Call call = getIntegrationApisValidateBeforeCall(name, activeOnly, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Integrations of an Integration Provider (asynchronously) + * + * @param name (required) + * @param activeOnly (optional, default to true) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getIntegrationApisAsync(String name, Boolean activeOnly, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getIntegrationApisValidateBeforeCall(name, activeOnly, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getIntegrationAvailableApis + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getIntegrationAvailableApisCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/all".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getIntegrationAvailableApisValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getIntegrationAvailableApis(Async)"); + } + + Call call = getIntegrationAvailableApisCall(name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Integrations Available for an Integration Provider + * + * @param name (required) + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getIntegrationAvailableApis(String name) throws ApiException { + ApiResponse> resp = getIntegrationAvailableApisWithHttpInfo(name); + return resp.getData(); + } + + /** + * Get Integrations Available for an Integration Provider + * + * @param name (required) + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getIntegrationAvailableApisWithHttpInfo(String name) throws ApiException { + Call call = getIntegrationAvailableApisValidateBeforeCall(name, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Integrations Available for an Integration Provider (asynchronously) + * + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getIntegrationAvailableApisAsync(String name, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getIntegrationAvailableApisValidateBeforeCall(name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getIntegrationProvider + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getIntegrationProviderCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getIntegrationProviderValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getIntegrationProvider(Async)"); + } + + Call call = getIntegrationProviderCall(name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Integration provider + * + * @param name (required) + * @return Integration + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Integration getIntegrationProvider(String name) throws ApiException { + ApiResponse resp = getIntegrationProviderWithHttpInfo(name); + return resp.getData(); + } + + /** + * Get Integration provider + * + * @param name (required) + * @return ApiResponse<Integration> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getIntegrationProviderWithHttpInfo(String name) throws ApiException { + Call call = getIntegrationProviderValidateBeforeCall(name, null, null); + Type localVarReturnType = new TypeReference() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Integration provider (asynchronously) + * + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getIntegrationProviderAsync(String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getIntegrationProviderValidateBeforeCall(name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getIntegrationProviderDefs + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getIntegrationProviderDefsCall(final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/def"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getIntegrationProviderDefsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + Call call = getIntegrationProviderDefsCall(progressListener, progressRequestListener); + return call; + + } + + /** + * Get Integration provider definitions + * + * @return List<IntegrationDef> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getIntegrationProviderDefs() throws ApiException { + ApiResponse> resp = getIntegrationProviderDefsWithHttpInfo(); + return resp.getData(); + } + + /** + * Get Integration provider definitions + * + * @return ApiResponse<List<IntegrationDef>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getIntegrationProviderDefsWithHttpInfo() throws ApiException { + Call call = getIntegrationProviderDefsValidateBeforeCall(null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Integration provider definitions (asynchronously) + * + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getIntegrationProviderDefsAsync(final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getIntegrationProviderDefsValidateBeforeCall(progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getIntegrationProviders + * @param category (optional) + * @param activeOnly (optional, default to true) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getIntegrationProvidersCall(String category, Boolean activeOnly, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (category != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("category", category)); + } + if (activeOnly != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("activeOnly", activeOnly)); + } + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getIntegrationProvidersValidateBeforeCall(String category, Boolean activeOnly, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + Call call = getIntegrationProvidersCall(category, activeOnly, progressListener, progressRequestListener); + return call; + + } + + /** + * Get all Integrations Providers + * + * @param category (optional) + * @param activeOnly (optional, default to true) + * @return List<Integration> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getIntegrationProviders(String category, Boolean activeOnly) throws ApiException { + ApiResponse> resp = getIntegrationProvidersWithHttpInfo(category, activeOnly); + return resp.getData(); + } + + /** + * Get all Integrations Providers + * + * @param category (optional) + * @param activeOnly (optional, default to true) + * @return ApiResponse<List<Integration>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getIntegrationProvidersWithHttpInfo(String category, Boolean activeOnly) throws ApiException { + Call call = getIntegrationProvidersValidateBeforeCall(category, activeOnly, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get all Integrations Providers (asynchronously) + * + * @param category (optional) + * @param activeOnly (optional, default to true) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getIntegrationProvidersAsync(String category, Boolean activeOnly, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getIntegrationProvidersValidateBeforeCall(category, activeOnly, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getPromptsWithIntegration + * @param integrationProvider (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getPromptsWithIntegrationCall(String integrationProvider, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{integration_provider}/integration/{integration_name}/prompt".replaceAll( + "\\{" + "integration_provider" + "\\}", apiClient.escapeString(integrationProvider)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getPromptsWithIntegrationValidateBeforeCall(String integrationProvider, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'integrationProvider' is set + if (integrationProvider == null) { + throw new ApiException("Missing the required parameter 'integrationProvider' when calling getPromptsWithIntegration(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling getPromptsWithIntegration(Async)"); + } + + Call call = getPromptsWithIntegrationCall(integrationProvider, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Get the list of prompt templates associated with an integration + * + * @param integrationProvider (required) + * @param integrationName (required) + * @return List<PromptTemplate> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getPromptsWithIntegration(String integrationProvider, String integrationName) throws ApiException { + ApiResponse> resp = getPromptsWithIntegrationWithHttpInfo(integrationProvider, integrationName); + return resp.getData(); + } + + /** + * Get the list of prompt templates associated with an integration + * + * @param integrationProvider (required) + * @param integrationName (required) + * @return ApiResponse<List<PromptTemplate>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getPromptsWithIntegrationWithHttpInfo(String integrationProvider, String integrationName) throws ApiException { + Call call = getPromptsWithIntegrationValidateBeforeCall(integrationProvider, integrationName, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get the list of prompt templates associated with an integration (asynchronously) + * + * @param integrationProvider (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getPromptsWithIntegrationAsync(String integrationProvider, String integrationName, final ApiCallback> callback) + throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getPromptsWithIntegrationValidateBeforeCall(integrationProvider, integrationName, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getProvidersAndIntegrations + * @param type (optional) + * @param activeOnly (optional, default to true) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getProvidersAndIntegrationsCall(String type, Boolean activeOnly, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/all"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (type != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("type", type)); + } + if (activeOnly != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("activeOnly", activeOnly)); + } + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getProvidersAndIntegrationsValidateBeforeCall(String type, Boolean activeOnly, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + Call call = getProvidersAndIntegrationsCall(type, activeOnly, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Integrations Providers and Integrations combo + * + * @param type (optional) + * @param activeOnly (optional, default to true) + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getProvidersAndIntegrations(String type, Boolean activeOnly) throws ApiException { + ApiResponse> resp = getProvidersAndIntegrationsWithHttpInfo(type, activeOnly); + return resp.getData(); + } + + /** + * Get Integrations Providers and Integrations combo + * + * @param type (optional) + * @param activeOnly (optional, default to true) + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getProvidersAndIntegrationsWithHttpInfo(String type, Boolean activeOnly) throws ApiException { + Call call = getProvidersAndIntegrationsValidateBeforeCall(type, activeOnly, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Integrations Providers and Integrations combo (asynchronously) + * + * @param type (optional) + * @param activeOnly (optional, default to true) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getProvidersAndIntegrationsAsync(String type, Boolean activeOnly, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getProvidersAndIntegrationsValidateBeforeCall(type, activeOnly, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getTagsForIntegration + * @param name (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getTagsForIntegrationCall(String name, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/{integration_name}/tags".replaceAll("\\{" + "name" + "\\}", + apiClient.escapeString(name)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getTagsForIntegrationValidateBeforeCall(String name, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getTagsForIntegration(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling getTagsForIntegration(Async)"); + } + + Call call = getTagsForIntegrationCall(name, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Get tags by Integration + * + * @param name (required) + * @param integrationName (required) + * @return List<Tag> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getTagsForIntegration(String name, String integrationName) throws ApiException { + ApiResponse> resp = getTagsForIntegrationWithHttpInfo(name, integrationName); + return resp.getData(); + } + + /** + * Get tags by Integration + * + * @param name (required) + * @param integrationName (required) + * @return ApiResponse<List<Tag>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getTagsForIntegrationWithHttpInfo(String name, String integrationName) throws ApiException { + Call call = getTagsForIntegrationValidateBeforeCall(name, integrationName, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get tags by Integration (asynchronously) + * + * @param name (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getTagsForIntegrationAsync(String name, String integrationName, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getTagsForIntegrationValidateBeforeCall(name, integrationName, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getTagsForIntegrationProvider + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getTagsForIntegrationProviderCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/tags".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getTagsForIntegrationProviderValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getTagsForIntegrationProvider(Async)"); + } + + Call call = getTagsForIntegrationProviderCall(name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get tags by Integration Provider + * + * @param name (required) + * @return List<Tag> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getTagsForIntegrationProvider(String name) throws ApiException { + ApiResponse> resp = getTagsForIntegrationProviderWithHttpInfo(name); + return resp.getData(); + } + + /** + * Get tags by Integration Provider + * + * @param name (required) + * @return ApiResponse<List<Tag>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getTagsForIntegrationProviderWithHttpInfo(String name) throws ApiException { + Call call = getTagsForIntegrationProviderValidateBeforeCall(name, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get tags by Integration Provider (asynchronously) + * + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getTagsForIntegrationProviderAsync(String name, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getTagsForIntegrationProviderValidateBeforeCall(name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getTokenUsageForIntegration + * @param name (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getTokenUsageForIntegrationCall(String name, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/{integration_name}/metrics".replaceAll("\\{" + "name" + "\\}", + apiClient.escapeString(name)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getTokenUsageForIntegrationValidateBeforeCall(String name, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getTokenUsageForIntegration(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling getTokenUsageForIntegration(Async)"); + } + + Call call = getTokenUsageForIntegrationCall(name, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Token Usage by Integration + * + * @param name (required) + * @param integrationName (required) + * @return Integer + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Integer getTokenUsageForIntegration(String name, String integrationName) throws ApiException { + ApiResponse resp = getTokenUsageForIntegrationWithHttpInfo(name, integrationName); + return resp.getData(); + } + + /** + * Get Token Usage by Integration + * + * @param name (required) + * @param integrationName (required) + * @return ApiResponse<Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getTokenUsageForIntegrationWithHttpInfo(String name, String integrationName) throws ApiException { + Call call = getTokenUsageForIntegrationValidateBeforeCall(name, integrationName, null, null); + Type localVarReturnType = new TypeReference() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Token Usage by Integration (asynchronously) + * + * @param name (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getTokenUsageForIntegrationAsync(String name, String integrationName, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getTokenUsageForIntegrationValidateBeforeCall(name, integrationName, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getTokenUsageForIntegrationProvider + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getTokenUsageForIntegrationProviderCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/metrics".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getTokenUsageForIntegrationProviderValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getTokenUsageForIntegrationProvider(Async)"); + } + + Call call = getTokenUsageForIntegrationProviderCall(name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Token Usage by Integration Provider + * + * @param name (required) + * @return Map<String, String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Map getTokenUsageForIntegrationProvider(String name) throws ApiException { + ApiResponse> resp = getTokenUsageForIntegrationProviderWithHttpInfo(name); + return resp.getData(); + } + + /** + * Get Token Usage by Integration Provider + * + * @param name (required) + * @return ApiResponse<Map<String, String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getTokenUsageForIntegrationProviderWithHttpInfo(String name) throws ApiException { + Call call = getTokenUsageForIntegrationProviderValidateBeforeCall(name, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Token Usage by Integration Provider (asynchronously) + * + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getTokenUsageForIntegrationProviderAsync(String name, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getTokenUsageForIntegrationProviderValidateBeforeCall(name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for putTagForIntegration + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call putTagForIntegrationCall(List body, String name, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/{integration_name}/tags".replaceAll("\\{" + "name" + "\\}", + apiClient.escapeString(name)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call putTagForIntegrationValidateBeforeCall(List body, String name, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling putTagForIntegration(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling putTagForIntegration(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling putTagForIntegration(Async)"); + } + + Call call = putTagForIntegrationCall(body, name, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Put a tag to Integration + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void putTagForIntegration(List body, String name, String integrationName) throws ApiException { + putTagForIntegrationWithHttpInfo(body, name, integrationName); + } + + /** + * Put a tag to Integration + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse putTagForIntegrationWithHttpInfo(List body, String name, String integrationName) throws ApiException { + Call call = putTagForIntegrationValidateBeforeCall(body, name, integrationName, null, null); + return apiClient.execute(call); + } + + /** + * Put a tag to Integration (asynchronously) + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call putTagForIntegrationAsync(List body, String name, String integrationName, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = putTagForIntegrationValidateBeforeCall(body, name, integrationName, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for putTagForIntegrationProvider + * @param body (required) + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call putTagForIntegrationProviderCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/tags".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call putTagForIntegrationProviderValidateBeforeCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling putTagForIntegrationProvider(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling putTagForIntegrationProvider(Async)"); + } + + Call call = putTagForIntegrationProviderCall(body, name, progressListener, progressRequestListener); + return call; + + } + + /** + * Put a tag to Integration Provider + * + * @param body (required) + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void putTagForIntegrationProvider(List body, String name) throws ApiException { + putTagForIntegrationProviderWithHttpInfo(body, name); + } + + /** + * Put a tag to Integration Provider + * + * @param body (required) + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse putTagForIntegrationProviderWithHttpInfo(List body, String name) throws ApiException { + Call call = putTagForIntegrationProviderValidateBeforeCall(body, name, null, null); + return apiClient.execute(call); + } + + /** + * Put a tag to Integration Provider (asynchronously) + * + * @param body (required) + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call putTagForIntegrationProviderAsync(List body, String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = putTagForIntegrationProviderValidateBeforeCall(body, name, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for registerTokenUsage + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call registerTokenUsageCall(Integer body, String name, String integrationName, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/{integration_name}/metrics".replaceAll("\\{" + "name" + "\\}", + apiClient.escapeString(name)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call registerTokenUsageValidateBeforeCall(Integer body, String name, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling registerTokenUsage(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling registerTokenUsage(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling registerTokenUsage(Async)"); + } + + Call call = registerTokenUsageCall(body, name, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Register Token usage + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void registerTokenUsage(Integer body, String name, String integrationName) throws ApiException { + registerTokenUsageWithHttpInfo(body, name, integrationName); + } + + /** + * Register Token usage + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse registerTokenUsageWithHttpInfo(Integer body, String name, String integrationName) throws ApiException { + Call call = registerTokenUsageValidateBeforeCall(body, name, integrationName, null, null); + return apiClient.execute(call); + } + + /** + * Register Token usage (asynchronously) + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call registerTokenUsageAsync(Integer body, String name, String integrationName, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = registerTokenUsageValidateBeforeCall(body, name, integrationName, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for saveIntegrationApi + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call saveIntegrationApiCall(IntegrationApiUpdate body, String name, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}/integration/{integration_name}".replaceAll("\\{" + "name" + "\\}", + apiClient.escapeString(name)) + .replaceAll("\\{" + "integration_name" + "\\}", apiClient.escapeString(integrationName)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call saveIntegrationApiValidateBeforeCall(IntegrationApiUpdate body, String name, String integrationName, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling saveIntegrationApi(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling saveIntegrationApi(Async)"); + } + // verify the required parameter 'integrationName' is set + if (integrationName == null) { + throw new ApiException("Missing the required parameter 'integrationName' when calling saveIntegrationApi(Async)"); + } + + Call call = saveIntegrationApiCall(body, name, integrationName, progressListener, progressRequestListener); + return call; + + } + + /** + * Create or Update Integration + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void saveIntegrationApi(IntegrationApiUpdate body, String name, String integrationName) throws ApiException { + saveIntegrationApiWithHttpInfo(body, name, integrationName); + } + + /** + * Create or Update Integration + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse saveIntegrationApiWithHttpInfo(IntegrationApiUpdate body, String name, String integrationName) throws ApiException { + Call call = saveIntegrationApiValidateBeforeCall(body, name, integrationName, null, null); + return apiClient.execute(call); + } + + /** + * Create or Update Integration (asynchronously) + * + * @param body (required) + * @param name (required) + * @param integrationName (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call saveIntegrationApiAsync(IntegrationApiUpdate body, String name, String integrationName, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = saveIntegrationApiValidateBeforeCall(body, name, integrationName, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for saveIntegrationProvider + * @param body (required) + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call saveIntegrationProviderCall(IntegrationUpdate body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/integrations/provider/{name}".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call saveIntegrationProviderValidateBeforeCall(IntegrationUpdate body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling saveIntegrationProvider(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling saveIntegrationProvider(Async)"); + } + + Call call = saveIntegrationProviderCall(body, name, progressListener, progressRequestListener); + return call; + + } + + /** + * Create or Update Integration provider + * + * @param body (required) + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void saveIntegrationProvider(IntegrationUpdate body, String name) throws ApiException { + saveIntegrationProviderWithHttpInfo(body, name); + } + + /** + * Create or Update Integration provider + * + * @param body (required) + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse saveIntegrationProviderWithHttpInfo(IntegrationUpdate body, String name) throws ApiException { + Call call = saveIntegrationProviderValidateBeforeCall(body, name, null, null); + return apiClient.execute(call); + } + + /** + * Create or Update Integration provider (asynchronously) + * + * @param body (required) + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call saveIntegrationProviderAsync(IntegrationUpdate body, String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = saveIntegrationProviderValidateBeforeCall(body, name, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } +} diff --git a/src/main/java/io/orkes/conductor/client/http/api/PromptResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/PromptResourceApi.java new file mode 100644 index 00000000..45f94da5 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/http/api/PromptResourceApi.java @@ -0,0 +1,1045 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.http.api; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import io.orkes.conductor.client.ApiClient; +import io.orkes.conductor.client.http.ApiCallback; +import io.orkes.conductor.client.http.ApiException; +import io.orkes.conductor.client.http.ApiResponse; +import io.orkes.conductor.client.http.Pair; +import io.orkes.conductor.client.http.ProgressRequestBody; +import io.orkes.conductor.client.http.ProgressResponseBody; +import io.orkes.conductor.client.model.TagObject; +import io.orkes.conductor.client.model.integration.PromptTemplateTestRequest; +import io.orkes.conductor.client.model.integration.ai.PromptTemplate; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.squareup.okhttp.Call; + +public class PromptResourceApi { + + private ApiClient apiClient; + + public PromptResourceApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for deletePromptTemplate + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call deletePromptTemplateCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/prompts/{name}".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call deletePromptTemplateValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling deletePromptTemplate(Async)"); + } + + Call call = deletePromptTemplateCall(name, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete Template + * + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deletePromptTemplate(String name) throws ApiException { + deletePromptTemplateWithHttpInfo(name); + } + + /** + * Delete Template + * + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deletePromptTemplateWithHttpInfo(String name) throws ApiException { + Call call = deletePromptTemplateValidateBeforeCall(name, null, null); + return apiClient.execute(call); + } + + /** + * Delete Template (asynchronously) + * + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deletePromptTemplateAsync(String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deletePromptTemplateValidateBeforeCall(name, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for deleteTagForPromptTemplate + * @param body (required) + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call deleteTagForPromptTemplateCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/prompts/{name}/tags".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call deleteTagForPromptTemplateValidateBeforeCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling deleteTagForPromptTemplate(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling deleteTagForPromptTemplate(Async)"); + } + + Call call = deleteTagForPromptTemplateCall(body, name, progressListener, progressRequestListener); + return call; + + } + + /** + * Delete a tag for Prompt Template + * + * @param body (required) + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteTagForPromptTemplate(List body, String name) throws ApiException { + deleteTagForPromptTemplateWithHttpInfo(body, name); + } + + /** + * Delete a tag for Prompt Template + * + * @param body (required) + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteTagForPromptTemplateWithHttpInfo(List body, String name) throws ApiException { + Call call = deleteTagForPromptTemplateValidateBeforeCall(body, name, null, null); + return apiClient.execute(call); + } + + /** + * Delete a tag for Prompt Template (asynchronously) + * + * @param body (required) + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteTagForPromptTemplateAsync(List body, String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = deleteTagForPromptTemplateValidateBeforeCall(body, name, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for getPromptTemplate + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getPromptTemplateCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/prompts/{name}".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getPromptTemplateValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getPromptTemplate(Async)"); + } + + Call call = getPromptTemplateCall(name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get Template + * + * @param name (required) + * @return PromptTemplate + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public PromptTemplate getPromptTemplate(String name) throws ApiException { + ApiResponse resp = getPromptTemplateWithHttpInfo(name); + return resp.getData(); + } + + /** + * Get Template + * + * @param name (required) + * @return ApiResponse<PromptTemplate> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getPromptTemplateWithHttpInfo(String name) throws ApiException { + Call call = getPromptTemplateValidateBeforeCall(name, null, null); + Type localVarReturnType = new TypeReference() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Template (asynchronously) + * + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getPromptTemplateAsync(String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getPromptTemplateValidateBeforeCall(name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getPromptTemplates + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getPromptTemplatesCall(final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/prompts"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getPromptTemplatesValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + Call call = getPromptTemplatesCall(progressListener, progressRequestListener); + return call; + + } + + /** + * Get Templates + * + * @return List<PromptTemplate> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getPromptTemplates() throws ApiException { + ApiResponse> resp = getPromptTemplatesWithHttpInfo(); + return resp.getData(); + } + + /** + * Get Templates + * + * @return ApiResponse<List<PromptTemplate>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getPromptTemplatesWithHttpInfo() throws ApiException { + Call call = getPromptTemplatesValidateBeforeCall(null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get Templates (asynchronously) + * + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getPromptTemplatesAsync(final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getPromptTemplatesValidateBeforeCall(progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for getTagsForPromptTemplate + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call getTagsForPromptTemplateCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/prompts/{name}/tags".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call getTagsForPromptTemplateValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getTagsForPromptTemplate(Async)"); + } + + Call call = getTagsForPromptTemplateCall(name, progressListener, progressRequestListener); + return call; + + } + + /** + * Get tags by Prompt Template + * + * @param name (required) + * @return List<Tag> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getTagsForPromptTemplate(String name) throws ApiException { + ApiResponse> resp = getTagsForPromptTemplateWithHttpInfo(name); + return resp.getData(); + } + + /** + * Get tags by Prompt Template + * + * @param name (required) + * @return ApiResponse<List<Tag>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getTagsForPromptTemplateWithHttpInfo(String name) throws ApiException { + Call call = getTagsForPromptTemplateValidateBeforeCall(name, null, null); + Type localVarReturnType = new TypeReference>() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get tags by Prompt Template (asynchronously) + * + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getTagsForPromptTemplateAsync(String name, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getTagsForPromptTemplateValidateBeforeCall(name, progressListener, progressRequestListener); + Type localVarReturnType = new TypeReference>() { + }.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for putTagForPromptTemplate + * @param body (required) + * @param name (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call putTagForPromptTemplateCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/prompts/{name}/tags".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call putTagForPromptTemplateValidateBeforeCall(List body, String name, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling putTagForPromptTemplate(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling putTagForPromptTemplate(Async)"); + } + + Call call = putTagForPromptTemplateCall(body, name, progressListener, progressRequestListener); + return call; + + } + + /** + * Put a tag to Prompt Template + * + * @param body (required) + * @param name (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void putTagForPromptTemplate(List body, String name) throws ApiException { + putTagForPromptTemplateWithHttpInfo(body, name); + } + + /** + * Put a tag to Prompt Template + * + * @param body (required) + * @param name (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse putTagForPromptTemplateWithHttpInfo(List body, String name) throws ApiException { + Call call = putTagForPromptTemplateValidateBeforeCall(body, name, null, null); + return apiClient.execute(call); + } + + /** + * Put a tag to Prompt Template (asynchronously) + * + * @param body (required) + * @param name (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call putTagForPromptTemplateAsync(List body, String name, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = putTagForPromptTemplateValidateBeforeCall(body, name, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + /** + * Build call for savePromptTemplate + * @param body (required) + * @param description (required) + * @param name (required) + * @param models (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public Call savePromptTemplateCall(String body, String description, String name, List models, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/prompts/{name}".replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name)); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (description != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("description", description)); + } + if (models != null) { + localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("multi", "models", models)); + } + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private Call savePromptTemplateValidateBeforeCall(String body, String description, String name, List models, + final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling savePromptTemplate(Async)"); + } + // verify the required parameter 'description' is set + if (description == null) { + throw new ApiException("Missing the required parameter 'description' when calling savePromptTemplate(Async)"); + } + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling savePromptTemplate(Async)"); + } + + Call call = savePromptTemplateCall(body, description, name, models, progressListener, progressRequestListener); + return call; + + } + + /** + * Create or Update Template + * + * @param body (required) + * @param description (required) + * @param name (required) + * @param models (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void savePromptTemplate(String body, String description, String name, List models) throws ApiException { + savePromptTemplateWithHttpInfo(body, description, name, models); + } + + /** + * Create or Update Template + * + * @param body (required) + * @param description (required) + * @param name (required) + * @param models (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse savePromptTemplateWithHttpInfo(String body, String description, String name, List models) throws ApiException { + Call call = savePromptTemplateValidateBeforeCall(body, description, name, models, null, null); + return apiClient.execute(call); + } + + /** + * Create or Update Template (asynchronously) + * + * @param body (required) + * @param description (required) + * @param name (required) + * @param models (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call savePromptTemplateAsync(String body, String description, String name, List models, final ApiCallback callback) + throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = savePromptTemplateValidateBeforeCall(body, description, name, models, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + + @SuppressWarnings("rawtypes") + private Call testMessageTemplateValidateBeforeCall(PromptTemplateTestRequest body, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testMessageTemplate(Async)"); + } + + Call call = testMessageTemplateCall(body, progressListener, progressRequestListener); + return call; + + } + + public Call testMessageTemplateCall(PromptTemplateTestRequest body, final ProgressResponseBody.ProgressListener progressListener, + final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/prompts/test"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if (progressListener != null) { + apiClient.getHttpClient() + .networkInterceptors() + .add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, + localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Test Prompt Template + * + * @param body (required) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public String testMessageTemplate(PromptTemplateTestRequest body) throws ApiException { + ApiResponse resp = testMessageTemplateWithHttpInfo(body); + return resp.getData(); + } + + /** + * Test Prompt Template + * + * @param body (required) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse testMessageTemplateWithHttpInfo(PromptTemplateTestRequest body) throws ApiException { + Call call = testMessageTemplateValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeReference() { + }.getType(); + return apiClient.execute(call, localVarReturnType); + } + +} diff --git a/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java index 8035ee25..50498b8a 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/SchedulerResourceApi.java @@ -22,6 +22,7 @@ import io.orkes.conductor.client.ApiClient; import io.orkes.conductor.client.http.*; import io.orkes.conductor.client.model.SaveScheduleRequest; +import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecution; import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel; import io.orkes.conductor.client.model.TagObject; import io.orkes.conductor.client.model.WorkflowSchedule; @@ -1331,6 +1332,13 @@ public SearchResultWorkflowScheduleExecutionModel searchV22( return resp.getData(); } + public SearchResultWorkflowScheduleExecution search( + Integer start, Integer size, String sort, String freeText, String query) + throws ApiException { + ApiResponse resp = searchWithHttpInfo(start, size, sort, freeText, query); + return resp.getData(); + } + /** * Search for workflows based on payload and other parameters use sort options as * sort=<field>:ASC|DESC e.g. sort=name&sort=workflowId:DESC. If order @@ -1355,6 +1363,16 @@ private ApiResponse searchV22WithHtt return apiClient.execute(call, localVarReturnType); } + private ApiResponse searchWithHttpInfo( + Integer start, Integer size, String sort, String freeText, String query) + throws ApiException { + com.squareup.okhttp.Call call = + searchV22ValidateBeforeCall(start, size, sort, freeText, query, null, null); + Type localVarReturnType = + new TypeReference() {}.getType(); + return apiClient.execute(call, localVarReturnType); + } + /** * Build call for testTimeout * diff --git a/src/main/java/io/orkes/conductor/client/model/Action.java b/src/main/java/io/orkes/conductor/client/model/Action.java deleted file mode 100644 index f321e7b2..00000000 --- a/src/main/java/io/orkes/conductor/client/model/Action.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright 2022 Orkes, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.orkes.conductor.client.model; - -import java.util.Objects; - -import com.google.gson.annotations.SerializedName; -import io.swagger.v3.oas.annotations.media.Schema; - -/** Action */ -public class Action { - /** Gets or Sets action */ - public enum ActionEnum { - START_WORKFLOW("start_workflow"), - COMPLETE_TASK("complete_task"), - FAIL_TASK("fail_task"), - TERMINATE_WORKFLOW("terminate_workflow"), - UPDATE_WORKFLOW_VARIABLES("update_workflow_variables"); - - private String value; - - ActionEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ActionEnum fromValue(String input) { - for (ActionEnum b : ActionEnum.values()) { - if (b.value.equals(input)) { - return b; - } - } - return null; - } - } - - @SerializedName("action") - private ActionEnum action = null; - - @SerializedName("complete_task") - private TaskDetails completeTask = null; - - @SerializedName("expandInlineJSON") - private Boolean expandInlineJSON = null; - - @SerializedName("fail_task") - private TaskDetails failTask = null; - - @SerializedName("start_workflow") - private StartWorkflow startWorkflow = null; - - @SerializedName("terminate_workflow") - private TerminateWorkflow terminateWorkflow = null; - - @SerializedName("update_workflow_variables") - private UpdateWorkflowVariables updateWorkflowVariables = null; - - public Action action(ActionEnum action) { - this.action = action; - return this; - } - - /** - * Get action - * - * @return action - */ - @Schema(description = "") - public ActionEnum getAction() { - return action; - } - - public void setAction(ActionEnum action) { - this.action = action; - } - - public Action completeTask(TaskDetails completeTask) { - this.completeTask = completeTask; - return this; - } - - /** - * Get completeTask - * - * @return completeTask - */ - @Schema(description = "") - public TaskDetails getCompleteTask() { - return completeTask; - } - - public void setCompleteTask(TaskDetails completeTask) { - this.completeTask = completeTask; - } - - public Action expandInlineJSON(Boolean expandInlineJSON) { - this.expandInlineJSON = expandInlineJSON; - return this; - } - - /** - * Get expandInlineJSON - * - * @return expandInlineJSON - */ - @Schema(description = "") - public Boolean isExpandInlineJSON() { - return expandInlineJSON; - } - - public void setExpandInlineJSON(Boolean expandInlineJSON) { - this.expandInlineJSON = expandInlineJSON; - } - - public Action failTask(TaskDetails failTask) { - this.failTask = failTask; - return this; - } - - /** - * Get failTask - * - * @return failTask - */ - @Schema(description = "") - public TaskDetails getFailTask() { - return failTask; - } - - public void setFailTask(TaskDetails failTask) { - this.failTask = failTask; - } - - public Action startWorkflow(StartWorkflow startWorkflow) { - this.startWorkflow = startWorkflow; - return this; - } - - /** - * Get startWorkflow - * - * @return startWorkflow - */ - @Schema(description = "") - public StartWorkflow getStartWorkflow() { - return startWorkflow; - } - - public void setStartWorkflow(StartWorkflow startWorkflow) { - this.startWorkflow = startWorkflow; - } - - public Action terminateWorkflow(TerminateWorkflow terminateWorkflow) { - this.terminateWorkflow = terminateWorkflow; - return this; - } - - /** - * Get terminateWorkflow - * - * @return terminateWorkflow - */ - @Schema(description = "") - public TerminateWorkflow getTerminateWorkflow() { - return terminateWorkflow; - } - - public void setTerminateWorkflow(TerminateWorkflow terminateWorkflow) { - this.terminateWorkflow = terminateWorkflow; - } - - public Action updateWorkflowVariables(UpdateWorkflowVariables updateWorkflowVariables) { - this.updateWorkflowVariables = updateWorkflowVariables; - return this; - } - - /** - * Get updateWorkflowVariables - * - * @return updateWorkflowVariables - */ - @Schema(description = "") - public UpdateWorkflowVariables getUpdateWorkflowVariables() { - return updateWorkflowVariables; - } - - public void setUpdateWorkflowVariables(UpdateWorkflowVariables updateWorkflowVariables) { - this.updateWorkflowVariables = updateWorkflowVariables; - } - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Action action = (Action) o; - return Objects.equals(this.action, action.action) - && Objects.equals(this.completeTask, action.completeTask) - && Objects.equals(this.expandInlineJSON, action.expandInlineJSON) - && Objects.equals(this.failTask, action.failTask) - && Objects.equals(this.startWorkflow, action.startWorkflow) - && Objects.equals(this.terminateWorkflow, action.terminateWorkflow) - && Objects.equals(this.updateWorkflowVariables, action.updateWorkflowVariables); - } - - @Override - public int hashCode() { - return Objects.hash( - action, - completeTask, - expandInlineJSON, - failTask, - startWorkflow, - terminateWorkflow, - updateWorkflowVariables); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Action {\n"); - - sb.append(" action: ").append(toIndentedString(action)).append("\n"); - sb.append(" completeTask: ").append(toIndentedString(completeTask)).append("\n"); - sb.append(" expandInlineJSON: ").append(toIndentedString(expandInlineJSON)).append("\n"); - sb.append(" failTask: ").append(toIndentedString(failTask)).append("\n"); - sb.append(" startWorkflow: ").append(toIndentedString(startWorkflow)).append("\n"); - sb.append(" terminateWorkflow: ") - .append(toIndentedString(terminateWorkflow)) - .append("\n"); - sb.append(" updateWorkflowVariables: ") - .append(toIndentedString(updateWorkflowVariables)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/src/main/java/io/orkes/conductor/client/model/SearchResultTaskSummary.java b/src/main/java/io/orkes/conductor/client/model/SearchResultTaskSummary.java index d21fa649..ae8df3c2 100644 --- a/src/main/java/io/orkes/conductor/client/model/SearchResultTaskSummary.java +++ b/src/main/java/io/orkes/conductor/client/model/SearchResultTaskSummary.java @@ -1,9 +1,22 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ package io.orkes.conductor.client.model; -import java.util.Objects; -import io.swagger.v3.oas.annotations.media.Schema; import java.util.ArrayList; import java.util.List; +import java.util.Objects; + +import io.swagger.v3.oas.annotations.media.Schema; /** * SearchResultTaskSummary */ diff --git a/src/main/java/io/orkes/conductor/client/model/SearchResultWorkflowScheduleExecution.java b/src/main/java/io/orkes/conductor/client/model/SearchResultWorkflowScheduleExecution.java new file mode 100644 index 00000000..982156f2 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/SearchResultWorkflowScheduleExecution.java @@ -0,0 +1,25 @@ +/* + * Copyright 2022 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model; + +import java.util.List; + +import lombok.Data; + +@Data +public class SearchResultWorkflowScheduleExecution { + private List results; + + private Long totalHits; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/TaskSummary.java b/src/main/java/io/orkes/conductor/client/model/TaskSummary.java index f6e84fcc..7ddb21ed 100644 --- a/src/main/java/io/orkes/conductor/client/model/TaskSummary.java +++ b/src/main/java/io/orkes/conductor/client/model/TaskSummary.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Netflix, Inc. + * Copyright 2020 Orkes, Inc. *

* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -12,16 +12,17 @@ */ package io.orkes.conductor.client.model; -import com.netflix.conductor.common.metadata.tasks.Task; -import com.netflix.conductor.common.metadata.tasks.Task.Status; -import com.netflix.conductor.common.utils.SummaryUtil; -import org.apache.commons.lang3.StringUtils; - import java.text.SimpleDateFormat; import java.util.Date; import java.util.Objects; import java.util.TimeZone; +import org.apache.commons.lang3.StringUtils; + +import com.netflix.conductor.common.metadata.tasks.Task; +import com.netflix.conductor.common.metadata.tasks.Task.Status; +import com.netflix.conductor.common.utils.SummaryUtil; + public class TaskSummary { /** The time should be stored as GMT */ diff --git a/src/main/java/io/orkes/conductor/client/model/integration/Category.java b/src/main/java/io/orkes/conductor/client/model/integration/Category.java new file mode 100644 index 00000000..c970e140 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/Category.java @@ -0,0 +1,27 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration; + +public enum Category { + + API, + + AI_MODEL, + + VECTOR_DB, + + RELATIONAL_DB, + + MESSAGE_BROKER + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/Integration.java b/src/main/java/io/orkes/conductor/client/model/integration/Integration.java new file mode 100644 index 00000000..f8f33bb6 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/Integration.java @@ -0,0 +1,38 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration; + +import java.util.List; +import java.util.Map; + +import io.orkes.conductor.client.model.TagObject; + +import lombok.Data; + +@Data +public class Integration { + + private Category category; + private Map configuration; + private String createdBy; + private Long createdOn; + private String description; + private Boolean enabled; + private long modelsCount; + private String name; + private List tags; + private String type; + private String updatedBy; + private Long updatedOn; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/IntegrationApi.java b/src/main/java/io/orkes/conductor/client/model/integration/IntegrationApi.java new file mode 100644 index 00000000..7f50d1df --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/IntegrationApi.java @@ -0,0 +1,36 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration; + +import java.util.List; +import java.util.Map; + +import io.orkes.conductor.client.model.TagObject; + +import lombok.Data; + +@Data +public class IntegrationApi { + + private String api; + private Map configuration; + private String createdBy; + private Long createdOn; + private String description; + private Boolean enabled; + private String integrationName; + private List tags; + private String updatedBy; + private Long updatedOn; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/IntegrationApiUpdate.java b/src/main/java/io/orkes/conductor/client/model/integration/IntegrationApiUpdate.java new file mode 100644 index 00000000..375c358c --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/IntegrationApiUpdate.java @@ -0,0 +1,26 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration; + +import java.util.Map; + +import lombok.Data; + +@Data +public class IntegrationApiUpdate { + + private Map configuration; + private String description; + private Boolean enabled; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/IntegrationDef.java b/src/main/java/io/orkes/conductor/client/model/integration/IntegrationDef.java new file mode 100644 index 00000000..75f61dbf --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/IntegrationDef.java @@ -0,0 +1,30 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration; + +import java.util.List; + +import lombok.Data; + +@Data +public class IntegrationDef { + + private Category category; + private String categoryLabel; + private String description; + private Boolean enabled; + private String iconName; + private String name; + private List tags; + private String type; +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/IntegrationUpdate.java b/src/main/java/io/orkes/conductor/client/model/integration/IntegrationUpdate.java new file mode 100644 index 00000000..1c65850e --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/IntegrationUpdate.java @@ -0,0 +1,28 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration; + +import java.util.Map; + +import lombok.Data; + +@Data +public class IntegrationUpdate { + + private Category category; + private Map configuration; + private String description; + private Boolean enabled; + private String type; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/PromptTemplateTestRequest.java b/src/main/java/io/orkes/conductor/client/model/integration/PromptTemplateTestRequest.java new file mode 100644 index 00000000..3acf1c56 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/PromptTemplateTestRequest.java @@ -0,0 +1,31 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration; + +import java.util.List; +import java.util.Map; + +import lombok.Data; + +@Data +public class PromptTemplateTestRequest { + + private String llmProvider; + private String model; + private String prompt; + private Map promptVariables; + private List stopWords; + private Double temperature; + private Double topP; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/ChatCompletion.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/ChatCompletion.java new file mode 100644 index 00000000..74896dba --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/ChatCompletion.java @@ -0,0 +1,34 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import java.util.List; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class ChatCompletion extends LLMWorkerInput { + private List messages; + + //Starting template + //e.g. start by saying: + // you are a helpful assistant, who does not deviate from the goals" + //You do not respond to questions that are not related to the topic + //Any answer you give - should be related to the following topic: weather + // + // + private String instructions; + private boolean jsonOutput; +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/ChatMessage.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/ChatMessage.java new file mode 100644 index 00000000..3e5fc285 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/ChatMessage.java @@ -0,0 +1,30 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ChatMessage { + + public enum Actor { + user, assistant, system, human, chatbot + } + + String role; + String message; +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/EmbeddingRequest.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/EmbeddingRequest.java new file mode 100644 index 00000000..bb717b7b --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/EmbeddingRequest.java @@ -0,0 +1,24 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import lombok.Data; + +@Data +public class EmbeddingRequest { + private String llmProvider; + private String model; + private String text; + private Integer dimensions; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/IndexDocInput.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/IndexDocInput.java new file mode 100644 index 00000000..a31ad317 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/IndexDocInput.java @@ -0,0 +1,55 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import java.util.Map; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class IndexDocInput { + + private String llmProvider; + private String model; + private String embeddingModelProvider; + private String embeddingModel; + private String vectorDB; + private String text; + private String docId; + private String url; + private String mediaType; + private String namespace; + private String index; + private int chunkSize; + private int chunkOverlap; + private Map metadata; + private Integer dimensions; + public String getNamespace() { + if(namespace == null) { + return docId; + } + return namespace; + } + + public int getChunkSize() { + return chunkSize > 0 ? chunkSize : 12000; + } + + public int getChunkOverlap() { + return chunkOverlap > 0 ? chunkOverlap : 400; + } +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/IndexedDoc.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/IndexedDoc.java new file mode 100644 index 00000000..6ac62754 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/IndexedDoc.java @@ -0,0 +1,38 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import java.util.HashMap; +import java.util.Map; + +import lombok.Data; + + +@Data +public class IndexedDoc { + private String docId; + private String parentDocId; + private String text; + private double score; + private Map metadata = new HashMap<>(); + + public IndexedDoc(String docId, String parentDocId, String text, double score) { + this.docId = docId; + this.parentDocId = parentDocId; + this.text = text; + this.score = score; + } + + public IndexedDoc() { + } +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/LLMResponse.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/LLMResponse.java new file mode 100644 index 00000000..33455761 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/LLMResponse.java @@ -0,0 +1,26 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class LLMResponse { + private Object result; + private String finishReason; + private int tokenUsed; + + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/LLMWorkerInput.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/LLMWorkerInput.java new file mode 100644 index 00000000..c4746fbd --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/LLMWorkerInput.java @@ -0,0 +1,33 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import java.util.List; + +import lombok.Data; + +@Data +public class LLMWorkerInput { + + private String llmProvider; + private String model; + private String embeddingModel; + private String embeddingModelProvider; + private String prompt; + private double temperature = 0.1; + private double topP = 0.9; + private List stopWords; + private int maxTokens; + private int maxResults = 1; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/PromptTemplate.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/PromptTemplate.java new file mode 100644 index 00000000..6d0bd88d --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/PromptTemplate.java @@ -0,0 +1,34 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import java.util.List; + +import io.orkes.conductor.client.model.TagObject; + +import lombok.Data; + +@Data +public class PromptTemplate { + + private String createdBy; + private Long createdOn; + private String description; + private List integrations; + private String name; + private List tags; + private String template; + private String updatedBy; + private Long updatedOn; + private List variables; +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/PromptTemplateTestRequest.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/PromptTemplateTestRequest.java new file mode 100644 index 00000000..69a56590 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/PromptTemplateTestRequest.java @@ -0,0 +1,32 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import lombok.Data; + +@Data +public class PromptTemplateTestRequest { + + private String llmProvider; + private String model; + private String prompt; + private Map promptVariables = new HashMap<>(); + private double temperature = 0.1; + private double topP = 0.9; + private List stopWords; + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/StoreEmbeddingsInput.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/StoreEmbeddingsInput.java new file mode 100644 index 00000000..feaadc9f --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/StoreEmbeddingsInput.java @@ -0,0 +1,31 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import java.util.List; +import java.util.Map; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class StoreEmbeddingsInput extends LLMWorkerInput { + + private String vectorDB; + private String index; + private String namespace; + private List embeddings; + private String id; + private Map metadata; +} \ No newline at end of file diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/TextCompletion.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/TextCompletion.java new file mode 100644 index 00000000..46ee461f --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/TextCompletion.java @@ -0,0 +1,24 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Data +@ToString +@EqualsAndHashCode(callSuper = true) +public class TextCompletion extends LLMWorkerInput { + +} diff --git a/src/main/java/io/orkes/conductor/client/model/integration/ai/VectorDBInput.java b/src/main/java/io/orkes/conductor/client/model/integration/ai/VectorDBInput.java new file mode 100644 index 00000000..847695a3 --- /dev/null +++ b/src/main/java/io/orkes/conductor/client/model/integration/ai/VectorDBInput.java @@ -0,0 +1,32 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.model.integration.ai; + +import java.util.List; +import java.util.Map; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class VectorDBInput extends LLMWorkerInput { + + private String vectorDB; + private String index; + private String namespace; + private List embeddings; + private String query; + private Map metadata; + private Integer dimensions; +} \ No newline at end of file diff --git a/src/test/java/io/orkes/conductor/client/MetadataFromFiles.java b/src/test/java/io/orkes/conductor/client/MetadataFromFiles.java deleted file mode 100644 index df7a6e32..00000000 --- a/src/test/java/io/orkes/conductor/client/MetadataFromFiles.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Orkes, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.orkes.conductor.client; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import com.netflix.conductor.common.metadata.tasks.TaskDef; - -import io.orkes.conductor.client.util.ApiUtil; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class MetadataFromFiles { - private final MetadataClient metadataClient; - - private final ObjectMapper objectMapper = new ObjectMapper(); - - public MetadataFromFiles() { - OrkesClients orkesClients = ApiUtil.getOrkesClient(); - metadataClient = orkesClients.getMetadataClient(); - } - - @Test - @DisplayName("load tasks from file and store definition in conductor") - public void loadAndStoreTaskDefinitions() throws IOException { - InputStream inputStream = MetadataFromFiles.class.getResourceAsStream("/sample_tasks.json"); - List taskDefs = objectMapper.readValue(inputStream, List.class); - metadataClient.registerTaskDefs(taskDefs); - } -} diff --git a/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java b/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java index 14f832a8..5fdb845a 100644 --- a/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java @@ -39,11 +39,11 @@ void testMethods() { schedulerClient.deleteSchedule(NAME); assertTrue(schedulerClient.getNextFewSchedules(CRON_EXPRESSION, 0L, 0L, 0).isEmpty()); schedulerClient.saveSchedule(getSaveScheduleRequest()); - assertEquals(1, schedulerClient.getAllSchedules(Commons.WORKFLOW_NAME).size()); + assertTrue(schedulerClient.getAllSchedules(Commons.WORKFLOW_NAME).size() > 0); WorkflowSchedule workflowSchedule = schedulerClient.getSchedule(NAME); assertEquals(NAME, workflowSchedule.getName()); assertEquals(CRON_EXPRESSION, workflowSchedule.getCronExpression()); - assertFalse(schedulerClient.searchV22(0, 10, "ASC", "*", "").getResults().isEmpty()); + assertFalse(schedulerClient.search(0, 10, "ASC", "*", "").getResults().isEmpty()); schedulerClient.setSchedulerTags(getTagObject(), NAME); assertEquals(getTagObject(), schedulerClient.getSchedulerTags(NAME)); schedulerClient.deleteSchedulerTags(getTagObject(), NAME); diff --git a/src/test/java/io/orkes/conductor/client/api/TaskClientTests.java b/src/test/java/io/orkes/conductor/client/api/TaskClientTests.java index c66978c1..c42de13c 100644 --- a/src/test/java/io/orkes/conductor/client/api/TaskClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/TaskClientTests.java @@ -90,16 +90,16 @@ public void testUpdateByRefName() { int maxLoop = 10; int count = 0; while (!workflow.getStatus().isTerminal() && count < maxLoop) { - workflow.getTasks().stream().filter(t -> !t.getStatus().isTerminal()).forEach(running -> { + workflow.getTasks().stream().filter(t -> !t.getStatus().isTerminal() && t.getWorkflowTask().getType().equals("SIMPLE")).forEach(running -> { String referenceName = running.getReferenceTaskName(); - System.out.println("Updating " + referenceName); - taskClient.updateTask(workflowId, referenceName, TaskResult.Status.COMPLETED, Map.of("k", "value")); + System.out.println("Updating " + referenceName + ", and its status is " + running.getStatus()); + taskClient.updateTaskSync(workflowId, referenceName, TaskResult.Status.COMPLETED, Map.of("k", "value")); }); count++; Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); workflow = workflowClient.getWorkflow(workflowId, true); } - assertTrue(count < maxLoop); + assertTrue(count <= maxLoop, "count " + count + " is not less than maxLoop " + maxLoop); workflow = workflowClient.getWorkflow(workflowId, true); assertEquals(Workflow.WorkflowStatus.COMPLETED, workflow.getStatus()); } diff --git a/src/test/java/io/orkes/conductor/client/api/WorkflowClientTests.java b/src/test/java/io/orkes/conductor/client/api/WorkflowClientTests.java index 19acd123..7180fec5 100644 --- a/src/test/java/io/orkes/conductor/client/api/WorkflowClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/WorkflowClientTests.java @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; import com.netflix.conductor.common.metadata.tasks.TaskDef; -import com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest; import com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest; import com.netflix.conductor.common.metadata.workflow.WorkflowDef; import com.netflix.conductor.common.run.Workflow; @@ -31,7 +30,6 @@ import io.orkes.conductor.client.MetadataClient; import io.orkes.conductor.client.WorkflowClient; -import io.orkes.conductor.client.http.ApiException; import io.orkes.conductor.client.util.Commons; import io.orkes.conductor.client.util.TestUtil; diff --git a/src/test/java/io/orkes/conductor/client/ex/WorkflowManager.java b/src/test/java/io/orkes/conductor/client/ex/WorkflowManager.java new file mode 100644 index 00000000..e2d67d6a --- /dev/null +++ b/src/test/java/io/orkes/conductor/client/ex/WorkflowManager.java @@ -0,0 +1,120 @@ +/* + * Copyright 2024 Orkes, Inc. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package io.orkes.conductor.client.ex; + +import java.time.Duration; +import java.util.Map; + +import com.netflix.conductor.common.metadata.tasks.Task; +import com.netflix.conductor.common.metadata.tasks.TaskResult; +import com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest; +import com.netflix.conductor.common.run.SearchResult; +import com.netflix.conductor.common.run.Workflow; +import com.netflix.conductor.common.run.WorkflowSummary; +import com.netflix.conductor.sdk.workflow.def.ConductorWorkflow; +import com.netflix.conductor.sdk.workflow.def.tasks.Http; +import com.netflix.conductor.sdk.workflow.def.tasks.Wait; +import com.netflix.conductor.sdk.workflow.executor.WorkflowExecutor; + +import io.orkes.conductor.client.ApiClient; +import io.orkes.conductor.client.OrkesClients; +import io.orkes.conductor.client.TaskClient; +import io.orkes.conductor.client.WorkflowClient; + +public class WorkflowManager { + + + private OrkesClients orkesClients; + private WorkflowClient workflowClient; + private TaskClient taskClient; + + public WorkflowManager() { + var configuration = new ApiClient("http://localhost:8080/api", "api_key_user_03", "api_key_user_03"); + + this.orkesClients = new OrkesClients(configuration); + this.workflowClient = orkesClients.getWorkflowClient(); + this.taskClient = orkesClients.getTaskClient(); + } + + public String startWorkflow(WorkflowExecutor workflowExecutor) { + ConductorWorkflow workflow = new ConductorWorkflow<>(workflowExecutor); + workflow.setName("workflow_signals_demo"); + workflow.setVersion(1); + Wait waitForTwoSec = new Wait("wait_for_2_sec", Duration.ofSeconds(2)); + Http httpCall = new Http("call_remote_api"); + httpCall.url("https://orkes-api-tester.orkesconductor.com/api"); + + Wait waitForSignal = new Wait("wait_for_signal"); + + workflow.add(waitForTwoSec); + workflow.add(waitForSignal); + workflow.add(httpCall); + + workflow.registerWorkflow(true); + StartWorkflowRequest request = new StartWorkflowRequest(); + request.setVersion(1); + request.setName(workflow.getName()); + request.setInput(Map.of()); + + return workflowClient.startWorkflow(request); + } + + public void main() { + WorkflowExecutor workflowExecutor = orkesClients.getWorkflowExecutor(); + String workflowId = startWorkflow(workflowExecutor); + System.out.println("Started workflow with id " + workflowId); + + try { + Thread.sleep(3000); // Wait for 3 seconds + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + + Workflow workflow = workflowClient.getWorkflow(workflowId, true); + Task lastTask = workflow.getTasks().get(workflow.getTasks().size() - 1); + System.out.println("Workflow status is " + workflow.getStatus() + " and currently running task is " + lastTask.getReferenceTaskName()); + + workflowClient.terminateWorkflow(workflowId, "testing termination"); + + // Other operations like retry, update tasks, etc. + + // Example of task completion + TaskResult taskResult = new TaskResult(); + taskResult.setWorkflowInstanceId(workflowId); + taskResult.setTaskId(lastTask.getTaskId()); + taskResult.setStatus(TaskResult.Status.COMPLETED); + taskResult.setOutputData(Map.of("greetings", "hello from Orkes")); + taskClient.updateTask(taskResult); + + // Handling workflow lifecycle: terminate, restart, pause, resume + workflowClient.terminateWorkflow(workflowId, "terminating so we can do a restart"); + workflowClient.restart(workflowId, true); + workflowClient.pauseWorkflow(workflowId); + + try { + Thread.sleep(3000); // Simulating a wait + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + + workflowClient.resumeWorkflow(workflowId); + + // Search workflow examples + SearchResult searchResults = workflowClient.search(0, 100, "", "*", "correlationId = 'correlation_123'"); + System.out.println("Found " + searchResults.getTotalHits() + " executions with correlation_id 'correlation_123'"); + } + + public static void main(String[] args) { + new WorkflowManager().main(); + } +} diff --git a/src/test/java/io/orkes/conductor/client/sdk/WorkflowSDKTests.java b/src/test/java/io/orkes/conductor/client/sdk/WorkflowSDKTests.java index 949b4d5d..4593c531 100644 --- a/src/test/java/io/orkes/conductor/client/sdk/WorkflowSDKTests.java +++ b/src/test/java/io/orkes/conductor/client/sdk/WorkflowSDKTests.java @@ -38,6 +38,7 @@ public class WorkflowSDKTests { + @Test public void testCreateWorkflow() { ApiClient apiClient = ApiUtil.getApiClientWithCredentials(); diff --git a/src/test/java/io/orkes/conductor/client/secrets/manager/AzureSecretsManagerTests.java b/src/test/java/io/orkes/conductor/client/secrets/manager/AzureSecretsManagerTests.java deleted file mode 100644 index 9ed0d195..00000000 --- a/src/test/java/io/orkes/conductor/client/secrets/manager/AzureSecretsManagerTests.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2022 Orkes, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.orkes.conductor.client.secrets.manager; - -import org.junit.jupiter.api.Test; - -import io.orkes.conductor.client.secrets.manager.azure.AzureSecretsManager; -import io.orkes.conductor.client.util.ApiUtil; -import io.orkes.conductor.client.util.Commons; -import io.orkes.conductor.client.util.secrets.manager.SecretsManagerUtil; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class AzureSecretsManagerTests { - @Test - void testAzureSecretsManager() { - AzureSecretsManager azureSecretsManager = getAzureSecretsManager(); - SecretsManagerUtil.validateApiClientWithSecretsManager(azureSecretsManager); - } - - AzureSecretsManager getAzureSecretsManager() { - AzureSecretsManager azureSecretsManager = mock(AzureSecretsManager.class); - when(azureSecretsManager.getSecret(Commons.SECRET_MANAGER_KEY_PATH)) - .thenReturn(ApiUtil.getKeyId()); - when(azureSecretsManager.getSecret(Commons.SECRET_MANAGER_SECRET_PATH)) - .thenReturn(ApiUtil.getKeySecret()); - return azureSecretsManager; - } -} diff --git a/src/test/java/io/orkes/conductor/client/spring/Workers.java b/src/test/java/io/orkes/conductor/client/spring/MyWorkers.java similarity index 81% rename from src/test/java/io/orkes/conductor/client/spring/Workers.java rename to src/test/java/io/orkes/conductor/client/spring/MyWorkers.java index a4bdd95f..d781e18f 100644 --- a/src/test/java/io/orkes/conductor/client/spring/Workers.java +++ b/src/test/java/io/orkes/conductor/client/spring/MyWorkers.java @@ -18,13 +18,25 @@ import com.netflix.conductor.sdk.workflow.executor.task.TaskContext; import com.netflix.conductor.sdk.workflow.task.InputParam; +import com.netflix.conductor.sdk.workflow.task.OutputParam; import com.netflix.conductor.sdk.workflow.task.WorkerTask; @Component -public class Workers { - - @WorkerTask(value = "hello", threadCount = 1, pollingInterval = 99) - public String helloWorld(@InputParam("name") String name) { +public class MyWorkers { + + @WorkerTask("hello") + /** + * for the below method, the workflow task input should be like: + * { + * "name": "orkes", + * "age": 23 + * } + * output: + * { + * "greetings": "hello, Orkes" + * } + */ + public @OutputParam("greetings") String helloWorld(String name) { TaskContext context = TaskContext.get(); System.out.println(new Date() + ":: Poll count: " + context.getPollCount()); if (context.getPollCount() < 5) { @@ -37,7 +49,9 @@ public String helloWorld(@InputParam("name") String name) { @WorkerTask(value = "hello_again", pollingInterval = 333) public String helloAgain(@InputParam("name") String name) { + TaskContext context = TaskContext.get(); + System.out.println(new Date() + ":: Poll count: " + context.getPollCount()); if (context.getPollCount() < 5) { context.addLog("Not ready yet, poll count is only " + context.getPollCount()); diff --git a/src/test/java/io/orkes/conductor/client/util/ApiUtil.java b/src/test/java/io/orkes/conductor/client/util/ApiUtil.java index 91f2da93..40761258 100644 --- a/src/test/java/io/orkes/conductor/client/util/ApiUtil.java +++ b/src/test/java/io/orkes/conductor/client/util/ApiUtil.java @@ -18,9 +18,9 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; public class ApiUtil { - private static final String ENV_ROOT_URI = "SDK_INTEGRATION_TESTS_SERVER_API_URL"; - private static final String ENV_KEY_ID = "SDK_INTEGRATION_TESTS_SERVER_KEY_ID"; - private static final String ENV_SECRET = "SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET"; + private static final String ENV_ROOT_URI = "CONDUCTOR_SERVER_URL"; + private static final String ENV_KEY_ID = "CONDUCTOR_SERVER_AUTH_KEY"; + private static final String ENV_SECRET = "CONDUCTOR_SERVER_AUTH_SECRET"; public static OrkesClients getOrkesClient() { final ApiClient apiClient = getApiClientWithCredentials();