1010module SpeakeasyClientSDK
1111 extend T ::Sig
1212 class ApiEndpoints
13+ # REST APIs for managing ApiEndpoint entities
1314 extend T ::Sig
14- sig { params ( sdk : SpeakeasyClientSDK ::SDK , client : Faraday ::Connection , server_url : String , language : String , sdk_version : String , gen_version : String , openapi_doc_version : String ) . void }
15- def initialize ( sdk , client , server_url , language , sdk_version , gen_version , openapi_doc_version )
16- @sdk = sdk
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
2318 end
2419
2520 sig { params ( request : Operations ::DeleteApiEndpointRequest ) . returns ( Utils ::FieldAugmented ) }
2621 def delete_api_endpoint ( request )
2722 # delete_api_endpoint - Delete an ApiEndpoint.
2823 # Delete an ApiEndpoint. This will also delete all associated Request Logs (if using a Postgres datastore).
29- base_url = @server_url
24+ url , params = @sdk_configuration . get_server_details
25+ base_url = Utils . template_url ( url , params )
3026 url = Utils . generate_url (
3127 Operations ::DeleteApiEndpointRequest ,
3228 base_url ,
@@ -35,11 +31,11 @@ def delete_api_endpoint(request)
3531 )
3632 headers = { }
3733 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 } "
3935
40- r = @client . delete ( url ) do |req |
36+ r = @sdk_configuration . client . delete ( url ) do |req |
4137 req . headers = headers
42- Utils . configure_request_security ( req , @sdk . security ) if !@sdk . nil? && !@sdk . security . nil?
38+ Utils . configure_request_security ( req , @sdk_configuration . security ) if !@sdk_configuration . nil? && !@sdk_configuration . security . nil?
4339 end
4440
4541 content_type = r . headers . fetch ( 'Content-Type' , 'application/octet-stream' )
@@ -62,7 +58,8 @@ def find_api_endpoint(request)
6258 # find_api_endpoint - Find an ApiEndpoint via its displayName.
6359 # Find an ApiEndpoint via its displayName (set by operationId from a registered OpenAPI schema).
6460 # This is useful for finding the ID of an ApiEndpoint to use in the /v1/apis/{apiID}/version/{versionID}/api_endpoints/{apiEndpointID} endpoints.
65- base_url = @server_url
61+ url , params = @sdk_configuration . get_server_details
62+ base_url = Utils . template_url ( url , params )
6663 url = Utils . generate_url (
6764 Operations ::FindApiEndpointRequest ,
6865 base_url ,
@@ -71,11 +68,11 @@ def find_api_endpoint(request)
7168 )
7269 headers = { }
7370 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 } "
7572
76- r = @client . get ( url ) do |req |
73+ r = @sdk_configuration . client . get ( url ) do |req |
7774 req . headers = headers
78- Utils . configure_request_security ( req , @sdk . security ) if !@sdk . nil? && !@sdk . security . nil?
75+ Utils . configure_request_security ( req , @sdk_configuration . security ) if !@sdk_configuration . nil? && !@sdk_configuration . security . nil?
7976 end
8077
8178 content_type = r . headers . fetch ( 'Content-Type' , 'application/octet-stream' )
@@ -102,7 +99,8 @@ def generate_open_api_spec_for_api_endpoint(request)
10299 # generate_open_api_spec_for_api_endpoint - Generate an OpenAPI specification for a particular ApiEndpoint.
103100 # This endpoint will generate a new operation in any registered OpenAPI document if the operation does not already exist in the document.
104101 # Returns the original document and the newly generated document allowing a diff to be performed to see what has changed.
105- base_url = @server_url
102+ url , params = @sdk_configuration . get_server_details
103+ base_url = Utils . template_url ( url , params )
106104 url = Utils . generate_url (
107105 Operations ::GenerateOpenApiSpecForApiEndpointRequest ,
108106 base_url ,
@@ -111,11 +109,11 @@ def generate_open_api_spec_for_api_endpoint(request)
111109 )
112110 headers = { }
113111 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 } "
115113
116- r = @client . get ( url ) do |req |
114+ r = @sdk_configuration . client . get ( url ) do |req |
117115 req . headers = headers
118- Utils . configure_request_security ( req , @sdk . security ) if !@sdk . nil? && !@sdk . security . nil?
116+ Utils . configure_request_security ( req , @sdk_configuration . security ) if !@sdk_configuration . nil? && !@sdk_configuration . security . nil?
119117 end
120118
121119 content_type = r . headers . fetch ( 'Content-Type' , 'application/octet-stream' )
@@ -141,7 +139,8 @@ def generate_open_api_spec_for_api_endpoint(request)
141139 def generate_postman_collection_for_api_endpoint ( request )
142140 # generate_postman_collection_for_api_endpoint - Generate a Postman collection for a particular ApiEndpoint.
143141 # 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- base_url = @server_url
142+ url , params = @sdk_configuration . get_server_details
143+ base_url = Utils . template_url ( url , params )
145144 url = Utils . generate_url (
146145 Operations ::GeneratePostmanCollectionForApiEndpointRequest ,
147146 base_url ,
@@ -150,11 +149,11 @@ def generate_postman_collection_for_api_endpoint(request)
150149 )
151150 headers = { }
152151 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 } "
154153
155- r = @client . get ( url ) do |req |
154+ r = @sdk_configuration . client . get ( url ) do |req |
156155 req . headers = headers
157- Utils . configure_request_security ( req , @sdk . security ) if !@sdk . nil? && !@sdk . security . nil?
156+ Utils . configure_request_security ( req , @sdk_configuration . security ) if !@sdk_configuration . nil? && !@sdk_configuration . security . nil?
158157 end
159158
160159 content_type = r . headers . fetch ( 'Content-Type' , 'application/octet-stream' )
@@ -176,7 +175,8 @@ def generate_postman_collection_for_api_endpoint(request)
176175 sig { params ( request : Operations ::GetAllApiEndpointsRequest ) . returns ( Utils ::FieldAugmented ) }
177176 def get_all_api_endpoints ( request )
178177 # get_all_api_endpoints - Get all Api endpoints for a particular apiID.
179- base_url = @server_url
178+ url , params = @sdk_configuration . get_server_details
179+ base_url = Utils . template_url ( url , params )
180180 url = Utils . generate_url (
181181 Operations ::GetAllApiEndpointsRequest ,
182182 base_url ,
@@ -185,11 +185,11 @@ def get_all_api_endpoints(request)
185185 )
186186 headers = { }
187187 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 } "
189189
190- r = @client . get ( url ) do |req |
190+ r = @sdk_configuration . client . get ( url ) do |req |
191191 req . headers = headers
192- Utils . configure_request_security ( req , @sdk . security ) if !@sdk . nil? && !@sdk . security . nil?
192+ Utils . configure_request_security ( req , @sdk_configuration . security ) if !@sdk_configuration . nil? && !@sdk_configuration . security . nil?
193193 end
194194
195195 content_type = r . headers . fetch ( 'Content-Type' , 'application/octet-stream' )
@@ -214,7 +214,8 @@ def get_all_api_endpoints(request)
214214 sig { params ( request : Operations ::GetAllForVersionApiEndpointsRequest ) . returns ( Utils ::FieldAugmented ) }
215215 def get_all_for_version_api_endpoints ( request )
216216 # get_all_for_version_api_endpoints - Get all ApiEndpoints for a particular apiID and versionID.
217- base_url = @server_url
217+ url , params = @sdk_configuration . get_server_details
218+ base_url = Utils . template_url ( url , params )
218219 url = Utils . generate_url (
219220 Operations ::GetAllForVersionApiEndpointsRequest ,
220221 base_url ,
@@ -223,11 +224,11 @@ def get_all_for_version_api_endpoints(request)
223224 )
224225 headers = { }
225226 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 } "
227228
228- r = @client . get ( url ) do |req |
229+ r = @sdk_configuration . client . get ( url ) do |req |
229230 req . headers = headers
230- Utils . configure_request_security ( req , @sdk . security ) if !@sdk . nil? && !@sdk . security . nil?
231+ Utils . configure_request_security ( req , @sdk_configuration . security ) if !@sdk_configuration . nil? && !@sdk_configuration . security . nil?
231232 end
232233
233234 content_type = r . headers . fetch ( 'Content-Type' , 'application/octet-stream' )
@@ -252,7 +253,8 @@ def get_all_for_version_api_endpoints(request)
252253 sig { params ( request : Operations ::GetApiEndpointRequest ) . returns ( Utils ::FieldAugmented ) }
253254 def get_api_endpoint ( request )
254255 # get_api_endpoint - Get an ApiEndpoint.
255- base_url = @server_url
256+ url , params = @sdk_configuration . get_server_details
257+ base_url = Utils . template_url ( url , params )
256258 url = Utils . generate_url (
257259 Operations ::GetApiEndpointRequest ,
258260 base_url ,
@@ -261,11 +263,11 @@ def get_api_endpoint(request)
261263 )
262264 headers = { }
263265 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 } "
265267
266- r = @client . get ( url ) do |req |
268+ r = @sdk_configuration . client . get ( url ) do |req |
267269 req . headers = headers
268- Utils . configure_request_security ( req , @sdk . security ) if !@sdk . nil? && !@sdk . security . nil?
270+ Utils . configure_request_security ( req , @sdk_configuration . security ) if !@sdk_configuration . nil? && !@sdk_configuration . security . nil?
269271 end
270272
271273 content_type = r . headers . fetch ( 'Content-Type' , 'application/octet-stream' )
@@ -291,7 +293,8 @@ def get_api_endpoint(request)
291293 def upsert_api_endpoint ( request )
292294 # upsert_api_endpoint - Upsert an ApiEndpoint.
293295 # Upsert an ApiEndpoint. If the ApiEndpoint does not exist it will be created, otherwise it will be updated.
294- base_url = @server_url
296+ url , params = @sdk_configuration . get_server_details
297+ base_url = Utils . template_url ( url , params )
295298 url = Utils . generate_url (
296299 Operations ::UpsertApiEndpointRequest ,
297300 base_url ,
@@ -303,11 +306,11 @@ def upsert_api_endpoint(request)
303306 headers [ 'content-type' ] = req_content_type
304307 raise StandardError , 'request body is required' if data . nil? && form . nil?
305308 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 } "
307310
308- r = @client . put ( url ) do |req |
311+ r = @sdk_configuration . client . put ( url ) do |req |
309312 req . headers = headers
310- Utils . configure_request_security ( req , @sdk . security ) if !@sdk . nil? && !@sdk . security . nil?
313+ Utils . configure_request_security ( req , @sdk_configuration . security ) if !@sdk_configuration . nil? && !@sdk_configuration . security . nil?
311314 if form
312315 req . body = Utils . encode_form ( form )
313316 elsif Utils . match_content_type ( req_content_type , 'application/x-www-form-urlencoded' )
0 commit comments