speakeasy_client_sdk_ruby 1.14.0 → 1.15.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 +4 -4
- data/lib/sdk/apiendpoints.rb +44 -41
- data/lib/sdk/apis.rb +35 -34
- data/lib/sdk/embeds.rb +21 -23
- data/lib/sdk/metadata.rb +19 -21
- data/lib/sdk/plugins.rb +21 -23
- data/lib/sdk/requests.rb +20 -22
- data/lib/sdk/schemas.rb +44 -41
- data/lib/sdk/sdk.rb +37 -93
- data/lib/sdk/sdkconfiguration.rb +53 -0
- data/lib/sdk/utils/utils.rb +6 -1
- data/lib/speakeasy_client_sdk_ruby.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa180e6ab1d595a096ae6e65f3a5b4690c1751a37167d8a80a4c5af6427d33b0
|
4
|
+
data.tar.gz: 48f97699c4ab8cc7aaad233a8e5685f30445362e7b8fa7b23d21ee04f3eea405
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f737e85b8dac4d413fe3674c68b771daae5d2623bfea907eb95c45b401686cb8f88390af43b7355b55d1d48d42efe98f3d314ab559822c413d562f4f96dd2ef
|
7
|
+
data.tar.gz: 0cd9d71e4531774fd9e60b13e424f1e4a34976b78227f6e23a53d14001ce1539fb33d35f2d65e0b50fc8fbc4812247d67bd4f3aeacdad2b985a2d945fdf3ef54
|
data/lib/sdk/apiendpoints.rb
CHANGED
@@ -10,23 +10,19 @@ require 'sorbet-runtime'
|
|
10
10
|
module SpeakeasyClientSDK
|
11
11
|
extend T::Sig
|
12
12
|
class ApiEndpoints
|
13
|
+
# REST APIs for managing ApiEndpoint entities
|
13
14
|
extend T::Sig
|
14
|
-
sig { params(
|
15
|
-
def initialize(
|
16
|
-
@
|
17
|
-
@client = client
|
18
|
-
@server_url = server_url
|
19
|
-
@language = language
|
20
|
-
@sdk_version = sdk_version
|
21
|
-
@gen_version = gen_version
|
22
|
-
@openapi_doc_version = openapi_doc_version
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
23
18
|
end
|
24
19
|
|
25
20
|
sig { params(request: Operations::DeleteApiEndpointRequest).returns(Utils::FieldAugmented) }
|
26
21
|
def delete_api_endpoint(request)
|
27
22
|
# delete_api_endpoint - Delete an ApiEndpoint.
|
28
23
|
# Delete an ApiEndpoint. This will also delete all associated Request Logs (if using a Postgres datastore).
|
29
|
-
|
24
|
+
url, params = @sdk_configuration.get_server_details
|
25
|
+
base_url = Utils.template_url(url, params)
|
30
26
|
url = Utils.generate_url(
|
31
27
|
Operations::DeleteApiEndpointRequest,
|
32
28
|
base_url,
|
@@ -35,11 +31,11 @@ module SpeakeasyClientSDK
|
|
35
31
|
)
|
36
32
|
headers = {}
|
37
33
|
headers['Accept'] = 'application/json'
|
38
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
34
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
39
35
|
|
40
|
-
r = @client.delete(url) do |req|
|
36
|
+
r = @sdk_configuration.client.delete(url) do |req|
|
41
37
|
req.headers = headers
|
42
|
-
Utils.configure_request_security(req, @
|
38
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
43
39
|
end
|
44
40
|
|
45
41
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -62,7 +58,8 @@ module SpeakeasyClientSDK
|
|
62
58
|
# find_api_endpoint - Find an ApiEndpoint via its displayName.
|
63
59
|
# Find an ApiEndpoint via its displayName (set by operationId from a registered OpenAPI schema).
|
64
60
|
# This is useful for finding the ID of an ApiEndpoint to use in the /v1/apis/{apiID}/version/{versionID}/api_endpoints/{apiEndpointID} endpoints.
|
65
|
-
|
61
|
+
url, params = @sdk_configuration.get_server_details
|
62
|
+
base_url = Utils.template_url(url, params)
|
66
63
|
url = Utils.generate_url(
|
67
64
|
Operations::FindApiEndpointRequest,
|
68
65
|
base_url,
|
@@ -71,11 +68,11 @@ module SpeakeasyClientSDK
|
|
71
68
|
)
|
72
69
|
headers = {}
|
73
70
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
74
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
71
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
75
72
|
|
76
|
-
r = @client.get(url) do |req|
|
73
|
+
r = @sdk_configuration.client.get(url) do |req|
|
77
74
|
req.headers = headers
|
78
|
-
Utils.configure_request_security(req, @
|
75
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
79
76
|
end
|
80
77
|
|
81
78
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -102,7 +99,8 @@ module SpeakeasyClientSDK
|
|
102
99
|
# generate_open_api_spec_for_api_endpoint - Generate an OpenAPI specification for a particular ApiEndpoint.
|
103
100
|
# This endpoint will generate a new operation in any registered OpenAPI document if the operation does not already exist in the document.
|
104
101
|
# Returns the original document and the newly generated document allowing a diff to be performed to see what has changed.
|
105
|
-
|
102
|
+
url, params = @sdk_configuration.get_server_details
|
103
|
+
base_url = Utils.template_url(url, params)
|
106
104
|
url = Utils.generate_url(
|
107
105
|
Operations::GenerateOpenApiSpecForApiEndpointRequest,
|
108
106
|
base_url,
|
@@ -111,11 +109,11 @@ module SpeakeasyClientSDK
|
|
111
109
|
)
|
112
110
|
headers = {}
|
113
111
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
114
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
112
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
115
113
|
|
116
|
-
r = @client.get(url) do |req|
|
114
|
+
r = @sdk_configuration.client.get(url) do |req|
|
117
115
|
req.headers = headers
|
118
|
-
Utils.configure_request_security(req, @
|
116
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
119
117
|
end
|
120
118
|
|
121
119
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -141,7 +139,8 @@ module SpeakeasyClientSDK
|
|
141
139
|
def generate_postman_collection_for_api_endpoint(request)
|
142
140
|
# generate_postman_collection_for_api_endpoint - Generate a Postman collection for a particular ApiEndpoint.
|
143
141
|
# Generates a postman collection that allows the endpoint to be called from postman variables produced for any path/query/header parameters included in the OpenAPI document.
|
144
|
-
|
142
|
+
url, params = @sdk_configuration.get_server_details
|
143
|
+
base_url = Utils.template_url(url, params)
|
145
144
|
url = Utils.generate_url(
|
146
145
|
Operations::GeneratePostmanCollectionForApiEndpointRequest,
|
147
146
|
base_url,
|
@@ -150,11 +149,11 @@ module SpeakeasyClientSDK
|
|
150
149
|
)
|
151
150
|
headers = {}
|
152
151
|
headers['Accept'] = 'application/json;q=1, application/octet-stream;q=0'
|
153
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
152
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
154
153
|
|
155
|
-
r = @client.get(url) do |req|
|
154
|
+
r = @sdk_configuration.client.get(url) do |req|
|
156
155
|
req.headers = headers
|
157
|
-
Utils.configure_request_security(req, @
|
156
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
158
157
|
end
|
159
158
|
|
160
159
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -176,7 +175,8 @@ module SpeakeasyClientSDK
|
|
176
175
|
sig { params(request: Operations::GetAllApiEndpointsRequest).returns(Utils::FieldAugmented) }
|
177
176
|
def get_all_api_endpoints(request)
|
178
177
|
# get_all_api_endpoints - Get all Api endpoints for a particular apiID.
|
179
|
-
|
178
|
+
url, params = @sdk_configuration.get_server_details
|
179
|
+
base_url = Utils.template_url(url, params)
|
180
180
|
url = Utils.generate_url(
|
181
181
|
Operations::GetAllApiEndpointsRequest,
|
182
182
|
base_url,
|
@@ -185,11 +185,11 @@ module SpeakeasyClientSDK
|
|
185
185
|
)
|
186
186
|
headers = {}
|
187
187
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
188
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
188
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
189
189
|
|
190
|
-
r = @client.get(url) do |req|
|
190
|
+
r = @sdk_configuration.client.get(url) do |req|
|
191
191
|
req.headers = headers
|
192
|
-
Utils.configure_request_security(req, @
|
192
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
193
193
|
end
|
194
194
|
|
195
195
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -214,7 +214,8 @@ module SpeakeasyClientSDK
|
|
214
214
|
sig { params(request: Operations::GetAllForVersionApiEndpointsRequest).returns(Utils::FieldAugmented) }
|
215
215
|
def get_all_for_version_api_endpoints(request)
|
216
216
|
# get_all_for_version_api_endpoints - Get all ApiEndpoints for a particular apiID and versionID.
|
217
|
-
|
217
|
+
url, params = @sdk_configuration.get_server_details
|
218
|
+
base_url = Utils.template_url(url, params)
|
218
219
|
url = Utils.generate_url(
|
219
220
|
Operations::GetAllForVersionApiEndpointsRequest,
|
220
221
|
base_url,
|
@@ -223,11 +224,11 @@ module SpeakeasyClientSDK
|
|
223
224
|
)
|
224
225
|
headers = {}
|
225
226
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
226
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
227
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
227
228
|
|
228
|
-
r = @client.get(url) do |req|
|
229
|
+
r = @sdk_configuration.client.get(url) do |req|
|
229
230
|
req.headers = headers
|
230
|
-
Utils.configure_request_security(req, @
|
231
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
231
232
|
end
|
232
233
|
|
233
234
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -252,7 +253,8 @@ module SpeakeasyClientSDK
|
|
252
253
|
sig { params(request: Operations::GetApiEndpointRequest).returns(Utils::FieldAugmented) }
|
253
254
|
def get_api_endpoint(request)
|
254
255
|
# get_api_endpoint - Get an ApiEndpoint.
|
255
|
-
|
256
|
+
url, params = @sdk_configuration.get_server_details
|
257
|
+
base_url = Utils.template_url(url, params)
|
256
258
|
url = Utils.generate_url(
|
257
259
|
Operations::GetApiEndpointRequest,
|
258
260
|
base_url,
|
@@ -261,11 +263,11 @@ module SpeakeasyClientSDK
|
|
261
263
|
)
|
262
264
|
headers = {}
|
263
265
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
264
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
266
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
265
267
|
|
266
|
-
r = @client.get(url) do |req|
|
268
|
+
r = @sdk_configuration.client.get(url) do |req|
|
267
269
|
req.headers = headers
|
268
|
-
Utils.configure_request_security(req, @
|
270
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
269
271
|
end
|
270
272
|
|
271
273
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -291,7 +293,8 @@ module SpeakeasyClientSDK
|
|
291
293
|
def upsert_api_endpoint(request)
|
292
294
|
# upsert_api_endpoint - Upsert an ApiEndpoint.
|
293
295
|
# Upsert an ApiEndpoint. If the ApiEndpoint does not exist it will be created, otherwise it will be updated.
|
294
|
-
|
296
|
+
url, params = @sdk_configuration.get_server_details
|
297
|
+
base_url = Utils.template_url(url, params)
|
295
298
|
url = Utils.generate_url(
|
296
299
|
Operations::UpsertApiEndpointRequest,
|
297
300
|
base_url,
|
@@ -303,11 +306,11 @@ module SpeakeasyClientSDK
|
|
303
306
|
headers['content-type'] = req_content_type
|
304
307
|
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
305
308
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
306
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
309
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
307
310
|
|
308
|
-
r = @client.put(url) do |req|
|
311
|
+
r = @sdk_configuration.client.put(url) do |req|
|
309
312
|
req.headers = headers
|
310
|
-
Utils.configure_request_security(req, @
|
313
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
311
314
|
if form
|
312
315
|
req.body = Utils.encode_form(form)
|
313
316
|
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
data/lib/sdk/apis.rb
CHANGED
@@ -10,23 +10,19 @@ require 'sorbet-runtime'
|
|
10
10
|
module SpeakeasyClientSDK
|
11
11
|
extend T::Sig
|
12
12
|
class Apis
|
13
|
+
# REST APIs for managing Api entities
|
13
14
|
extend T::Sig
|
14
|
-
sig { params(
|
15
|
-
def initialize(
|
16
|
-
@
|
17
|
-
@client = client
|
18
|
-
@server_url = server_url
|
19
|
-
@language = language
|
20
|
-
@sdk_version = sdk_version
|
21
|
-
@gen_version = gen_version
|
22
|
-
@openapi_doc_version = openapi_doc_version
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
23
18
|
end
|
24
19
|
|
25
20
|
sig { params(request: Operations::DeleteApiRequest).returns(Utils::FieldAugmented) }
|
26
21
|
def delete_api(request)
|
27
22
|
# delete_api - Delete an Api.
|
28
23
|
# Delete a particular version of an Api. The will also delete all associated ApiEndpoints, Metadata, Schemas & Request Logs (if using a Postgres datastore).
|
29
|
-
|
24
|
+
url, params = @sdk_configuration.get_server_details
|
25
|
+
base_url = Utils.template_url(url, params)
|
30
26
|
url = Utils.generate_url(
|
31
27
|
Operations::DeleteApiRequest,
|
32
28
|
base_url,
|
@@ -35,11 +31,11 @@ module SpeakeasyClientSDK
|
|
35
31
|
)
|
36
32
|
headers = {}
|
37
33
|
headers['Accept'] = 'application/json'
|
38
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
34
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
39
35
|
|
40
|
-
r = @client.delete(url) do |req|
|
36
|
+
r = @sdk_configuration.client.delete(url) do |req|
|
41
37
|
req.headers = headers
|
42
|
-
Utils.configure_request_security(req, @
|
38
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
43
39
|
end
|
44
40
|
|
45
41
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -62,7 +58,8 @@ module SpeakeasyClientSDK
|
|
62
58
|
# generate_open_api_spec - Generate an OpenAPI specification for a particular Api.
|
63
59
|
# This endpoint will generate any missing operations in any registered OpenAPI document if the operation does not already exist in the document.
|
64
60
|
# Returns the original document and the newly generated document allowing a diff to be performed to see what has changed.
|
65
|
-
|
61
|
+
url, params = @sdk_configuration.get_server_details
|
62
|
+
base_url = Utils.template_url(url, params)
|
66
63
|
url = Utils.generate_url(
|
67
64
|
Operations::GenerateOpenApiSpecRequest,
|
68
65
|
base_url,
|
@@ -71,11 +68,11 @@ module SpeakeasyClientSDK
|
|
71
68
|
)
|
72
69
|
headers = {}
|
73
70
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
74
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
71
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
75
72
|
|
76
|
-
r = @client.get(url) do |req|
|
73
|
+
r = @sdk_configuration.client.get(url) do |req|
|
77
74
|
req.headers = headers
|
78
|
-
Utils.configure_request_security(req, @
|
75
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
79
76
|
end
|
80
77
|
|
81
78
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -101,7 +98,8 @@ module SpeakeasyClientSDK
|
|
101
98
|
def generate_postman_collection(request)
|
102
99
|
# generate_postman_collection - Generate a Postman collection for a particular Api.
|
103
100
|
# Generates a postman collection containing all endpoints for a particular API. Includes variables produced for any path/query/header parameters included in the OpenAPI document.
|
104
|
-
|
101
|
+
url, params = @sdk_configuration.get_server_details
|
102
|
+
base_url = Utils.template_url(url, params)
|
105
103
|
url = Utils.generate_url(
|
106
104
|
Operations::GeneratePostmanCollectionRequest,
|
107
105
|
base_url,
|
@@ -110,11 +108,11 @@ module SpeakeasyClientSDK
|
|
110
108
|
)
|
111
109
|
headers = {}
|
112
110
|
headers['Accept'] = 'application/json;q=1, application/octet-stream;q=0'
|
113
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
111
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
114
112
|
|
115
|
-
r = @client.get(url) do |req|
|
113
|
+
r = @sdk_configuration.client.get(url) do |req|
|
116
114
|
req.headers = headers
|
117
|
-
Utils.configure_request_security(req, @
|
115
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
118
116
|
end
|
119
117
|
|
120
118
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -138,7 +136,8 @@ module SpeakeasyClientSDK
|
|
138
136
|
# get_all_api_versions - Get all Api versions for a particular ApiEndpoint.
|
139
137
|
# Get all Api versions for a particular ApiEndpoint.
|
140
138
|
# Supports filtering the versions based on metadata attributes.
|
141
|
-
|
139
|
+
url, params = @sdk_configuration.get_server_details
|
140
|
+
base_url = Utils.template_url(url, params)
|
142
141
|
url = Utils.generate_url(
|
143
142
|
Operations::GetAllApiVersionsRequest,
|
144
143
|
base_url,
|
@@ -148,12 +147,12 @@ module SpeakeasyClientSDK
|
|
148
147
|
headers = {}
|
149
148
|
query_params = Utils.get_query_params(Operations::GetAllApiVersionsRequest, request)
|
150
149
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
151
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
150
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
152
151
|
|
153
|
-
r = @client.get(url) do |req|
|
152
|
+
r = @sdk_configuration.client.get(url) do |req|
|
154
153
|
req.headers = headers
|
155
154
|
req.params = query_params
|
156
|
-
Utils.configure_request_security(req, @
|
155
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
157
156
|
end
|
158
157
|
|
159
158
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -180,17 +179,18 @@ module SpeakeasyClientSDK
|
|
180
179
|
# get_apis - Get a list of Apis for a given workspace
|
181
180
|
# Get a list of all Apis and their versions for a given workspace.
|
182
181
|
# Supports filtering the APIs based on metadata attributes.
|
183
|
-
|
184
|
-
|
182
|
+
url, params = @sdk_configuration.get_server_details
|
183
|
+
base_url = Utils.template_url(url, params)
|
184
|
+
url = "#{base_url}/v1/apis"
|
185
185
|
headers = {}
|
186
186
|
query_params = Utils.get_query_params(Operations::GetApisRequest, request)
|
187
187
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
188
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
188
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
189
189
|
|
190
|
-
r = @client.get(url) do |req|
|
190
|
+
r = @sdk_configuration.client.get(url) do |req|
|
191
191
|
req.headers = headers
|
192
192
|
req.params = query_params
|
193
|
-
Utils.configure_request_security(req, @
|
193
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
194
194
|
end
|
195
195
|
|
196
196
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -217,7 +217,8 @@ module SpeakeasyClientSDK
|
|
217
217
|
# upsert_api - Upsert an Api
|
218
218
|
# Upsert an Api. If the Api does not exist, it will be created.
|
219
219
|
# If the Api exists, it will be updated.
|
220
|
-
|
220
|
+
url, params = @sdk_configuration.get_server_details
|
221
|
+
base_url = Utils.template_url(url, params)
|
221
222
|
url = Utils.generate_url(
|
222
223
|
Operations::UpsertApiRequest,
|
223
224
|
base_url,
|
@@ -229,11 +230,11 @@ module SpeakeasyClientSDK
|
|
229
230
|
headers['content-type'] = req_content_type
|
230
231
|
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
231
232
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
232
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
233
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
233
234
|
|
234
|
-
r = @client.put(url) do |req|
|
235
|
+
r = @sdk_configuration.client.put(url) do |req|
|
235
236
|
req.headers = headers
|
236
|
-
Utils.configure_request_security(req, @
|
237
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
237
238
|
if form
|
238
239
|
req.body = Utils.encode_form(form)
|
239
240
|
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
data/lib/sdk/embeds.rb
CHANGED
@@ -10,16 +10,11 @@ require 'sorbet-runtime'
|
|
10
10
|
module SpeakeasyClientSDK
|
11
11
|
extend T::Sig
|
12
12
|
class Embeds
|
13
|
+
# REST APIs for managing embeds
|
13
14
|
extend T::Sig
|
14
|
-
sig { params(
|
15
|
-
def initialize(
|
16
|
-
@
|
17
|
-
@client = client
|
18
|
-
@server_url = server_url
|
19
|
-
@language = language
|
20
|
-
@sdk_version = sdk_version
|
21
|
-
@gen_version = gen_version
|
22
|
-
@openapi_doc_version = openapi_doc_version
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
23
18
|
end
|
24
19
|
|
25
20
|
sig { params(request: Operations::GetEmbedAccessTokenRequest).returns(Utils::FieldAugmented) }
|
@@ -27,17 +22,18 @@ module SpeakeasyClientSDK
|
|
27
22
|
# get_embed_access_token - Get an embed access token for the current workspace.
|
28
23
|
# Returns an embed access token for the current workspace. This can be used to authenticate access to externally embedded content.
|
29
24
|
# Filters can be applied allowing views to be filtered to things like particular customerIds.
|
30
|
-
|
31
|
-
|
25
|
+
url, params = @sdk_configuration.get_server_details
|
26
|
+
base_url = Utils.template_url(url, params)
|
27
|
+
url = "#{base_url}/v1/workspace/embed-access-token"
|
32
28
|
headers = {}
|
33
29
|
query_params = Utils.get_query_params(Operations::GetEmbedAccessTokenRequest, request)
|
34
30
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
35
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
31
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
36
32
|
|
37
|
-
r = @client.get(url) do |req|
|
33
|
+
r = @sdk_configuration.client.get(url) do |req|
|
38
34
|
req.headers = headers
|
39
35
|
req.params = query_params
|
40
|
-
Utils.configure_request_security(req, @
|
36
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
41
37
|
end
|
42
38
|
|
43
39
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -62,15 +58,16 @@ module SpeakeasyClientSDK
|
|
62
58
|
sig { returns(Utils::FieldAugmented) }
|
63
59
|
def get_valid_embed_access_tokens
|
64
60
|
# get_valid_embed_access_tokens - Get all valid embed access tokens for the current workspace.
|
65
|
-
|
66
|
-
|
61
|
+
url, params = @sdk_configuration.get_server_details
|
62
|
+
base_url = Utils.template_url(url, params)
|
63
|
+
url = "#{base_url}/v1/workspace/embed-access-tokens/valid"
|
67
64
|
headers = {}
|
68
65
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
69
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
66
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
70
67
|
|
71
|
-
r = @client.get(url) do |req|
|
68
|
+
r = @sdk_configuration.client.get(url) do |req|
|
72
69
|
req.headers = headers
|
73
|
-
Utils.configure_request_security(req, @
|
70
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
74
71
|
end
|
75
72
|
|
76
73
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -95,7 +92,8 @@ module SpeakeasyClientSDK
|
|
95
92
|
sig { params(request: Operations::RevokeEmbedAccessTokenRequest).returns(Utils::FieldAugmented) }
|
96
93
|
def revoke_embed_access_token(request)
|
97
94
|
# revoke_embed_access_token - Revoke an embed access EmbedToken.
|
98
|
-
|
95
|
+
url, params = @sdk_configuration.get_server_details
|
96
|
+
base_url = Utils.template_url(url, params)
|
99
97
|
url = Utils.generate_url(
|
100
98
|
Operations::RevokeEmbedAccessTokenRequest,
|
101
99
|
base_url,
|
@@ -104,11 +102,11 @@ module SpeakeasyClientSDK
|
|
104
102
|
)
|
105
103
|
headers = {}
|
106
104
|
headers['Accept'] = 'application/json'
|
107
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
105
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
108
106
|
|
109
|
-
r = @client.delete(url) do |req|
|
107
|
+
r = @sdk_configuration.client.delete(url) do |req|
|
110
108
|
req.headers = headers
|
111
|
-
Utils.configure_request_security(req, @
|
109
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
112
110
|
end
|
113
111
|
|
114
112
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
data/lib/sdk/metadata.rb
CHANGED
@@ -10,22 +10,18 @@ require 'sorbet-runtime'
|
|
10
10
|
module SpeakeasyClientSDK
|
11
11
|
extend T::Sig
|
12
12
|
class Metadata
|
13
|
+
# REST APIs for managing Version Metadata entities
|
13
14
|
extend T::Sig
|
14
|
-
sig { params(
|
15
|
-
def initialize(
|
16
|
-
@
|
17
|
-
@client = client
|
18
|
-
@server_url = server_url
|
19
|
-
@language = language
|
20
|
-
@sdk_version = sdk_version
|
21
|
-
@gen_version = gen_version
|
22
|
-
@openapi_doc_version = openapi_doc_version
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
23
18
|
end
|
24
19
|
|
25
20
|
sig { params(request: Operations::DeleteVersionMetadataRequest).returns(Utils::FieldAugmented) }
|
26
21
|
def delete_version_metadata(request)
|
27
22
|
# delete_version_metadata - Delete metadata for a particular apiID and versionID.
|
28
|
-
|
23
|
+
url, params = @sdk_configuration.get_server_details
|
24
|
+
base_url = Utils.template_url(url, params)
|
29
25
|
url = Utils.generate_url(
|
30
26
|
Operations::DeleteVersionMetadataRequest,
|
31
27
|
base_url,
|
@@ -34,11 +30,11 @@ module SpeakeasyClientSDK
|
|
34
30
|
)
|
35
31
|
headers = {}
|
36
32
|
headers['Accept'] = 'application/json'
|
37
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
33
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
38
34
|
|
39
|
-
r = @client.delete(url) do |req|
|
35
|
+
r = @sdk_configuration.client.delete(url) do |req|
|
40
36
|
req.headers = headers
|
41
|
-
Utils.configure_request_security(req, @
|
37
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
42
38
|
end
|
43
39
|
|
44
40
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -59,7 +55,8 @@ module SpeakeasyClientSDK
|
|
59
55
|
sig { params(request: Operations::GetVersionMetadataRequest).returns(Utils::FieldAugmented) }
|
60
56
|
def get_version_metadata(request)
|
61
57
|
# get_version_metadata - Get all metadata for a particular apiID and versionID.
|
62
|
-
|
58
|
+
url, params = @sdk_configuration.get_server_details
|
59
|
+
base_url = Utils.template_url(url, params)
|
63
60
|
url = Utils.generate_url(
|
64
61
|
Operations::GetVersionMetadataRequest,
|
65
62
|
base_url,
|
@@ -68,11 +65,11 @@ module SpeakeasyClientSDK
|
|
68
65
|
)
|
69
66
|
headers = {}
|
70
67
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
71
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
68
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
72
69
|
|
73
|
-
r = @client.get(url) do |req|
|
70
|
+
r = @sdk_configuration.client.get(url) do |req|
|
74
71
|
req.headers = headers
|
75
|
-
Utils.configure_request_security(req, @
|
72
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
76
73
|
end
|
77
74
|
|
78
75
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -97,7 +94,8 @@ module SpeakeasyClientSDK
|
|
97
94
|
sig { params(request: Operations::InsertVersionMetadataRequest).returns(Utils::FieldAugmented) }
|
98
95
|
def insert_version_metadata(request)
|
99
96
|
# insert_version_metadata - Insert metadata for a particular apiID and versionID.
|
100
|
-
|
97
|
+
url, params = @sdk_configuration.get_server_details
|
98
|
+
base_url = Utils.template_url(url, params)
|
101
99
|
url = Utils.generate_url(
|
102
100
|
Operations::InsertVersionMetadataRequest,
|
103
101
|
base_url,
|
@@ -109,11 +107,11 @@ module SpeakeasyClientSDK
|
|
109
107
|
headers['content-type'] = req_content_type
|
110
108
|
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
111
109
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
112
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
110
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
113
111
|
|
114
|
-
r = @client.post(url) do |req|
|
112
|
+
r = @sdk_configuration.client.post(url) do |req|
|
115
113
|
req.headers = headers
|
116
|
-
Utils.configure_request_security(req, @
|
114
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
117
115
|
if form
|
118
116
|
req.body = Utils.encode_form(form)
|
119
117
|
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
data/lib/sdk/plugins.rb
CHANGED
@@ -10,30 +10,26 @@ require 'sorbet-runtime'
|
|
10
10
|
module SpeakeasyClientSDK
|
11
11
|
extend T::Sig
|
12
12
|
class Plugins
|
13
|
+
# REST APIs for managing and running plugins
|
13
14
|
extend T::Sig
|
14
|
-
sig { params(
|
15
|
-
def initialize(
|
16
|
-
@
|
17
|
-
@client = client
|
18
|
-
@server_url = server_url
|
19
|
-
@language = language
|
20
|
-
@sdk_version = sdk_version
|
21
|
-
@gen_version = gen_version
|
22
|
-
@openapi_doc_version = openapi_doc_version
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
23
18
|
end
|
24
19
|
|
25
20
|
sig { returns(Utils::FieldAugmented) }
|
26
21
|
def get_plugins
|
27
22
|
# get_plugins - Get all plugins for the current workspace.
|
28
|
-
|
29
|
-
|
23
|
+
url, params = @sdk_configuration.get_server_details
|
24
|
+
base_url = Utils.template_url(url, params)
|
25
|
+
url = "#{base_url}/v1/plugins"
|
30
26
|
headers = {}
|
31
27
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
32
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
28
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
33
29
|
|
34
|
-
r = @client.get(url) do |req|
|
30
|
+
r = @sdk_configuration.client.get(url) do |req|
|
35
31
|
req.headers = headers
|
36
|
-
Utils.configure_request_security(req, @
|
32
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
37
33
|
end
|
38
34
|
|
39
35
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -58,7 +54,8 @@ module SpeakeasyClientSDK
|
|
58
54
|
sig { params(request: Operations::RunPluginRequest).returns(Utils::FieldAugmented) }
|
59
55
|
def run_plugin(request)
|
60
56
|
# run_plugin - Run a plugin
|
61
|
-
|
57
|
+
url, params = @sdk_configuration.get_server_details
|
58
|
+
base_url = Utils.template_url(url, params)
|
62
59
|
url = Utils.generate_url(
|
63
60
|
Operations::RunPluginRequest,
|
64
61
|
base_url,
|
@@ -68,12 +65,12 @@ module SpeakeasyClientSDK
|
|
68
65
|
headers = {}
|
69
66
|
query_params = Utils.get_query_params(Operations::RunPluginRequest, request)
|
70
67
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
71
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
68
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
72
69
|
|
73
|
-
r = @client.post(url) do |req|
|
70
|
+
r = @sdk_configuration.client.post(url) do |req|
|
74
71
|
req.headers = headers
|
75
72
|
req.params = query_params
|
76
|
-
Utils.configure_request_security(req, @
|
73
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
77
74
|
end
|
78
75
|
|
79
76
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -98,18 +95,19 @@ module SpeakeasyClientSDK
|
|
98
95
|
sig { params(request: Shared::Plugin).returns(Utils::FieldAugmented) }
|
99
96
|
def upsert_plugin(request)
|
100
97
|
# upsert_plugin - Upsert a plugin
|
101
|
-
|
102
|
-
|
98
|
+
url, params = @sdk_configuration.get_server_details
|
99
|
+
base_url = Utils.template_url(url, params)
|
100
|
+
url = "#{base_url}/v1/plugins"
|
103
101
|
headers = {}
|
104
102
|
req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
|
105
103
|
headers['content-type'] = req_content_type
|
106
104
|
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
107
105
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
108
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
106
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
109
107
|
|
110
|
-
r = @client.put(url) do |req|
|
108
|
+
r = @sdk_configuration.client.put(url) do |req|
|
111
109
|
req.headers = headers
|
112
|
-
Utils.configure_request_security(req, @
|
110
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
113
111
|
if form
|
114
112
|
req.body = Utils.encode_form(form)
|
115
113
|
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
data/lib/sdk/requests.rb
CHANGED
@@ -10,16 +10,11 @@ require 'sorbet-runtime'
|
|
10
10
|
module SpeakeasyClientSDK
|
11
11
|
extend T::Sig
|
12
12
|
class Requests
|
13
|
+
# REST APIs for retrieving request information
|
13
14
|
extend T::Sig
|
14
|
-
sig { params(
|
15
|
-
def initialize(
|
16
|
-
@
|
17
|
-
@client = client
|
18
|
-
@server_url = server_url
|
19
|
-
@language = language
|
20
|
-
@sdk_version = sdk_version
|
21
|
-
@gen_version = gen_version
|
22
|
-
@openapi_doc_version = openapi_doc_version
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
23
18
|
end
|
24
19
|
|
25
20
|
sig { params(request: Operations::GenerateRequestPostmanCollectionRequest).returns(Utils::FieldAugmented) }
|
@@ -27,7 +22,8 @@ module SpeakeasyClientSDK
|
|
27
22
|
# generate_request_postman_collection - Generate a Postman collection for a particular request.
|
28
23
|
# Generates a Postman collection for a particular request.
|
29
24
|
# Allowing it to be replayed with the same inputs that were captured by the SDK.
|
30
|
-
|
25
|
+
url, params = @sdk_configuration.get_server_details
|
26
|
+
base_url = Utils.template_url(url, params)
|
31
27
|
url = Utils.generate_url(
|
32
28
|
Operations::GenerateRequestPostmanCollectionRequest,
|
33
29
|
base_url,
|
@@ -36,11 +32,11 @@ module SpeakeasyClientSDK
|
|
36
32
|
)
|
37
33
|
headers = {}
|
38
34
|
headers['Accept'] = 'application/json;q=1, application/octet-stream;q=0'
|
39
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
35
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
40
36
|
|
41
|
-
r = @client.get(url) do |req|
|
37
|
+
r = @sdk_configuration.client.get(url) do |req|
|
42
38
|
req.headers = headers
|
43
|
-
Utils.configure_request_security(req, @
|
39
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
44
40
|
end
|
45
41
|
|
46
42
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -62,7 +58,8 @@ module SpeakeasyClientSDK
|
|
62
58
|
sig { params(request: Operations::GetRequestFromEventLogRequest).returns(Utils::FieldAugmented) }
|
63
59
|
def get_request_from_event_log(request)
|
64
60
|
# get_request_from_event_log - Get information about a particular request.
|
65
|
-
|
61
|
+
url, params = @sdk_configuration.get_server_details
|
62
|
+
base_url = Utils.template_url(url, params)
|
66
63
|
url = Utils.generate_url(
|
67
64
|
Operations::GetRequestFromEventLogRequest,
|
68
65
|
base_url,
|
@@ -71,11 +68,11 @@ module SpeakeasyClientSDK
|
|
71
68
|
)
|
72
69
|
headers = {}
|
73
70
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
74
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
71
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
75
72
|
|
76
|
-
r = @client.get(url) do |req|
|
73
|
+
r = @sdk_configuration.client.get(url) do |req|
|
77
74
|
req.headers = headers
|
78
|
-
Utils.configure_request_security(req, @
|
75
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
79
76
|
end
|
80
77
|
|
81
78
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -102,17 +99,18 @@ module SpeakeasyClientSDK
|
|
102
99
|
# query_event_log - Query the event log to retrieve a list of requests.
|
103
100
|
# Supports retrieving a list of request captured by the SDK for this workspace.
|
104
101
|
# Allows the filtering of requests on a number of criteria such as ApiID, VersionID, Path, Method, etc.
|
105
|
-
|
106
|
-
|
102
|
+
url, params = @sdk_configuration.get_server_details
|
103
|
+
base_url = Utils.template_url(url, params)
|
104
|
+
url = "#{base_url}/v1/eventlog/query"
|
107
105
|
headers = {}
|
108
106
|
query_params = Utils.get_query_params(Operations::QueryEventLogRequest, request)
|
109
107
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
110
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
108
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
111
109
|
|
112
|
-
r = @client.get(url) do |req|
|
110
|
+
r = @sdk_configuration.client.get(url) do |req|
|
113
111
|
req.headers = headers
|
114
112
|
req.params = query_params
|
115
|
-
Utils.configure_request_security(req, @
|
113
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
116
114
|
end
|
117
115
|
|
118
116
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
data/lib/sdk/schemas.rb
CHANGED
@@ -10,22 +10,18 @@ require 'sorbet-runtime'
|
|
10
10
|
module SpeakeasyClientSDK
|
11
11
|
extend T::Sig
|
12
12
|
class Schemas
|
13
|
+
# REST APIs for managing Schema entities
|
13
14
|
extend T::Sig
|
14
|
-
sig { params(
|
15
|
-
def initialize(
|
16
|
-
@
|
17
|
-
@client = client
|
18
|
-
@server_url = server_url
|
19
|
-
@language = language
|
20
|
-
@sdk_version = sdk_version
|
21
|
-
@gen_version = gen_version
|
22
|
-
@openapi_doc_version = openapi_doc_version
|
15
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
16
|
+
def initialize(sdk_config)
|
17
|
+
@sdk_configuration = sdk_config
|
23
18
|
end
|
24
19
|
|
25
20
|
sig { params(request: Operations::DeleteSchemaRequest).returns(Utils::FieldAugmented) }
|
26
21
|
def delete_schema(request)
|
27
22
|
# delete_schema - Delete a particular schema revision for an Api.
|
28
|
-
|
23
|
+
url, params = @sdk_configuration.get_server_details
|
24
|
+
base_url = Utils.template_url(url, params)
|
29
25
|
url = Utils.generate_url(
|
30
26
|
Operations::DeleteSchemaRequest,
|
31
27
|
base_url,
|
@@ -34,11 +30,11 @@ module SpeakeasyClientSDK
|
|
34
30
|
)
|
35
31
|
headers = {}
|
36
32
|
headers['Accept'] = 'application/json'
|
37
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
33
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
38
34
|
|
39
|
-
r = @client.delete(url) do |req|
|
35
|
+
r = @sdk_configuration.client.delete(url) do |req|
|
40
36
|
req.headers = headers
|
41
|
-
Utils.configure_request_security(req, @
|
37
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
42
38
|
end
|
43
39
|
|
44
40
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -59,7 +55,8 @@ module SpeakeasyClientSDK
|
|
59
55
|
sig { params(request: Operations::DownloadSchemaRequest).returns(Utils::FieldAugmented) }
|
60
56
|
def download_schema(request)
|
61
57
|
# download_schema - Download the latest schema for a particular apiID.
|
62
|
-
|
58
|
+
url, params = @sdk_configuration.get_server_details
|
59
|
+
base_url = Utils.template_url(url, params)
|
63
60
|
url = Utils.generate_url(
|
64
61
|
Operations::DownloadSchemaRequest,
|
65
62
|
base_url,
|
@@ -68,11 +65,11 @@ module SpeakeasyClientSDK
|
|
68
65
|
)
|
69
66
|
headers = {}
|
70
67
|
headers['Accept'] = 'application/json;q=1, application/json;q=0.7, application/x-yaml;q=0'
|
71
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
68
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
72
69
|
|
73
|
-
r = @client.get(url) do |req|
|
70
|
+
r = @sdk_configuration.client.get(url) do |req|
|
74
71
|
req.headers = headers
|
75
|
-
Utils.configure_request_security(req, @
|
72
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
76
73
|
end
|
77
74
|
|
78
75
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -95,7 +92,8 @@ module SpeakeasyClientSDK
|
|
95
92
|
sig { params(request: Operations::DownloadSchemaRevisionRequest).returns(Utils::FieldAugmented) }
|
96
93
|
def download_schema_revision(request)
|
97
94
|
# download_schema_revision - Download a particular schema revision for an Api.
|
98
|
-
|
95
|
+
url, params = @sdk_configuration.get_server_details
|
96
|
+
base_url = Utils.template_url(url, params)
|
99
97
|
url = Utils.generate_url(
|
100
98
|
Operations::DownloadSchemaRevisionRequest,
|
101
99
|
base_url,
|
@@ -104,11 +102,11 @@ module SpeakeasyClientSDK
|
|
104
102
|
)
|
105
103
|
headers = {}
|
106
104
|
headers['Accept'] = 'application/json;q=1, application/json;q=0.7, application/x-yaml;q=0'
|
107
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
105
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
108
106
|
|
109
|
-
r = @client.get(url) do |req|
|
107
|
+
r = @sdk_configuration.client.get(url) do |req|
|
110
108
|
req.headers = headers
|
111
|
-
Utils.configure_request_security(req, @
|
109
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
112
110
|
end
|
113
111
|
|
114
112
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -133,7 +131,8 @@ module SpeakeasyClientSDK
|
|
133
131
|
# get_schema - Get information about the latest schema.
|
134
132
|
# Returns information about the last uploaded schema for a particular API version.
|
135
133
|
# This won't include the schema itself, that can be retrieved via the downloadSchema operation.
|
136
|
-
|
134
|
+
url, params = @sdk_configuration.get_server_details
|
135
|
+
base_url = Utils.template_url(url, params)
|
137
136
|
url = Utils.generate_url(
|
138
137
|
Operations::GetSchemaRequest,
|
139
138
|
base_url,
|
@@ -142,11 +141,11 @@ module SpeakeasyClientSDK
|
|
142
141
|
)
|
143
142
|
headers = {}
|
144
143
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
145
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
144
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
146
145
|
|
147
|
-
r = @client.get(url) do |req|
|
146
|
+
r = @sdk_configuration.client.get(url) do |req|
|
148
147
|
req.headers = headers
|
149
|
-
Utils.configure_request_security(req, @
|
148
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
150
149
|
end
|
151
150
|
|
152
151
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -171,7 +170,8 @@ module SpeakeasyClientSDK
|
|
171
170
|
sig { params(request: Operations::GetSchemaDiffRequest).returns(Utils::FieldAugmented) }
|
172
171
|
def get_schema_diff(request)
|
173
172
|
# get_schema_diff - Get a diff of two schema revisions for an Api.
|
174
|
-
|
173
|
+
url, params = @sdk_configuration.get_server_details
|
174
|
+
base_url = Utils.template_url(url, params)
|
175
175
|
url = Utils.generate_url(
|
176
176
|
Operations::GetSchemaDiffRequest,
|
177
177
|
base_url,
|
@@ -180,11 +180,11 @@ module SpeakeasyClientSDK
|
|
180
180
|
)
|
181
181
|
headers = {}
|
182
182
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
183
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
183
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
184
184
|
|
185
|
-
r = @client.get(url) do |req|
|
185
|
+
r = @sdk_configuration.client.get(url) do |req|
|
186
186
|
req.headers = headers
|
187
|
-
Utils.configure_request_security(req, @
|
187
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
188
188
|
end
|
189
189
|
|
190
190
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -211,7 +211,8 @@ module SpeakeasyClientSDK
|
|
211
211
|
# get_schema_revision - Get information about a particular schema revision for an Api.
|
212
212
|
# Returns information about the last uploaded schema for a particular schema revision.
|
213
213
|
# This won't include the schema itself, that can be retrieved via the downloadSchema operation.
|
214
|
-
|
214
|
+
url, params = @sdk_configuration.get_server_details
|
215
|
+
base_url = Utils.template_url(url, params)
|
215
216
|
url = Utils.generate_url(
|
216
217
|
Operations::GetSchemaRevisionRequest,
|
217
218
|
base_url,
|
@@ -220,11 +221,11 @@ module SpeakeasyClientSDK
|
|
220
221
|
)
|
221
222
|
headers = {}
|
222
223
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
223
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
224
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
224
225
|
|
225
|
-
r = @client.get(url) do |req|
|
226
|
+
r = @sdk_configuration.client.get(url) do |req|
|
226
227
|
req.headers = headers
|
227
|
-
Utils.configure_request_security(req, @
|
228
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
228
229
|
end
|
229
230
|
|
230
231
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -251,7 +252,8 @@ module SpeakeasyClientSDK
|
|
251
252
|
# get_schemas - Get information about all schemas associated with a particular apiID.
|
252
253
|
# Returns information the schemas associated with a particular apiID.
|
253
254
|
# This won't include the schemas themselves, they can be retrieved via the downloadSchema operation.
|
254
|
-
|
255
|
+
url, params = @sdk_configuration.get_server_details
|
256
|
+
base_url = Utils.template_url(url, params)
|
255
257
|
url = Utils.generate_url(
|
256
258
|
Operations::GetSchemasRequest,
|
257
259
|
base_url,
|
@@ -260,11 +262,11 @@ module SpeakeasyClientSDK
|
|
260
262
|
)
|
261
263
|
headers = {}
|
262
264
|
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
263
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
265
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
264
266
|
|
265
|
-
r = @client.get(url) do |req|
|
267
|
+
r = @sdk_configuration.client.get(url) do |req|
|
266
268
|
req.headers = headers
|
267
|
-
Utils.configure_request_security(req, @
|
269
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
268
270
|
end
|
269
271
|
|
270
272
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -291,7 +293,8 @@ module SpeakeasyClientSDK
|
|
291
293
|
# register_schema - Register a schema.
|
292
294
|
# Allows uploading a schema for a particular API version.
|
293
295
|
# This will be used to populate ApiEndpoints and used as a base for any schema generation if present.
|
294
|
-
|
296
|
+
url, params = @sdk_configuration.get_server_details
|
297
|
+
base_url = Utils.template_url(url, params)
|
295
298
|
url = Utils.generate_url(
|
296
299
|
Operations::RegisterSchemaRequest,
|
297
300
|
base_url,
|
@@ -303,11 +306,11 @@ module SpeakeasyClientSDK
|
|
303
306
|
headers['content-type'] = req_content_type
|
304
307
|
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
305
308
|
headers['Accept'] = 'application/json'
|
306
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
309
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
307
310
|
|
308
|
-
r = @client.post(url) do |req|
|
311
|
+
r = @sdk_configuration.client.post(url) do |req|
|
309
312
|
req.headers = headers
|
310
|
-
Utils.configure_request_security(req, @
|
313
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
311
314
|
if form
|
312
315
|
req.body = Utils.encode_form(form)
|
313
316
|
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
data/lib/sdk/sdk.rb
CHANGED
@@ -8,10 +8,7 @@ require 'faraday/multipart'
|
|
8
8
|
require 'sorbet-runtime'
|
9
9
|
module SpeakeasyClientSDK
|
10
10
|
extend T::Sig
|
11
|
-
|
12
|
-
SERVERS = {
|
13
|
-
SERVER_PROD: 'https://api.prod.speakeasyapi.dev'
|
14
|
-
}.freeze
|
11
|
+
|
15
12
|
class SDK
|
16
13
|
extend T::Sig
|
17
14
|
|
@@ -20,7 +17,7 @@ module SpeakeasyClientSDK
|
|
20
17
|
attr_accessor :security, :language, :sdk_version, :gen_version
|
21
18
|
|
22
19
|
sig do
|
23
|
-
params(security: Shared::Security,
|
20
|
+
params(security: T.nilable(Shared::Security),
|
24
21
|
server: String,
|
25
22
|
server_url: String,
|
26
23
|
url_params: T::Hash[Symbol, String],
|
@@ -39,128 +36,75 @@ module SpeakeasyClientSDK
|
|
39
36
|
# @param [Hash<Symbol, String>] url_params Parameters to optionally template the server URL with
|
40
37
|
# @param [Faraday::Request] client The faraday HTTP client to use for all operations
|
41
38
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
if client.nil?
|
40
|
+
client = Faraday.new(request: {
|
41
|
+
params_encoder: Faraday::FlatParamsEncoder
|
42
|
+
}) do |f|
|
43
|
+
f.request :multipart, {}
|
44
|
+
# f.response :logger
|
45
|
+
end
|
47
46
|
end
|
48
47
|
|
49
|
-
|
48
|
+
if !server_url.nil?
|
49
|
+
if !url_params.nil?
|
50
|
+
server_url = Utils.template_url(server_url, url_params)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
server = SERVER_PROD if server.nil?
|
50
54
|
|
55
|
+
|
51
56
|
|
52
|
-
@
|
53
|
-
@server_url = SERVERS[SERVER_PROD]
|
54
|
-
@language = 'ruby'
|
55
|
-
@sdk_version = '1.14.0'
|
56
|
-
@gen_version = '2.65.0'
|
57
|
-
@openapi_doc_version = '0.3.0'
|
57
|
+
@sdk_configuration = SDKConfiguration.new(client, security, server_url, server)
|
58
58
|
init_sdks
|
59
59
|
end
|
60
60
|
|
61
|
-
sig { params(
|
62
|
-
def config_server_url(
|
63
|
-
if params.nil?
|
64
|
-
@server_url = server_url
|
65
|
-
else
|
66
|
-
@server_url = Utils.template_url(server_url, params)
|
61
|
+
sig { params(params: T.nilable(T::Hash[Symbol, String])).void }
|
62
|
+
def config_server_url(params)
|
63
|
+
if !params.nil?
|
64
|
+
@server_url = Utils.template_url(@server_url, params)
|
67
65
|
end
|
68
66
|
init_sdks
|
69
67
|
end
|
70
68
|
|
71
69
|
sig { params(server: String, params: T.nilable(T::Hash[Symbol, String])).void }
|
72
|
-
def config_server(
|
70
|
+
def config_server(params)
|
73
71
|
raise StandardError, 'Invalid server' if !SERVERS.include? server
|
74
72
|
|
75
|
-
config_server_url(
|
73
|
+
config_server_url(params)
|
76
74
|
init_sdks
|
77
75
|
end
|
78
76
|
|
79
77
|
sig { params(security: Shared::Security).void }
|
80
78
|
def config_security(security)
|
81
79
|
@security = security
|
80
|
+
@sdk_configuration.security = security
|
82
81
|
end
|
83
82
|
|
84
83
|
sig { void }
|
85
84
|
def init_sdks
|
86
|
-
@api_endpoints = ApiEndpoints.new(
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
@openapi_doc_version
|
94
|
-
)
|
95
|
-
@apis = Apis.new(
|
96
|
-
self,
|
97
|
-
@client,
|
98
|
-
@server_url,
|
99
|
-
@language,
|
100
|
-
@sdk_version,
|
101
|
-
@gen_version,
|
102
|
-
@openapi_doc_version
|
103
|
-
)
|
104
|
-
@embeds = Embeds.new(
|
105
|
-
self,
|
106
|
-
@client,
|
107
|
-
@server_url,
|
108
|
-
@language,
|
109
|
-
@sdk_version,
|
110
|
-
@gen_version,
|
111
|
-
@openapi_doc_version
|
112
|
-
)
|
113
|
-
@metadata = Metadata.new(
|
114
|
-
self,
|
115
|
-
@client,
|
116
|
-
@server_url,
|
117
|
-
@language,
|
118
|
-
@sdk_version,
|
119
|
-
@gen_version,
|
120
|
-
@openapi_doc_version
|
121
|
-
)
|
122
|
-
@plugins = Plugins.new(
|
123
|
-
self,
|
124
|
-
@client,
|
125
|
-
@server_url,
|
126
|
-
@language,
|
127
|
-
@sdk_version,
|
128
|
-
@gen_version,
|
129
|
-
@openapi_doc_version
|
130
|
-
)
|
131
|
-
@requests = Requests.new(
|
132
|
-
self,
|
133
|
-
@client,
|
134
|
-
@server_url,
|
135
|
-
@language,
|
136
|
-
@sdk_version,
|
137
|
-
@gen_version,
|
138
|
-
@openapi_doc_version
|
139
|
-
)
|
140
|
-
@schemas = Schemas.new(
|
141
|
-
self,
|
142
|
-
@client,
|
143
|
-
@server_url,
|
144
|
-
@language,
|
145
|
-
@sdk_version,
|
146
|
-
@gen_version,
|
147
|
-
@openapi_doc_version
|
148
|
-
)
|
85
|
+
@api_endpoints = ApiEndpoints.new(@sdk_configuration)
|
86
|
+
@apis = Apis.new(@sdk_configuration)
|
87
|
+
@embeds = Embeds.new(@sdk_configuration)
|
88
|
+
@metadata = Metadata.new(@sdk_configuration)
|
89
|
+
@plugins = Plugins.new(@sdk_configuration)
|
90
|
+
@requests = Requests.new(@sdk_configuration)
|
91
|
+
@schemas = Schemas.new(@sdk_configuration)
|
149
92
|
end
|
150
93
|
|
151
94
|
|
152
95
|
sig { returns(Utils::FieldAugmented) }
|
153
96
|
def validate_api_key
|
154
97
|
# validate_api_key - Validate the current api key.
|
155
|
-
|
156
|
-
|
98
|
+
url, params = @sdk_configuration.get_server_details
|
99
|
+
base_url = Utils.template_url(url, params)
|
100
|
+
url = "#{base_url}/v1/auth/validate"
|
157
101
|
headers = {}
|
158
102
|
headers['Accept'] = 'application/json'
|
159
|
-
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version} #{@openapi_doc_version}"
|
103
|
+
headers['user-agent'] = "speakeasy-sdk/#{@sdk_configuration.language} #{@sdk_configuration.sdk_version} #{@sdk_configuration.gen_version} #{@sdk_configuration.openapi_doc_version}"
|
160
104
|
|
161
|
-
r = @client.get(url) do |req|
|
105
|
+
r = @sdk_configuration.client.get(url) do |req|
|
162
106
|
req.headers = headers
|
163
|
-
Utils.configure_request_security(req, @
|
107
|
+
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
164
108
|
end
|
165
109
|
|
166
110
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'sorbet-runtime'
|
9
|
+
|
10
|
+
module OpenApiSDK
|
11
|
+
extend T::Sig
|
12
|
+
|
13
|
+
|
14
|
+
SERVER_PROD = 'prod'
|
15
|
+
SERVERS = {
|
16
|
+
SERVER_PROD: 'https://api.prod.speakeasyapi.dev',
|
17
|
+
}.freeze
|
18
|
+
# Contains the list of servers available to the SDK
|
19
|
+
|
20
|
+
|
21
|
+
class SDKConfiguration < OpenApiSDK::Utils::FieldAugmented
|
22
|
+
extend T::Sig
|
23
|
+
|
24
|
+
field :client, T.nilable(Faraday::Connection)
|
25
|
+
field :security, Shared::Security
|
26
|
+
field :server_url, T.nilable(String)
|
27
|
+
field :server, T.nilable(String)
|
28
|
+
field :server_defaults, Hash[Symbol, Hash[Symbol, String]], { 'default_factory': Hash}
|
29
|
+
field :language, String
|
30
|
+
field :openapi_doc_version, String
|
31
|
+
field :sdk_version, String
|
32
|
+
field :gen_version, String
|
33
|
+
|
34
|
+
|
35
|
+
sig { params(client: Faraday::Connection, security: T.nilable(Shared::Security), server_url: T.nilable(String), server_idx: T.nilable(Integer), server_defaults: T::Hash[Symbol, String], globals: T::Hash[Symbol, T::Hash[Symbol, T::Hash[Symbol, Object]]]).void }
|
36
|
+
def initialize(client, security, server_url, server_idx, server_defaults, globals)
|
37
|
+
@client = client
|
38
|
+
@server = server_url.nil? ? '' : server_url
|
39
|
+
@language = 'ruby'
|
40
|
+
@openapi_doc_version = '0.3.0'
|
41
|
+
@sdk_version = '1.15.1'
|
42
|
+
@gen_version = '2.73.1'
|
43
|
+
end
|
44
|
+
|
45
|
+
sig { returns([String, T::Hash[Symbol, String]]) }
|
46
|
+
def get_server_details
|
47
|
+
return [@server_url.delete_suffix('/'), {}] if !@server_url.nil?
|
48
|
+
@server = SERVER_PROD if @server.nil?
|
49
|
+
|
50
|
+
[SERVERS[@server], {}]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/sdk/utils/utils.rb
CHANGED
@@ -707,7 +707,12 @@ module SpeakeasyClientSDK
|
|
707
707
|
sig { params(url_with_params: String, params: T::Hash[Symbol, String]).returns(String) }
|
708
708
|
def self.template_url(url_with_params, params)
|
709
709
|
params.each do |key, value|
|
710
|
-
|
710
|
+
if value.respond_to? :serialize
|
711
|
+
val_str = value.serialize
|
712
|
+
else
|
713
|
+
val_str = value
|
714
|
+
end
|
715
|
+
url_with_params = url_with_params.gsub("{#{key}}", val_str)
|
711
716
|
end
|
712
717
|
|
713
718
|
url_with_params
|
@@ -58,6 +58,7 @@ require_relative 'sdk/models/operations/upsertapi'
|
|
58
58
|
require_relative 'sdk/models/operations/upsertapiendpoint'
|
59
59
|
require_relative 'sdk/models/operations/upsertplugin'
|
60
60
|
require_relative 'sdk/models/operations/validateapikey'
|
61
|
+
require_relative 'sdk/sdkconfiguration'
|
61
62
|
require_relative 'sdk/apiendpoints'
|
62
63
|
require_relative 'sdk/apis'
|
63
64
|
require_relative 'sdk/embeds'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speakeasy_client_sdk_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Speakeasy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- lib/sdk/requests.rb
|
174
174
|
- lib/sdk/schemas.rb
|
175
175
|
- lib/sdk/sdk.rb
|
176
|
+
- lib/sdk/sdkconfiguration.rb
|
176
177
|
- lib/sdk/utils/metadata_fields.rb
|
177
178
|
- lib/sdk/utils/retries.rb
|
178
179
|
- lib/sdk/utils/utils.rb
|