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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +153 -0
- data/bin/console +15 -0
- data/lib/seltz_api/api_helper.rb +10 -0
- data/lib/seltz_api/apis/agent_api.rb +140 -0
- data/lib/seltz_api/apis/answer_api.rb +61 -0
- data/lib/seltz_api/apis/base_api.rb +67 -0
- data/lib/seltz_api/apis/fetch_api.rb +48 -0
- data/lib/seltz_api/apis/monitors_api.rb +161 -0
- data/lib/seltz_api/apis/records_api.rb +97 -0
- data/lib/seltz_api/apis/runs_api.rb +109 -0
- data/lib/seltz_api/apis/search_api.rb +55 -0
- data/lib/seltz_api/client.rb +111 -0
- data/lib/seltz_api/configuration.rb +165 -0
- data/lib/seltz_api/exceptions/api_exception.rb +21 -0
- data/lib/seltz_api/exceptions/error_envelope_exception.rb +46 -0
- data/lib/seltz_api/http/api_response.rb +19 -0
- data/lib/seltz_api/http/auth/custom_header_authentication.rb +52 -0
- data/lib/seltz_api/http/http_call_back.rb +10 -0
- data/lib/seltz_api/http/http_method_enum.rb +10 -0
- data/lib/seltz_api/http/http_request.rb +10 -0
- data/lib/seltz_api/http/http_response.rb +10 -0
- data/lib/seltz_api/http/proxy_settings.rb +22 -0
- data/lib/seltz_api/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/seltz_api/logging/sdk_logger.rb +17 -0
- data/lib/seltz_api/models/agent_run.rb +161 -0
- data/lib/seltz_api/models/agent_run_citation.rb +85 -0
- data/lib/seltz_api/models/agent_run_grounding.rb +94 -0
- data/lib/seltz_api/models/agent_run_output.rb +131 -0
- data/lib/seltz_api/models/agent_run_output2.rb +131 -0
- data/lib/seltz_api/models/agent_run_request.rb +100 -0
- data/lib/seltz_api/models/agent_run_request2.rb +100 -0
- data/lib/seltz_api/models/agent_run_source.rb +86 -0
- data/lib/seltz_api/models/agent_run_status.rb +49 -0
- data/lib/seltz_api/models/agent_run_status2.rb +48 -0
- data/lib/seltz_api/models/agent_run_stop_reason.rb +53 -0
- data/lib/seltz_api/models/agent_run_stop_reason2.rb +52 -0
- data/lib/seltz_api/models/answer_http_request.rb +172 -0
- data/lib/seltz_api/models/answer_http_response.rb +93 -0
- data/lib/seltz_api/models/base_model.rb +110 -0
- data/lib/seltz_api/models/content_options.rb +99 -0
- data/lib/seltz_api/models/create_agent_run_request.rb +104 -0
- data/lib/seltz_api/models/create_monitor_request.rb +143 -0
- data/lib/seltz_api/models/create_monitor_response.rb +90 -0
- data/lib/seltz_api/models/document.rb +128 -0
- data/lib/seltz_api/models/envelope_error.rb +83 -0
- data/lib/seltz_api/models/envelope_error1.rb +82 -0
- data/lib/seltz_api/models/fetch_error.rb +107 -0
- data/lib/seltz_api/models/fetch_error1.rb +108 -0
- data/lib/seltz_api/models/fetch_request.rb +144 -0
- data/lib/seltz_api/models/fetch_response.rb +87 -0
- data/lib/seltz_api/models/fetch_result.rb +176 -0
- data/lib/seltz_api/models/fetch_status.rb +36 -0
- data/lib/seltz_api/models/fetch_status2.rb +40 -0
- data/lib/seltz_api/models/fields.rb +108 -0
- data/lib/seltz_api/models/fields2.rb +101 -0
- data/lib/seltz_api/models/get_monitor_response.rb +87 -0
- data/lib/seltz_api/models/get_run_response.rb +76 -0
- data/lib/seltz_api/models/http_citation.rb +86 -0
- data/lib/seltz_api/models/list_agent_runs_response.rb +96 -0
- data/lib/seltz_api/models/list_monitors_response.rb +97 -0
- data/lib/seltz_api/models/list_records_response.rb +96 -0
- data/lib/seltz_api/models/list_run_records_response.rb +96 -0
- data/lib/seltz_api/models/list_run_requests_response.rb +84 -0
- data/lib/seltz_api/models/list_runs_response.rb +96 -0
- data/lib/seltz_api/models/monitor.rb +157 -0
- data/lib/seltz_api/models/monitor_search_request.rb +110 -0
- data/lib/seltz_api/models/monitor_status.rb +47 -0
- data/lib/seltz_api/models/monitor_status2.rb +45 -0
- data/lib/seltz_api/models/payload.rb +74 -0
- data/lib/seltz_api/models/record.rb +116 -0
- data/lib/seltz_api/models/record_type.rb +26 -0
- data/lib/seltz_api/models/request_status.rb +36 -0
- data/lib/seltz_api/models/run.rb +200 -0
- data/lib/seltz_api/models/run_request.rb +127 -0
- data/lib/seltz_api/models/run_state.rb +40 -0
- data/lib/seltz_api/models/run_state2.rb +41 -0
- data/lib/seltz_api/models/run_status.rb +47 -0
- data/lib/seltz_api/models/schedule.rb +73 -0
- data/lib/seltz_api/models/search_record.rb +101 -0
- data/lib/seltz_api/models/search_request.rb +208 -0
- data/lib/seltz_api/models/search_request_ref.rb +87 -0
- data/lib/seltz_api/models/search_response.rb +85 -0
- data/lib/seltz_api/models/snippet.rb +76 -0
- data/lib/seltz_api/models/snippet_options.rb +151 -0
- data/lib/seltz_api/models/update_monitor_request.rb +153 -0
- data/lib/seltz_api/models/update_monitor_response.rb +77 -0
- data/lib/seltz_api/models/webhook.rb +113 -0
- data/lib/seltz_api/models/webhook1.rb +114 -0
- data/lib/seltz_api/utilities/date_time_helper.rb +11 -0
- data/lib/seltz_api/utilities/file_wrapper.rb +28 -0
- data/lib/seltz_api/utilities/union_type_lookup.rb +62 -0
- data/lib/seltz_api.rb +115 -0
- metadata +178 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: dcf655cc6865d47e6f6996e6725a8cf1914dee9e92fd41de96e0f9568b324f0e
|
|
4
|
+
data.tar.gz: bc7340cd321ccd527c474836b17585300076669852a95f1175292b25091a1841
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a77b1717262d639930baa2287a504b3c6927b39ae8b579164db7dd1600cc6156d160ea996ea38b6ee2da1fc672c9ccf5dc5dfc7543a5085673d13c5834618885
|
|
7
|
+
data.tar.gz: 5d8761c674480606939f39191ddfed9b99c465482097feff8bd1804f07ffca7e981c7c84477d9a1434cf8f6cb4955651c0342e0fb7731e3295b2ea0e95796942
|
data/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
License:
|
|
2
|
+
========
|
|
3
|
+
The MIT License (MIT)
|
|
4
|
+
http://opensource.org/licenses/MIT
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2014 - 2026 APIMATIC Limited
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
Trade Mark:
|
|
27
|
+
==========
|
|
28
|
+
APIMATIC is a trade mark for APIMATIC Limited
|
data/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
|
|
2
|
+
# Getting Started with Seltz API
|
|
3
|
+
|
|
4
|
+
## Introduction
|
|
5
|
+
|
|
6
|
+
REST API for the Seltz platform: context retrieval (`/v1/search`), RAG answers (`/v1/answer`), monitors (`/v1/monitors`), and page fetching (`/v1/fetch`).
|
|
7
|
+
|
|
8
|
+
## Install the Package
|
|
9
|
+
|
|
10
|
+
Install the gem from the command line:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
gem install sz-apimatic-sdk -v 0.0.1
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or add the gem to your Gemfile and run `bundle`:
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
gem 'sz-apimatic-sdk', '0.0.1'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For additional gem details, see the [RubyGems page for the sz-apimatic-sdk gem](https://rubygems.org/gems/sz-apimatic-sdk/versions/0.0.1).
|
|
23
|
+
|
|
24
|
+
## IRB Console Usage
|
|
25
|
+
|
|
26
|
+
You can explore the SDK interactively using IRB in two ways
|
|
27
|
+
|
|
28
|
+
### 1. Use IRB with Installed Gem
|
|
29
|
+
|
|
30
|
+
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
irb
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Now you can load the SDK in the IRB
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
require 'seltz_api'
|
|
40
|
+
include SeltzApi
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Use IRB within SDK
|
|
44
|
+
|
|
45
|
+
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
cd path/to/seltz_api
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Now you can start the preconfigured irb console by running the following command
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
ruby bin/console
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**_Note:_** This automatically loads the SDK from lib/
|
|
58
|
+
|
|
59
|
+
## Initialize the API Client
|
|
60
|
+
|
|
61
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/client.md)
|
|
62
|
+
|
|
63
|
+
The following parameters are configurable for the API Client:
|
|
64
|
+
|
|
65
|
+
| Parameter | Type | Description |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
|
68
|
+
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
|
69
|
+
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
|
|
70
|
+
| max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
|
71
|
+
| retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
|
|
72
|
+
| backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
|
|
73
|
+
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
74
|
+
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
|
75
|
+
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
|
76
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
77
|
+
| logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
|
|
78
|
+
| custom_header_authentication_credentials | [`CustomHeaderAuthenticationCredentials`](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
|
|
79
|
+
|
|
80
|
+
The API client can be initialized as follows:
|
|
81
|
+
|
|
82
|
+
### Code-Based Client Initialization
|
|
83
|
+
|
|
84
|
+
```ruby
|
|
85
|
+
require 'seltz_api'
|
|
86
|
+
include SeltzApi
|
|
87
|
+
|
|
88
|
+
client = Client.new(
|
|
89
|
+
custom_header_authentication_credentials: CustomHeaderAuthenticationCredentials.new(
|
|
90
|
+
x_api_key: 'x-api-key'
|
|
91
|
+
),
|
|
92
|
+
logging_configuration: LoggingConfiguration.new(
|
|
93
|
+
log_level: Logger::INFO,
|
|
94
|
+
request_logging_config: RequestLoggingConfiguration.new(
|
|
95
|
+
log_body: true
|
|
96
|
+
),
|
|
97
|
+
response_logging_config: ResponseLoggingConfiguration.new(
|
|
98
|
+
log_headers: true
|
|
99
|
+
)
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Environment-Based Client Initialization
|
|
105
|
+
|
|
106
|
+
```ruby
|
|
107
|
+
require 'seltz_api'
|
|
108
|
+
include SeltzApi
|
|
109
|
+
|
|
110
|
+
# Create client from environment
|
|
111
|
+
client = Client.from_env
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md) section for details.
|
|
115
|
+
|
|
116
|
+
## Authorization
|
|
117
|
+
|
|
118
|
+
This API uses the following authentication schemes.
|
|
119
|
+
|
|
120
|
+
* [`ApiKeyAuth (Custom Header Signature)`](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature.md)
|
|
121
|
+
|
|
122
|
+
## List of APIs
|
|
123
|
+
|
|
124
|
+
* [Search](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/search.md)
|
|
125
|
+
* [Answer](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/answer.md)
|
|
126
|
+
* [Monitors](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/monitors.md)
|
|
127
|
+
* [Records](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/records.md)
|
|
128
|
+
* [Runs](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/runs.md)
|
|
129
|
+
* [Agent](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/agent.md)
|
|
130
|
+
* [Fetch](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/fetch.md)
|
|
131
|
+
|
|
132
|
+
## SDK Infrastructure
|
|
133
|
+
|
|
134
|
+
### Configuration
|
|
135
|
+
|
|
136
|
+
* [ProxySettings](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/proxy-settings.md)
|
|
137
|
+
* [Environment-Based Client Initialization](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md)
|
|
138
|
+
* [AbstractLogger](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/abstract-logger.md)
|
|
139
|
+
* [LoggingConfiguration](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/logging-configuration.md)
|
|
140
|
+
* [RequestLoggingConfiguration](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/request-logging-configuration.md)
|
|
141
|
+
* [ResponseLoggingConfiguration](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/response-logging-configuration.md)
|
|
142
|
+
|
|
143
|
+
### HTTP
|
|
144
|
+
|
|
145
|
+
* [HttpResponse](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/http-response.md)
|
|
146
|
+
* [HttpRequest](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/http-request.md)
|
|
147
|
+
|
|
148
|
+
### Utilities
|
|
149
|
+
|
|
150
|
+
* [ApiResponse](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/api-response.md)
|
|
151
|
+
* [ApiHelper](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/api-helper.md)
|
|
152
|
+
* [DateTimeHelper](https://www.github.com/sdks-io/sz-apimatic-ruby-sdk/tree/0.0.1/doc/date-time-helper.md)
|
|
153
|
+
|
data/bin/console
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# Load the lib folder into Ruby's load path
|
|
4
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
|
5
|
+
|
|
6
|
+
# Require the gem
|
|
7
|
+
require 'seltz_api'
|
|
8
|
+
|
|
9
|
+
puts 'SeltzApi SDK loaded!'
|
|
10
|
+
puts 'You can now create a client with: client = SeltzApi::Client.new'
|
|
11
|
+
puts 'Or use from_env: client = SeltzApi::Client.from_env'
|
|
12
|
+
|
|
13
|
+
# Start an interactive IRB session
|
|
14
|
+
require 'irb'
|
|
15
|
+
IRB.start
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# seltz_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SeltzApi
|
|
7
|
+
# AgentApi
|
|
8
|
+
class AgentApi < BaseApi
|
|
9
|
+
# The organization's runs, newest first. Pass one page's `next` as the
|
|
10
|
+
# following request's `after`.
|
|
11
|
+
# @param [Integer] limit Optional parameter: Page size, 1-100. Defaults to
|
|
12
|
+
# 20.
|
|
13
|
+
# @param [String] after Optional parameter: Pagination cursor: the previous
|
|
14
|
+
# page's `next`.
|
|
15
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
16
|
+
def list_agent_runs(limit: nil,
|
|
17
|
+
after: nil)
|
|
18
|
+
@api_call
|
|
19
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
20
|
+
'/v1/agent/runs',
|
|
21
|
+
Server::DEFAULT)
|
|
22
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
23
|
+
.query_param(new_parameter(after, key: 'after'))
|
|
24
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
25
|
+
.auth(Single.new('ApiKeyAuth')))
|
|
26
|
+
.response(new_response_handler
|
|
27
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
28
|
+
.deserialize_into(ListAgentRunsResponse.method(:from_hash))
|
|
29
|
+
.is_api_response(true)
|
|
30
|
+
.local_error('400',
|
|
31
|
+
'Malformed or unknown query parameter.',
|
|
32
|
+
ErrorEnvelopeException)
|
|
33
|
+
.local_error('401',
|
|
34
|
+
'Invalid or missing API key.',
|
|
35
|
+
ErrorEnvelopeException)
|
|
36
|
+
.local_error('404',
|
|
37
|
+
'Unknown `after` cursor.',
|
|
38
|
+
ErrorEnvelopeException)
|
|
39
|
+
.local_error('500',
|
|
40
|
+
'Unexpected server error.',
|
|
41
|
+
ErrorEnvelopeException))
|
|
42
|
+
.execute
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns the new run in `pending` state. Poll it by id until `status`
|
|
46
|
+
# reaches a terminal state.
|
|
47
|
+
# @param [CreateAgentRunRequest] body Required parameter: TODO: type
|
|
48
|
+
# description here
|
|
49
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
50
|
+
def create_agent_run(body)
|
|
51
|
+
@api_call
|
|
52
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
53
|
+
'/v1/agent/runs',
|
|
54
|
+
Server::DEFAULT)
|
|
55
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
56
|
+
.body_param(new_parameter(body)
|
|
57
|
+
.is_required(true))
|
|
58
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
59
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
60
|
+
.auth(Single.new('ApiKeyAuth')))
|
|
61
|
+
.response(new_response_handler
|
|
62
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
63
|
+
.deserialize_into(AgentRun.method(:from_hash))
|
|
64
|
+
.is_api_response(true)
|
|
65
|
+
.local_error('400',
|
|
66
|
+
'Malformed body, unknown field, unknown `effort`, or a rejected'\
|
|
67
|
+
' `output_schema`.',
|
|
68
|
+
ErrorEnvelopeException)
|
|
69
|
+
.local_error('401',
|
|
70
|
+
'Invalid or missing API key.',
|
|
71
|
+
ErrorEnvelopeException)
|
|
72
|
+
.local_error('402',
|
|
73
|
+
'Insufficient credits.',
|
|
74
|
+
ErrorEnvelopeException)
|
|
75
|
+
.local_error('500',
|
|
76
|
+
'Unexpected server error.',
|
|
77
|
+
ErrorEnvelopeException))
|
|
78
|
+
.execute
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Poll until `status` reaches a terminal state.
|
|
82
|
+
# @param [String] id Required parameter: The run id.
|
|
83
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
84
|
+
def get_agent_run(id)
|
|
85
|
+
@api_call
|
|
86
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
87
|
+
'/v1/agent/runs/{id}',
|
|
88
|
+
Server::DEFAULT)
|
|
89
|
+
.template_param(new_parameter(id, key: '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(AgentRun.method(:from_hash))
|
|
97
|
+
.is_api_response(true)
|
|
98
|
+
.local_error('401',
|
|
99
|
+
'Invalid or missing API key.',
|
|
100
|
+
ErrorEnvelopeException)
|
|
101
|
+
.local_error('404',
|
|
102
|
+
'No such run in this org.',
|
|
103
|
+
ErrorEnvelopeException)
|
|
104
|
+
.local_error('500',
|
|
105
|
+
'Unexpected server error.',
|
|
106
|
+
ErrorEnvelopeException))
|
|
107
|
+
.execute
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Stop a run that has not finished. Returns the run, unchanged if it had
|
|
111
|
+
# already ended, so cancelling is safe to retry.
|
|
112
|
+
# @param [String] id Required parameter: The run id.
|
|
113
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
114
|
+
def cancel_agent_run(id)
|
|
115
|
+
@api_call
|
|
116
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
117
|
+
'/v1/agent/runs/{id}/cancel',
|
|
118
|
+
Server::DEFAULT)
|
|
119
|
+
.template_param(new_parameter(id, key: 'id')
|
|
120
|
+
.is_required(true)
|
|
121
|
+
.should_encode(true))
|
|
122
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
123
|
+
.auth(Single.new('ApiKeyAuth')))
|
|
124
|
+
.response(new_response_handler
|
|
125
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
126
|
+
.deserialize_into(AgentRun.method(:from_hash))
|
|
127
|
+
.is_api_response(true)
|
|
128
|
+
.local_error('401',
|
|
129
|
+
'Invalid or missing API key.',
|
|
130
|
+
ErrorEnvelopeException)
|
|
131
|
+
.local_error('404',
|
|
132
|
+
'No such run in this org.',
|
|
133
|
+
ErrorEnvelopeException)
|
|
134
|
+
.local_error('500',
|
|
135
|
+
'Unexpected server error.',
|
|
136
|
+
ErrorEnvelopeException))
|
|
137
|
+
.execute
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# seltz_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SeltzApi
|
|
7
|
+
# AnswerApi
|
|
8
|
+
class AnswerApi < BaseApi
|
|
9
|
+
# TODO: type endpoint description here
|
|
10
|
+
# @param [AnswerHttpRequest] body Required parameter: TODO: type description
|
|
11
|
+
# here
|
|
12
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
13
|
+
def answer(body)
|
|
14
|
+
@api_call
|
|
15
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
16
|
+
'/v1/answer',
|
|
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(AnswerHttpResponse.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('408',
|
|
44
|
+
'The answer did not complete in time.',
|
|
45
|
+
ErrorEnvelopeException)
|
|
46
|
+
.local_error('413',
|
|
47
|
+
'Request body is too large.',
|
|
48
|
+
ErrorEnvelopeException)
|
|
49
|
+
.local_error('415',
|
|
50
|
+
'`Content-Type` is not `application/json`.',
|
|
51
|
+
ErrorEnvelopeException)
|
|
52
|
+
.local_error('429',
|
|
53
|
+
'Rate limit exceeded. Wait before retrying.',
|
|
54
|
+
ErrorEnvelopeException)
|
|
55
|
+
.local_error('500',
|
|
56
|
+
'Unexpected server error.',
|
|
57
|
+
ErrorEnvelopeException))
|
|
58
|
+
.execute
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# seltz_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SeltzApi
|
|
7
|
+
# BaseApi.
|
|
8
|
+
class BaseApi
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
attr_accessor :config, :http_call_back
|
|
11
|
+
|
|
12
|
+
def self.user_agent
|
|
13
|
+
'Ruby-SDK/0.0.1 (OS: {os-info}, Engine: {engine}/{engine-version})'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.user_agent_parameters
|
|
17
|
+
{
|
|
18
|
+
'{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false },
|
|
19
|
+
'{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false },
|
|
20
|
+
'{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
GLOBAL_ERRORS = {
|
|
25
|
+
'default' => ErrorCase.new
|
|
26
|
+
.error_message('HTTP response not OK.')
|
|
27
|
+
.exception_type(APIException)
|
|
28
|
+
}.freeze
|
|
29
|
+
|
|
30
|
+
# Initialization constructor.
|
|
31
|
+
# @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
|
|
32
|
+
def initialize(global_configuration)
|
|
33
|
+
@global_configuration = global_configuration
|
|
34
|
+
@config = @global_configuration.client_configuration
|
|
35
|
+
@http_call_back = @config.http_callback
|
|
36
|
+
@api_call = ApiCall.new(@global_configuration)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Creates a new instance of the request builder.
|
|
40
|
+
# @param [String] http_method The HTTP method to use in the request.
|
|
41
|
+
# @param [String] path The endpoint path to use in the request.
|
|
42
|
+
# @param [String] server The server to extract the base uri for the request.
|
|
43
|
+
# @return [RequestBuilder] The instance of RequestBuilder.
|
|
44
|
+
def new_request_builder(http_method, path, server)
|
|
45
|
+
RequestBuilder.new
|
|
46
|
+
.http_method(http_method)
|
|
47
|
+
.path(path)
|
|
48
|
+
.server(server)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Creates a new instance of the response handler.
|
|
52
|
+
# @return [ResponseHandler] The instance of ResponseHandler.
|
|
53
|
+
def new_response_handler
|
|
54
|
+
ResponseHandler.new
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Creates a new instance of the parameter.
|
|
58
|
+
# @param [String|optional] key The key of the parameter.
|
|
59
|
+
# @param [Object] value The value of the parameter.
|
|
60
|
+
# @return [Parameter] The instance of Parameter.
|
|
61
|
+
def new_parameter(value, key: nil)
|
|
62
|
+
Parameter.new
|
|
63
|
+
.key(key)
|
|
64
|
+
.value(value)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# seltz_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SeltzApi
|
|
7
|
+
# FetchApi
|
|
8
|
+
class FetchApi < BaseApi
|
|
9
|
+
# TODO: type endpoint description here
|
|
10
|
+
# @param [FetchRequest] body Required parameter: TODO: type description
|
|
11
|
+
# here
|
|
12
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
13
|
+
def fetch(body)
|
|
14
|
+
@api_call
|
|
15
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
16
|
+
'/v1/fetch',
|
|
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(FetchResponse.method(:from_hash))
|
|
27
|
+
.is_api_response(true)
|
|
28
|
+
.local_error('400',
|
|
29
|
+
'Malformed body, an out-of-bounds or duplicated `urls` entry,'\
|
|
30
|
+
' or an unavailable `formats` or `tier` value. Unrecognized'\
|
|
31
|
+
' fields are ignored.',
|
|
32
|
+
ErrorEnvelopeException)
|
|
33
|
+
.local_error('401',
|
|
34
|
+
'Invalid or missing API key.',
|
|
35
|
+
ErrorEnvelopeException)
|
|
36
|
+
.local_error('402',
|
|
37
|
+
'Insufficient credits.',
|
|
38
|
+
ErrorEnvelopeException)
|
|
39
|
+
.local_error('429',
|
|
40
|
+
'Rate limited.',
|
|
41
|
+
ErrorEnvelopeException)
|
|
42
|
+
.local_error('500',
|
|
43
|
+
'Unexpected server error.',
|
|
44
|
+
ErrorEnvelopeException))
|
|
45
|
+
.execute
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|