@@ -96,18 +96,18 @@ public class ApiEndpoints: IApiEndpoints
96
96
{
97
97
public SDKConfig SDKConfiguration { get ; private set ; }
98
98
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 " ;
101
101
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" ;
103
103
private string _serverUrl = "" ;
104
104
private ISpeakeasyHttpClient _defaultClient ;
105
- private ISpeakeasyHttpClient _securityClient ;
105
+ private Func < Security > ? _securitySource ;
106
106
107
- public ApiEndpoints ( ISpeakeasyHttpClient defaultClient , ISpeakeasyHttpClient securityClient , string serverUrl , SDKConfig config )
107
+ public ApiEndpoints ( ISpeakeasyHttpClient defaultClient , Func < Security > ? securitySource , string serverUrl , SDKConfig config )
108
108
{
109
109
_defaultClient = defaultClient ;
110
- _securityClient = securityClient ;
110
+ _securitySource = securitySource ;
111
111
_serverUrl = serverUrl ;
112
112
SDKConfiguration = config ;
113
113
}
@@ -122,8 +122,12 @@ public async Task<DeleteApiEndpointResponse> DeleteApiEndpointAsync(DeleteApiEnd
122
122
httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
123
123
124
124
125
- var client = _securityClient ;
126
-
125
+ var client = _defaultClient ;
126
+ if ( _securitySource != null )
127
+ {
128
+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
129
+ }
130
+
127
131
var httpResponse = await client . SendAsync ( httpRequest ) ;
128
132
129
133
var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -137,12 +141,13 @@ public async Task<DeleteApiEndpointResponse> DeleteApiEndpointAsync(DeleteApiEnd
137
141
138
142
if ( ( response . StatusCode == 200 ) )
139
143
{
140
-
144
+
141
145
return response ;
142
146
}
143
147
response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
144
148
return response ;
145
149
}
150
+
146
151
147
152
148
153
public async Task < FindApiEndpointResponse > FindApiEndpointAsync ( FindApiEndpointRequest ? request = null )
@@ -154,8 +159,12 @@ public async Task<FindApiEndpointResponse> FindApiEndpointAsync(FindApiEndpointR
154
159
httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
155
160
156
161
157
- var client = _securityClient ;
158
-
162
+ var client = _defaultClient ;
163
+ if ( _securitySource != null )
164
+ {
165
+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
166
+ }
167
+
159
168
var httpResponse = await client . SendAsync ( httpRequest ) ;
160
169
161
170
var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -173,12 +182,13 @@ public async Task<FindApiEndpointResponse> FindApiEndpointAsync(FindApiEndpointR
173
182
{
174
183
response . ApiEndpoint = JsonConvert . DeserializeObject < ApiEndpoint > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
175
184
}
176
-
185
+
177
186
return response ;
178
187
}
179
188
response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
180
189
return response ;
181
190
}
191
+
182
192
183
193
184
194
public async Task < GenerateOpenApiSpecForApiEndpointResponse > GenerateOpenApiSpecForApiEndpointAsync ( GenerateOpenApiSpecForApiEndpointRequest ? request = null )
@@ -190,8 +200,12 @@ public async Task<GenerateOpenApiSpecForApiEndpointResponse> GenerateOpenApiSpec
190
200
httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
191
201
192
202
193
- var client = _securityClient ;
194
-
203
+ var client = _defaultClient ;
204
+ if ( _securitySource != null )
205
+ {
206
+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
207
+ }
208
+
195
209
var httpResponse = await client . SendAsync ( httpRequest ) ;
196
210
197
211
var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -209,12 +223,13 @@ public async Task<GenerateOpenApiSpecForApiEndpointResponse> GenerateOpenApiSpec
209
223
{
210
224
response . GenerateOpenApiSpecDiff = JsonConvert . DeserializeObject < GenerateOpenApiSpecDiff > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
211
225
}
212
-
226
+
213
227
return response ;
214
228
}
215
229
response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
216
230
return response ;
217
231
}
232
+
218
233
219
234
220
235
public async Task < GeneratePostmanCollectionForApiEndpointResponse > GeneratePostmanCollectionForApiEndpointAsync ( GeneratePostmanCollectionForApiEndpointRequest ? request = null )
@@ -226,8 +241,12 @@ public async Task<GeneratePostmanCollectionForApiEndpointResponse> GeneratePostm
226
241
httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
227
242
228
243
229
- var client = _securityClient ;
230
-
244
+ var client = _defaultClient ;
245
+ if ( _securitySource != null )
246
+ {
247
+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
248
+ }
249
+
231
250
var httpResponse = await client . SendAsync ( httpRequest ) ;
232
251
233
252
var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -245,12 +264,13 @@ public async Task<GeneratePostmanCollectionForApiEndpointResponse> GeneratePostm
245
264
{
246
265
response . PostmanCollection = await httpResponse . Content . ReadAsByteArrayAsync ( ) ;
247
266
}
248
-
267
+
249
268
return response ;
250
269
}
251
270
response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
252
271
return response ;
253
272
}
273
+
254
274
255
275
256
276
public async Task < GetAllApiEndpointsResponse > GetAllApiEndpointsAsync ( GetAllApiEndpointsRequest ? request = null )
@@ -262,8 +282,12 @@ public async Task<GetAllApiEndpointsResponse> GetAllApiEndpointsAsync(GetAllApiE
262
282
httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
263
283
264
284
265
- var client = _securityClient ;
266
-
285
+ var client = _defaultClient ;
286
+ if ( _securitySource != null )
287
+ {
288
+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
289
+ }
290
+
267
291
var httpResponse = await client . SendAsync ( httpRequest ) ;
268
292
269
293
var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -281,12 +305,13 @@ public async Task<GetAllApiEndpointsResponse> GetAllApiEndpointsAsync(GetAllApiE
281
305
{
282
306
response . Classes = JsonConvert . DeserializeObject < List < ApiEndpoint > > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
283
307
}
284
-
308
+
285
309
return response ;
286
310
}
287
311
response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
288
312
return response ;
289
313
}
314
+
290
315
291
316
292
317
public async Task < GetAllForVersionApiEndpointsResponse > GetAllForVersionApiEndpointsAsync ( GetAllForVersionApiEndpointsRequest ? request = null )
@@ -298,8 +323,12 @@ public async Task<GetAllForVersionApiEndpointsResponse> GetAllForVersionApiEndpo
298
323
httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
299
324
300
325
301
- var client = _securityClient ;
302
-
326
+ var client = _defaultClient ;
327
+ if ( _securitySource != null )
328
+ {
329
+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
330
+ }
331
+
303
332
var httpResponse = await client . SendAsync ( httpRequest ) ;
304
333
305
334
var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -317,12 +346,13 @@ public async Task<GetAllForVersionApiEndpointsResponse> GetAllForVersionApiEndpo
317
346
{
318
347
response . Classes = JsonConvert . DeserializeObject < List < ApiEndpoint > > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
319
348
}
320
-
349
+
321
350
return response ;
322
351
}
323
352
response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
324
353
return response ;
325
354
}
355
+
326
356
327
357
328
358
public async Task < GetApiEndpointResponse > GetApiEndpointAsync ( GetApiEndpointRequest ? request = null )
@@ -334,8 +364,12 @@ public async Task<GetApiEndpointResponse> GetApiEndpointAsync(GetApiEndpointRequ
334
364
httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
335
365
336
366
337
- var client = _securityClient ;
338
-
367
+ var client = _defaultClient ;
368
+ if ( _securitySource != null )
369
+ {
370
+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
371
+ }
372
+
339
373
var httpResponse = await client . SendAsync ( httpRequest ) ;
340
374
341
375
var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -353,12 +387,13 @@ public async Task<GetApiEndpointResponse> GetApiEndpointAsync(GetApiEndpointRequ
353
387
{
354
388
response . ApiEndpoint = JsonConvert . DeserializeObject < ApiEndpoint > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
355
389
}
356
-
390
+
357
391
return response ;
358
392
}
359
393
response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
360
394
return response ;
361
395
}
396
+
362
397
363
398
364
399
public async Task < UpsertApiEndpointResponse > UpsertApiEndpointAsync ( UpsertApiEndpointRequest request )
@@ -370,7 +405,7 @@ public async Task<UpsertApiEndpointResponse> UpsertApiEndpointAsync(UpsertApiEnd
370
405
httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
371
406
372
407
var serializedBody = RequestBodySerializer . Serialize ( request , "ApiEndpoint" , "json" ) ;
373
- if ( serializedBody == null )
408
+ if ( serializedBody == null )
374
409
{
375
410
throw new ArgumentNullException ( "request body is required" ) ;
376
411
}
@@ -379,8 +414,12 @@ public async Task<UpsertApiEndpointResponse> UpsertApiEndpointAsync(UpsertApiEnd
379
414
httpRequest . Content = serializedBody ;
380
415
}
381
416
382
- var client = _securityClient ;
383
-
417
+ var client = _defaultClient ;
418
+ if ( _securitySource != null )
419
+ {
420
+ client = SecuritySerializer . Apply ( _defaultClient , _securitySource ) ;
421
+ }
422
+
384
423
var httpResponse = await client . SendAsync ( httpRequest ) ;
385
424
386
425
var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
@@ -398,12 +437,13 @@ public async Task<UpsertApiEndpointResponse> UpsertApiEndpointAsync(UpsertApiEnd
398
437
{
399
438
response . ApiEndpoint = JsonConvert . DeserializeObject < ApiEndpoint > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
400
439
}
401
-
440
+
402
441
return response ;
403
442
}
404
443
response . Error = JsonConvert . DeserializeObject < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , new JsonSerializerSettings ( ) { NullValueHandling = NullValueHandling . Ignore , Converters = new JsonConverter [ ] { new FlexibleObjectDeserializer ( ) , new EnumSerializer ( ) } } ) ;
405
444
return response ;
406
445
}
446
+
407
447
408
448
}
409
449
}
0 commit comments