fetch_hive 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +64 -0
- data/lib/fetch_hive/client.rb +160 -0
- data/lib/fetch_hive/generated/api/agents_api.rb +90 -0
- data/lib/fetch_hive/generated/api/prompts_api.rb +90 -0
- data/lib/fetch_hive/generated/api/workflows_api.rb +90 -0
- data/lib/fetch_hive/generated/api_client.rb +441 -0
- data/lib/fetch_hive/generated/api_error.rb +58 -0
- data/lib/fetch_hive/generated/api_model_base.rb +88 -0
- data/lib/fetch_hive/generated/configuration.rb +415 -0
- data/lib/fetch_hive/generated/models/agent_message.rb +228 -0
- data/lib/fetch_hive/generated/models/async_config.rb +175 -0
- data/lib/fetch_hive/generated/models/error_response.rb +158 -0
- data/lib/fetch_hive/generated/models/invoke_agent_request.rb +250 -0
- data/lib/fetch_hive/generated/models/invoke_agent_response.rb +200 -0
- data/lib/fetch_hive/generated/models/invoke_prompt_request.rb +211 -0
- data/lib/fetch_hive/generated/models/invoke_prompt_response.rb +177 -0
- data/lib/fetch_hive/generated/models/invoke_workflow_async_response.rb +193 -0
- data/lib/fetch_hive/generated/models/invoke_workflow_request.rb +208 -0
- data/lib/fetch_hive/generated/models/invoke_workflow_response.rb +223 -0
- data/lib/fetch_hive/generated/models/sse_chunk.rb +228 -0
- data/lib/fetch_hive/generated/models/token_usage.rb +169 -0
- data/lib/fetch_hive/generated/models/tool_invocation.rb +169 -0
- data/lib/fetch_hive/generated/version.rb +15 -0
- data/lib/fetch_hive/streaming.rb +65 -0
- data/lib/fetch_hive/version.rb +5 -0
- data/lib/fetch_hive.rb +10 -0
- metadata +101 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fetch Hive Public API
|
|
3
|
+
|
|
4
|
+
#The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.2.2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FetchHive::Generated
|
|
17
|
+
# Asynchronous workflow accepted response.
|
|
18
|
+
class InvokeWorkflowAsyncResponse < ApiModelBase
|
|
19
|
+
# Identifier for the queued workflow run. Use this to poll `GET /v1/workflow_runs/{id}` on the management API.
|
|
20
|
+
attr_accessor :run_id
|
|
21
|
+
|
|
22
|
+
# Always `\"queued\"` for async responses.
|
|
23
|
+
attr_accessor :status
|
|
24
|
+
|
|
25
|
+
class EnumAttributeValidator
|
|
26
|
+
attr_reader :datatype
|
|
27
|
+
attr_reader :allowable_values
|
|
28
|
+
|
|
29
|
+
def initialize(datatype, allowable_values)
|
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
|
31
|
+
case datatype.to_s
|
|
32
|
+
when /Integer/i
|
|
33
|
+
value.to_i
|
|
34
|
+
when /Float/i
|
|
35
|
+
value.to_f
|
|
36
|
+
else
|
|
37
|
+
value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def valid?(value)
|
|
43
|
+
!value || allowable_values.include?(value)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
48
|
+
def self.attribute_map
|
|
49
|
+
{
|
|
50
|
+
:'run_id' => :'run_id',
|
|
51
|
+
:'status' => :'status'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns attribute mapping this model knows about
|
|
56
|
+
def self.acceptable_attribute_map
|
|
57
|
+
attribute_map
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Returns all the JSON keys this model knows about
|
|
61
|
+
def self.acceptable_attributes
|
|
62
|
+
acceptable_attribute_map.values
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Attribute type mapping.
|
|
66
|
+
def self.openapi_types
|
|
67
|
+
{
|
|
68
|
+
:'run_id' => :'String',
|
|
69
|
+
:'status' => :'String'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# List of attributes with nullable: true
|
|
74
|
+
def self.openapi_nullable
|
|
75
|
+
Set.new([
|
|
76
|
+
])
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Initializes the object
|
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
81
|
+
def initialize(attributes = {})
|
|
82
|
+
if (!attributes.is_a?(Hash))
|
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::InvokeWorkflowAsyncResponse` initialize method"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
87
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
89
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::InvokeWorkflowAsyncResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
91
|
+
end
|
|
92
|
+
h[k.to_sym] = v
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'run_id')
|
|
96
|
+
self.run_id = attributes[:'run_id']
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'status')
|
|
100
|
+
self.status = attributes[:'status']
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
105
|
+
# @return Array for valid properties with the reasons
|
|
106
|
+
def list_invalid_properties
|
|
107
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
108
|
+
invalid_properties = Array.new
|
|
109
|
+
invalid_properties
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Check to see if the all the properties in the model are valid
|
|
113
|
+
# @return true if the model is valid
|
|
114
|
+
def valid?
|
|
115
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
116
|
+
status_validator = EnumAttributeValidator.new('String', ["queued"])
|
|
117
|
+
return false unless status_validator.valid?(@status)
|
|
118
|
+
true
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
122
|
+
# @param [Object] status Object to be assigned
|
|
123
|
+
def status=(status)
|
|
124
|
+
validator = EnumAttributeValidator.new('String', ["queued"])
|
|
125
|
+
unless validator.valid?(status)
|
|
126
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
127
|
+
end
|
|
128
|
+
@status = status
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Checks equality by comparing each attribute.
|
|
132
|
+
# @param [Object] Object to be compared
|
|
133
|
+
def ==(o)
|
|
134
|
+
return true if self.equal?(o)
|
|
135
|
+
self.class == o.class &&
|
|
136
|
+
run_id == o.run_id &&
|
|
137
|
+
status == o.status
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# @see the `==` method
|
|
141
|
+
# @param [Object] Object to be compared
|
|
142
|
+
def eql?(o)
|
|
143
|
+
self == o
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Calculates hash code according to all attributes.
|
|
147
|
+
# @return [Integer] Hash code
|
|
148
|
+
def hash
|
|
149
|
+
[run_id, status].hash
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Builds the object from hash
|
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
154
|
+
# @return [Object] Returns the model itself
|
|
155
|
+
def self.build_from_hash(attributes)
|
|
156
|
+
return nil unless attributes.is_a?(Hash)
|
|
157
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
158
|
+
transformed_hash = {}
|
|
159
|
+
openapi_types.each_pair do |key, type|
|
|
160
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
161
|
+
transformed_hash["#{key}"] = nil
|
|
162
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
163
|
+
# check to ensure the input is an array given that the attribute
|
|
164
|
+
# is documented as an array but the input is not
|
|
165
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
166
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
167
|
+
end
|
|
168
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
169
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
new(transformed_hash)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Returns the object in the form of hash
|
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
|
177
|
+
def to_hash
|
|
178
|
+
hash = {}
|
|
179
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
180
|
+
value = self.send(attr)
|
|
181
|
+
if value.nil?
|
|
182
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
183
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
hash[param] = _to_hash(value)
|
|
187
|
+
end
|
|
188
|
+
hash
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
end
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fetch Hive Public API
|
|
3
|
+
|
|
4
|
+
#The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.2.2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FetchHive::Generated
|
|
17
|
+
class InvokeWorkflowRequest < ApiModelBase
|
|
18
|
+
# Slug of the workflow deployment to invoke.
|
|
19
|
+
attr_accessor :deployment
|
|
20
|
+
|
|
21
|
+
# Optional variant name to override the default.
|
|
22
|
+
attr_accessor :variant
|
|
23
|
+
|
|
24
|
+
# Input variables for the workflow.
|
|
25
|
+
attr_accessor :inputs
|
|
26
|
+
|
|
27
|
+
attr_accessor :async
|
|
28
|
+
|
|
29
|
+
# Optional opaque caller identifier for audit logging.
|
|
30
|
+
attr_accessor :user
|
|
31
|
+
|
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
33
|
+
def self.attribute_map
|
|
34
|
+
{
|
|
35
|
+
:'deployment' => :'deployment',
|
|
36
|
+
:'variant' => :'variant',
|
|
37
|
+
:'inputs' => :'inputs',
|
|
38
|
+
:'async' => :'async',
|
|
39
|
+
:'user' => :'user'
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Returns attribute mapping this model knows about
|
|
44
|
+
def self.acceptable_attribute_map
|
|
45
|
+
attribute_map
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Returns all the JSON keys this model knows about
|
|
49
|
+
def self.acceptable_attributes
|
|
50
|
+
acceptable_attribute_map.values
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Attribute type mapping.
|
|
54
|
+
def self.openapi_types
|
|
55
|
+
{
|
|
56
|
+
:'deployment' => :'String',
|
|
57
|
+
:'variant' => :'String',
|
|
58
|
+
:'inputs' => :'Hash<String, Object>',
|
|
59
|
+
:'async' => :'AsyncConfig',
|
|
60
|
+
:'user' => :'String'
|
|
61
|
+
}
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# List of attributes with nullable: true
|
|
65
|
+
def self.openapi_nullable
|
|
66
|
+
Set.new([
|
|
67
|
+
])
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Initializes the object
|
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
72
|
+
def initialize(attributes = {})
|
|
73
|
+
if (!attributes.is_a?(Hash))
|
|
74
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::InvokeWorkflowRequest` initialize method"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
78
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
80
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::InvokeWorkflowRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
82
|
+
end
|
|
83
|
+
h[k.to_sym] = v
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'deployment')
|
|
87
|
+
self.deployment = attributes[:'deployment']
|
|
88
|
+
else
|
|
89
|
+
self.deployment = nil
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if attributes.key?(:'variant')
|
|
93
|
+
self.variant = attributes[:'variant']
|
|
94
|
+
else
|
|
95
|
+
self.variant = ''
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'inputs')
|
|
99
|
+
if (value = attributes[:'inputs']).is_a?(Hash)
|
|
100
|
+
self.inputs = value
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'async')
|
|
105
|
+
self.async = attributes[:'async']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'user')
|
|
109
|
+
self.user = attributes[:'user']
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
114
|
+
# @return Array for valid properties with the reasons
|
|
115
|
+
def list_invalid_properties
|
|
116
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
117
|
+
invalid_properties = Array.new
|
|
118
|
+
if @deployment.nil?
|
|
119
|
+
invalid_properties.push('invalid value for "deployment", deployment cannot be nil.')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
invalid_properties
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Check to see if the all the properties in the model are valid
|
|
126
|
+
# @return true if the model is valid
|
|
127
|
+
def valid?
|
|
128
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
129
|
+
return false if @deployment.nil?
|
|
130
|
+
true
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Custom attribute writer method with validation
|
|
134
|
+
# @param [Object] deployment Value to be assigned
|
|
135
|
+
def deployment=(deployment)
|
|
136
|
+
if deployment.nil?
|
|
137
|
+
fail ArgumentError, 'deployment cannot be nil'
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
@deployment = deployment
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Checks equality by comparing each attribute.
|
|
144
|
+
# @param [Object] Object to be compared
|
|
145
|
+
def ==(o)
|
|
146
|
+
return true if self.equal?(o)
|
|
147
|
+
self.class == o.class &&
|
|
148
|
+
deployment == o.deployment &&
|
|
149
|
+
variant == o.variant &&
|
|
150
|
+
inputs == o.inputs &&
|
|
151
|
+
async == o.async &&
|
|
152
|
+
user == o.user
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# @see the `==` method
|
|
156
|
+
# @param [Object] Object to be compared
|
|
157
|
+
def eql?(o)
|
|
158
|
+
self == o
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Calculates hash code according to all attributes.
|
|
162
|
+
# @return [Integer] Hash code
|
|
163
|
+
def hash
|
|
164
|
+
[deployment, variant, inputs, async, user].hash
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Builds the object from hash
|
|
168
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
169
|
+
# @return [Object] Returns the model itself
|
|
170
|
+
def self.build_from_hash(attributes)
|
|
171
|
+
return nil unless attributes.is_a?(Hash)
|
|
172
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
173
|
+
transformed_hash = {}
|
|
174
|
+
openapi_types.each_pair do |key, type|
|
|
175
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
176
|
+
transformed_hash["#{key}"] = nil
|
|
177
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
178
|
+
# check to ensure the input is an array given that the attribute
|
|
179
|
+
# is documented as an array but the input is not
|
|
180
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
181
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
182
|
+
end
|
|
183
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
184
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
new(transformed_hash)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Returns the object in the form of hash
|
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
|
192
|
+
def to_hash
|
|
193
|
+
hash = {}
|
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
195
|
+
value = self.send(attr)
|
|
196
|
+
if value.nil?
|
|
197
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
198
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
hash[param] = _to_hash(value)
|
|
202
|
+
end
|
|
203
|
+
hash
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
end
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fetch Hive Public API
|
|
3
|
+
|
|
4
|
+
#The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.2.2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FetchHive::Generated
|
|
17
|
+
# Synchronous workflow result.
|
|
18
|
+
class InvokeWorkflowResponse < ApiModelBase
|
|
19
|
+
# Unique identifier for this invocation.
|
|
20
|
+
attr_accessor :request_id
|
|
21
|
+
|
|
22
|
+
# Workflow run identifier.
|
|
23
|
+
attr_accessor :run_id
|
|
24
|
+
|
|
25
|
+
# Final status of the workflow run.
|
|
26
|
+
attr_accessor :status
|
|
27
|
+
|
|
28
|
+
# The workflow's final output value. May contain serialised JSON; parse client-side as needed.
|
|
29
|
+
attr_accessor :output
|
|
30
|
+
|
|
31
|
+
# Error message when `status` is `failed`.
|
|
32
|
+
attr_accessor :error
|
|
33
|
+
|
|
34
|
+
class EnumAttributeValidator
|
|
35
|
+
attr_reader :datatype
|
|
36
|
+
attr_reader :allowable_values
|
|
37
|
+
|
|
38
|
+
def initialize(datatype, allowable_values)
|
|
39
|
+
@allowable_values = allowable_values.map do |value|
|
|
40
|
+
case datatype.to_s
|
|
41
|
+
when /Integer/i
|
|
42
|
+
value.to_i
|
|
43
|
+
when /Float/i
|
|
44
|
+
value.to_f
|
|
45
|
+
else
|
|
46
|
+
value
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def valid?(value)
|
|
52
|
+
!value || allowable_values.include?(value)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
57
|
+
def self.attribute_map
|
|
58
|
+
{
|
|
59
|
+
:'request_id' => :'request_id',
|
|
60
|
+
:'run_id' => :'run_id',
|
|
61
|
+
:'status' => :'status',
|
|
62
|
+
:'output' => :'output',
|
|
63
|
+
:'error' => :'error'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Returns attribute mapping this model knows about
|
|
68
|
+
def self.acceptable_attribute_map
|
|
69
|
+
attribute_map
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Returns all the JSON keys this model knows about
|
|
73
|
+
def self.acceptable_attributes
|
|
74
|
+
acceptable_attribute_map.values
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Attribute type mapping.
|
|
78
|
+
def self.openapi_types
|
|
79
|
+
{
|
|
80
|
+
:'request_id' => :'String',
|
|
81
|
+
:'run_id' => :'String',
|
|
82
|
+
:'status' => :'String',
|
|
83
|
+
:'output' => :'String',
|
|
84
|
+
:'error' => :'String'
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# List of attributes with nullable: true
|
|
89
|
+
def self.openapi_nullable
|
|
90
|
+
Set.new([
|
|
91
|
+
])
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Initializes the object
|
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
96
|
+
def initialize(attributes = {})
|
|
97
|
+
if (!attributes.is_a?(Hash))
|
|
98
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::InvokeWorkflowResponse` initialize method"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
102
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
103
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
104
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
105
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::InvokeWorkflowResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
106
|
+
end
|
|
107
|
+
h[k.to_sym] = v
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'request_id')
|
|
111
|
+
self.request_id = attributes[:'request_id']
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'run_id')
|
|
115
|
+
self.run_id = attributes[:'run_id']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'status')
|
|
119
|
+
self.status = attributes[:'status']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'output')
|
|
123
|
+
self.output = attributes[:'output']
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'error')
|
|
127
|
+
self.error = attributes[:'error']
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
132
|
+
# @return Array for valid properties with the reasons
|
|
133
|
+
def list_invalid_properties
|
|
134
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
135
|
+
invalid_properties = Array.new
|
|
136
|
+
invalid_properties
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Check to see if the all the properties in the model are valid
|
|
140
|
+
# @return true if the model is valid
|
|
141
|
+
def valid?
|
|
142
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
143
|
+
status_validator = EnumAttributeValidator.new('String', ["completed", "failed"])
|
|
144
|
+
return false unless status_validator.valid?(@status)
|
|
145
|
+
true
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
149
|
+
# @param [Object] status Object to be assigned
|
|
150
|
+
def status=(status)
|
|
151
|
+
validator = EnumAttributeValidator.new('String', ["completed", "failed"])
|
|
152
|
+
unless validator.valid?(status)
|
|
153
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
154
|
+
end
|
|
155
|
+
@status = status
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Checks equality by comparing each attribute.
|
|
159
|
+
# @param [Object] Object to be compared
|
|
160
|
+
def ==(o)
|
|
161
|
+
return true if self.equal?(o)
|
|
162
|
+
self.class == o.class &&
|
|
163
|
+
request_id == o.request_id &&
|
|
164
|
+
run_id == o.run_id &&
|
|
165
|
+
status == o.status &&
|
|
166
|
+
output == o.output &&
|
|
167
|
+
error == o.error
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# @see the `==` method
|
|
171
|
+
# @param [Object] Object to be compared
|
|
172
|
+
def eql?(o)
|
|
173
|
+
self == o
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Calculates hash code according to all attributes.
|
|
177
|
+
# @return [Integer] Hash code
|
|
178
|
+
def hash
|
|
179
|
+
[request_id, run_id, status, output, error].hash
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Builds the object from hash
|
|
183
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
184
|
+
# @return [Object] Returns the model itself
|
|
185
|
+
def self.build_from_hash(attributes)
|
|
186
|
+
return nil unless attributes.is_a?(Hash)
|
|
187
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
188
|
+
transformed_hash = {}
|
|
189
|
+
openapi_types.each_pair do |key, type|
|
|
190
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
191
|
+
transformed_hash["#{key}"] = nil
|
|
192
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
193
|
+
# check to ensure the input is an array given that the attribute
|
|
194
|
+
# is documented as an array but the input is not
|
|
195
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
196
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
197
|
+
end
|
|
198
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
199
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
new(transformed_hash)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Returns the object in the form of hash
|
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
|
207
|
+
def to_hash
|
|
208
|
+
hash = {}
|
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
210
|
+
value = self.send(attr)
|
|
211
|
+
if value.nil?
|
|
212
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
213
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
hash[param] = _to_hash(value)
|
|
217
|
+
end
|
|
218
|
+
hash
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
end
|