# Class ConnectionsClient

java.lang.Object
com.google.adk.tools.applicationintegrationtoolset.ConnectionsClient

public class ConnectionsClient extends Object
Utility class for interacting with the Google Cloud Connectors API.

This class provides methods to fetch connection details, schemas for entities and actions, and to generate OpenAPI specifications for creating tools based on these connections.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `ConnectionsClient.ActionSchema`
  Represents the schema for an action.
  `static class`
  `ConnectionsClient.ConnectionDetails`
  Represents details of a connection.
  `static class`
  `ConnectionsClient.EntitySchemaAndOperations`
  Represents the schema and available operations for an entity.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ConnectionsClient(String project, String location, String connection, String serviceAccountJson, HttpClient httpClient, CredentialsHelper credentialsHelper, com.fasterxml.jackson.databind.ObjectMapper objectMapper)`
  Initializes the ConnectionsClient.
  `ConnectionsClient(String project, String location, String connection, HttpClient httpClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `actionRequest(String action)`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `actionResponse(String action)`
  `Map<String,Object>`
  `connectorPayload(Map<String,Object> jsonSchema)`
  `Map<String,Object>`
  `convertJsonSchemaToOpenApiSchema(Map<String,Object> jsonSchema)`
  Converts a JSON Schema dictionary to an OpenAPI schema dictionary.
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `createOperation(String entity, String toolName, String toolInstructions)`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `createOperationRequest(String entity)`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `deleteOperation(String entity, String toolName, String toolInstructions)`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `deleteOperationRequest()`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `executeCustomQueryRequest()`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `getActionOperation(String action, String operation, String actionDisplayName, String toolName, String toolInstructions)`
  `ConnectionsClient.ActionSchema`
  `getActionSchema(String action)`
  Retrieves the input and output JSON schema for a given action.
  `ConnectionsClient.ConnectionDetails`
  `getConnectionDetails()`
  Retrieves service details for a given connection.
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `getConnectorBaseSpec()`
  `ConnectionsClient.EntitySchemaAndOperations`
  `getEntitySchemaAndOperations(String entity)`
  Retrieves the JSON schema and available operations for a given entity.
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `getOperation(String entity, String schemaAsString, String toolName, String toolInstructions)`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `getOperationRequest()`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `listOperation(String entity, String schemaAsString, String toolName, String toolInstructions)`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `listOperationRequest()`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `updateOperation(String entity, String toolName, String toolInstructions)`
  `static com.google.common.collect.ImmutableMap<String,Object>`
  `updateOperationRequest(String entity)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ConnectionsClient

    public ConnectionsClient(String project, String location, String connection, String serviceAccountJson, HttpClient httpClient, CredentialsHelper credentialsHelper, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    Initializes the ConnectionsClient.
    Parameters:
      `project` - The Google Cloud project ID.
      `location` - The Google Cloud location (e.g., us-central1).
      `connection` - The connection name.

  - ### ConnectionsClient

    public ConnectionsClient(String project, String location, String connection, HttpClient httpClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper)

- ## Method Details

  - ### getConnectionDetails

    public ConnectionsClient.ConnectionDetails getConnectionDetails() throws IOException, InterruptedException
    Retrieves service details for a given connection.
    Returns:
      A `ConnectionsClient.ConnectionDetails` object with the connection's info.
    Throws:
      `IOException` - If there is an issue with network communication or credentials.
      `InterruptedException` - If the thread is interrupted during the API call.

  - ### getEntitySchemaAndOperations

    public ConnectionsClient.EntitySchemaAndOperations getEntitySchemaAndOperations(String entity) throws IOException, InterruptedException
    Retrieves the JSON schema and available operations for a given entity.
    Parameters:
      `entity` - The entity name.
    Returns:
      A `ConnectionsClient.EntitySchemaAndOperations` object.
    Throws:
      `IOException` - If there is an issue with network communication or credentials.
      `InterruptedException` - If the thread is interrupted during polling.

  - ### getActionSchema

    public ConnectionsClient.ActionSchema getActionSchema(String action) throws IOException, InterruptedException
    Retrieves the input and output JSON schema for a given action.
    Parameters:
      `action` - The action name.
    Returns:
      An `ConnectionsClient.ActionSchema` object.
    Throws:
      `IOException` - If there is an issue with network communication or credentials.
      `InterruptedException` - If the thread is interrupted during polling.

  - ### convertJsonSchemaToOpenApiSchema

    public Map<String,Object> convertJsonSchemaToOpenApiSchema(Map<String,Object> jsonSchema)
    Converts a JSON Schema dictionary to an OpenAPI schema dictionary.
    Parameters:
      `jsonSchema` - The input JSON schema map.
    Returns:
      The converted OpenAPI schema map.

  - ### connectorPayload

    public Map<String,Object> connectorPayload(Map<String,Object> jsonSchema)

  - ### getConnectorBaseSpec

    public static com.google.common.collect.ImmutableMap<String,Object> getConnectorBaseSpec()

  - ### getActionOperation

    public static com.google.common.collect.ImmutableMap<String,Object> getActionOperation(String action, String operation, String actionDisplayName, String toolName, String toolInstructions)

  - ### listOperation

    public static com.google.common.collect.ImmutableMap<String,Object> listOperation(String entity, String schemaAsString, String toolName, String toolInstructions)

  - ### getOperation

    public static com.google.common.collect.ImmutableMap<String,Object> getOperation(String entity, String schemaAsString, String toolName, String toolInstructions)

  - ### createOperation

    public static com.google.common.collect.ImmutableMap<String,Object> createOperation(String entity, String toolName, String toolInstructions)

  - ### updateOperation

    public static com.google.common.collect.ImmutableMap<String,Object> updateOperation(String entity, String toolName, String toolInstructions)

  - ### deleteOperation

    public static com.google.common.collect.ImmutableMap<String,Object> deleteOperation(String entity, String toolName, String toolInstructions)

  - ### createOperationRequest

    public static com.google.common.collect.ImmutableMap<String,Object> createOperationRequest(String entity)

  - ### updateOperationRequest

    public static com.google.common.collect.ImmutableMap<String,Object> updateOperationRequest(String entity)

  - ### getOperationRequest

    public static com.google.common.collect.ImmutableMap<String,Object> getOperationRequest()

  - ### deleteOperationRequest

    public static com.google.common.collect.ImmutableMap<String,Object> deleteOperationRequest()

  - ### listOperationRequest

    public static com.google.common.collect.ImmutableMap<String,Object> listOperationRequest()

  - ### actionRequest

    public static com.google.common.collect.ImmutableMap<String,Object> actionRequest(String action)

  - ### actionResponse

    public static com.google.common.collect.ImmutableMap<String,Object> actionResponse(String action)

  - ### executeCustomQueryRequest

    public static com.google.common.collect.ImmutableMap<String,Object> executeCustomQueryRequest()