Class: Vellum::WorkflowExecutionFulfilledEvent

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent: OMIT, links: OMIT, name:, body:, id:, timestamp:, api_version: OMIT, trace_id:, span_id:, additional_properties: nil) ⇒ Vellum::WorkflowExecutionFulfilledEvent



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/vellum_ai/types/workflow_execution_fulfilled_event.rb', line 49

def initialize(parent: OMIT, links: OMIT, name:, body:, id:, timestamp:, api_version: OMIT, trace_id:, span_id:, additional_properties: nil)
  @parent = parent if parent != OMIT
  @links = links if links != OMIT
  @name = name
  @body = body
  @id = id
  @timestamp = timestamp
  @api_version = api_version if api_version != OMIT
  @trace_id = trace_id
  @span_id = span_id
  @additional_properties = additional_properties
  @_field_set = { "parent": parent, "links": links, "name": name, "body": body, "id": id, "timestamp": timestamp, "api_version": api_version, "trace_id": trace_id, "span_id": span_id }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)



31
32
33
# File 'lib/vellum_ai/types/workflow_execution_fulfilled_event.rb', line 31

def additional_properties
  @additional_properties
end

#api_version ⇒ Vellum::ApiVersionEnum (readonly)



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

def api_version
  @api_version
end

#body ⇒ Vellum::WorkflowExecutionFulfilledBody (readonly)



19
20
21
# File 'lib/vellum_ai/types/workflow_execution_fulfilled_event.rb', line 19

def body
  @body
end

#id ⇒ String (readonly)



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

def id
  @id
end


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

def links
  @links
end

#name ⇒ String (readonly)



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

def name
  @name
end

#parent ⇒ Vellum::ParentContext (readonly)



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

def parent
  @parent
end

#span_id ⇒ String (readonly)



29
30
31
# File 'lib/vellum_ai/types/workflow_execution_fulfilled_event.rb', line 29

def span_id
  @span_id
end

#timestamp ⇒ DateTime (readonly)



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

def timestamp
  @timestamp
end

#trace_id ⇒ String (readonly)



27
28
29
# File 'lib/vellum_ai/types/workflow_execution_fulfilled_event.rb', line 27

def trace_id
  @trace_id
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::WorkflowExecutionFulfilledEvent



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/vellum_ai/types/workflow_execution_fulfilled_event.rb', line 68

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["parent"].nil?
    parent = parsed_json["parent"].to_json
    parent = Vellum::ParentContext.from_json(json_object: parent)
  else
    parent = nil
  end
  links = parsed_json["links"]&.map do | item |
  item = item.to_json
  Vellum::SpanLink.from_json(json_object: item)
end
  name = parsed_json["name"]
  unless parsed_json["body"].nil?
    body = parsed_json["body"].to_json
    body = Vellum::WorkflowExecutionFulfilledBody.from_json(json_object: body)
  else
    body = nil
  end
  id = parsed_json["id"]
  timestamp = unless parsed_json["timestamp"].nil?
  DateTime.parse(parsed_json["timestamp"])
else
  nil
end
  api_version = parsed_json["api_version"]
  trace_id = parsed_json["trace_id"]
  span_id = parsed_json["span_id"]
  new(
    parent: parent,
    links: links,
    name: name,
    body: body,
    id: id,
    timestamp: timestamp,
    api_version: api_version,
    trace_id: trace_id,
    span_id: span_id,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void



122
123
124
125
126
127
128
129
130
131
132
# File 'lib/vellum_ai/types/workflow_execution_fulfilled_event.rb', line 122

def self.validate_raw(obj:)
  obj.parent.nil? || Vellum::ParentContext.validate_raw(obj: obj.parent)
  obj.links&.is_a?(Array) != false || raise("Passed value for field obj.links 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.")
  Vellum::WorkflowExecutionFulfilledBody.validate_raw(obj: obj.body)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.timestamp.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
  obj.api_version&.is_a?(Vellum::ApiVersionEnum) != false || raise("Passed value for field obj.api_version is not the expected type, validation failed.")
  obj.trace_id.is_a?(String) != false || raise("Passed value for field obj.trace_id is not the expected type, validation failed.")
  obj.span_id.is_a?(String) != false || raise("Passed value for field obj.span_id is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String



113
114
115
# File 'lib/vellum_ai/types/workflow_execution_fulfilled_event.rb', line 113

def to_json
  @_field_set&.to_json
end