sz-apimatic-sdk 0.0.1

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.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +153 -0
  4. data/bin/console +15 -0
  5. data/lib/seltz_api/api_helper.rb +10 -0
  6. data/lib/seltz_api/apis/agent_api.rb +140 -0
  7. data/lib/seltz_api/apis/answer_api.rb +61 -0
  8. data/lib/seltz_api/apis/base_api.rb +67 -0
  9. data/lib/seltz_api/apis/fetch_api.rb +48 -0
  10. data/lib/seltz_api/apis/monitors_api.rb +161 -0
  11. data/lib/seltz_api/apis/records_api.rb +97 -0
  12. data/lib/seltz_api/apis/runs_api.rb +109 -0
  13. data/lib/seltz_api/apis/search_api.rb +55 -0
  14. data/lib/seltz_api/client.rb +111 -0
  15. data/lib/seltz_api/configuration.rb +165 -0
  16. data/lib/seltz_api/exceptions/api_exception.rb +21 -0
  17. data/lib/seltz_api/exceptions/error_envelope_exception.rb +46 -0
  18. data/lib/seltz_api/http/api_response.rb +19 -0
  19. data/lib/seltz_api/http/auth/custom_header_authentication.rb +52 -0
  20. data/lib/seltz_api/http/http_call_back.rb +10 -0
  21. data/lib/seltz_api/http/http_method_enum.rb +10 -0
  22. data/lib/seltz_api/http/http_request.rb +10 -0
  23. data/lib/seltz_api/http/http_response.rb +10 -0
  24. data/lib/seltz_api/http/proxy_settings.rb +22 -0
  25. data/lib/seltz_api/logging/configuration/api_logging_configuration.rb +186 -0
  26. data/lib/seltz_api/logging/sdk_logger.rb +17 -0
  27. data/lib/seltz_api/models/agent_run.rb +161 -0
  28. data/lib/seltz_api/models/agent_run_citation.rb +85 -0
  29. data/lib/seltz_api/models/agent_run_grounding.rb +94 -0
  30. data/lib/seltz_api/models/agent_run_output.rb +131 -0
  31. data/lib/seltz_api/models/agent_run_output2.rb +131 -0
  32. data/lib/seltz_api/models/agent_run_request.rb +100 -0
  33. data/lib/seltz_api/models/agent_run_request2.rb +100 -0
  34. data/lib/seltz_api/models/agent_run_source.rb +86 -0
  35. data/lib/seltz_api/models/agent_run_status.rb +49 -0
  36. data/lib/seltz_api/models/agent_run_status2.rb +48 -0
  37. data/lib/seltz_api/models/agent_run_stop_reason.rb +53 -0
  38. data/lib/seltz_api/models/agent_run_stop_reason2.rb +52 -0
  39. data/lib/seltz_api/models/answer_http_request.rb +172 -0
  40. data/lib/seltz_api/models/answer_http_response.rb +93 -0
  41. data/lib/seltz_api/models/base_model.rb +110 -0
  42. data/lib/seltz_api/models/content_options.rb +99 -0
  43. data/lib/seltz_api/models/create_agent_run_request.rb +104 -0
  44. data/lib/seltz_api/models/create_monitor_request.rb +143 -0
  45. data/lib/seltz_api/models/create_monitor_response.rb +90 -0
  46. data/lib/seltz_api/models/document.rb +128 -0
  47. data/lib/seltz_api/models/envelope_error.rb +83 -0
  48. data/lib/seltz_api/models/envelope_error1.rb +82 -0
  49. data/lib/seltz_api/models/fetch_error.rb +107 -0
  50. data/lib/seltz_api/models/fetch_error1.rb +108 -0
  51. data/lib/seltz_api/models/fetch_request.rb +144 -0
  52. data/lib/seltz_api/models/fetch_response.rb +87 -0
  53. data/lib/seltz_api/models/fetch_result.rb +176 -0
  54. data/lib/seltz_api/models/fetch_status.rb +36 -0
  55. data/lib/seltz_api/models/fetch_status2.rb +40 -0
  56. data/lib/seltz_api/models/fields.rb +108 -0
  57. data/lib/seltz_api/models/fields2.rb +101 -0
  58. data/lib/seltz_api/models/get_monitor_response.rb +87 -0
  59. data/lib/seltz_api/models/get_run_response.rb +76 -0
  60. data/lib/seltz_api/models/http_citation.rb +86 -0
  61. data/lib/seltz_api/models/list_agent_runs_response.rb +96 -0
  62. data/lib/seltz_api/models/list_monitors_response.rb +97 -0
  63. data/lib/seltz_api/models/list_records_response.rb +96 -0
  64. data/lib/seltz_api/models/list_run_records_response.rb +96 -0
  65. data/lib/seltz_api/models/list_run_requests_response.rb +84 -0
  66. data/lib/seltz_api/models/list_runs_response.rb +96 -0
  67. data/lib/seltz_api/models/monitor.rb +157 -0
  68. data/lib/seltz_api/models/monitor_search_request.rb +110 -0
  69. data/lib/seltz_api/models/monitor_status.rb +47 -0
  70. data/lib/seltz_api/models/monitor_status2.rb +45 -0
  71. data/lib/seltz_api/models/payload.rb +74 -0
  72. data/lib/seltz_api/models/record.rb +116 -0
  73. data/lib/seltz_api/models/record_type.rb +26 -0
  74. data/lib/seltz_api/models/request_status.rb +36 -0
  75. data/lib/seltz_api/models/run.rb +200 -0
  76. data/lib/seltz_api/models/run_request.rb +127 -0
  77. data/lib/seltz_api/models/run_state.rb +40 -0
  78. data/lib/seltz_api/models/run_state2.rb +41 -0
  79. data/lib/seltz_api/models/run_status.rb +47 -0
  80. data/lib/seltz_api/models/schedule.rb +73 -0
  81. data/lib/seltz_api/models/search_record.rb +101 -0
  82. data/lib/seltz_api/models/search_request.rb +208 -0
  83. data/lib/seltz_api/models/search_request_ref.rb +87 -0
  84. data/lib/seltz_api/models/search_response.rb +85 -0
  85. data/lib/seltz_api/models/snippet.rb +76 -0
  86. data/lib/seltz_api/models/snippet_options.rb +151 -0
  87. data/lib/seltz_api/models/update_monitor_request.rb +153 -0
  88. data/lib/seltz_api/models/update_monitor_response.rb +77 -0
  89. data/lib/seltz_api/models/webhook.rb +113 -0
  90. data/lib/seltz_api/models/webhook1.rb +114 -0
  91. data/lib/seltz_api/utilities/date_time_helper.rb +11 -0
  92. data/lib/seltz_api/utilities/file_wrapper.rb +28 -0
  93. data/lib/seltz_api/utilities/union_type_lookup.rb +62 -0
  94. data/lib/seltz_api.rb +115 -0
  95. metadata +178 -0
@@ -0,0 +1,110 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Base model.
8
+ # rubocop:disable all
9
+ class BaseModel < CoreLibrary::BaseModel
10
+ # Returns a Hash representation of the current object.
11
+ def to_hash
12
+ # validating the model being serialized
13
+ self.class.validate(self) if self.class.respond_to?(:validate)
14
+
15
+ hash = {}
16
+ instance_variables.each do |name|
17
+ value = instance_variable_get(name)
18
+ name = name[1..]
19
+ if name == 'additional_properties'
20
+ additional_properties = process_additional_properties(value, self.class.names)
21
+ hash.merge!(additional_properties)
22
+ else
23
+ key = self.class.names.key?(name) ? self.class.names[name] : name
24
+ optional_fields = self.class.optionals
25
+ nullable_fields = self.class.nullables
26
+ if value.nil?
27
+ next unless nullable_fields.include?(name)
28
+
29
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
30
+ raise ArgumentError,
31
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
32
+ end
33
+ end
34
+
35
+ hash[key] = nil
36
+ unless value.nil?
37
+ if respond_to?("to_custom_#{name}")
38
+ if (value.instance_of? Array) || (value.instance_of? Hash)
39
+ params = [hash, key]
40
+ hash[key] = send("to_custom_#{name}", *params)
41
+ else
42
+ hash[key] = send("to_custom_#{name}")
43
+ end
44
+ elsif respond_to?("to_union_type_#{name}")
45
+ hash[key] = send("to_union_type_#{name}")
46
+ elsif value.instance_of? Array
47
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
48
+ elsif value.instance_of? Hash
49
+ hash[key] = {}
50
+ value.each do |k, v|
51
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
52
+ end
53
+ else
54
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
55
+ end
56
+ end
57
+ end
58
+ end
59
+ hash
60
+ end
61
+
62
+ # Processes additional properties, ensuring no conflicts with existing properties.
63
+ def process_additional_properties(additional_properties, existing_prop_names)
64
+ hash = {}
65
+ additional_properties.each do |name, value|
66
+ check_for_conflict(name, existing_prop_names)
67
+
68
+ hash[name] = if value.is_a?(Array)
69
+ process_array(value)
70
+ elsif value.is_a?(Hash)
71
+ process_hash(value)
72
+ else
73
+ process_basic_value(value)
74
+ end
75
+ end
76
+ hash
77
+ end
78
+
79
+ # Checks if an additional property conflicts with a model's existing property.
80
+ def check_for_conflict(name, existing_prop_names)
81
+ return unless existing_prop_names.key?(name)
82
+
83
+ raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
84
+ end
85
+
86
+ # Processes an array of values, recursively calling `to_hash` on BaseModel objects.
87
+ def process_array(value)
88
+ value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
89
+ end
90
+
91
+ # Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
92
+ def process_hash(value)
93
+ value.transform_values do |v|
94
+ v.is_a?(BaseModel) ? v.to_hash : v
95
+ end
96
+ end
97
+
98
+ # Processes a basic value (non-array, non-hash).
99
+ def process_basic_value(value)
100
+ value.is_a?(BaseModel) ? value.to_hash : value
101
+ end
102
+
103
+ # Returns a JSON representation of the curent object.
104
+ def to_json(options = {})
105
+ hash = to_hash
106
+ hash.to_json(options)
107
+ end
108
+ end
109
+ # rubocop:enable all
110
+ end
@@ -0,0 +1,99 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # The ceiling on the content returned. The ceiling is an upper bound; the
8
+ # response carries at most what is specified here. The service may hold
9
+ # callers to a tighter bound than the range below. A larger request is then
10
+ # served at that bound rather than refused, which still carries at most what
11
+ # was specified. Only a value outside the range below is rejected.
12
+ class ContentOptions < BaseModel
13
+ SKIP = Object.new
14
+ private_constant :SKIP
15
+
16
+ # Ceiling on the characters of any single result's content.
17
+ # Counts Unicode code points -- Rust `char`, Python `len(s)`, JavaScript
18
+ # `\[...s\].length`.
19
+ # Defaults to 20000, accepted range 100-1000000.
20
+ # @return [Integer]
21
+ attr_accessor :max_characters_per_result
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ @_hash = {} if @_hash.nil?
26
+ @_hash['max_characters_per_result'] = 'max_characters_per_result'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ %w[
33
+ max_characters_per_result
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ %w[
40
+ max_characters_per_result
41
+ ]
42
+ end
43
+
44
+ def initialize(max_characters_per_result: SKIP, additional_properties: nil)
45
+ # Add additional model properties to the instance
46
+ additional_properties = {} if additional_properties.nil?
47
+
48
+ unless max_characters_per_result == SKIP
49
+ @max_characters_per_result =
50
+ max_characters_per_result
51
+ end
52
+ @additional_properties = additional_properties
53
+ end
54
+
55
+ # Creates an instance of the object from a hash.
56
+ def self.from_hash(hash)
57
+ return nil unless hash
58
+
59
+ # Extract variables from the hash.
60
+ max_characters_per_result =
61
+ hash.key?('max_characters_per_result') ? hash['max_characters_per_result'] : SKIP
62
+
63
+ # Create a new hash for additional properties, removing known properties.
64
+ new_hash = hash.reject { |k, _| names.value?(k) }
65
+
66
+ additional_properties = APIHelper.get_additional_properties(
67
+ new_hash, proc { |value| value }
68
+ )
69
+
70
+ # Create object from extracted values.
71
+ ContentOptions.new(max_characters_per_result: max_characters_per_result,
72
+ additional_properties: additional_properties)
73
+ end
74
+
75
+ # Validates an instance of the object from a given value.
76
+ # @param [ContentOptions | Hash] The value against the validation is performed.
77
+ def self.validate(value)
78
+ return true if value.instance_of? self
79
+
80
+ return false unless value.instance_of? Hash
81
+
82
+ true
83
+ end
84
+
85
+ # Provides a human-readable string representation of the object.
86
+ def to_s
87
+ class_name = self.class.name.split('::').last
88
+ "<#{class_name} max_characters_per_result: #{@max_characters_per_result},"\
89
+ " additional_properties: #{@additional_properties}>"
90
+ end
91
+
92
+ # Provides a debugging-friendly string with detailed object information.
93
+ def inspect
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} max_characters_per_result: #{@max_characters_per_result.inspect},"\
96
+ " additional_properties: #{@additional_properties}>"
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,104 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # CreateAgentRunRequest Model.
8
+ class CreateAgentRunRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The API key, on gRPC requests. REST reads the `x-api-key` header instead.
13
+ # @return [String]
14
+ attr_accessor :api_key
15
+
16
+ # Effort level: how much research the run may do, and its price. One of
17
+ # the configured level names (e.g. `low`, `medium`, `high`, `max`).
18
+ # Omitted = the default level.
19
+ # @return [String]
20
+ attr_accessor :effort
21
+
22
+ # Optional OpenAI-style `response_format` object requesting structured
23
+ # output: `{"type": "text" | "json_object" | "json_schema", ...}`, with
24
+ # `name` / `schema` / `strict` for type `json_schema`. A structured type
25
+ # adds `output.structured` and its `grounding` alongside the cited text;
26
+ # type `text` is accepted and requests no structure. On gRPC the object is
27
+ # JSON-encoded.
28
+ # @return [Object]
29
+ attr_accessor :output_schema
30
+
31
+ # The natural-language question. Instructions inside the query are
32
+ # followed.
33
+ # @return [String]
34
+ attr_accessor :query
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['api_key'] = 'api_key'
40
+ @_hash['effort'] = 'effort'
41
+ @_hash['output_schema'] = 'output_schema'
42
+ @_hash['query'] = 'query'
43
+ @_hash
44
+ end
45
+
46
+ # An array for optional fields
47
+ def self.optionals
48
+ %w[
49
+ api_key
50
+ effort
51
+ output_schema
52
+ query
53
+ ]
54
+ end
55
+
56
+ # An array for nullable fields
57
+ def self.nullables
58
+ %w[
59
+ api_key
60
+ effort
61
+ output_schema
62
+ ]
63
+ end
64
+
65
+ def initialize(api_key: SKIP, effort: SKIP, output_schema: SKIP,
66
+ query: SKIP)
67
+ @api_key = api_key unless api_key == SKIP
68
+ @effort = effort unless effort == SKIP
69
+ @output_schema = output_schema unless output_schema == SKIP
70
+ @query = query unless query == SKIP
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ api_key = hash.key?('api_key') ? hash['api_key'] : SKIP
79
+ effort = hash.key?('effort') ? hash['effort'] : SKIP
80
+ output_schema = hash.key?('output_schema') ? hash['output_schema'] : SKIP
81
+ query = hash.key?('query') ? hash['query'] : SKIP
82
+
83
+ # Create object from extracted values.
84
+ CreateAgentRunRequest.new(api_key: api_key,
85
+ effort: effort,
86
+ output_schema: output_schema,
87
+ query: query)
88
+ end
89
+
90
+ # Provides a human-readable string representation of the object.
91
+ def to_s
92
+ class_name = self.class.name.split('::').last
93
+ "<#{class_name} api_key: #{@api_key}, effort: #{@effort}, output_schema: #{@output_schema},"\
94
+ " query: #{@query}>"
95
+ end
96
+
97
+ # Provides a debugging-friendly string with detailed object information.
98
+ def inspect
99
+ class_name = self.class.name.split('::').last
100
+ "<#{class_name} api_key: #{@api_key.inspect}, effort: #{@effort.inspect}, output_schema:"\
101
+ " #{@output_schema.inspect}, query: #{@query.inspect}>"
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,143 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # CreateMonitorRequest Model.
8
+ class CreateMonitorRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :cadence
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :api_key
19
+
20
+ # Unique per org among live monitors; a deleted monitor's name becomes
21
+ # available again. At most 512 bytes of UTF-8.
22
+ # @return [String]
23
+ attr_accessor :name
24
+
25
+ # At least one, at most 1000. Every request runs on every run. A request
26
+ # with an `api_key` set, a blank `query`, or a body identical to another in
27
+ # the list is rejected.
28
+ # @return [Array[SearchRequest]]
29
+ attr_accessor :search_requests
30
+
31
+ # At least one, at most 1000. Every request runs on every run. A request
32
+ # with an `api_key` set, a blank `query`, or a body identical to another in
33
+ # the list is rejected.
34
+ # @return [MonitorStatus2]
35
+ attr_accessor :status
36
+
37
+ # At least one, at most 1000. Every request runs on every run. A request
38
+ # with an `api_key` set, a blank `query`, or a body identical to another in
39
+ # the list is rejected.
40
+ # @return [Webhook]
41
+ attr_accessor :webhook
42
+
43
+ # A mapping from model property names to API property names.
44
+ def self.names
45
+ @_hash = {} if @_hash.nil?
46
+ @_hash['cadence'] = 'cadence'
47
+ @_hash['api_key'] = 'api_key'
48
+ @_hash['name'] = 'name'
49
+ @_hash['search_requests'] = 'search_requests'
50
+ @_hash['status'] = 'status'
51
+ @_hash['webhook'] = 'webhook'
52
+ @_hash
53
+ end
54
+
55
+ # An array for optional fields
56
+ def self.optionals
57
+ %w[
58
+ api_key
59
+ name
60
+ search_requests
61
+ status
62
+ webhook
63
+ ]
64
+ end
65
+
66
+ # An array for nullable fields
67
+ def self.nullables
68
+ %w[
69
+ api_key
70
+ webhook
71
+ ]
72
+ end
73
+
74
+ def initialize(cadence:, api_key: SKIP, name: SKIP, search_requests: SKIP,
75
+ status: SKIP, webhook: SKIP, additional_properties: nil)
76
+ # Add additional model properties to the instance
77
+ additional_properties = {} if additional_properties.nil?
78
+
79
+ @cadence = cadence
80
+ @api_key = api_key unless api_key == SKIP
81
+ @name = name unless name == SKIP
82
+ @search_requests = search_requests unless search_requests == SKIP
83
+ @status = status unless status == SKIP
84
+ @webhook = webhook unless webhook == SKIP
85
+ @additional_properties = additional_properties
86
+ end
87
+
88
+ # Creates an instance of the object from a hash.
89
+ def self.from_hash(hash)
90
+ return nil unless hash
91
+
92
+ # Extract variables from the hash.
93
+ cadence = hash.key?('cadence') ? hash['cadence'] : nil
94
+ api_key = hash.key?('api_key') ? hash['api_key'] : SKIP
95
+ name = hash.key?('name') ? hash['name'] : SKIP
96
+ # Parameter is an array, so we need to iterate through it
97
+ search_requests = nil
98
+ unless hash['search_requests'].nil?
99
+ search_requests = []
100
+ hash['search_requests'].each do |structure|
101
+ search_requests << (SearchRequest.from_hash(structure) if structure)
102
+ end
103
+ end
104
+
105
+ search_requests = SKIP unless hash.key?('search_requests')
106
+ status = hash.key?('status') ? hash['status'] : SKIP
107
+ webhook = Webhook.from_hash(hash['webhook']) if hash['webhook']
108
+
109
+ # Create a new hash for additional properties, removing known properties.
110
+ new_hash = hash.reject { |k, _| names.value?(k) }
111
+
112
+ additional_properties = APIHelper.get_additional_properties(
113
+ new_hash, proc { |value| value }
114
+ )
115
+
116
+ # Create object from extracted values.
117
+ CreateMonitorRequest.new(cadence: cadence,
118
+ api_key: api_key,
119
+ name: name,
120
+ search_requests: search_requests,
121
+ status: status,
122
+ webhook: webhook,
123
+ additional_properties: additional_properties)
124
+ end
125
+
126
+ # Provides a human-readable string representation of the object.
127
+ def to_s
128
+ class_name = self.class.name.split('::').last
129
+ "<#{class_name} cadence: #{@cadence}, api_key: #{@api_key}, name: #{@name},"\
130
+ " search_requests: #{@search_requests}, status: #{@status}, webhook: #{@webhook},"\
131
+ " additional_properties: #{@additional_properties}>"
132
+ end
133
+
134
+ # Provides a debugging-friendly string with detailed object information.
135
+ def inspect
136
+ class_name = self.class.name.split('::').last
137
+ "<#{class_name} cadence: #{@cadence.inspect}, api_key: #{@api_key.inspect}, name:"\
138
+ " #{@name.inspect}, search_requests: #{@search_requests.inspect}, status:"\
139
+ " #{@status.inspect}, webhook: #{@webhook.inspect}, additional_properties:"\
140
+ " #{@additional_properties}>"
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,90 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # CreateMonitorResponse Model.
8
+ class CreateMonitorResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Monitor]
14
+ attr_accessor :monitor
15
+
16
+ # Returned once, at create, and never again. Issued whether or not the
17
+ # create supplied a webhook, so keep it.
18
+ # @return [String]
19
+ attr_accessor :webhook_secret
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['monitor'] = 'monitor'
25
+ @_hash['webhook_secret'] = 'webhook_secret'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ monitor
33
+ webhook_secret
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ %w[
40
+ monitor
41
+ ]
42
+ end
43
+
44
+ def initialize(monitor: SKIP, webhook_secret: SKIP,
45
+ additional_properties: nil)
46
+ # Add additional model properties to the instance
47
+ additional_properties = {} if additional_properties.nil?
48
+
49
+ @monitor = monitor unless monitor == SKIP
50
+ @webhook_secret = webhook_secret unless webhook_secret == SKIP
51
+ @additional_properties = additional_properties
52
+ end
53
+
54
+ # Creates an instance of the object from a hash.
55
+ def self.from_hash(hash)
56
+ return nil unless hash
57
+
58
+ # Extract variables from the hash.
59
+ monitor = Monitor.from_hash(hash['monitor']) if hash['monitor']
60
+ webhook_secret =
61
+ hash.key?('webhook_secret') ? hash['webhook_secret'] : SKIP
62
+
63
+ # Create a new hash for additional properties, removing known properties.
64
+ new_hash = hash.reject { |k, _| names.value?(k) }
65
+
66
+ additional_properties = APIHelper.get_additional_properties(
67
+ new_hash, proc { |value| value }
68
+ )
69
+
70
+ # Create object from extracted values.
71
+ CreateMonitorResponse.new(monitor: monitor,
72
+ webhook_secret: webhook_secret,
73
+ additional_properties: additional_properties)
74
+ end
75
+
76
+ # Provides a human-readable string representation of the object.
77
+ def to_s
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} monitor: #{@monitor}, webhook_secret: #{@webhook_secret},"\
80
+ " additional_properties: #{@additional_properties}>"
81
+ end
82
+
83
+ # Provides a debugging-friendly string with detailed object information.
84
+ def inspect
85
+ class_name = self.class.name.split('::').last
86
+ "<#{class_name} monitor: #{@monitor.inspect}, webhook_secret: #{@webhook_secret.inspect},"\
87
+ " additional_properties: #{@additional_properties}>"
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,128 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # A single search result. `url` and `published_date` are returned without
8
+ # being asked for, and either may still be absent for a document that carries
9
+ # no such value. The remaining members are populated only when
10
+ # `SearchRequest.fields` asked for them.
11
+ class Document < BaseModel
12
+ SKIP = Object.new
13
+ private_constant :SKIP
14
+
15
+ # TODO: Write general description for this method
16
+ # @return [String]
17
+ attr_accessor :content
18
+
19
+ # Publication date as ISO 8601 string (e.g. "2024-03-15T00:00:00Z")
20
+ # @return [String]
21
+ attr_accessor :published_date
22
+
23
+ # The document's highest-scoring snippets, in the order they appear in the
24
+ # document.
25
+ # Populated when `fields.snippets` is selected and passages are available;
26
+ # empty otherwise.
27
+ # @return [Array[Snippet]]
28
+ attr_accessor :snippets
29
+
30
+ # The document's highest-scoring snippets, in the order they appear in the
31
+ # document.
32
+ # Populated when `fields.snippets` is selected and passages are available;
33
+ # empty otherwise.
34
+ # @return [String]
35
+ attr_accessor :url
36
+
37
+ # A mapping from model property names to API property names.
38
+ def self.names
39
+ @_hash = {} if @_hash.nil?
40
+ @_hash['content'] = 'content'
41
+ @_hash['published_date'] = 'published_date'
42
+ @_hash['snippets'] = 'snippets'
43
+ @_hash['url'] = 'url'
44
+ @_hash
45
+ end
46
+
47
+ # An array for optional fields
48
+ def self.optionals
49
+ %w[
50
+ content
51
+ published_date
52
+ snippets
53
+ url
54
+ ]
55
+ end
56
+
57
+ # An array for nullable fields
58
+ def self.nullables
59
+ %w[
60
+ content
61
+ published_date
62
+ url
63
+ ]
64
+ end
65
+
66
+ def initialize(content: SKIP, published_date: SKIP, snippets: SKIP,
67
+ url: SKIP, additional_properties: nil)
68
+ # Add additional model properties to the instance
69
+ additional_properties = {} if additional_properties.nil?
70
+
71
+ @content = content unless content == SKIP
72
+ @published_date = published_date unless published_date == SKIP
73
+ @snippets = snippets unless snippets == SKIP
74
+ @url = url unless url == SKIP
75
+ @additional_properties = additional_properties
76
+ end
77
+
78
+ # Creates an instance of the object from a hash.
79
+ def self.from_hash(hash)
80
+ return nil unless hash
81
+
82
+ # Extract variables from the hash.
83
+ content = hash.key?('content') ? hash['content'] : SKIP
84
+ published_date =
85
+ hash.key?('published_date') ? hash['published_date'] : SKIP
86
+ # Parameter is an array, so we need to iterate through it
87
+ snippets = nil
88
+ unless hash['snippets'].nil?
89
+ snippets = []
90
+ hash['snippets'].each do |structure|
91
+ snippets << (Snippet.from_hash(structure) if structure)
92
+ end
93
+ end
94
+
95
+ snippets = SKIP unless hash.key?('snippets')
96
+ url = hash.key?('url') ? hash['url'] : SKIP
97
+
98
+ # Create a new hash for additional properties, removing known properties.
99
+ new_hash = hash.reject { |k, _| names.value?(k) }
100
+
101
+ additional_properties = APIHelper.get_additional_properties(
102
+ new_hash, proc { |value| value }
103
+ )
104
+
105
+ # Create object from extracted values.
106
+ Document.new(content: content,
107
+ published_date: published_date,
108
+ snippets: snippets,
109
+ url: url,
110
+ additional_properties: additional_properties)
111
+ end
112
+
113
+ # Provides a human-readable string representation of the object.
114
+ def to_s
115
+ class_name = self.class.name.split('::').last
116
+ "<#{class_name} content: #{@content}, published_date: #{@published_date}, snippets:"\
117
+ " #{@snippets}, url: #{@url}, additional_properties: #{@additional_properties}>"
118
+ end
119
+
120
+ # Provides a debugging-friendly string with detailed object information.
121
+ def inspect
122
+ class_name = self.class.name.split('::').last
123
+ "<#{class_name} content: #{@content.inspect}, published_date: #{@published_date.inspect},"\
124
+ " snippets: #{@snippets.inspect}, url: #{@url.inspect}, additional_properties:"\
125
+ " #{@additional_properties}>"
126
+ end
127
+ end
128
+ end