@@ -628,7 +628,7 @@ def build_job_router_cancel_job_request(job_id: str, **kwargs: Any) -> HttpReque
628
628
return HttpRequest (method = "POST" , url = _url , params = _params , headers = _headers , ** kwargs )
629
629
630
630
631
- def build_job_router_complete_job_request (job_id : str , ** kwargs : Any ) -> HttpRequest :
631
+ def build_job_router_complete_job_request (job_id : str , assignment_id : str , ** kwargs : Any ) -> HttpRequest :
632
632
_headers = case_insensitive_dict (kwargs .pop ("headers" , {}) or {})
633
633
_params = case_insensitive_dict (kwargs .pop ("params" , {}) or {})
634
634
@@ -637,9 +637,10 @@ def build_job_router_complete_job_request(job_id: str, **kwargs: Any) -> HttpReq
637
637
accept = _headers .pop ("Accept" , "application/json" )
638
638
639
639
# Construct URL
640
- _url = "/routing/jobs/{jobId}:complete"
640
+ _url = "/routing/jobs/{jobId}/assignments/{assignmentId} :complete"
641
641
path_format_arguments = {
642
642
"jobId" : _SERIALIZER .url ("job_id" , job_id , "str" ),
643
+ "assignmentId" : _SERIALIZER .url ("assignment_id" , assignment_id , "str" ),
643
644
}
644
645
645
646
_url : str = _url .format (** path_format_arguments ) # type: ignore
@@ -655,7 +656,7 @@ def build_job_router_complete_job_request(job_id: str, **kwargs: Any) -> HttpReq
655
656
return HttpRequest (method = "POST" , url = _url , params = _params , headers = _headers , ** kwargs )
656
657
657
658
658
- def build_job_router_close_job_request (job_id : str , ** kwargs : Any ) -> HttpRequest :
659
+ def build_job_router_close_job_request (job_id : str , assignment_id : str , ** kwargs : Any ) -> HttpRequest :
659
660
_headers = case_insensitive_dict (kwargs .pop ("headers" , {}) or {})
660
661
_params = case_insensitive_dict (kwargs .pop ("params" , {}) or {})
661
662
@@ -664,9 +665,10 @@ def build_job_router_close_job_request(job_id: str, **kwargs: Any) -> HttpReques
664
665
accept = _headers .pop ("Accept" , "application/json" )
665
666
666
667
# Construct URL
667
- _url = "/routing/jobs/{jobId}:close"
668
+ _url = "/routing/jobs/{jobId}/assignments/{assignmentId} :close"
668
669
path_format_arguments = {
669
670
"jobId" : _SERIALIZER .url ("job_id" , job_id , "str" ),
671
+ "assignmentId" : _SERIALIZER .url ("assignment_id" , assignment_id , "str" ),
670
672
}
671
673
672
674
_url : str = _url .format (** path_format_arguments ) # type: ignore
@@ -3128,7 +3130,7 @@ def _reclassify_job( # pylint: disable=protected-access
3128
3130
3129
3131
Reclassify a job.
3130
3132
3131
- :param job_id: Id of the job. Required.
3133
+ :param job_id: The id of the job. Required.
3132
3134
:type job_id: str
3133
3135
:param options: Request object for reclassifying a job. Is one of the following types:
3134
3136
ReclassifyJobOptions, JSON, IO Default value is None.
@@ -3235,7 +3237,7 @@ def _cancel_job( # pylint: disable=protected-access
3235
3237
3236
3238
Submits request to cancel an existing job by Id while supplying free-form cancellation reason.
3237
3239
3238
- :param job_id: Id of the job. Required.
3240
+ :param job_id: The id of the job. Required.
3239
3241
:type job_id: str
3240
3242
:param options: Request model for cancelling job. Is one of the following types:
3241
3243
CancelJobOptions, JSON, IO Default value is None.
@@ -3315,7 +3317,8 @@ def _cancel_job( # pylint: disable=protected-access
3315
3317
def _complete_job ( # pylint: disable=protected-access
3316
3318
self ,
3317
3319
job_id : str ,
3318
- options : _models ._models .CompleteJobOptions ,
3320
+ assignment_id : str ,
3321
+ options : Optional [_models ._models .CompleteJobOptions ] = None ,
3319
3322
* ,
3320
3323
content_type : str = "application/json" ,
3321
3324
** kwargs : Any
@@ -3324,28 +3327,46 @@ def _complete_job( # pylint: disable=protected-access
3324
3327
3325
3328
@overload
3326
3329
def _complete_job ( # pylint: disable=protected-access
3327
- self , job_id : str , options : JSON , * , content_type : str = "application/json" , ** kwargs : Any
3330
+ self ,
3331
+ job_id : str ,
3332
+ assignment_id : str ,
3333
+ options : Optional [JSON ] = None ,
3334
+ * ,
3335
+ content_type : str = "application/json" ,
3336
+ ** kwargs : Any
3328
3337
) -> _models ._models .CompleteJobResult :
3329
3338
...
3330
3339
3331
3340
@overload
3332
3341
def _complete_job ( # pylint: disable=protected-access
3333
- self , job_id : str , options : IO , * , content_type : str = "application/json" , ** kwargs : Any
3342
+ self ,
3343
+ job_id : str ,
3344
+ assignment_id : str ,
3345
+ options : Optional [IO ] = None ,
3346
+ * ,
3347
+ content_type : str = "application/json" ,
3348
+ ** kwargs : Any
3334
3349
) -> _models ._models .CompleteJobResult :
3335
3350
...
3336
3351
3337
3352
@distributed_trace
3338
3353
def _complete_job ( # pylint: disable=protected-access
3339
- self , job_id : str , options : Union [_models ._models .CompleteJobOptions , JSON , IO ], ** kwargs : Any
3354
+ self ,
3355
+ job_id : str ,
3356
+ assignment_id : str ,
3357
+ options : Optional [Union [_models ._models .CompleteJobOptions , JSON , IO ]] = None ,
3358
+ ** kwargs : Any
3340
3359
) -> _models ._models .CompleteJobResult :
3341
3360
"""Completes an assigned job.
3342
3361
3343
3362
Completes an assigned job.
3344
3363
3345
- :param job_id: Id of the job. Required.
3364
+ :param job_id: The id of the job. Required.
3346
3365
:type job_id: str
3366
+ :param assignment_id: The Id of the job assignment. Required.
3367
+ :type assignment_id: str
3347
3368
:param options: Request model for completing job. Is one of the following types:
3348
- CompleteJobOptions, JSON, IO Required .
3369
+ CompleteJobOptions, JSON, IO Default value is None .
3349
3370
:type options: ~azure.communication.jobrouter.models.CompleteJobOptions or JSON or IO
3350
3371
:keyword content_type: Body parameter Content-Type. Known values are: application/json. Default
3351
3372
value is None.
@@ -3375,10 +3396,14 @@ def _complete_job( # pylint: disable=protected-access
3375
3396
if isinstance (options , (IOBase , bytes )):
3376
3397
_content = options
3377
3398
else :
3378
- _content = json .dumps (options , cls = SdkJSONEncoder , exclude_readonly = True ) # type: ignore
3399
+ if options is not None :
3400
+ _content = json .dumps (options , cls = SdkJSONEncoder , exclude_readonly = True ) # type: ignore
3401
+ else :
3402
+ _content = None
3379
3403
3380
3404
_request = build_job_router_complete_job_request (
3381
3405
job_id = job_id ,
3406
+ assignment_id = assignment_id ,
3382
3407
content_type = content_type ,
3383
3408
api_version = self ._config .api_version ,
3384
3409
content = _content ,
@@ -3419,7 +3444,8 @@ def _complete_job( # pylint: disable=protected-access
3419
3444
def _close_job ( # pylint: disable=protected-access
3420
3445
self ,
3421
3446
job_id : str ,
3422
- options : _models ._models .CloseJobOptions ,
3447
+ assignment_id : str ,
3448
+ options : Optional [_models ._models .CloseJobOptions ] = None ,
3423
3449
* ,
3424
3450
content_type : str = "application/json" ,
3425
3451
** kwargs : Any
@@ -3428,28 +3454,46 @@ def _close_job( # pylint: disable=protected-access
3428
3454
3429
3455
@overload
3430
3456
def _close_job ( # pylint: disable=protected-access
3431
- self , job_id : str , options : JSON , * , content_type : str = "application/json" , ** kwargs : Any
3457
+ self ,
3458
+ job_id : str ,
3459
+ assignment_id : str ,
3460
+ options : Optional [JSON ] = None ,
3461
+ * ,
3462
+ content_type : str = "application/json" ,
3463
+ ** kwargs : Any
3432
3464
) -> _models ._models .CloseJobResult :
3433
3465
...
3434
3466
3435
3467
@overload
3436
3468
def _close_job ( # pylint: disable=protected-access
3437
- self , job_id : str , options : IO , * , content_type : str = "application/json" , ** kwargs : Any
3469
+ self ,
3470
+ job_id : str ,
3471
+ assignment_id : str ,
3472
+ options : Optional [IO ] = None ,
3473
+ * ,
3474
+ content_type : str = "application/json" ,
3475
+ ** kwargs : Any
3438
3476
) -> _models ._models .CloseJobResult :
3439
3477
...
3440
3478
3441
3479
@distributed_trace
3442
3480
def _close_job ( # pylint: disable=protected-access
3443
- self , job_id : str , options : Union [_models ._models .CloseJobOptions , JSON , IO ], ** kwargs : Any
3481
+ self ,
3482
+ job_id : str ,
3483
+ assignment_id : str ,
3484
+ options : Optional [Union [_models ._models .CloseJobOptions , JSON , IO ]] = None ,
3485
+ ** kwargs : Any
3444
3486
) -> _models ._models .CloseJobResult :
3445
3487
"""Closes a completed job.
3446
3488
3447
3489
Closes a completed job.
3448
3490
3449
- :param job_id: Id of the job. Required.
3491
+ :param job_id: The id of the job. Required.
3450
3492
:type job_id: str
3493
+ :param assignment_id: The Id of the job assignment. Required.
3494
+ :type assignment_id: str
3451
3495
:param options: Request model for closing job. Is one of the following types: CloseJobOptions,
3452
- JSON, IO Required .
3496
+ JSON, IO Default value is None .
3453
3497
:type options: ~azure.communication.jobrouter.models.CloseJobOptions or JSON or IO
3454
3498
:keyword content_type: Body parameter Content-Type. Known values are: application/json. Default
3455
3499
value is None.
@@ -3479,10 +3523,14 @@ def _close_job( # pylint: disable=protected-access
3479
3523
if isinstance (options , (IOBase , bytes )):
3480
3524
_content = options
3481
3525
else :
3482
- _content = json .dumps (options , cls = SdkJSONEncoder , exclude_readonly = True ) # type: ignore
3526
+ if options is not None :
3527
+ _content = json .dumps (options , cls = SdkJSONEncoder , exclude_readonly = True ) # type: ignore
3528
+ else :
3529
+ _content = None
3483
3530
3484
3531
_request = build_job_router_close_job_request (
3485
3532
job_id = job_id ,
3533
+ assignment_id = assignment_id ,
3486
3534
content_type = content_type ,
3487
3535
api_version = self ._config .api_version ,
3488
3536
content = _content ,
@@ -3501,27 +3549,18 @@ def _close_job( # pylint: disable=protected-access
3501
3549
3502
3550
response = pipeline_response .http_response
3503
3551
3504
- if response .status_code not in [200 , 202 ]:
3552
+ if response .status_code not in [200 ]:
3505
3553
if _stream :
3506
3554
response .read () # Load the body in memory and close the socket
3507
3555
map_error (status_code = response .status_code , response = response , error_map = error_map )
3508
3556
raise HttpResponseError (response = response )
3509
3557
3510
- if response .status_code == 200 :
3511
- if _stream :
3512
- deserialized = response .iter_bytes ()
3513
- else :
3514
- deserialized = _deserialize (
3515
- _models ._models .CloseJobResult , response .json () # pylint: disable=protected-access
3516
- )
3517
-
3518
- if response .status_code == 202 :
3519
- if _stream :
3520
- deserialized = response .iter_bytes ()
3521
- else :
3522
- deserialized = _deserialize (
3523
- _models ._models .CloseJobResult , response .json () # pylint: disable=protected-access
3524
- )
3558
+ if _stream :
3559
+ deserialized = response .iter_bytes ()
3560
+ else :
3561
+ deserialized = _deserialize (
3562
+ _models ._models .CloseJobResult , response .json () # pylint: disable=protected-access
3563
+ )
3525
3564
3526
3565
if cls :
3527
3566
return cls (pipeline_response , deserialized , {}) # type: ignore
@@ -3726,9 +3765,9 @@ def unassign_job(
3726
3765
3727
3766
Un-assign a job.
3728
3767
3729
- :param job_id: Id of the job to un-assign . Required.
3768
+ :param job_id: The id of the job. Required.
3730
3769
:type job_id: str
3731
- :param assignment_id: Id of the assignment to un-assign . Required.
3770
+ :param assignment_id: The Id of the job assignment . Required.
3732
3771
:type assignment_id: str
3733
3772
:param options: Request body for unassign route. Default value is None.
3734
3773
:type options: ~azure.communication.jobrouter.models.UnassignJobOptions
@@ -3756,9 +3795,9 @@ def unassign_job(
3756
3795
3757
3796
Un-assign a job.
3758
3797
3759
- :param job_id: Id of the job to un-assign . Required.
3798
+ :param job_id: The id of the job. Required.
3760
3799
:type job_id: str
3761
- :param assignment_id: Id of the assignment to un-assign . Required.
3800
+ :param assignment_id: The Id of the job assignment . Required.
3762
3801
:type assignment_id: str
3763
3802
:param options: Request body for unassign route. Default value is None.
3764
3803
:type options: JSON
@@ -3786,9 +3825,9 @@ def unassign_job(
3786
3825
3787
3826
Un-assign a job.
3788
3827
3789
- :param job_id: Id of the job to un-assign . Required.
3828
+ :param job_id: The id of the job. Required.
3790
3829
:type job_id: str
3791
- :param assignment_id: Id of the assignment to un-assign . Required.
3830
+ :param assignment_id: The Id of the job assignment . Required.
3792
3831
:type assignment_id: str
3793
3832
:param options: Request body for unassign route. Default value is None.
3794
3833
:type options: IO
@@ -3814,9 +3853,9 @@ def unassign_job(
3814
3853
3815
3854
Un-assign a job.
3816
3855
3817
- :param job_id: Id of the job to un-assign . Required.
3856
+ :param job_id: The id of the job. Required.
3818
3857
:type job_id: str
3819
- :param assignment_id: Id of the assignment to un-assign . Required.
3858
+ :param assignment_id: The Id of the job assignment . Required.
3820
3859
:type assignment_id: str
3821
3860
:param options: Request body for unassign route. Is one of the following types:
3822
3861
UnassignJobOptions, JSON, IO Default value is None.
@@ -3901,7 +3940,7 @@ def accept_job_offer(self, worker_id: str, offer_id: str, **kwargs: Any) -> _mod
3901
3940
3902
3941
:param worker_id: Id of the worker. Required.
3903
3942
:type worker_id: str
3904
- :param offer_id: Id of the offer. Required.
3943
+ :param offer_id: The Id of the offer. Required.
3905
3944
:type offer_id: str
3906
3945
:keyword bool stream: Whether to stream the response of this operation. Defaults to False. You
3907
3946
will have to context manage the returned stream.
@@ -4007,7 +4046,7 @@ def _decline_job_offer( # pylint: disable=protected-access
4007
4046
4008
4047
:param worker_id: Id of the worker. Required.
4009
4048
:type worker_id: str
4010
- :param offer_id: Id of the offer. Required.
4049
+ :param offer_id: The Id of the offer. Required.
4011
4050
:type offer_id: str
4012
4051
:param options: Request model for declining offer. Is one of the following types:
4013
4052
DeclineJobOfferOptions, JSON, IO Default value is None.
0 commit comments