@@ -96,18 +96,18 @@ public class ApiEndpoints: IApiEndpoints
9696 {
9797 public SDKConfig SDKConfiguration { get ; private set ; }
9898 private const string _language = "csharp" ;
99- private const string _sdkVersion = "3 .0.0" ;
100- private const string _sdkGenVersion = "2.245.1 " ;
99+ private const string _sdkVersion = "4 .0.0" ;
100+ private const string _sdkGenVersion = "2.250.2 " ;
101101 private const string _openapiDocVersion = "0.3.0" ;
102- private const string _userAgent = "speakeasy-sdk/csharp 3 .0.0 2.245.1 0.3.0 SpeakeasySDK" ;
102+ private const string _userAgent = "speakeasy-sdk/csharp 4 .0.0 2.250.2 0.3.0 SpeakeasySDK" ;
103103 private string _serverUrl = "" ;
104104 private ISpeakeasyHttpClient _defaultClient ;
105- private ISpeakeasyHttpClient _securityClient ;
105+ private Func < Security > ? _securitySource ;
106106
107- public ApiEndpoints ( ISpeakeasyHttpClient defaultClient , ISpeakeasyHttpClient securityClient , string serverUrl , SDKConfig config )
107+ public ApiEndpoints ( ISpeakeasyHttpClient defaultClient , Func < Security > ? securitySource , string serverUrl , SDKConfig config )
108108 {
109109 _defaultClient = defaultClient ;
110- _securityClient = securityClient ;
110+ _securitySource = securitySource ;
111111 _serverUrl = serverUrl ;
112112 SDKConfiguration = config ;
113113 }
@@ -122,8 +122,12 @@ public async Task<DeleteApiEndpointResponse> DeleteApiEndpointAsync(DeleteApiEnd
122122 httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
123123
124124
125- var client = _securityClient ;
126-
125+ var client = _defaultClient ;
126+ if ( _securitySource != null )
127+ {
128+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
129+ }
130+
127131 var httpResponse = await client . SendAsync ( httpRequest ) ;
128132
129133 var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -137,12 +141,13 @@ public async Task<DeleteApiEndpointResponse> DeleteApiEndpointAsync(DeleteApiEnd
137141
138142 if ( ( response . StatusCode == 200 ) )
139143 {
140-
144+
141145 return response ;
142146 }
143147 response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
144148 return response ;
145149 }
150+
146151
147152
148153 public async Task < FindApiEndpointResponse > FindApiEndpointAsync ( FindApiEndpointRequest ? request = null )
@@ -154,8 +159,12 @@ public async Task<FindApiEndpointResponse> FindApiEndpointAsync(FindApiEndpointR
154159 httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
155160
156161
157- var client = _securityClient ;
158-
162+ var client = _defaultClient ;
163+ if ( _securitySource != null )
164+ {
165+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
166+ }
167+
159168 var httpResponse = await client . SendAsync ( httpRequest ) ;
160169
161170 var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -173,12 +182,13 @@ public async Task<FindApiEndpointResponse> FindApiEndpointAsync(FindApiEndpointR
173182 {
174183 response . ApiEndpoint = JsonConvert . DeserializeObject < ApiEndpoint > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
175184 }
176-
185+
177186 return response ;
178187 }
179188 response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
180189 return response ;
181190 }
191+
182192
183193
184194 public async Task < GenerateOpenApiSpecForApiEndpointResponse > GenerateOpenApiSpecForApiEndpointAsync ( GenerateOpenApiSpecForApiEndpointRequest ? request = null )
@@ -190,8 +200,12 @@ public async Task<GenerateOpenApiSpecForApiEndpointResponse> GenerateOpenApiSpec
190200 httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
191201
192202
193- var client = _securityClient ;
194-
203+ var client = _defaultClient ;
204+ if ( _securitySource != null )
205+ {
206+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
207+ }
208+
195209 var httpResponse = await client . SendAsync ( httpRequest ) ;
196210
197211 var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -209,12 +223,13 @@ public async Task<GenerateOpenApiSpecForApiEndpointResponse> GenerateOpenApiSpec
209223 {
210224 response . GenerateOpenApiSpecDiff = JsonConvert . DeserializeObject < GenerateOpenApiSpecDiff > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
211225 }
212-
226+
213227 return response ;
214228 }
215229 response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
216230 return response ;
217231 }
232+
218233
219234
220235 public async Task < GeneratePostmanCollectionForApiEndpointResponse > GeneratePostmanCollectionForApiEndpointAsync ( GeneratePostmanCollectionForApiEndpointRequest ? request = null )
@@ -226,8 +241,12 @@ public async Task<GeneratePostmanCollectionForApiEndpointResponse> GeneratePostm
226241 httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
227242
228243
229- var client = _securityClient ;
230-
244+ var client = _defaultClient ;
245+ if ( _securitySource != null )
246+ {
247+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
248+ }
249+
231250 var httpResponse = await client . SendAsync ( httpRequest ) ;
232251
233252 var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -245,12 +264,13 @@ public async Task<GeneratePostmanCollectionForApiEndpointResponse> GeneratePostm
245264 {
246265 response . PostmanCollection = await httpResponse . Content . ReadAsByteArrayAsync ( ) ;
247266 }
248-
267+
249268 return response ;
250269 }
251270 response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
252271 return response ;
253272 }
273+
254274
255275
256276 public async Task < GetAllApiEndpointsResponse > GetAllApiEndpointsAsync ( GetAllApiEndpointsRequest ? request = null )
@@ -262,8 +282,12 @@ public async Task<GetAllApiEndpointsResponse> GetAllApiEndpointsAsync(GetAllApiE
262282 httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
263283
264284
265- var client = _securityClient ;
266-
285+ var client = _defaultClient ;
286+ if ( _securitySource != null )
287+ {
288+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
289+ }
290+
267291 var httpResponse = await client . SendAsync ( httpRequest ) ;
268292
269293 var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -281,12 +305,13 @@ public async Task<GetAllApiEndpointsResponse> GetAllApiEndpointsAsync(GetAllApiE
281305 {
282306 response . Classes = JsonConvert . DeserializeObject < List < ApiEndpoint > > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
283307 }
284-
308+
285309 return response ;
286310 }
287311 response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
288312 return response ;
289313 }
314+
290315
291316
292317 public async Task < GetAllForVersionApiEndpointsResponse > GetAllForVersionApiEndpointsAsync ( GetAllForVersionApiEndpointsRequest ? request = null )
@@ -298,8 +323,12 @@ public async Task<GetAllForVersionApiEndpointsResponse> GetAllForVersionApiEndpo
298323 httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
299324
300325
301- var client = _securityClient ;
302-
326+ var client = _defaultClient ;
327+ if ( _securitySource != null )
328+ {
329+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
330+ }
331+
303332 var httpResponse = await client . SendAsync ( httpRequest ) ;
304333
305334 var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -317,12 +346,13 @@ public async Task<GetAllForVersionApiEndpointsResponse> GetAllForVersionApiEndpo
317346 {
318347 response . Classes = JsonConvert . DeserializeObject < List < ApiEndpoint > > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
319348 }
320-
349+
321350 return response ;
322351 }
323352 response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
324353 return response ;
325354 }
355+
326356
327357
328358 public async Task < GetApiEndpointResponse > GetApiEndpointAsync ( GetApiEndpointRequest ? request = null )
@@ -334,8 +364,12 @@ public async Task<GetApiEndpointResponse> GetApiEndpointAsync(GetApiEndpointRequ
334364 httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
335365
336366
337- var client = _securityClient ;
338-
367+ var client = _defaultClient ;
368+ if ( _securitySource != null )
369+ {
370+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
371+ }
372+
339373 var httpResponse = await client . SendAsync ( httpRequest ) ;
340374
341375 var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -353,12 +387,13 @@ public async Task<GetApiEndpointResponse> GetApiEndpointAsync(GetApiEndpointRequ
353387 {
354388 response . ApiEndpoint = JsonConvert . DeserializeObject < ApiEndpoint > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
355389 }
356-
390+
357391 return response ;
358392 }
359393 response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
360394 return response ;
361395 }
396+
362397
363398
364399 public async Task < UpsertApiEndpointResponse > UpsertApiEndpointAsync ( UpsertApiEndpointRequest request )
@@ -370,7 +405,7 @@ public async Task<UpsertApiEndpointResponse> UpsertApiEndpointAsync(UpsertApiEnd
370405 httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
371406
372407 var serializedBody = RequestBodySerializer . Serialize ( request , "ApiEndpoint" , "json" ) ;
373- if ( serializedBody == null )
408+ if ( serializedBody == null )
374409 {
375410 throw new ArgumentNullException ( "request body is required" ) ;
376411 }
@@ -379,8 +414,12 @@ public async Task<UpsertApiEndpointResponse> UpsertApiEndpointAsync(UpsertApiEnd
379414 httpRequest . Content = serializedBody ;
380415 }
381416
382- var client = _securityClient ;
383-
417+ var client = _defaultClient ;
418+ if ( _securitySource != null )
419+ {
420+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
421+ }
422+
384423 var httpResponse = await client . SendAsync ( httpRequest ) ;
385424
386425 var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -398,12 +437,13 @@ public async Task<UpsertApiEndpointResponse> UpsertApiEndpointAsync(UpsertApiEnd
398437 {
399438 response . ApiEndpoint = JsonConvert . DeserializeObject < ApiEndpoint > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
400439 }
401-
440+
402441 return response ;
403442 }
404443 response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
405444 return response ;
406445 }
446+
407447
408448 }
409449}
0 commit comments