@@ -3184,6 +3184,105 @@ public virtual async System.Threading.Tasks.Task<EstablishmentDto> GetEstablishm
3184
3184
}
3185
3185
}
3186
3186
3187
+ /// <summary>
3188
+ /// Retrieves a list of establishments by their Unique Reference Numbers (URNs).
3189
+ /// </summary>
3190
+ /// <param name="model">Contains Unique Reference Number (URNs) of the establishments.</param>
3191
+ /// <returns>Successfully found and returned the establishments.</returns>
3192
+ /// <exception cref="AcademiesApiException">A server side error occurred.</exception>
3193
+ public virtual System . Threading . Tasks . Task < System . Collections . ObjectModel . ObservableCollection < EstablishmentDto > > GetEstablishmentsByUrnsAsync ( UrnRequestModel model )
3194
+ {
3195
+ return GetEstablishmentsByUrnsAsync ( model , System . Threading . CancellationToken . None ) ;
3196
+ }
3197
+
3198
+ /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
3199
+ /// <summary>
3200
+ /// Retrieves a list of establishments by their Unique Reference Numbers (URNs).
3201
+ /// </summary>
3202
+ /// <param name="model">Contains Unique Reference Number (URNs) of the establishments.</param>
3203
+ /// <returns>Successfully found and returned the establishments.</returns>
3204
+ /// <exception cref="AcademiesApiException">A server side error occurred.</exception>
3205
+ public virtual async System . Threading . Tasks . Task < System . Collections . ObjectModel . ObservableCollection < EstablishmentDto > > GetEstablishmentsByUrnsAsync ( UrnRequestModel model , System . Threading . CancellationToken cancellationToken )
3206
+ {
3207
+ if ( model == null )
3208
+ throw new System . ArgumentNullException ( "model" ) ;
3209
+
3210
+ var client_ = _httpClient ;
3211
+ var disposeClient_ = false ;
3212
+ try
3213
+ {
3214
+ using ( var request_ = new System . Net . Http . HttpRequestMessage ( ) )
3215
+ {
3216
+ var json_ = Newtonsoft . Json . JsonConvert . SerializeObject ( model , JsonSerializerSettings ) ;
3217
+ var content_ = new System . Net . Http . StringContent ( json_ ) ;
3218
+ content_ . Headers . ContentType = System . Net . Http . Headers . MediaTypeHeaderValue . Parse ( "application/json" ) ;
3219
+ request_ . Content = content_ ;
3220
+ request_ . Method = new System . Net . Http . HttpMethod ( "POST" ) ;
3221
+ request_ . Headers . Accept . Add ( System . Net . Http . Headers . MediaTypeWithQualityHeaderValue . Parse ( "application/json" ) ) ;
3222
+
3223
+ var urlBuilder_ = new System . Text . StringBuilder ( ) ;
3224
+ if ( ! string . IsNullOrEmpty ( _baseUrl ) ) urlBuilder_ . Append ( _baseUrl ) ;
3225
+ // Operation Path: "v4/establishments/bulk/urns"
3226
+ urlBuilder_ . Append ( "v4/establishments/bulk/urns" ) ;
3227
+
3228
+ PrepareRequest ( client_ , request_ , urlBuilder_ ) ;
3229
+
3230
+ var url_ = urlBuilder_ . ToString ( ) ;
3231
+ request_ . RequestUri = new System . Uri ( url_ , System . UriKind . RelativeOrAbsolute ) ;
3232
+
3233
+ PrepareRequest ( client_ , request_ , url_ ) ;
3234
+
3235
+ var response_ = await client_ . SendAsync ( request_ , System . Net . Http . HttpCompletionOption . ResponseHeadersRead , cancellationToken ) . ConfigureAwait ( false ) ;
3236
+ var disposeResponse_ = true ;
3237
+ try
3238
+ {
3239
+ var headers_ = new System . Collections . Generic . Dictionary < string , System . Collections . Generic . IEnumerable < string > > ( ) ;
3240
+ foreach ( var item_ in response_ . Headers )
3241
+ headers_ [ item_ . Key ] = item_ . Value ;
3242
+ if ( response_ . Content != null && response_ . Content . Headers != null )
3243
+ {
3244
+ foreach ( var item_ in response_ . Content . Headers )
3245
+ headers_ [ item_ . Key ] = item_ . Value ;
3246
+ }
3247
+
3248
+ ProcessResponse ( client_ , response_ ) ;
3249
+
3250
+ var status_ = ( int ) response_ . StatusCode ;
3251
+ if ( status_ == 200 )
3252
+ {
3253
+ var objectResponse_ = await ReadObjectResponseAsync < System . Collections . ObjectModel . ObservableCollection < EstablishmentDto > > ( response_ , headers_ , cancellationToken ) . ConfigureAwait ( false ) ;
3254
+ if ( objectResponse_ . Object == null )
3255
+ {
3256
+ throw new AcademiesApiException ( "Response was null which was not expected." , status_ , objectResponse_ . Text , headers_ , null ) ;
3257
+ }
3258
+ return objectResponse_ . Object ;
3259
+ }
3260
+ else
3261
+ if ( status_ == 404 )
3262
+ {
3263
+ string responseText_ = ( response_ . Content == null ) ? string . Empty : await response_ . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
3264
+ throw new AcademiesApiException ( "Establishments with specified Unique Reference Numbers (URNs) not found." , status_ , responseText_ , headers_ , null ) ;
3265
+ }
3266
+ else
3267
+ {
3268
+ var responseData_ = response_ . Content == null ? null : await response_ . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
3269
+ throw new AcademiesApiException ( "The HTTP status code of the response was not expected (" + status_ + ")." , status_ , responseData_ , headers_ , null ) ;
3270
+ }
3271
+ }
3272
+ finally
3273
+ {
3274
+ if ( disposeResponse_ )
3275
+ response_ . Dispose ( ) ;
3276
+ }
3277
+ }
3278
+ }
3279
+ finally
3280
+ {
3281
+ if ( disposeClient_ )
3282
+ client_ . Dispose ( ) ;
3283
+ }
3284
+ }
3285
+
3187
3286
/// <summary>
3188
3287
/// Retrieves a list of establishments by their Trust UK Provider Reference Number (UKPRN) identifier.
3189
3288
/// </summary>
@@ -3380,6 +3479,105 @@ public virtual async System.Threading.Tasks.Task<EstablishmentDto> GetEstablishm
3380
3479
}
3381
3480
}
3382
3481
3482
+ /// <summary>
3483
+ /// Retrieves a list of establishments by their UKPRNs.
3484
+ /// </summary>
3485
+ /// <param name="model">Contains UKPRNs of the establishments.</param>
3486
+ /// <returns>Successfully found and returned the establishments.</returns>
3487
+ /// <exception cref="AcademiesApiException">A server side error occurred.</exception>
3488
+ public virtual System . Threading . Tasks . Task < System . Collections . ObjectModel . ObservableCollection < EstablishmentResponse > > GetEstablishmentsByUkprnsAsync ( UkprnRequestModel model )
3489
+ {
3490
+ return GetEstablishmentsByUkprnsAsync ( model , System . Threading . CancellationToken . None ) ;
3491
+ }
3492
+
3493
+ /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
3494
+ /// <summary>
3495
+ /// Retrieves a list of establishments by their UKPRNs.
3496
+ /// </summary>
3497
+ /// <param name="model">Contains UKPRNs of the establishments.</param>
3498
+ /// <returns>Successfully found and returned the establishments.</returns>
3499
+ /// <exception cref="AcademiesApiException">A server side error occurred.</exception>
3500
+ public virtual async System . Threading . Tasks . Task < System . Collections . ObjectModel . ObservableCollection < EstablishmentResponse > > GetEstablishmentsByUkprnsAsync ( UkprnRequestModel model , System . Threading . CancellationToken cancellationToken )
3501
+ {
3502
+ if ( model == null )
3503
+ throw new System . ArgumentNullException ( "model" ) ;
3504
+
3505
+ var client_ = _httpClient ;
3506
+ var disposeClient_ = false ;
3507
+ try
3508
+ {
3509
+ using ( var request_ = new System . Net . Http . HttpRequestMessage ( ) )
3510
+ {
3511
+ var json_ = Newtonsoft . Json . JsonConvert . SerializeObject ( model , JsonSerializerSettings ) ;
3512
+ var content_ = new System . Net . Http . StringContent ( json_ ) ;
3513
+ content_ . Headers . ContentType = System . Net . Http . Headers . MediaTypeHeaderValue . Parse ( "application/json" ) ;
3514
+ request_ . Content = content_ ;
3515
+ request_ . Method = new System . Net . Http . HttpMethod ( "POST" ) ;
3516
+ request_ . Headers . Accept . Add ( System . Net . Http . Headers . MediaTypeWithQualityHeaderValue . Parse ( "application/json" ) ) ;
3517
+
3518
+ var urlBuilder_ = new System . Text . StringBuilder ( ) ;
3519
+ if ( ! string . IsNullOrEmpty ( _baseUrl ) ) urlBuilder_ . Append ( _baseUrl ) ;
3520
+ // Operation Path: "v4/establishments/bulk/ukprns"
3521
+ urlBuilder_ . Append ( "v4/establishments/bulk/ukprns" ) ;
3522
+
3523
+ PrepareRequest ( client_ , request_ , urlBuilder_ ) ;
3524
+
3525
+ var url_ = urlBuilder_ . ToString ( ) ;
3526
+ request_ . RequestUri = new System . Uri ( url_ , System . UriKind . RelativeOrAbsolute ) ;
3527
+
3528
+ PrepareRequest ( client_ , request_ , url_ ) ;
3529
+
3530
+ var response_ = await client_ . SendAsync ( request_ , System . Net . Http . HttpCompletionOption . ResponseHeadersRead , cancellationToken ) . ConfigureAwait ( false ) ;
3531
+ var disposeResponse_ = true ;
3532
+ try
3533
+ {
3534
+ var headers_ = new System . Collections . Generic . Dictionary < string , System . Collections . Generic . IEnumerable < string > > ( ) ;
3535
+ foreach ( var item_ in response_ . Headers )
3536
+ headers_ [ item_ . Key ] = item_ . Value ;
3537
+ if ( response_ . Content != null && response_ . Content . Headers != null )
3538
+ {
3539
+ foreach ( var item_ in response_ . Content . Headers )
3540
+ headers_ [ item_ . Key ] = item_ . Value ;
3541
+ }
3542
+
3543
+ ProcessResponse ( client_ , response_ ) ;
3544
+
3545
+ var status_ = ( int ) response_ . StatusCode ;
3546
+ if ( status_ == 200 )
3547
+ {
3548
+ var objectResponse_ = await ReadObjectResponseAsync < System . Collections . ObjectModel . ObservableCollection < EstablishmentResponse > > ( response_ , headers_ , cancellationToken ) . ConfigureAwait ( false ) ;
3549
+ if ( objectResponse_ . Object == null )
3550
+ {
3551
+ throw new AcademiesApiException ( "Response was null which was not expected." , status_ , objectResponse_ . Text , headers_ , null ) ;
3552
+ }
3553
+ return objectResponse_ . Object ;
3554
+ }
3555
+ else
3556
+ if ( status_ == 404 )
3557
+ {
3558
+ string responseText_ = ( response_ . Content == null ) ? string . Empty : await response_ . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
3559
+ throw new AcademiesApiException ( "Establishments with specified UKPRNs not found." , status_ , responseText_ , headers_ , null ) ;
3560
+ }
3561
+ else
3562
+ {
3563
+ var responseData_ = response_ . Content == null ? null : await response_ . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
3564
+ throw new AcademiesApiException ( "The HTTP status code of the response was not expected (" + status_ + ")." , status_ , responseData_ , headers_ , null ) ;
3565
+ }
3566
+ }
3567
+ finally
3568
+ {
3569
+ if ( disposeResponse_ )
3570
+ response_ . Dispose ( ) ;
3571
+ }
3572
+ }
3573
+ }
3574
+ finally
3575
+ {
3576
+ if ( disposeClient_ )
3577
+ client_ . Dispose ( ) ;
3578
+ }
3579
+ }
3580
+
3383
3581
protected struct ObjectResponseResult < T >
3384
3582
{
3385
3583
public ObjectResponseResult ( T responseObject , string responseText )
0 commit comments