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,161 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # MonitorsApi
8
+ class MonitorsApi < BaseApi
9
+ # TODO: type endpoint description here
10
+ # @param [String] name Optional parameter: Matches a monitor whose name is
11
+ # exactly this.
12
+ # @param [String] status Optional parameter: One of `active`, `paused`,
13
+ # `disabled`. `deleted` is not a filter: a deleted monitor is invisible.
14
+ # @param [String] since Optional parameter: Exclusive lower bound: the
15
+ # `monitor_id` of a monitor to start after.
16
+ # @param [String] before Optional parameter: Exclusive upper bound. The list
17
+ # is newest first, so page forward with the `monitor_id` of the last monitor
18
+ # on the previous page.
19
+ # @param [Integer] limit Optional parameter: Defaults to 100, at most 1,000.
20
+ # A short page is normal: a page ends at `limit` or at the byte budget,
21
+ # whichever binds first.
22
+ # @return [ApiResponse] Complete http response with raw body and status code.
23
+ def list_monitors(name: nil,
24
+ status: nil,
25
+ since: nil,
26
+ before: nil,
27
+ limit: nil)
28
+ @api_call
29
+ .request(new_request_builder(HttpMethodEnum::GET,
30
+ '/v1/monitors',
31
+ Server::DEFAULT)
32
+ .query_param(new_parameter(name, key: 'name'))
33
+ .query_param(new_parameter(status, key: 'status'))
34
+ .query_param(new_parameter(since, key: 'since'))
35
+ .query_param(new_parameter(before, key: 'before'))
36
+ .query_param(new_parameter(limit, key: 'limit'))
37
+ .header_param(new_parameter('application/json', key: 'accept'))
38
+ .auth(Single.new('ApiKeyAuth')))
39
+ .response(new_response_handler
40
+ .deserializer(APIHelper.method(:custom_type_deserializer))
41
+ .deserialize_into(ListMonitorsResponse.method(:from_hash))
42
+ .is_api_response(true)
43
+ .local_error('401',
44
+ 'Invalid or missing API key.',
45
+ ErrorEnvelopeException))
46
+ .execute
47
+ end
48
+
49
+ # TODO: type endpoint description here
50
+ # @param [CreateMonitorRequest] body Required parameter: TODO: type
51
+ # description here
52
+ # @return [ApiResponse] Complete http response with raw body and status code.
53
+ def create_monitor(body)
54
+ @api_call
55
+ .request(new_request_builder(HttpMethodEnum::POST,
56
+ '/v1/monitors',
57
+ Server::DEFAULT)
58
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
59
+ .body_param(new_parameter(body)
60
+ .is_required(true))
61
+ .header_param(new_parameter('application/json', key: 'accept'))
62
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
63
+ .auth(Single.new('ApiKeyAuth')))
64
+ .response(new_response_handler
65
+ .deserializer(APIHelper.method(:custom_type_deserializer))
66
+ .deserialize_into(CreateMonitorResponse.method(:from_hash))
67
+ .is_api_response(true)
68
+ .local_error('400',
69
+ 'Missing or malformed fields.',
70
+ ErrorEnvelopeException)
71
+ .local_error('401',
72
+ 'Invalid or missing API key.',
73
+ ErrorEnvelopeException)
74
+ .local_error('409',
75
+ 'That name is already taken in this org.',
76
+ ErrorEnvelopeException))
77
+ .execute
78
+ end
79
+
80
+ # TODO: type endpoint description here
81
+ # @param [String] monitor_id Required parameter: TODO: type description
82
+ # here
83
+ # @return [ApiResponse] Complete http response with raw body and status code.
84
+ def get_monitor(monitor_id)
85
+ @api_call
86
+ .request(new_request_builder(HttpMethodEnum::GET,
87
+ '/v1/monitors/{monitor_id}',
88
+ Server::DEFAULT)
89
+ .template_param(new_parameter(monitor_id, key: 'monitor_id')
90
+ .is_required(true)
91
+ .should_encode(true))
92
+ .header_param(new_parameter('application/json', key: 'accept'))
93
+ .auth(Single.new('ApiKeyAuth')))
94
+ .response(new_response_handler
95
+ .deserializer(APIHelper.method(:custom_type_deserializer))
96
+ .deserialize_into(GetMonitorResponse.method(:from_hash))
97
+ .is_api_response(true)
98
+ .local_error('404',
99
+ 'No such monitor in this org.',
100
+ ErrorEnvelopeException))
101
+ .execute
102
+ end
103
+
104
+ # TODO: type endpoint description here
105
+ # @param [String] monitor_id Required parameter: TODO: type description
106
+ # here
107
+ # @return [ApiResponse] Complete http response with raw body and status code.
108
+ def delete_monitor(monitor_id)
109
+ @api_call
110
+ .request(new_request_builder(HttpMethodEnum::DELETE,
111
+ '/v1/monitors/{monitor_id}',
112
+ Server::DEFAULT)
113
+ .template_param(new_parameter(monitor_id, key: 'monitor_id')
114
+ .is_required(true)
115
+ .should_encode(true))
116
+ .header_param(new_parameter('application/json', key: 'accept'))
117
+ .auth(Single.new('ApiKeyAuth')))
118
+ .response(new_response_handler
119
+ .deserializer(APIHelper.method(:json_deserialize))
120
+ .is_api_response(true)
121
+ .local_error('404',
122
+ 'No such monitor in this org.',
123
+ ErrorEnvelopeException))
124
+ .execute
125
+ end
126
+
127
+ # TODO: type endpoint description here
128
+ # @param [String] monitor_id Required parameter: TODO: type description
129
+ # here
130
+ # @param [UpdateMonitorRequest] body Required parameter: TODO: type
131
+ # description here
132
+ # @return [ApiResponse] Complete http response with raw body and status code.
133
+ def update_monitor(monitor_id,
134
+ body)
135
+ @api_call
136
+ .request(new_request_builder(HttpMethodEnum::PATCH,
137
+ '/v1/monitors/{monitor_id}',
138
+ Server::DEFAULT)
139
+ .template_param(new_parameter(monitor_id, key: 'monitor_id')
140
+ .is_required(true)
141
+ .should_encode(true))
142
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
143
+ .body_param(new_parameter(body)
144
+ .is_required(true))
145
+ .header_param(new_parameter('application/json', key: 'accept'))
146
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
147
+ .auth(Single.new('ApiKeyAuth')))
148
+ .response(new_response_handler
149
+ .deserializer(APIHelper.method(:custom_type_deserializer))
150
+ .deserialize_into(UpdateMonitorResponse.method(:from_hash))
151
+ .is_api_response(true)
152
+ .local_error('404',
153
+ 'No such monitor in this org.',
154
+ ErrorEnvelopeException)
155
+ .local_error('409',
156
+ 'That name is already taken in this org.',
157
+ ErrorEnvelopeException))
158
+ .execute
159
+ end
160
+ end
161
+ end
@@ -0,0 +1,97 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # RecordsApi
8
+ class RecordsApi < BaseApi
9
+ # TODO: type endpoint description here
10
+ # @param [String] monitor_id Required parameter: TODO: type description
11
+ # here
12
+ # @param [String] since Optional parameter: Exclusive lower bound on
13
+ # `record_id`.
14
+ # @param [String] before Optional parameter: Exclusive upper bound on
15
+ # `record_id`.
16
+ # @param [Integer] limit Optional parameter: Defaults to 100, at most 1,000.
17
+ # A short page is normal: a page ends at `limit` or at the byte budget,
18
+ # whichever binds first.
19
+ # @param [TrueClass | FalseClass] include_content Optional parameter:
20
+ # Include each record's document content. Defaults to true.
21
+ # @return [ApiResponse] Complete http response with raw body and status code.
22
+ def list_records(monitor_id,
23
+ since: nil,
24
+ before: nil,
25
+ limit: nil,
26
+ include_content: nil)
27
+ @api_call
28
+ .request(new_request_builder(HttpMethodEnum::GET,
29
+ '/v1/monitors/{monitor_id}/records',
30
+ Server::DEFAULT)
31
+ .template_param(new_parameter(monitor_id, key: 'monitor_id')
32
+ .is_required(true)
33
+ .should_encode(true))
34
+ .query_param(new_parameter(since, key: 'since'))
35
+ .query_param(new_parameter(before, key: 'before'))
36
+ .query_param(new_parameter(limit, key: 'limit'))
37
+ .query_param(new_parameter(include_content, key: 'include_content'))
38
+ .header_param(new_parameter('application/json', key: 'accept'))
39
+ .auth(Single.new('ApiKeyAuth')))
40
+ .response(new_response_handler
41
+ .deserializer(APIHelper.method(:custom_type_deserializer))
42
+ .deserialize_into(ListRecordsResponse.method(:from_hash))
43
+ .is_api_response(true)
44
+ .local_error('404',
45
+ 'No such monitor in this org.',
46
+ ErrorEnvelopeException))
47
+ .execute
48
+ end
49
+
50
+ # Exists so that no consumer does arithmetic on a record id: a webhook
51
+ # carries a run's record range as a bound, not a dense sequence.
52
+ # @param [String] monitor_id Required parameter: TODO: type description
53
+ # here
54
+ # @param [String] run_id Required parameter: TODO: type description here
55
+ # @param [String] since Optional parameter: Exclusive lower bound on
56
+ # `record_id`.
57
+ # @param [String] before Optional parameter: Exclusive upper bound on
58
+ # `record_id`.
59
+ # @param [Integer] limit Optional parameter: Defaults to 100, at most 1,000.
60
+ # A short page is normal: a page ends at `limit` or at the byte budget,
61
+ # whichever binds first.
62
+ # @param [TrueClass | FalseClass] include_content Optional parameter:
63
+ # Include each record's document content. Defaults to true.
64
+ # @return [ApiResponse] Complete http response with raw body and status code.
65
+ def list_run_records(monitor_id,
66
+ run_id,
67
+ since: nil,
68
+ before: nil,
69
+ limit: nil,
70
+ include_content: nil)
71
+ @api_call
72
+ .request(new_request_builder(HttpMethodEnum::GET,
73
+ '/v1/monitors/{monitor_id}/runs/{run_id}/records',
74
+ Server::DEFAULT)
75
+ .template_param(new_parameter(monitor_id, key: 'monitor_id')
76
+ .is_required(true)
77
+ .should_encode(true))
78
+ .template_param(new_parameter(run_id, key: 'run_id')
79
+ .is_required(true)
80
+ .should_encode(true))
81
+ .query_param(new_parameter(since, key: 'since'))
82
+ .query_param(new_parameter(before, key: 'before'))
83
+ .query_param(new_parameter(limit, key: 'limit'))
84
+ .query_param(new_parameter(include_content, key: 'include_content'))
85
+ .header_param(new_parameter('application/json', key: 'accept'))
86
+ .auth(Single.new('ApiKeyAuth')))
87
+ .response(new_response_handler
88
+ .deserializer(APIHelper.method(:custom_type_deserializer))
89
+ .deserialize_into(ListRunRecordsResponse.method(:from_hash))
90
+ .is_api_response(true)
91
+ .local_error('404',
92
+ 'No such run on this monitor.',
93
+ ErrorEnvelopeException))
94
+ .execute
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,109 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # RunsApi
8
+ class RunsApi < BaseApi
9
+ # TODO: type endpoint description here
10
+ # @param [String] monitor_id Required parameter: TODO: type description
11
+ # here
12
+ # @param [String] since Optional parameter: Exclusive lower bound on
13
+ # `run_id`.
14
+ # @param [String] before Optional parameter: Exclusive upper bound on
15
+ # `run_id`.
16
+ # @param [Integer] limit Optional parameter: Defaults to 100, at most
17
+ # 1,000.
18
+ # @param [String] sort Optional parameter: `desc` (the default, newest
19
+ # first) or `asc`.
20
+ # @return [ApiResponse] Complete http response with raw body and status code.
21
+ def list_runs(monitor_id,
22
+ since: nil,
23
+ before: nil,
24
+ limit: nil,
25
+ sort: nil)
26
+ @api_call
27
+ .request(new_request_builder(HttpMethodEnum::GET,
28
+ '/v1/monitors/{monitor_id}/runs',
29
+ Server::DEFAULT)
30
+ .template_param(new_parameter(monitor_id, key: 'monitor_id')
31
+ .is_required(true)
32
+ .should_encode(true))
33
+ .query_param(new_parameter(since, key: 'since'))
34
+ .query_param(new_parameter(before, key: 'before'))
35
+ .query_param(new_parameter(limit, key: 'limit'))
36
+ .query_param(new_parameter(sort, key: 'sort'))
37
+ .header_param(new_parameter('application/json', key: 'accept'))
38
+ .auth(Single.new('ApiKeyAuth')))
39
+ .response(new_response_handler
40
+ .deserializer(APIHelper.method(:custom_type_deserializer))
41
+ .deserialize_into(ListRunsResponse.method(:from_hash))
42
+ .is_api_response(true)
43
+ .local_error('404',
44
+ 'No such monitor in this org.',
45
+ ErrorEnvelopeException))
46
+ .execute
47
+ end
48
+
49
+ # TODO: type endpoint description here
50
+ # @param [String] monitor_id Required parameter: TODO: type description
51
+ # here
52
+ # @param [String] run_id Required parameter: TODO: type description here
53
+ # @return [ApiResponse] Complete http response with raw body and status code.
54
+ def get_run(monitor_id,
55
+ run_id)
56
+ @api_call
57
+ .request(new_request_builder(HttpMethodEnum::GET,
58
+ '/v1/monitors/{monitor_id}/runs/{run_id}',
59
+ Server::DEFAULT)
60
+ .template_param(new_parameter(monitor_id, key: 'monitor_id')
61
+ .is_required(true)
62
+ .should_encode(true))
63
+ .template_param(new_parameter(run_id, key: 'run_id')
64
+ .is_required(true)
65
+ .should_encode(true))
66
+ .header_param(new_parameter('application/json', key: 'accept'))
67
+ .auth(Single.new('ApiKeyAuth')))
68
+ .response(new_response_handler
69
+ .deserializer(APIHelper.method(:custom_type_deserializer))
70
+ .deserialize_into(GetRunResponse.method(:from_hash))
71
+ .is_api_response(true)
72
+ .local_error('404',
73
+ 'No such run on this monitor.',
74
+ ErrorEnvelopeException))
75
+ .execute
76
+ end
77
+
78
+ # The only place a customer can tell *this query failed* from *there was
79
+ # genuinely nothing new*: records are a stream of positives, and absence
80
+ # cannot be inferred from presences.
81
+ # @param [String] monitor_id Required parameter: TODO: type description
82
+ # here
83
+ # @param [String] run_id Required parameter: TODO: type description here
84
+ # @return [ApiResponse] Complete http response with raw body and status code.
85
+ def list_run_requests(monitor_id,
86
+ run_id)
87
+ @api_call
88
+ .request(new_request_builder(HttpMethodEnum::GET,
89
+ '/v1/monitors/{monitor_id}/runs/{run_id}/requests',
90
+ Server::DEFAULT)
91
+ .template_param(new_parameter(monitor_id, key: 'monitor_id')
92
+ .is_required(true)
93
+ .should_encode(true))
94
+ .template_param(new_parameter(run_id, key: 'run_id')
95
+ .is_required(true)
96
+ .should_encode(true))
97
+ .header_param(new_parameter('application/json', key: 'accept'))
98
+ .auth(Single.new('ApiKeyAuth')))
99
+ .response(new_response_handler
100
+ .deserializer(APIHelper.method(:custom_type_deserializer))
101
+ .deserialize_into(ListRunRequestsResponse.method(:from_hash))
102
+ .is_api_response(true)
103
+ .local_error('404',
104
+ 'No such run on this monitor.',
105
+ ErrorEnvelopeException))
106
+ .execute
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,55 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # SearchApi
8
+ class SearchApi < BaseApi
9
+ # TODO: type endpoint description here
10
+ # @param [SearchRequest] body Required parameter: TODO: type description
11
+ # here
12
+ # @return [ApiResponse] Complete http response with raw body and status code.
13
+ def search(body)
14
+ @api_call
15
+ .request(new_request_builder(HttpMethodEnum::POST,
16
+ '/v1/search',
17
+ Server::DEFAULT)
18
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
19
+ .body_param(new_parameter(body)
20
+ .is_required(true))
21
+ .header_param(new_parameter('application/json', key: 'accept'))
22
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
23
+ .auth(Single.new('ApiKeyAuth')))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:custom_type_deserializer))
26
+ .deserialize_into(SearchResponse.method(:from_hash))
27
+ .is_api_response(true)
28
+ .local_error('400',
29
+ 'Missing or malformed request fields.',
30
+ ErrorEnvelopeException)
31
+ .local_error('401',
32
+ 'Invalid or missing API key.',
33
+ ErrorEnvelopeException)
34
+ .local_error('402',
35
+ 'Insufficient credits.',
36
+ ErrorEnvelopeException)
37
+ .local_error('404',
38
+ 'Endpoint not found, or a scope that matches nothing.',
39
+ ErrorEnvelopeException)
40
+ .local_error('405',
41
+ 'Wrong method for this endpoint.',
42
+ ErrorEnvelopeException)
43
+ .local_error('413',
44
+ 'Request body is too large.',
45
+ ErrorEnvelopeException)
46
+ .local_error('429',
47
+ 'Rate limit exceeded. Wait before retrying.',
48
+ ErrorEnvelopeException)
49
+ .local_error('500',
50
+ 'Unexpected server error.',
51
+ ErrorEnvelopeException))
52
+ .execute
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,111 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # seltz_api client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ def user_agent_detail
13
+ config.user_agent_detail
14
+ end
15
+
16
+ # Access to search controller.
17
+ # @return [SearchApi] Returns the controller instance.
18
+ def search
19
+ @search ||= SearchApi.new @global_configuration
20
+ end
21
+
22
+ # Access to answer controller.
23
+ # @return [AnswerApi] Returns the controller instance.
24
+ def answer
25
+ @answer ||= AnswerApi.new @global_configuration
26
+ end
27
+
28
+ # Access to monitors controller.
29
+ # @return [MonitorsApi] Returns the controller instance.
30
+ def monitors
31
+ @monitors ||= MonitorsApi.new @global_configuration
32
+ end
33
+
34
+ # Access to records controller.
35
+ # @return [RecordsApi] Returns the controller instance.
36
+ def records
37
+ @records ||= RecordsApi.new @global_configuration
38
+ end
39
+
40
+ # Access to runs controller.
41
+ # @return [RunsApi] Returns the controller instance.
42
+ def runs
43
+ @runs ||= RunsApi.new @global_configuration
44
+ end
45
+
46
+ # Access to agent controller.
47
+ # @return [AgentApi] Returns the controller instance.
48
+ def agent
49
+ @agent ||= AgentApi.new @global_configuration
50
+ end
51
+
52
+ # Access to fetch controller.
53
+ # @return [FetchApi] Returns the controller instance.
54
+ def fetch
55
+ @fetch ||= FetchApi.new @global_configuration
56
+ end
57
+
58
+ def initialize(
59
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
60
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
61
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
62
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
63
+ logging_configuration: nil, environment: Environment::PRODUCTION,
64
+ custom_header_authentication_credentials: nil, config: nil
65
+ )
66
+ @config = if config.nil?
67
+ Configuration.new(
68
+ connection: connection, adapter: adapter, timeout: timeout,
69
+ max_retries: max_retries, retry_interval: retry_interval,
70
+ backoff_factor: backoff_factor,
71
+ retry_statuses: retry_statuses,
72
+ retry_methods: retry_methods, http_callback: http_callback,
73
+ proxy_settings: proxy_settings,
74
+ logging_configuration: logging_configuration,
75
+ environment: environment,
76
+ custom_header_authentication_credentials: custom_header_authentication_credentials
77
+ )
78
+ else
79
+ config
80
+ end
81
+ user_agent_params = BaseApi.user_agent_parameters
82
+
83
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
84
+ .base_uri_executor(@config.method(:get_base_uri))
85
+ .global_errors(BaseApi::GLOBAL_ERRORS)
86
+ .user_agent(BaseApi.user_agent,
87
+ agent_parameters: user_agent_params)
88
+
89
+ initialize_auth_managers(@global_configuration)
90
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
91
+ end
92
+
93
+ # Initializes the auth managers hash used for authenticating API calls.
94
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
95
+ def initialize_auth_managers(global_config)
96
+ @auth_managers = {}
97
+ http_client_config = global_config.client_configuration
98
+ %w[ApiKeyAuth].each { |auth| @auth_managers[auth] = nil }
99
+ @auth_managers['ApiKeyAuth'] = CustomHeaderAuthentication.new(
100
+ http_client_config.custom_header_authentication_credentials
101
+ )
102
+ end
103
+
104
+ # Creates a client directly from environment variables.
105
+ def self.from_env(**overrides)
106
+ default_config = Configuration.build_default_config_from_env
107
+ new_config = default_config.clone_with(**overrides)
108
+ new(config: new_config)
109
+ end
110
+ end
111
+ end