class Vellum::DocumentIndexesClient

def create(label:, name:, indexing_config:, status: nil, environment: nil, copy_documents_from_index_id: nil,

Returns:
  • (DocumentIndexRead) -

Parameters:
  • request_options (RequestOptions) --
  • copy_documents_from_index_id (String) -- Optionally specify the id of a document index from which you'd like to copy and re-index its documents into this newly created index
  • indexing_config (Hash{String => String}) -- Configuration representing how documents should be indexed
  • environment (ENVIRONMENT_ENUM) -- The environment this document index is used in
  • status (ENTITY_STATUS) -- The current status of the document index
  • name (String) -- A name that uniquely identifies this index within its workspace
  • label (String) -- A human-readable label for the document index
def create(label:, name:, indexing_config:, status: nil, environment: nil, copy_documents_from_index_id: nil,
           request_options: nil)
  response = @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      label: label,
      name: name,
      status: status,
      environment: environment,
      indexing_config: indexing_config,
      copy_documents_from_index_id: copy_documents_from_index_id
    }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes"
  end
  DocumentIndexRead.from_json(json_object: response.body)
end

def destroy(id:, request_options: nil)

Returns:
  • (Void) -

Parameters:
  • request_options (RequestOptions) --
  • id (String) -- A UUID string identifying this document index.
def destroy(id:, request_options: nil)
  @request_client.conn.delete do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
  end
end

def initialize(request_client:)

Returns:
  • (DocumentIndexesClient) -

Parameters:
  • request_client (RequestClient) --
def initialize(request_client:)
  # @type [RequestClient]
  @request_client = request_client
end

def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)

Returns:
  • (PaginatedDocumentIndexReadList) -

Parameters:
  • request_options (RequestOptions) --
  • status (DOCUMENT_INDEXES_LIST_REQUEST_STATUS) -- The current status of the document index
  • ordering (String) -- Which field to use when ordering the results.
  • offset (Integer) -- The initial index from which to return the results.
  • limit (Integer) -- Number of results to return per page.
def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "limit": limit,
      "offset": offset,
      "ordering": ordering,
      "status": status
    }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes"
  end
  PaginatedDocumentIndexReadList.from_json(json_object: response.body)
end

def partial_update(id:, label: nil, status: nil, environment: nil, request_options: nil)

Returns:
  • (DocumentIndexRead) -

Parameters:
  • request_options (RequestOptions) --
  • environment (ENVIRONMENT_ENUM) -- The environment this document index is used in
  • status (ENTITY_STATUS) -- The current status of the document index
  • label (String) -- A human-readable label for the document index
  • id (String) -- A UUID string identifying this document index.
def partial_update(id:, label: nil, status: nil, environment: nil, request_options: nil)
  response = @request_client.conn.patch do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      label: label,
      status: status,
      environment: environment
    }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
  end
  DocumentIndexRead.from_json(json_object: response.body)
end

def retrieve(id:, request_options: nil)

Returns:
  • (DocumentIndexRead) -

Parameters:
  • request_options (RequestOptions) --
  • id (String) -- Either the Document Index's ID or its unique name
def retrieve(id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
  end
  DocumentIndexRead.from_json(json_object: response.body)
end

def update(id:, label:, status: nil, environment: nil, request_options: nil)

Returns:
  • (DocumentIndexRead) -

Parameters:
  • request_options (RequestOptions) --
  • environment (ENVIRONMENT_ENUM) -- The environment this document index is used in
  • status (ENTITY_STATUS) -- The current status of the document index
  • label (String) -- A human-readable label for the document index
  • id (String) -- A UUID string identifying this document index.
def update(id:, label:, status: nil, environment: nil, request_options: nil)
  response = @request_client.conn.put do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      label: label,
      status: status,
      environment: environment
    }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
  end
  DocumentIndexRead.from_json(json_object: response.body)
end