All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clinia.api.DatapartitionClient Maven / Gradle / Ivy

// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/clinia/api-clients-generation. DO NOT EDIT.

package com.clinia.api;

import com.clinia.ApiClient;
import com.clinia.config.*;
import com.clinia.config.ClientOptions;
import com.clinia.exceptions.*;
import com.clinia.model.common.*;
import com.clinia.model.datapartition.*;
import com.clinia.utils.*;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nonnull;

public class DatapartitionClient extends ApiClient {

  public DatapartitionClient(String workspaceId, String apiKey) {
    this(workspaceId, apiKey, null);
  }

  public DatapartitionClient(String workspaceId, String apiKey, ClientOptions options) {
    super(workspaceId, apiKey, "Datapartition", options, getDefaultHosts(workspaceId));
  }

  private static List getDefaultHosts(String workspaceId) {
    List hosts = new ArrayList<>();
    hosts.add(new Host("api." + workspaceId + ".clinia.cloud", EnumSet.of(CallType.READ)));
    hosts.add(new Host("api." + workspaceId + ".clinia.cloud", EnumSet.of(CallType.WRITE)));

    return hosts;
  }

  /**
   * Retrieves a resource from a data partition.
   *
   * @param partitionKey (required)
   * @param collectionKey (required)
   * @param resourceId The resource ID. Can also be an identifier with one of the following formats:
   *     - `{sourceKey}:{sourceRecordId}:source` (e.g. `mySourceA:123:source`). This is useful to
   *     fetch a record when knowing its source record id. - `mdm:{unifiedRecordId}:old` (e.g.
   *     `mdm:123:old`). This is useful to fetch a unified record id that does not exist anymore
   *     after being merged. (required)
   * @param includes List of relationship property key (included resources) to includes with the
   *     response. (optional)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1DomainResourceWithIncludes getCollectionResource(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String resourceId,
    List includes,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return LaunderThrowable.await(getCollectionResourceAsync(partitionKey, collectionKey, resourceId, includes, innerType, requestOptions));
  }

  /**
   * Retrieves a resource from a data partition.
   *
   * @param partitionKey (required)
   * @param collectionKey (required)
   * @param resourceId The resource ID. Can also be an identifier with one of the following formats:
   *     - `{sourceKey}:{sourceRecordId}:source` (e.g. `mySourceA:123:source`). This is useful to
   *     fetch a record when knowing its source record id. - `mdm:{unifiedRecordId}:old` (e.g.
   *     `mdm:123:old`). This is useful to fetch a unified record id that does not exist anymore
   *     after being merged. (required)
   * @param includes List of relationship property key (included resources) to includes with the
   *     response. (optional)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1DomainResourceWithIncludes getCollectionResource(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String resourceId,
    List includes,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.getCollectionResource(partitionKey, collectionKey, resourceId, includes, innerType, null);
  }

  /**
   * Retrieves a resource from a data partition.
   *
   * @param partitionKey (required)
   * @param collectionKey (required)
   * @param resourceId The resource ID. Can also be an identifier with one of the following formats:
   *     - `{sourceKey}:{sourceRecordId}:source` (e.g. `mySourceA:123:source`). This is useful to
   *     fetch a record when knowing its source record id. - `mdm:{unifiedRecordId}:old` (e.g.
   *     `mdm:123:old`). This is useful to fetch a unified record id that does not exist anymore
   *     after being merged. (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1DomainResourceWithIncludes getCollectionResource(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String resourceId,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return this.getCollectionResource(partitionKey, collectionKey, resourceId, null, innerType, requestOptions);
  }

  /**
   * Retrieves a resource from a data partition.
   *
   * @param partitionKey (required)
   * @param collectionKey (required)
   * @param resourceId The resource ID. Can also be an identifier with one of the following formats:
   *     - `{sourceKey}:{sourceRecordId}:source` (e.g. `mySourceA:123:source`). This is useful to
   *     fetch a record when knowing its source record id. - `mdm:{unifiedRecordId}:old` (e.g.
   *     `mdm:123:old`). This is useful to fetch a unified record id that does not exist anymore
   *     after being merged. (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1DomainResourceWithIncludes getCollectionResource(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String resourceId,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.getCollectionResource(partitionKey, collectionKey, resourceId, null, innerType, null);
  }

  /**
   * (asynchronously) Retrieves a resource from a data partition.
   *
   * @param partitionKey (required)
   * @param collectionKey (required)
   * @param resourceId The resource ID. Can also be an identifier with one of the following formats:
   *     - `{sourceKey}:{sourceRecordId}:source` (e.g. `mySourceA:123:source`). This is useful to
   *     fetch a record when knowing its source record id. - `mdm:{unifiedRecordId}:old` (e.g.
   *     `mdm:123:old`). This is useful to fetch a unified record id that does not exist anymore
   *     after being merged. (required)
   * @param includes List of relationship property key (included resources) to includes with the
   *     response. (optional)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> getCollectionResourceAsync(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String resourceId,
    List includes,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    Parameters.requireNonNull(partitionKey, "Parameter `partitionKey` is required when calling `getCollectionResource`.");

    Parameters.requireNonNull(collectionKey, "Parameter `collectionKey` is required when calling `getCollectionResource`.");

    Parameters.requireNonNull(resourceId, "Parameter `resourceId` is required when calling `getCollectionResource`.");

    HttpRequest request = HttpRequest
      .builder()
      .setPath("/partitions/{partitionKey}/v1/collections/{collectionKey}/resources/{resourceId}", partitionKey, collectionKey, resourceId)
      .setMethod("GET")
      .addQueryParameter("includes", includes)
      .build();
    return executeAsync(request, requestOptions, V1DomainResourceWithIncludes.class, innerType);
  }

  /**
   * (asynchronously) Retrieves a resource from a data partition.
   *
   * @param partitionKey (required)
   * @param collectionKey (required)
   * @param resourceId The resource ID. Can also be an identifier with one of the following formats:
   *     - `{sourceKey}:{sourceRecordId}:source` (e.g. `mySourceA:123:source`). This is useful to
   *     fetch a record when knowing its source record id. - `mdm:{unifiedRecordId}:old` (e.g.
   *     `mdm:123:old`). This is useful to fetch a unified record id that does not exist anymore
   *     after being merged. (required)
   * @param includes List of relationship property key (included resources) to includes with the
   *     response. (optional)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> getCollectionResourceAsync(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String resourceId,
    List includes,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.getCollectionResourceAsync(partitionKey, collectionKey, resourceId, includes, innerType, null);
  }

  /**
   * (asynchronously) Retrieves a resource from a data partition.
   *
   * @param partitionKey (required)
   * @param collectionKey (required)
   * @param resourceId The resource ID. Can also be an identifier with one of the following formats:
   *     - `{sourceKey}:{sourceRecordId}:source` (e.g. `mySourceA:123:source`). This is useful to
   *     fetch a record when knowing its source record id. - `mdm:{unifiedRecordId}:old` (e.g.
   *     `mdm:123:old`). This is useful to fetch a unified record id that does not exist anymore
   *     after being merged. (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> getCollectionResourceAsync(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String resourceId,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return this.getCollectionResourceAsync(partitionKey, collectionKey, resourceId, null, innerType, requestOptions);
  }

  /**
   * (asynchronously) Retrieves a resource from a data partition.
   *
   * @param partitionKey (required)
   * @param collectionKey (required)
   * @param resourceId The resource ID. Can also be an identifier with one of the following formats:
   *     - `{sourceKey}:{sourceRecordId}:source` (e.g. `mySourceA:123:source`). This is useful to
   *     fetch a record when knowing its source record id. - `mdm:{unifiedRecordId}:old` (e.g.
   *     `mdm:123:old`). This is useful to fetch a unified record id that does not exist anymore
   *     after being merged. (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> getCollectionResourceAsync(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String resourceId,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.getCollectionResourceAsync(partitionKey, collectionKey, resourceId, null, innerType, null);
  }

  /**
   * Retrieves a relationship from a data partition.
   *
   * @param partitionKey (required)
   * @param relationshipType (required)
   * @param relationshipId The unique identifier of the relationship with one of the following
   *     formats: - v1RelationshipID format: `{fromType}.{fromID},{toType}.{toID}` (e.g.
   *     `patient.123,provider.456`). You can optionally pass in the simpler `{fromID},{toID}` form.
   *     - Identifier format: `{system}:{value}:{use}` (e.g. `clinia:123:source`). (required)
   * @param includes List of resource types to includes with the response. Includes must be valid
   *     resource types for the given relationship definition. (optional)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1RelationshipWithIncludes getRelationship(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull String relationshipId,
    List includes,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return LaunderThrowable.await(
      getRelationshipAsync(partitionKey, relationshipType, relationshipId, includes, innerType, requestOptions)
    );
  }

  /**
   * Retrieves a relationship from a data partition.
   *
   * @param partitionKey (required)
   * @param relationshipType (required)
   * @param relationshipId The unique identifier of the relationship with one of the following
   *     formats: - v1RelationshipID format: `{fromType}.{fromID},{toType}.{toID}` (e.g.
   *     `patient.123,provider.456`). You can optionally pass in the simpler `{fromID},{toID}` form.
   *     - Identifier format: `{system}:{value}:{use}` (e.g. `clinia:123:source`). (required)
   * @param includes List of resource types to includes with the response. Includes must be valid
   *     resource types for the given relationship definition. (optional)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1RelationshipWithIncludes getRelationship(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull String relationshipId,
    List includes,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.getRelationship(partitionKey, relationshipType, relationshipId, includes, innerType, null);
  }

  /**
   * Retrieves a relationship from a data partition.
   *
   * @param partitionKey (required)
   * @param relationshipType (required)
   * @param relationshipId The unique identifier of the relationship with one of the following
   *     formats: - v1RelationshipID format: `{fromType}.{fromID},{toType}.{toID}` (e.g.
   *     `patient.123,provider.456`). You can optionally pass in the simpler `{fromID},{toID}` form.
   *     - Identifier format: `{system}:{value}:{use}` (e.g. `clinia:123:source`). (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1RelationshipWithIncludes getRelationship(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull String relationshipId,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return this.getRelationship(partitionKey, relationshipType, relationshipId, null, innerType, requestOptions);
  }

  /**
   * Retrieves a relationship from a data partition.
   *
   * @param partitionKey (required)
   * @param relationshipType (required)
   * @param relationshipId The unique identifier of the relationship with one of the following
   *     formats: - v1RelationshipID format: `{fromType}.{fromID},{toType}.{toID}` (e.g.
   *     `patient.123,provider.456`). You can optionally pass in the simpler `{fromID},{toID}` form.
   *     - Identifier format: `{system}:{value}:{use}` (e.g. `clinia:123:source`). (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1RelationshipWithIncludes getRelationship(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull String relationshipId,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.getRelationship(partitionKey, relationshipType, relationshipId, null, innerType, null);
  }

  /**
   * (asynchronously) Retrieves a relationship from a data partition.
   *
   * @param partitionKey (required)
   * @param relationshipType (required)
   * @param relationshipId The unique identifier of the relationship with one of the following
   *     formats: - v1RelationshipID format: `{fromType}.{fromID},{toType}.{toID}` (e.g.
   *     `patient.123,provider.456`). You can optionally pass in the simpler `{fromID},{toID}` form.
   *     - Identifier format: `{system}:{value}:{use}` (e.g. `clinia:123:source`). (required)
   * @param includes List of resource types to includes with the response. Includes must be valid
   *     resource types for the given relationship definition. (optional)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> getRelationshipAsync(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull String relationshipId,
    List includes,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    Parameters.requireNonNull(partitionKey, "Parameter `partitionKey` is required when calling `getRelationship`.");

    Parameters.requireNonNull(relationshipType, "Parameter `relationshipType` is required when calling `getRelationship`.");

    Parameters.requireNonNull(relationshipId, "Parameter `relationshipId` is required when calling `getRelationship`.");

    HttpRequest request = HttpRequest
      .builder()
      .setPath(
        "/partitions/{partitionKey}/v1/relationships/{relationshipType}/{relationshipId}",
        partitionKey,
        relationshipType,
        relationshipId
      )
      .setMethod("GET")
      .addQueryParameter("includes", includes)
      .build();
    return executeAsync(request, requestOptions, V1RelationshipWithIncludes.class, innerType);
  }

  /**
   * (asynchronously) Retrieves a relationship from a data partition.
   *
   * @param partitionKey (required)
   * @param relationshipType (required)
   * @param relationshipId The unique identifier of the relationship with one of the following
   *     formats: - v1RelationshipID format: `{fromType}.{fromID},{toType}.{toID}` (e.g.
   *     `patient.123,provider.456`). You can optionally pass in the simpler `{fromID},{toID}` form.
   *     - Identifier format: `{system}:{value}:{use}` (e.g. `clinia:123:source`). (required)
   * @param includes List of resource types to includes with the response. Includes must be valid
   *     resource types for the given relationship definition. (optional)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> getRelationshipAsync(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull String relationshipId,
    List includes,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.getRelationshipAsync(partitionKey, relationshipType, relationshipId, includes, innerType, null);
  }

  /**
   * (asynchronously) Retrieves a relationship from a data partition.
   *
   * @param partitionKey (required)
   * @param relationshipType (required)
   * @param relationshipId The unique identifier of the relationship with one of the following
   *     formats: - v1RelationshipID format: `{fromType}.{fromID},{toType}.{toID}` (e.g.
   *     `patient.123,provider.456`). You can optionally pass in the simpler `{fromID},{toID}` form.
   *     - Identifier format: `{system}:{value}:{use}` (e.g. `clinia:123:source`). (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> getRelationshipAsync(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull String relationshipId,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return this.getRelationshipAsync(partitionKey, relationshipType, relationshipId, null, innerType, requestOptions);
  }

  /**
   * (asynchronously) Retrieves a relationship from a data partition.
   *
   * @param partitionKey (required)
   * @param relationshipType (required)
   * @param relationshipId The unique identifier of the relationship with one of the following
   *     formats: - v1RelationshipID format: `{fromType}.{fromID},{toType}.{toID}` (e.g.
   *     `patient.123,provider.456`). You can optionally pass in the simpler `{fromID},{toID}` form.
   *     - Identifier format: `{system}:{value}:{use}` (e.g. `clinia:123:source`). (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> getRelationshipAsync(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull String relationshipId,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.getRelationshipAsync(partitionKey, relationshipType, relationshipId, null, innerType, null);
  }

  /**
   * Searches resources of a specific collection in the data partition.
   *
   * @param partitionKey The partition from which to execute the query. (required)
   * @param collectionKey The collection from which to execute the query. (required)
   * @param v1SearchParameters (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1QueryResponse query(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull V1SearchParameters v1SearchParameters,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return LaunderThrowable.await(queryAsync(partitionKey, collectionKey, v1SearchParameters, innerType, requestOptions));
  }

  /**
   * Searches resources of a specific collection in the data partition.
   *
   * @param partitionKey The partition from which to execute the query. (required)
   * @param collectionKey The collection from which to execute the query. (required)
   * @param v1SearchParameters (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1QueryResponse query(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull V1SearchParameters v1SearchParameters,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.query(partitionKey, collectionKey, v1SearchParameters, innerType, null);
  }

  /**
   * (asynchronously) Searches resources of a specific collection in the data partition.
   *
   * @param partitionKey The partition from which to execute the query. (required)
   * @param collectionKey The collection from which to execute the query. (required)
   * @param v1SearchParameters (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> queryAsync(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull V1SearchParameters v1SearchParameters,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    Parameters.requireNonNull(partitionKey, "Parameter `partitionKey` is required when calling `query`.");

    Parameters.requireNonNull(collectionKey, "Parameter `collectionKey` is required when calling `query`.");

    Parameters.requireNonNull(v1SearchParameters, "Parameter `v1SearchParameters` is required when calling `query`.");

    HttpRequest request = HttpRequest
      .builder()
      .setPath("/partitions/{partitionKey}/v1/collections/{collectionKey}/query", partitionKey, collectionKey)
      .setMethod("POST")
      .setBody(v1SearchParameters)
      .build();
    return executeAsync(request, requestOptions, V1QueryResponse.class, innerType);
  }

  /**
   * (asynchronously) Searches resources of a specific collection in the data partition.
   *
   * @param partitionKey The partition from which to execute the query. (required)
   * @param collectionKey The collection from which to execute the query. (required)
   * @param v1SearchParameters (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> queryAsync(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull V1SearchParameters v1SearchParameters,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.queryAsync(partitionKey, collectionKey, v1SearchParameters, innerType, null);
  }

  /**
   * Searches relationships of a specific type in the data partition.
   *
   * @param partitionKey The partition from which to execute the query. (required)
   * @param relationshipType The relationship type. (required)
   * @param v1SearchParameters (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1QueryResponse queryRelationships(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull V1SearchParameters v1SearchParameters,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return LaunderThrowable.await(queryRelationshipsAsync(partitionKey, relationshipType, v1SearchParameters, innerType, requestOptions));
  }

  /**
   * Searches relationships of a specific type in the data partition.
   *
   * @param partitionKey The partition from which to execute the query. (required)
   * @param relationshipType The relationship type. (required)
   * @param v1SearchParameters (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  V1QueryResponse queryRelationships(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull V1SearchParameters v1SearchParameters,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.queryRelationships(partitionKey, relationshipType, v1SearchParameters, innerType, null);
  }

  /**
   * (asynchronously) Searches relationships of a specific type in the data partition.
   *
   * @param partitionKey The partition from which to execute the query. (required)
   * @param relationshipType The relationship type. (required)
   * @param v1SearchParameters (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> queryRelationshipsAsync(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull V1SearchParameters v1SearchParameters,
    Class innerType,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    Parameters.requireNonNull(partitionKey, "Parameter `partitionKey` is required when calling `queryRelationships`.");

    Parameters.requireNonNull(relationshipType, "Parameter `relationshipType` is required when calling `queryRelationships`.");

    Parameters.requireNonNull(v1SearchParameters, "Parameter `v1SearchParameters` is required when calling `queryRelationships`.");

    HttpRequest request = HttpRequest
      .builder()
      .setPath("/partitions/{partitionKey}/v1/relationships/{relationshipType}/query", partitionKey, relationshipType)
      .setMethod("POST")
      .setBody(v1SearchParameters)
      .build();
    return executeAsync(request, requestOptions, V1QueryResponse.class, innerType);
  }

  /**
   * (asynchronously) Searches relationships of a specific type in the data partition.
   *
   * @param partitionKey The partition from which to execute the query. (required)
   * @param relationshipType The relationship type. (required)
   * @param v1SearchParameters (required)
   * @param innerType The class held by the collection, could be your custom class or {@link
   *     Object}.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public  CompletableFuture> queryRelationshipsAsync(
    @Nonnull String partitionKey,
    @Nonnull String relationshipType,
    @Nonnull V1SearchParameters v1SearchParameters,
    Class innerType
  ) throws CliniaRuntimeException {
    return this.queryRelationshipsAsync(partitionKey, relationshipType, v1SearchParameters, innerType, null);
  }

  /**
   * Retrieve the facets for a property path in a specific collection in the data partition.
   *
   * @param partitionKey The partition from which to execute the search. (required)
   * @param collectionKey The collection from which to execute the search. (required)
   * @param propertyPath The property for which the facets are returned. (required)
   * @param v1FacetParameters (required)
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public SearchForFacets200Response searchForFacets(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String propertyPath,
    @Nonnull V1FacetParameters v1FacetParameters,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    return LaunderThrowable.await(searchForFacetsAsync(partitionKey, collectionKey, propertyPath, v1FacetParameters, requestOptions));
  }

  /**
   * Retrieve the facets for a property path in a specific collection in the data partition.
   *
   * @param partitionKey The partition from which to execute the search. (required)
   * @param collectionKey The collection from which to execute the search. (required)
   * @param propertyPath The property for which the facets are returned. (required)
   * @param v1FacetParameters (required)
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public SearchForFacets200Response searchForFacets(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String propertyPath,
    @Nonnull V1FacetParameters v1FacetParameters
  ) throws CliniaRuntimeException {
    return this.searchForFacets(partitionKey, collectionKey, propertyPath, v1FacetParameters, null);
  }

  /**
   * (asynchronously) Retrieve the facets for a property path in a specific collection in the data
   * partition.
   *
   * @param partitionKey The partition from which to execute the search. (required)
   * @param collectionKey The collection from which to execute the search. (required)
   * @param propertyPath The property for which the facets are returned. (required)
   * @param v1FacetParameters (required)
   * @param requestOptions The requestOptions to send along with the query, they will be merged with
   *     the transporter requestOptions.
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public CompletableFuture searchForFacetsAsync(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String propertyPath,
    @Nonnull V1FacetParameters v1FacetParameters,
    RequestOptions requestOptions
  ) throws CliniaRuntimeException {
    Parameters.requireNonNull(partitionKey, "Parameter `partitionKey` is required when calling `searchForFacets`.");

    Parameters.requireNonNull(collectionKey, "Parameter `collectionKey` is required when calling `searchForFacets`.");

    Parameters.requireNonNull(propertyPath, "Parameter `propertyPath` is required when calling `searchForFacets`.");

    Parameters.requireNonNull(v1FacetParameters, "Parameter `v1FacetParameters` is required when calling `searchForFacets`.");

    HttpRequest request = HttpRequest
      .builder()
      .setPath(
        "/partitions/{partitionKey}/v1/collections/{collectionKey}/facets/{propertyPath}/query",
        partitionKey,
        collectionKey,
        propertyPath
      )
      .setMethod("POST")
      .setBody(v1FacetParameters)
      .build();
    return executeAsync(request, requestOptions, new TypeReference() {});
  }

  /**
   * (asynchronously) Retrieve the facets for a property path in a specific collection in the data
   * partition.
   *
   * @param partitionKey The partition from which to execute the search. (required)
   * @param collectionKey The collection from which to execute the search. (required)
   * @param propertyPath The property for which the facets are returned. (required)
   * @param v1FacetParameters (required)
   * @throws CliniaRuntimeException If it fails to process the API call
   */
  public CompletableFuture searchForFacetsAsync(
    @Nonnull String partitionKey,
    @Nonnull String collectionKey,
    @Nonnull String propertyPath,
    @Nonnull V1FacetParameters v1FacetParameters
  ) throws CliniaRuntimeException {
    return this.searchForFacetsAsync(partitionKey, collectionKey, propertyPath, v1FacetParameters, null);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy