Class: Vellum::DocumentIndexRead

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/document_index_read.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created:, label:, name:, status: OMIT, indexing_config:, additional_properties: nil) ⇒ Vellum::DocumentIndexRead

Parameters:

  • indexing_config (Vellum::DocumentIndexIndexingConfig)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vellum_ai/types/document_index_read.rb', line 42

def initialize(id:, created:, label:, name:, status: OMIT, indexing_config:, additional_properties: nil)
  @id = id
  @created = created
  @label = label
  @name = name
  @status = status if status != OMIT
  @indexing_config = indexing_config
  @additional_properties = additional_properties
  @_field_set = { "id": id, "created": created, "label": label, "name": name, "status": status, "indexing_config": indexing_config }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



25
26
27
# File 'lib/vellum_ai/types/document_index_read.rb', line 25

def additional_properties
  @additional_properties
end

#createdDateTime (readonly)

Returns:

  • (DateTime)


13
14
15
# File 'lib/vellum_ai/types/document_index_read.rb', line 13

def created
  @created
end

#idString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/vellum_ai/types/document_index_read.rb', line 11

def id
  @id
end

#indexing_configVellum::DocumentIndexIndexingConfig (readonly)



23
24
25
# File 'lib/vellum_ai/types/document_index_read.rb', line 23

def indexing_config
  @indexing_config
end

#labelString (readonly)

Returns A human-readable label for the document index.

Returns:

  • (String)

    A human-readable label for the document index



15
16
17
# File 'lib/vellum_ai/types/document_index_read.rb', line 15

def label
  @label
end

#nameString (readonly)

Returns A name that uniquely identifies this index within its workspace.

Returns:

  • (String)

    A name that uniquely identifies this index within its workspace



17
18
19
# File 'lib/vellum_ai/types/document_index_read.rb', line 17

def name
  @name
end

#statusObject (readonly)

  • ‘ARCHIVED` - Archived



21
22
23
# File 'lib/vellum_ai/types/document_index_read.rb', line 21

def status
  @status
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::DocumentIndexRead

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/vellum_ai/types/document_index_read.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  created = unless parsed_json["created"].nil?
  DateTime.parse(parsed_json["created"])
else
  nil
end
  label = parsed_json["label"]
  name = parsed_json["name"]
  status = parsed_json["status"]
  unless parsed_json["indexing_config"].nil?
    indexing_config = parsed_json["indexing_config"].to_json
    indexing_config = Vellum::DocumentIndexIndexingConfig.from_json(json_object: indexing_config)
  else
    indexing_config = nil
  end
  new(
    id: id,
    created: created,
    label: label,
    name: name,
    status: status,
    indexing_config: indexing_config,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


98
99
100
101
102
103
104
105
# File 'lib/vellum_ai/types/document_index_read.rb', line 98

def self.validate_raw(obj:)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
  obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.status&.is_a?(Vellum::EntityStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  Vellum::DocumentIndexIndexingConfig.validate_raw(obj: obj.indexing_config)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


89
90
91
# File 'lib/vellum_ai/types/document_index_read.rb', line 89

def to_json
  @_field_set&.to_json
end