diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.Serialization.cs similarity index 76% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.Serialization.cs index 2e4886be3368f..16b6afc246dc8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -41,5 +42,13 @@ internal static AcceptJobOfferResult DeserializeAcceptJobOfferResult(JsonElement } return new AcceptJobOfferResult(assignmentId, jobId, workerId); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AcceptJobOfferResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAcceptJobOfferResult(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.cs similarity index 92% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.cs index 04b884341c6f4..a2a91162ca17e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.cs @@ -10,7 +10,10 @@ namespace Azure.Communication.JobRouter.Models { - /// Response containing Id's for the worker, job, and assignment from an accepted offer. + /// + /// Response containing Id's for the worker, job, and assignment from an accepted + /// offer + /// public partial class AcceptJobOfferResult { /// Initializes a new instance of AcceptJobOfferResult. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/AzureCommunicationJobRouterClientOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AzureCommunicationJobRouterClientOptions.cs new file mode 100644 index 0000000000000..144789f0500cc --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AzureCommunicationJobRouterClientOptions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Client options for Azure.Communication.JobRouter library clients. + public partial class AzureCommunicationJobRouterClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2023_11_01; + + /// The version of the service to use. + internal enum ServiceVersion + { + /// Service version "2023-11-01". + V2023_11_01 = 1, + } + + internal string Version { get; } + + /// Initializes new instance of AzureCommunicationJobRouterClientOptions. + public AzureCommunicationJobRouterClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2023_11_01 => "2023-11-01", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs index adc65b52b7951..6fc34c49865a7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs @@ -6,46 +6,14 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Communication.JobRouter.Models; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class BestWorkerMode : IUtf8JsonSerializable + public partial class BestWorkerMode { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ScoringRule)) - { - writer.WritePropertyName("scoringRule"u8); - writer.WriteObjectValue(ScoringRule); - } - if (Optional.IsDefined(ScoringRuleOptions)) - { - writer.WritePropertyName("scoringRuleOptions"u8); - writer.WriteObjectValue(ScoringRuleOptions); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - if (Optional.IsDefined(MinConcurrentOffers)) - { - writer.WritePropertyName("minConcurrentOffers"u8); - writer.WriteNumberValue(MinConcurrentOffers); - } - if (Optional.IsDefined(MaxConcurrentOffers)) - { - writer.WritePropertyName("maxConcurrentOffers"u8); - writer.WriteNumberValue(MaxConcurrentOffers); - } - if (Optional.IsDefined(BypassSelectors)) - { - writer.WritePropertyName("bypassSelectors"u8); - writer.WriteBooleanValue(BypassSelectors.Value); - } - writer.WriteEndObject(); - } - internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -113,5 +81,13 @@ internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) } return new BestWorkerMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), scoringRule.Value, scoringRuleOptions.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new BestWorkerMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeBestWorkerMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs similarity index 53% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs index 3cb41b46f2a5c..dc113b5c3624b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs @@ -13,33 +13,42 @@ namespace Azure.Communication.JobRouter public partial class BestWorkerMode : DistributionMode { /// Initializes a new instance of BestWorkerMode. - /// The type discriminator describing a sub-type of Mode. + /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// /// (Optional) - /// If set to true, then router will match workers to jobs even if they don't match label selectors. - /// Warning: You may get workers that are not qualified for the job they are matched with if you set this - /// variable to true. This flag is intended more for temporary usage. + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. /// By default, set to false. /// /// /// A rule of one of the following types: /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// + /// Encapsulates all options that can be passed as parameters for scoring rule with + /// BestWorkerMode /// - /// Encapsulates all options that can be passed as parameters for scoring rule with BestWorkerMode. internal BestWorkerMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, RouterRule scoringRule, ScoringRuleOptions scoringRuleOptions) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) { ScoringRule = scoringRule; ScoringRuleOptions = scoringRuleOptions; - Kind = kind ?? "best-worker"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs index 44edd36173956..52491f6438e6f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs @@ -6,30 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class CancelExceptionAction : IUtf8JsonSerializable + public partial class CancelExceptionAction { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Note)) - { - writer.WritePropertyName("note"u8); - writer.WriteStringValue(Note); - } - if (Optional.IsDefined(DispositionCode)) - { - writer.WritePropertyName("dispositionCode"u8); - writer.WriteStringValue(DispositionCode); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -59,5 +42,13 @@ internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonEleme } return new CancelExceptionAction(kind, note.Value, dispositionCode.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CancelExceptionAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCancelExceptionAction(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs new file mode 100644 index 0000000000000..f43560905ff86 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// An action that marks a job as cancelled. + public partial class CancelExceptionAction : ExceptionAction + { + /// Initializes a new instance of CancelExceptionAction. + internal CancelExceptionAction() + { + Kind = "cancel"; + } + + /// Initializes a new instance of CancelExceptionAction. + /// Discriminator. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + /// + /// (Optional) Indicates the outcome of the job, populate this field with your own + /// custom values. + /// + internal CancelExceptionAction(string kind, string note, string dispositionCode) : base(kind) + { + Note = note; + DispositionCode = dispositionCode; + } + + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + public string Note { get; } + /// + /// (Optional) Indicates the outcome of the job, populate this field with your own + /// custom values. + /// + public string DispositionCode { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs similarity index 74% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs index d9e66366ab157..3131479cf9d61 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs @@ -27,5 +27,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs new file mode 100644 index 0000000000000..d115b31a8ebfa --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Request payload for deleting a job. + internal partial class CancelJobRequest + { + /// Initializes a new instance of CancelJobRequest. + public CancelJobRequest() + { + } + + /// Initializes a new instance of CancelJobRequest. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + /// + /// Indicates the outcome of the job, populate this field with your own custom + /// values. + /// If not provided, default value of "Cancelled" is set. + /// + internal CancelJobRequest(string note, string dispositionCode) + { + Note = note; + DispositionCode = dispositionCode; + } + + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + public string Note { get; set; } + /// + /// Indicates the outcome of the job, populate this field with your own custom + /// values. + /// If not provided, default value of "Cancelled" is set. + /// + public string DispositionCode { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs index 0f005a0aad59e..f6b0c5890eb59 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs @@ -6,25 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ChannelConfiguration : IUtf8JsonSerializable + public partial class ChannelConfiguration { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("capacityCostPerJob"u8); - writer.WriteNumberValue(CapacityCostPerJob); - if (Optional.IsDefined(MaxNumberOfJobs)) - { - writer.WritePropertyName("maxNumberOfJobs"u8); - writer.WriteNumberValue(MaxNumberOfJobs.Value); - } - writer.WriteEndObject(); - } - internal static ChannelConfiguration DeserializeChannelConfiguration(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -52,5 +40,13 @@ internal static ChannelConfiguration DeserializeChannelConfiguration(JsonElement } return new ChannelConfiguration(capacityCostPerJob, Optional.ToNullable(maxNumberOfJobs)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ChannelConfiguration FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeChannelConfiguration(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs similarity index 58% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs index 37e35196027fb..79af361595366 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs @@ -11,14 +11,20 @@ namespace Azure.Communication.JobRouter public partial class ChannelConfiguration { /// Initializes a new instance of ChannelConfiguration. - /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity. - public ChannelConfiguration(int capacityCostPerJob) + /// + /// The amount of capacity that an instance of a job of this channel will consume + /// of the total worker capacity. + /// + internal ChannelConfiguration(int capacityCostPerJob) { CapacityCostPerJob = capacityCostPerJob; } /// Initializes a new instance of ChannelConfiguration. - /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity. + /// + /// The amount of capacity that an instance of a job of this channel will consume + /// of the total worker capacity. + /// /// The maximum number of jobs that can be supported concurrently for this channel. internal ChannelConfiguration(int capacityCostPerJob, int? maxNumberOfJobs) { @@ -26,9 +32,12 @@ internal ChannelConfiguration(int capacityCostPerJob, int? maxNumberOfJobs) MaxNumberOfJobs = maxNumberOfJobs; } - /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity. - public int CapacityCostPerJob { get; set; } + /// + /// The amount of capacity that an instance of a job of this channel will consume + /// of the total worker capacity. + /// + public int CapacityCostPerJob { get; } /// The maximum number of jobs that can be supported concurrently for this channel. - public int? MaxNumberOfJobs { get; set; } + public int? MaxNumberOfJobs { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs similarity index 62% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs index a9daab64bb03e..293451a564c5c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs @@ -7,61 +7,20 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Communication.JobRouter; +using Azure; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { - public partial class ClassificationPolicy : IUtf8JsonSerializable + public partial class ClassificationPolicy { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(FallbackQueueId)) - { - writer.WritePropertyName("fallbackQueueId"u8); - writer.WriteStringValue(FallbackQueueId); - } - if (Optional.IsCollectionDefined(_queueSelectors)) - { - writer.WritePropertyName("queueSelectors"u8); - writer.WriteStartArray(); - foreach (var item in _queueSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(PrioritizationRule)) - { - writer.WritePropertyName("prioritizationRule"u8); - writer.WriteObjectValue(PrioritizationRule); - } - if (Optional.IsCollectionDefined(_workerSelectors)) - { - writer.WritePropertyName("workerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in _workerSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional name = default; Optional fallbackQueueId = default; Optional> queueSelectors = default; @@ -122,7 +81,15 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement continue; } } - return new ClassificationPolicy(id.Value, name.Value, fallbackQueueId.Value, Optional.ToList(queueSelectors), prioritizationRule.Value, Optional.ToList(workerSelectors)); + return new ClassificationPolicy(id, name.Value, fallbackQueueId.Value, Optional.ToList(queueSelectors), prioritizationRule.Value, Optional.ToList(workerSelectors)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ClassificationPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeClassificationPolicy(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs new file mode 100644 index 0000000000000..5ebe1877a881b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// A container for the rules that govern how jobs are classified. + public partial class ClassificationPolicy + { + /// Initializes a new instance of ClassificationPolicy. + /// Unique identifier of this policy. + /// Friendly name of this policy. + /// The fallback queue to select if the queue selector doesn't find a match. + /// The queue selectors to resolve a queue for a given job. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The worker label selectors to attach to a given job. + internal ClassificationPolicy(string id, string name, string fallbackQueueId, IList queueSelectors, RouterRule prioritizationRule, IList workerSelectors) + { + Id = id; + Name = name; + FallbackQueueId = fallbackQueueId; + _queueSelectors = queueSelectors; + PrioritizationRule = prioritizationRule; + _workerSelectors = workerSelectors; + } + + /// Unique identifier of this policy. + public string Id { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs index 45d3876403fa9..f81f8c1b94558 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs @@ -6,6 +6,8 @@ #nullable disable using System.Text.Json; +using Azure; +using Azure.Communication.JobRouter; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -18,16 +20,12 @@ internal static ClassificationPolicyItem DeserializeClassificationPolicyItem(Jso { return null; } - Optional classificationPolicy = default; - Optional etag = default; + ClassificationPolicy classificationPolicy = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("classificationPolicy"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } classificationPolicy = ClassificationPolicy.DeserializeClassificationPolicy(property.Value); continue; } @@ -37,7 +35,15 @@ internal static ClassificationPolicyItem DeserializeClassificationPolicyItem(Jso continue; } } - return new ClassificationPolicyItem(classificationPolicy.Value, etag.Value); + return new ClassificationPolicyItem(classificationPolicy, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ClassificationPolicyItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeClassificationPolicyItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs similarity index 73% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs index 53d52d7f8dc03..9ab6151edf985 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs @@ -5,21 +5,24 @@ #nullable disable +using System; +using Azure.Communication.JobRouter; +using Azure.Core; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of ClassificationPolicy. public partial class ClassificationPolicyItem { - /// Initializes a new instance of ClassificationPolicyItem. - internal ClassificationPolicyItem() - { - } - /// Initializes a new instance of ClassificationPolicyItem. /// A container for the rules that govern how jobs are classified. /// (Optional) The Concurrency Token. + /// or is null. internal ClassificationPolicyItem(ClassificationPolicy classificationPolicy, string etag) { + Argument.AssertNotNull(classificationPolicy, nameof(classificationPolicy)); + Argument.AssertNotNull(etag, nameof(etag)); + ClassificationPolicy = classificationPolicy; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs similarity index 79% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs index 6b151616a3f00..689c8b136a186 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs @@ -34,5 +34,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs new file mode 100644 index 0000000000000..904b7ac9de92b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Request payload for closing jobs. + internal partial class CloseJobRequest + { + /// Initializes a new instance of CloseJobRequest. + /// The assignment within which the job is to be closed. + /// is null. + public CloseJobRequest(string assignmentId) + { + Argument.AssertNotNull(assignmentId, nameof(assignmentId)); + + AssignmentId = assignmentId; + } + + /// Initializes a new instance of CloseJobRequest. + /// The assignment within which the job is to be closed. + /// + /// Indicates the outcome of the job, populate this field with your own custom + /// values. + /// + /// + /// If not provided, worker capacity is released immediately along with a + /// JobClosedEvent notification. + /// If provided, worker capacity is released along + /// with a JobClosedEvent notification at a future time in UTC. + /// + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + internal CloseJobRequest(string assignmentId, string dispositionCode, DateTimeOffset? closeAt, string note) + { + AssignmentId = assignmentId; + DispositionCode = dispositionCode; + CloseAt = closeAt; + Note = note; + } + + /// The assignment within which the job is to be closed. + public string AssignmentId { get; } + /// + /// Indicates the outcome of the job, populate this field with your own custom + /// values. + /// + public string DispositionCode { get; set; } + /// + /// If not provided, worker capacity is released immediately along with a + /// JobClosedEvent notification. + /// If provided, worker capacity is released along + /// with a JobClosedEvent notification at a future time in UTC. + /// + public DateTimeOffset? CloseAt { get; set; } + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + public string Note { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs new file mode 100644 index 0000000000000..50ad54c695db2 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class CommunicationJobRouterClientBuilderExtensions + { + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs index fdde257d05637..34df8aedfe888 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs @@ -7,24 +7,438 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.Communication.JobRouter.Models; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// Model factory for models. public static partial class CommunicationJobRouterModelFactory { + /// Initializes a new instance of DistributionMode. + /// Discriminator. + /// Governs the minimum desired number of active concurrent offers a job can have. + /// Governs the maximum number of active concurrent offers a job can have. + /// + /// (Optional) + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. + /// By default, set to false. + /// + /// A new instance for mocking. + public static DistributionMode DistributionMode(string kind = null, int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null) + { + return new UnknownDistributionMode(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors); + } + + /// Initializes a new instance of BestWorkerMode. + /// Governs the minimum desired number of active concurrent offers a job can have. + /// Governs the maximum number of active concurrent offers a job can have. + /// + /// (Optional) + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. + /// By default, set to false. + /// + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// + /// Encapsulates all options that can be passed as parameters for scoring rule with + /// BestWorkerMode + /// + /// A new instance for mocking. + public static BestWorkerMode BestWorkerMode(int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null, RouterRule scoringRule = null, ScoringRuleOptions scoringRuleOptions = null) + { + return new BestWorkerMode("best-worker", minConcurrentOffers, maxConcurrentOffers, bypassSelectors, scoringRule, scoringRuleOptions); + } + + /// Initializes a new instance of ExpressionRouterRule. + /// The expression language to compile to and execute. + /// + /// The string containing the expression to evaluate. Should contain return + /// statement with calculated values. + /// + /// A new instance for mocking. + public static ExpressionRouterRule ExpressionRouterRule(string language = null, string expression = null) + { + return new ExpressionRouterRule("expression-rule", language, expression); + } + + /// Initializes a new instance of FunctionRouterRule. + /// URL for Azure Function. + /// Credentials used to access Azure function rule. + /// A new instance for mocking. + public static FunctionRouterRule FunctionRouterRule(Uri functionUri = null, FunctionRouterRuleCredential credential = null) + { + return new FunctionRouterRule("azure-function-rule", functionUri, credential); + } + + /// Initializes a new instance of WebhookRouterRule. + /// Uri for Authorization Server. + /// + /// OAuth2.0 Credentials used to Contoso's Authorization server. + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// + /// Uri for Contoso's Web Server. + /// A new instance for mocking. + public static WebhookRouterRule WebhookRouterRule(Uri authorizationServerUri = null, Oauth2ClientCredential clientCredential = null, Uri webhookUri = null) + { + return new WebhookRouterRule("webhook-rule", authorizationServerUri, clientCredential, webhookUri); + } + + /// Initializes a new instance of Oauth2ClientCredential. + /// ClientId for Contoso Authorization server. + /// Client secret for Contoso Authorization server. + /// A new instance for mocking. + public static Oauth2ClientCredential Oauth2ClientCredential(string clientId = null, string clientSecret = null) + { + return new Oauth2ClientCredential(clientId, clientSecret); + } + + /// Initializes a new instance of ScoringRuleOptions. + /// + /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. + /// Defaults to 20 if not configured. + /// + /// + /// (Optional) List of extra parameters from the job that will be sent as part of + /// the payload to scoring rule. + /// If not set, the job's labels (sent in the payload + /// as `job`) and the job's worker selectors (sent in the payload as + /// `selectors`) + /// are added to the payload of the scoring rule by default. + /// Note: + /// Worker labels are always sent with scoring payload. + /// + /// + /// (Optional) + /// If set to true, will score workers in batches, and the parameter + /// name of the worker labels will be sent as `workers`. + /// By default, set to false + /// and the parameter name for the worker labels will be sent as `worker`. + /// Note: If + /// enabled, use BatchSize to set batch size. + /// + /// + /// (Optional) + /// If false, will sort scores by ascending order. By default, set to + /// true. + /// + /// A new instance for mocking. + public static ScoringRuleOptions ScoringRuleOptions(int? batchSize = null, IEnumerable scoringParameters = null, bool? allowScoringBatchOfWorkers = null, bool? descendingOrder = null) + { + scoringParameters ??= new List(); + + return new ScoringRuleOptions(batchSize, scoringParameters?.ToList(), allowScoringBatchOfWorkers, descendingOrder); + } + + /// Initializes a new instance of LongestIdleMode. + /// Governs the minimum desired number of active concurrent offers a job can have. + /// Governs the maximum number of active concurrent offers a job can have. + /// + /// (Optional) + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. + /// By default, set to false. + /// + /// A new instance for mocking. + public static LongestIdleMode LongestIdleMode(int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null) + { + return new LongestIdleMode("longest-idle", minConcurrentOffers, maxConcurrentOffers, bypassSelectors); + } + + /// Initializes a new instance of RoundRobinMode. + /// Governs the minimum desired number of active concurrent offers a job can have. + /// Governs the maximum number of active concurrent offers a job can have. + /// + /// (Optional) + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. + /// By default, set to false. + /// + /// A new instance for mocking. + public static RoundRobinMode RoundRobinMode(int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null) + { + return new RoundRobinMode("round-robin", minConcurrentOffers, maxConcurrentOffers, bypassSelectors); + } + + /// Initializes a new instance of ConditionalQueueSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The queue selectors to attach. + /// A new instance for mocking. + public static ConditionalQueueSelectorAttachment ConditionalQueueSelectorAttachment(RouterRule condition = null, IEnumerable queueSelectors = null) + { + queueSelectors ??= new List(); + + return new ConditionalQueueSelectorAttachment("conditional", condition, queueSelectors?.ToList()); + } + + /// Initializes a new instance of PassThroughQueueSelectorAttachment. + /// The label key to query against. + /// Describes how the value of the label is compared to the value pass through. + /// A new instance for mocking. + public static PassThroughQueueSelectorAttachment PassThroughQueueSelectorAttachment(string key = null, LabelOperator labelOperator = default) + { + return new PassThroughQueueSelectorAttachment("pass-through", key, labelOperator); + } + + /// Initializes a new instance of RuleEngineQueueSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// A new instance for mocking. + public static RuleEngineQueueSelectorAttachment RuleEngineQueueSelectorAttachment(RouterRule rule = null) + { + return new RuleEngineQueueSelectorAttachment("rule-engine", rule); + } + + /// Initializes a new instance of StaticQueueSelectorAttachment. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// + /// A new instance for mocking. + public static StaticQueueSelectorAttachment StaticQueueSelectorAttachment(RouterQueueSelector queueSelector = null) + { + return new StaticQueueSelectorAttachment("static", queueSelector); + } + + /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. + /// A collection of percentage based weighted allocations. + /// A new instance for mocking. + public static WeightedAllocationQueueSelectorAttachment WeightedAllocationQueueSelectorAttachment(IEnumerable allocations = null) + { + allocations ??= new List(); + + return new WeightedAllocationQueueSelectorAttachment("weighted-allocation-queue-selector", allocations?.ToList()); + } + + /// Initializes a new instance of QueueWeightedAllocation. + /// The percentage of this weight, expressed as a fraction of 1. + /// + /// A collection of queue selectors that will be applied if this allocation is + /// selected. + /// + /// A new instance for mocking. + public static QueueWeightedAllocation QueueWeightedAllocation(double weight = default, IEnumerable queueSelectors = null) + { + queueSelectors ??= new List(); + + return new QueueWeightedAllocation(weight, queueSelectors?.ToList()); + } + + /// Initializes a new instance of ConditionalWorkerSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The worker selectors to attach. + /// A new instance for mocking. + public static ConditionalWorkerSelectorAttachment ConditionalWorkerSelectorAttachment(RouterRule condition = null, IEnumerable workerSelectors = null) + { + workerSelectors ??= new List(); + + return new ConditionalWorkerSelectorAttachment("conditional", condition, workerSelectors?.ToList()); + } + + /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// A new instance for mocking. + public static RuleEngineWorkerSelectorAttachment RuleEngineWorkerSelectorAttachment(RouterRule rule = null) + { + return new RuleEngineWorkerSelectorAttachment("rule-engine", rule); + } + + /// Initializes a new instance of StaticWorkerSelectorAttachment. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// + /// A new instance for mocking. + public static StaticWorkerSelectorAttachment StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector = null) + { + return new StaticWorkerSelectorAttachment("static", workerSelector); + } + + /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. + /// A collection of percentage based weighted allocations. + /// A new instance for mocking. + public static WeightedAllocationWorkerSelectorAttachment WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations = null) + { + allocations ??= new List(); + + return new WeightedAllocationWorkerSelectorAttachment("weighted-allocation-worker-selector", allocations?.ToList()); + } + + /// Initializes a new instance of WorkerWeightedAllocation. + /// The percentage of this weight, expressed as a fraction of 1. + /// + /// A collection of worker selectors that will be applied if this allocation is + /// selected. + /// + /// A new instance for mocking. + public static WorkerWeightedAllocation WorkerWeightedAllocation(double weight = default, IEnumerable workerSelectors = null) + { + workerSelectors ??= new List(); + + return new WorkerWeightedAllocation(weight, workerSelectors?.ToList()); + } + + /// Initializes a new instance of ExceptionRule. + /// The trigger for this exception rule. + /// + /// A dictionary collection of actions to perform once the exception is triggered. + /// Key is the Id of each exception action. + /// + /// or is null. + /// A new instance for mocking. + public static ExceptionRule ExceptionRule(ExceptionTrigger trigger = null, IDictionary actions = null) + { + if (trigger == null) + { + throw new ArgumentNullException(nameof(trigger)); + } + actions ??= new Dictionary(); + + return new ExceptionRule(trigger, actions); + } + + /// Initializes a new instance of QueueLengthExceptionTrigger. + /// Threshold of number of jobs ahead in the queue to for this trigger to fire. + /// A new instance for mocking. + public static QueueLengthExceptionTrigger QueueLengthExceptionTrigger(int threshold = default) + { + return new QueueLengthExceptionTrigger("queue-length", threshold); + } + + /// Initializes a new instance of CancelExceptionAction. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + /// + /// (Optional) Indicates the outcome of the job, populate this field with your own + /// custom values. + /// + /// A new instance for mocking. + public static CancelExceptionAction CancelExceptionAction(string note = null, string dispositionCode = null) + { + return new CancelExceptionAction("cancel", note, dispositionCode); + } + + /// Initializes a new instance of ManualReclassifyExceptionAction. + /// Updated QueueId. + /// Updated Priority. + /// Updated WorkerSelectors. + /// A new instance for mocking. + public static ManualReclassifyExceptionAction ManualReclassifyExceptionAction(string queueId = null, int? priority = null, IEnumerable workerSelectors = null) + { + workerSelectors ??= new List(); + + return new ManualReclassifyExceptionAction("manual-reclassify", queueId, priority, workerSelectors?.ToList()); + } + /// Initializes a new instance of RouterJobAssignment. /// The Id of the job assignment. /// The Id of the Worker assigned to the job. /// The assignment time of the job in UTC. /// The time the job was marked as completed after being assigned in UTC. /// The time the job was marked as closed after being completed in UTC. - /// A new instance for mocking. + /// A new instance for mocking. public static RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, DateTimeOffset assignedAt = default, DateTimeOffset? completedAt = null, DateTimeOffset? closedAt = null) { return new RouterJobAssignment(assignmentId, workerId, assignedAt, completedAt, closedAt); } + /// Initializes a new instance of ScheduleAndSuspendMode. + /// Scheduled time. + /// A new instance for mocking. + public static ScheduleAndSuspendMode ScheduleAndSuspendMode(DateTimeOffset? scheduleAt = null) + { + return new ScheduleAndSuspendMode(scheduleAt); + } + /// Initializes a new instance of UnassignJobResult. /// The Id of the job unassigned. /// The number of times a job is unassigned. At a maximum 3. @@ -67,7 +481,10 @@ public static AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = nu /// Initializes a new instance of RouterQueueStatistics. /// Id of the queue these details are about. /// Length of the queue: total number of enqueued jobs. - /// The estimated wait time of this queue rounded up to the nearest minute, grouped by job priority. + /// + /// The estimated wait time of this queue rounded up to the nearest minute, grouped + /// by job priority + /// /// The wait time of the job that has been enqueued in this queue for the longest. /// A new instance for mocking. public static RouterQueueStatistics RouterQueueStatistics(string queueId = null, int length = default, IReadOnlyDictionary estimatedWaitTimeMinutes = null, double? longestJobWaitTimeMinutes = null) @@ -77,6 +494,18 @@ public static RouterQueueStatistics RouterQueueStatistics(string queueId = null, return new RouterQueueStatistics(queueId, length, estimatedWaitTimeMinutes, longestJobWaitTimeMinutes); } + /// Initializes a new instance of ChannelConfiguration. + /// + /// The amount of capacity that an instance of a job of this channel will consume + /// of the total worker capacity. + /// + /// The maximum number of jobs that can be supported concurrently for this channel. + /// A new instance for mocking. + public static ChannelConfiguration ChannelConfiguration(int capacityCostPerJob = default, int? maxNumberOfJobs = null) + { + return new ChannelConfiguration(capacityCostPerJob, maxNumberOfJobs); + } + /// Initializes a new instance of RouterJobOffer. /// The Id of the offer. /// The Id of the job. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs index f3b60b47d21aa..a903934bdf7a0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs @@ -24,5 +24,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs similarity index 59% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs index 5ccc3b36b8b77..6c2b949384ebb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs @@ -23,9 +23,24 @@ public CompleteJobRequest(string assignmentId) AssignmentId = assignmentId; } + /// Initializes a new instance of CompleteJobRequest. + /// The assignment within the job to complete. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + internal CompleteJobRequest(string assignmentId, string note) + { + AssignmentId = assignmentId; + Note = note; + } + /// The assignment within the job to complete. public string AssignmentId { get; } - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// public string Note { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs index 72d1abc865589..0031202913a4f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs @@ -7,29 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ConditionalQueueSelectorAttachment : IUtf8JsonSerializable + public partial class ConditionalQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("condition"u8); - writer.WriteObjectValue(Condition); - writer.WritePropertyName("queueSelectors"u8); - writer.WriteStartArray(); - foreach (var item in QueueSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,7 +21,7 @@ internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSe return null; } RouterRule condition = default; - IList queueSelectors = default; + IReadOnlyList queueSelectors = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -64,5 +48,13 @@ internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSe } return new ConditionalQueueSelectorAttachment(kind, condition, queueSelectors); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ConditionalQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConditionalQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs new file mode 100644 index 0000000000000..3518611c8b82c --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// + /// Describes a set of queue selectors that will be attached if the given condition + /// resolves to true + /// + public partial class ConditionalQueueSelectorAttachment : QueueSelectorAttachment + { + /// Initializes a new instance of ConditionalQueueSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The queue selectors to attach. + /// or is null. + internal ConditionalQueueSelectorAttachment(RouterRule condition, IEnumerable queueSelectors) + { + Argument.AssertNotNull(condition, nameof(condition)); + Argument.AssertNotNull(queueSelectors, nameof(queueSelectors)); + + Kind = "conditional"; + Condition = condition; + QueueSelectors = queueSelectors.ToList(); + } + + /// Initializes a new instance of ConditionalQueueSelectorAttachment. + /// Discriminator. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The queue selectors to attach. + internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, IReadOnlyList queueSelectors) : base(kind) + { + Condition = condition; + QueueSelectors = queueSelectors; + } + + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , and . + /// + public RouterRule Condition { get; } + /// The queue selectors to attach. + public IReadOnlyList QueueSelectors { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs index 6feaaba94f2c7..55e38315bb962 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs @@ -7,29 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ConditionalWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class ConditionalWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("condition"u8); - writer.WriteObjectValue(Condition); - writer.WritePropertyName("workerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in WorkerSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,7 +21,7 @@ internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorker return null; } RouterRule condition = default; - IList workerSelectors = default; + IReadOnlyList workerSelectors = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -64,5 +48,13 @@ internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorker } return new ConditionalWorkerSelectorAttachment(kind, condition, workerSelectors); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ConditionalWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConditionalWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs new file mode 100644 index 0000000000000..a3051bde4479b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// + /// Describes a set of worker selectors that will be attached if the given + /// condition resolves to true + /// + public partial class ConditionalWorkerSelectorAttachment : WorkerSelectorAttachment + { + /// Initializes a new instance of ConditionalWorkerSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The worker selectors to attach. + /// or is null. + internal ConditionalWorkerSelectorAttachment(RouterRule condition, IEnumerable workerSelectors) + { + Argument.AssertNotNull(condition, nameof(condition)); + Argument.AssertNotNull(workerSelectors, nameof(workerSelectors)); + + Kind = "conditional"; + Condition = condition; + WorkerSelectors = workerSelectors.ToList(); + } + + /// Initializes a new instance of ConditionalWorkerSelectorAttachment. + /// Discriminator. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The worker selectors to attach. + internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, IReadOnlyList workerSelectors) : base(kind) + { + Condition = condition; + WorkerSelectors = workerSelectors; + } + + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , and . + /// + public RouterRule Condition { get; } + /// The worker selectors to attach. + public IReadOnlyList WorkerSelectors { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Configuration.json b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Configuration.json new file mode 100644 index 0000000000000..924c7e0303b72 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Configuration.json @@ -0,0 +1,11 @@ +{ + "output-folder": ".", + "namespace": "Azure.Communication.JobRouter", + "library-name": "Azure.Communication.JobRouter", + "shared-source-folders": [ + "../../TempTypeSpecFiles/Communication.JobRouter/node_modules/@autorest/csharp/Generator.Shared", + "../../TempTypeSpecFiles/Communication.JobRouter/node_modules/@autorest/csharp/Azure.Core.Shared" + ], + "use-overloads-between-protocol-and-convenience": true, + "model-namespace": false +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs similarity index 62% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs index e865afcce73e4..0f4f223a9401c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - public partial class DeclineJobOfferRequest : IUtf8JsonSerializable + internal partial class DeclineJobOfferRequest : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -22,5 +22,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs new file mode 100644 index 0000000000000..11cf5452faefd --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Communication.JobRouter +{ + /// Request payload for declining offers. + internal partial class DeclineJobOfferRequest + { + /// Initializes a new instance of DeclineJobOfferRequest. + public DeclineJobOfferRequest() + { + } + + /// Initializes a new instance of DeclineJobOfferRequest. + /// + /// If the RetryOfferAt is not provided, then this job will not be offered again to + /// the worker who declined this job unless + /// the worker is de-registered and + /// re-registered. If a RetryOfferAt time is provided, then the job will be + /// re-matched to + /// eligible workers at the retry time in UTC. The worker that + /// declined the job will also be eligible for the job at that time. + /// + internal DeclineJobOfferRequest(DateTimeOffset? retryOfferAt) + { + RetryOfferAt = retryOfferAt; + } + + /// + /// If the RetryOfferAt is not provided, then this job will not be offered again to + /// the worker who declined this job unless + /// the worker is de-registered and + /// re-registered. If a RetryOfferAt time is provided, then the job will be + /// re-matched to + /// eligible workers at the retry time in UTC. The worker that + /// declined the job will also be eligible for the job at that time. + /// + public DateTimeOffset? RetryOfferAt { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.Serialization.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.Serialization.cs index daef8caee0d24..b8e740fbe7a9a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.Serialization.cs @@ -6,20 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class DirectMapRouterRule : IUtf8JsonSerializable + public partial class DirectMapRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static DirectMapRouterRule DeserializeDirectMapRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +30,13 @@ internal static DirectMapRouterRule DeserializeDirectMapRouterRule(JsonElement e } return new DirectMapRouterRule(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DirectMapRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDirectMapRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs similarity index 78% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs index 353584682545c..d3a62a43c2d0b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs @@ -11,16 +11,15 @@ namespace Azure.Communication.JobRouter public partial class DirectMapRouterRule : RouterRule { /// Initializes a new instance of DirectMapRouterRule. - public DirectMapRouterRule() + internal DirectMapRouterRule() { Kind = "direct-map-rule"; } /// Initializes a new instance of DirectMapRouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. internal DirectMapRouterRule(string kind) : base(kind) { - Kind = kind ?? "direct-map-rule"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.Serialization.cs similarity index 52% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.Serialization.cs index f393cfc3ad711..0b8916b71436b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.Serialization.cs @@ -6,35 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class DistributionMode : IUtf8JsonSerializable + public partial class DistributionMode { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - if (Optional.IsDefined(MinConcurrentOffers)) - { - writer.WritePropertyName("minConcurrentOffers"u8); - writer.WriteNumberValue(MinConcurrentOffers); - } - if (Optional.IsDefined(MaxConcurrentOffers)) - { - writer.WritePropertyName("maxConcurrentOffers"u8); - writer.WriteNumberValue(MaxConcurrentOffers); - } - if (Optional.IsDefined(BypassSelectors)) - { - writer.WritePropertyName("bypassSelectors"u8); - writer.WriteBooleanValue(BypassSelectors.Value); - } - writer.WriteEndObject(); - } - internal static DistributionMode DeserializeDistributionMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -52,5 +29,13 @@ internal static DistributionMode DeserializeDistributionMode(JsonElement element } return UnknownDistributionMode.DeserializeUnknownDistributionMode(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DistributionMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDistributionMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs similarity index 73% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs index 6267ec74677fd..04b9938f68dcb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs @@ -20,14 +20,17 @@ protected DistributionMode() } /// Initializes a new instance of DistributionMode. - /// The type discriminator describing a sub-type of Mode. + /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// /// (Optional) - /// If set to true, then router will match workers to jobs even if they don't match label selectors. - /// Warning: You may get workers that are not qualified for the job they are matched with if you set this - /// variable to true. This flag is intended more for temporary usage. + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. /// By default, set to false. /// internal DistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) @@ -38,15 +41,18 @@ internal DistributionMode(string kind, int minConcurrentOffers, int maxConcurren BypassSelectors = bypassSelectors; } - /// The type discriminator describing a sub-type of Mode. + /// Discriminator. internal string Kind { get; set; } /// /// (Optional) - /// If set to true, then router will match workers to jobs even if they don't match label selectors. - /// Warning: You may get workers that are not qualified for the job they are matched with if you set this - /// variable to true. This flag is intended more for temporary usage. + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. /// By default, set to false. /// - public bool? BypassSelectors { get; set; } + public bool? BypassSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs index c1e9ce5b1a940..e501e5eb5f418 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs @@ -6,41 +6,21 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; namespace Azure.Communication.JobRouter.Models { - public partial class DistributionPolicy : IUtf8JsonSerializable + public partial class DistributionPolicy { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(_offerExpiresAfterSeconds)) - { - writer.WritePropertyName("offerExpiresAfterSeconds"u8); - writer.WriteNumberValue(_offerExpiresAfterSeconds.Value); - } - if (Optional.IsDefined(Mode)) - { - writer.WritePropertyName("mode"u8); - writer.WriteObjectValue(Mode); - } - writer.WriteEndObject(); - } - internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional name = default; Optional offerExpiresAfterSeconds = default; Optional mode = default; @@ -75,7 +55,15 @@ internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement ele continue; } } - return new DistributionPolicy(id.Value, name.Value, Optional.ToNullable(offerExpiresAfterSeconds), mode.Value); + return new DistributionPolicy(id, name.Value, Optional.ToNullable(offerExpiresAfterSeconds), mode.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DistributionPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDistributionPolicy(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs index db3ac9175cdb2..82379d6939867 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs @@ -15,12 +15,11 @@ public partial class DistributionPolicy /// Initializes a new instance of DistributionPolicy. /// The unique identifier of the policy. /// The human readable name of the policy. - /// The number of seconds after which any offers created under this policy will be expired. - /// - /// Abstract base class for defining a distribution mode - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// + /// The number of seconds after which any offers created under this policy will be + /// expired. /// + /// Abstract base class for defining a distribution mode. internal DistributionPolicy(string id, string name, double? offerExpiresAfterSeconds, DistributionMode mode) { Id = id; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs similarity index 67% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs index 0a2b5a4f8eda3..60018b8171410 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -18,16 +19,12 @@ internal static DistributionPolicyItem DeserializeDistributionPolicyItem(JsonEle { return null; } - Optional distributionPolicy = default; - Optional etag = default; + DistributionPolicy distributionPolicy = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("distributionPolicy"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } distributionPolicy = DistributionPolicy.DeserializeDistributionPolicy(property.Value); continue; } @@ -37,7 +34,15 @@ internal static DistributionPolicyItem DeserializeDistributionPolicyItem(JsonEle continue; } } - return new DistributionPolicyItem(distributionPolicy.Value, etag.Value); + return new DistributionPolicyItem(distributionPolicy, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DistributionPolicyItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDistributionPolicyItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs similarity index 74% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs index bb862e636db22..b1621e89a800e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs @@ -5,21 +5,23 @@ #nullable disable +using System; +using Azure.Core; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of DistributionPolicy. public partial class DistributionPolicyItem { - /// Initializes a new instance of DistributionPolicyItem. - internal DistributionPolicyItem() - { - } - /// Initializes a new instance of DistributionPolicyItem. /// Policy governing how jobs are distributed to workers. /// (Optional) The Concurrency Token. + /// or is null. internal DistributionPolicyItem(DistributionPolicy distributionPolicy, string etag) { + Argument.AssertNotNull(distributionPolicy, nameof(distributionPolicy)); + Argument.AssertNotNull(etag, nameof(etag)); + DistributionPolicy = distributionPolicy; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationRestClient.xml b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationRestClient.xml new file mode 100644 index 0000000000000..918ac1eda27a2 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationRestClient.xml @@ -0,0 +1,1029 @@ + + + + + +This sample shows how to call UpsertDistributionPolicyAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new {}; + +Response response = await client.UpsertDistributionPolicyAsync("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertDistributionPolicyAsync with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new { + name = "", + offerExpiresAfterSeconds = 123.45d, + mode = new { + scoringRule = new { + kind = "direct-map-rule", + }, + scoringRuleOptions = new { + batchSize = 1234, + scoringParameters = new[] { + "jobLabels" + }, + allowScoringBatchOfWorkers = true, + descendingOrder = true, + }, + kind = "best-worker", + minConcurrentOffers = 1234, + maxConcurrentOffers = 1234, + bypassSelectors = true, + }, +}; + +Response response = await client.UpsertDistributionPolicyAsync("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); +]]> + + + + +This sample shows how to call UpsertDistributionPolicy with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new {}; + +Response response = client.UpsertDistributionPolicy("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertDistributionPolicy with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new { + name = "", + offerExpiresAfterSeconds = 123.45d, + mode = new { + scoringRule = new { + kind = "direct-map-rule", + }, + scoringRuleOptions = new { + batchSize = 1234, + scoringParameters = new[] { + "jobLabels" + }, + allowScoringBatchOfWorkers = true, + descendingOrder = true, + }, + kind = "best-worker", + minConcurrentOffers = 1234, + maxConcurrentOffers = 1234, + bypassSelectors = true, + }, +}; + +Response response = client.UpsertDistributionPolicy("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); +]]> + + + + +This sample shows how to call GetDistributionPolicyAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var result = await client.GetDistributionPolicyAsync(""); +]]> + + + + +This sample shows how to call GetDistributionPolicy with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var result = client.GetDistributionPolicy(""); +]]> + + + + +This sample shows how to call GetDistributionPolicyAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = await client.GetDistributionPolicyAsync("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); +]]> + + + + +This sample shows how to call GetDistributionPolicy with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = client.GetDistributionPolicy("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); +]]> + + + + +This sample shows how to call DeleteDistributionPolicyAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = await client.DeleteDistributionPolicyAsync(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call DeleteDistributionPolicy with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = client.DeleteDistributionPolicy(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call UpsertClassificationPolicyAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new {}; + +Response response = await client.UpsertClassificationPolicyAsync("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertClassificationPolicyAsync with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new { + name = "", + fallbackQueueId = "", + queueSelectors = new[] { + new { + condition = new { + kind = "direct-map-rule", + }, + queueSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + } + }, + kind = "conditional", + } + }, + prioritizationRule = new { + kind = "direct-map-rule", + }, + workerSelectors = new[] { + new { + condition = new { + kind = "direct-map-rule", + }, + workerSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + expiresAfterSeconds = 123.45d, + expedite = true, + } + }, + kind = "conditional", + } + }, +}; + +Response response = await client.UpsertClassificationPolicyAsync("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); +Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); +]]> + + + + +This sample shows how to call UpsertClassificationPolicy with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new {}; + +Response response = client.UpsertClassificationPolicy("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertClassificationPolicy with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new { + name = "", + fallbackQueueId = "", + queueSelectors = new[] { + new { + condition = new { + kind = "direct-map-rule", + }, + queueSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + } + }, + kind = "conditional", + } + }, + prioritizationRule = new { + kind = "direct-map-rule", + }, + workerSelectors = new[] { + new { + condition = new { + kind = "direct-map-rule", + }, + workerSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + expiresAfterSeconds = 123.45d, + expedite = true, + } + }, + kind = "conditional", + } + }, +}; + +Response response = client.UpsertClassificationPolicy("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); +Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); +]]> + + + + +This sample shows how to call GetClassificationPolicyAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var result = await client.GetClassificationPolicyAsync(""); +]]> + + + + +This sample shows how to call GetClassificationPolicy with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var result = client.GetClassificationPolicy(""); +]]> + + + + +This sample shows how to call GetClassificationPolicyAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = await client.GetClassificationPolicyAsync("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); +Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); +]]> + + + + +This sample shows how to call GetClassificationPolicy with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = client.GetClassificationPolicy("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); +Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); +]]> + + + + +This sample shows how to call DeleteClassificationPolicyAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = await client.DeleteClassificationPolicyAsync(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call DeleteClassificationPolicy with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = client.DeleteClassificationPolicy(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call UpsertExceptionPolicyAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new {}; + +Response response = await client.UpsertExceptionPolicyAsync("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertExceptionPolicyAsync with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new { + name = "", + exceptionRules = new { + key = new { + trigger = new { + threshold = 1234, + kind = "queue-length", + }, + actions = new { + key = new { + note = "", + dispositionCode = "", + kind = "cancel", + }, + }, + }, + }, +}; + +Response response = await client.UpsertExceptionPolicyAsync("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); +]]> + + + + +This sample shows how to call UpsertExceptionPolicy with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new {}; + +Response response = client.UpsertExceptionPolicy("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertExceptionPolicy with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new { + name = "", + exceptionRules = new { + key = new { + trigger = new { + threshold = 1234, + kind = "queue-length", + }, + actions = new { + key = new { + note = "", + dispositionCode = "", + kind = "cancel", + }, + }, + }, + }, +}; + +Response response = client.UpsertExceptionPolicy("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); +]]> + + + + +This sample shows how to call GetExceptionPolicyAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var result = await client.GetExceptionPolicyAsync(""); +]]> + + + + +This sample shows how to call GetExceptionPolicy with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var result = client.GetExceptionPolicy(""); +]]> + + + + +This sample shows how to call GetExceptionPolicyAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = await client.GetExceptionPolicyAsync("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); +]]> + + + + +This sample shows how to call GetExceptionPolicy with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = client.GetExceptionPolicy("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); +]]> + + + + +This sample shows how to call DeleteExceptionPolicyAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = await client.DeleteExceptionPolicyAsync(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call DeleteExceptionPolicy with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = client.DeleteExceptionPolicy(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call UpsertQueueAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new {}; + +Response response = await client.UpsertQueueAsync("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertQueueAsync with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new { + name = "", + distributionPolicyId = "", + labels = new { + key = new {}, + }, + exceptionPolicyId = "", +}; + +Response response = await client.UpsertQueueAsync("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); +]]> + + + + +This sample shows how to call UpsertQueue with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new {}; + +Response response = client.UpsertQueue("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertQueue with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var data = new { + name = "", + distributionPolicyId = "", + labels = new { + key = new {}, + }, + exceptionPolicyId = "", +}; + +Response response = client.UpsertQueue("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); +]]> + + + + +This sample shows how to call GetQueueAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var result = await client.GetQueueAsync(""); +]]> + + + + +This sample shows how to call GetQueue with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +var result = client.GetQueue(""); +]]> + + + + +This sample shows how to call GetQueueAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = await client.GetQueueAsync("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); +]]> + + + + +This sample shows how to call GetQueue with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = client.GetQueue("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); +]]> + + + + +This sample shows how to call DeleteQueueAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = await client.DeleteQueueAsync(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call DeleteQueue with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +Response response = client.DeleteQueue(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call GetDistributionPoliciesAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +await foreach (var item in client.GetDistributionPoliciesAsync(1234)) +{ +} +]]> + + + + +This sample shows how to call GetDistributionPolicies with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +foreach (var item in client.GetDistributionPolicies(1234)) +{ +} +]]> + + + + +This sample shows how to call GetDistributionPoliciesAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +await foreach (var item in client.GetDistributionPoliciesAsync(1234, new RequestContext())) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetDistributionPolicies with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +foreach (var item in client.GetDistributionPolicies(1234, new RequestContext())) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetClassificationPoliciesAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +await foreach (var item in client.GetClassificationPoliciesAsync(1234)) +{ +} +]]> + + + + +This sample shows how to call GetClassificationPolicies with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +foreach (var item in client.GetClassificationPolicies(1234)) +{ +} +]]> + + + + +This sample shows how to call GetClassificationPoliciesAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +await foreach (var item in client.GetClassificationPoliciesAsync(1234, new RequestContext())) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetClassificationPolicies with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +foreach (var item in client.GetClassificationPolicies(1234, new RequestContext())) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetExceptionPoliciesAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +await foreach (var item in client.GetExceptionPoliciesAsync(1234)) +{ +} +]]> + + + + +This sample shows how to call GetExceptionPolicies with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +foreach (var item in client.GetExceptionPolicies(1234)) +{ +} +]]> + + + + +This sample shows how to call GetExceptionPoliciesAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +await foreach (var item in client.GetExceptionPoliciesAsync(1234, new RequestContext())) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetExceptionPolicies with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +foreach (var item in client.GetExceptionPolicies(1234, new RequestContext())) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetQueuesAsync with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +await foreach (var item in client.GetQueuesAsync(1234)) +{ +} +]]> + + + + +This sample shows how to call GetQueues with required parameters. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +foreach (var item in client.GetQueues(1234)) +{ +} +]]> + + + + +This sample shows how to call GetQueuesAsync with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +await foreach (var item in client.GetQueuesAsync(1234, new RequestContext())) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetQueues with required parameters and parse the result. +"); +var client = new JobRouterAdministrationRestClient(endpoint); + +foreach (var item in client.GetQueues(1234, new RequestContext())) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + \ No newline at end of file diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterRestClient.xml b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterRestClient.xml new file mode 100644 index 0000000000000..0376f9539a2a9 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterRestClient.xml @@ -0,0 +1,1443 @@ + + + + + +This sample shows how to call UpsertJobAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = await client.UpsertJobAsync("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertJobAsync with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + channelReference = "", + channelId = "", + classificationPolicyId = "", + queueId = "", + priority = 1234, + dispositionCode = "", + requestedWorkerSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + expiresAfterSeconds = 123.45d, + expedite = true, + } + }, + labels = new { + key = new {}, + }, + tags = new { + key = new {}, + }, + notes = new { + key = "", + }, + matchingMode = new { + modeType = "queueAndMatchMode", + queueAndMatchMode = new {}, + scheduleAndSuspendMode = new { + scheduleAt = "2022-05-10T14:57:31.2311892-04:00", + }, + suspendMode = new {}, + }, +}; + +Response response = await client.UpsertJobAsync("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("channelReference").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); +Console.WriteLine(result.GetProperty("channelId").ToString()); +Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("priority").ToString()); +Console.WriteLine(result.GetProperty("dispositionCode").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("scheduledAt").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString()); +]]> + + + + +This sample shows how to call UpsertJob with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = client.UpsertJob("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertJob with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + channelReference = "", + channelId = "", + classificationPolicyId = "", + queueId = "", + priority = 1234, + dispositionCode = "", + requestedWorkerSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + expiresAfterSeconds = 123.45d, + expedite = true, + } + }, + labels = new { + key = new {}, + }, + tags = new { + key = new {}, + }, + notes = new { + key = "", + }, + matchingMode = new { + modeType = "queueAndMatchMode", + queueAndMatchMode = new {}, + scheduleAndSuspendMode = new { + scheduleAt = "2022-05-10T14:57:31.2311892-04:00", + }, + suspendMode = new {}, + }, +}; + +Response response = client.UpsertJob("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("channelReference").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); +Console.WriteLine(result.GetProperty("channelId").ToString()); +Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("priority").ToString()); +Console.WriteLine(result.GetProperty("dispositionCode").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("scheduledAt").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString()); +]]> + + + + +This sample shows how to call GetJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = await client.GetJobAsync(""); +]]> + + + + +This sample shows how to call GetJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = client.GetJob(""); +]]> + + + + +This sample shows how to call GetJobAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = await client.GetJobAsync("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("channelReference").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); +Console.WriteLine(result.GetProperty("channelId").ToString()); +Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("priority").ToString()); +Console.WriteLine(result.GetProperty("dispositionCode").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("scheduledAt").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString()); +]]> + + + + +This sample shows how to call GetJob with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = client.GetJob("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("channelReference").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); +Console.WriteLine(result.GetProperty("channelId").ToString()); +Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("priority").ToString()); +Console.WriteLine(result.GetProperty("dispositionCode").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); +Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("scheduledAt").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); +Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString()); +]]> + + + + +This sample shows how to call DeleteJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = await client.DeleteJobAsync(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call DeleteJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = client.DeleteJob(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call ReclassifyJobAsync with required parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = await client.ReclassifyJobAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call ReclassifyJob with required parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = client.ReclassifyJob("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call CancelJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var cancelJobRequest = new CancelJobRequest() +{ + Note = "", + DispositionCode = "", +}; +var result = await client.CancelJobAsync("", cancelJobRequest); +]]> + + + + +This sample shows how to call CancelJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var cancelJobRequest = new CancelJobRequest() +{ + Note = "", + DispositionCode = "", +}; +var result = client.CancelJob("", cancelJobRequest); +]]> + + + + +This sample shows how to call CancelJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = await client.CancelJobAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call CancelJobAsync with all parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + note = "", + dispositionCode = "", +}; + +Response response = await client.CancelJobAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call CancelJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = client.CancelJob("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call CancelJob with all parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + note = "", + dispositionCode = "", +}; + +Response response = client.CancelJob("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call CompleteJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var completeJobRequest = new CompleteJobRequest("") +{ + Note = "", +}; +var result = await client.CompleteJobAsync("", completeJobRequest); +]]> + + + + +This sample shows how to call CompleteJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var completeJobRequest = new CompleteJobRequest("") +{ + Note = "", +}; +var result = client.CompleteJob("", completeJobRequest); +]]> + + + + +This sample shows how to call CompleteJobAsync with required parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + assignmentId = "", +}; + +Response response = await client.CompleteJobAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call CompleteJobAsync with all parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + assignmentId = "", + note = "", +}; + +Response response = await client.CompleteJobAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call CompleteJob with required parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + assignmentId = "", +}; + +Response response = client.CompleteJob("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call CompleteJob with all parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + assignmentId = "", + note = "", +}; + +Response response = client.CompleteJob("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call CloseJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var closeJobRequest = new CloseJobRequest("") +{ + DispositionCode = "", + CloseAt = DateTimeOffset.UtcNow, + Note = "", +}; +var result = await client.CloseJobAsync("", closeJobRequest); +]]> + + + + +This sample shows how to call CloseJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var closeJobRequest = new CloseJobRequest("") +{ + DispositionCode = "", + CloseAt = DateTimeOffset.UtcNow, + Note = "", +}; +var result = client.CloseJob("", closeJobRequest); +]]> + + + + +This sample shows how to call CloseJobAsync with required parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + assignmentId = "", +}; + +Response response = await client.CloseJobAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call CloseJobAsync with all parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + assignmentId = "", + dispositionCode = "", + closeAt = "2022-05-10T14:57:31.2311892-04:00", + note = "", +}; + +Response response = await client.CloseJobAsync("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call CloseJob with required parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + assignmentId = "", +}; + +Response response = client.CloseJob("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call CloseJob with all parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + assignmentId = "", + dispositionCode = "", + closeAt = "2022-05-10T14:57:31.2311892-04:00", + note = "", +}; + +Response response = client.CloseJob("", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call GetQueuePositionAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = await client.GetQueuePositionAsync(""); +]]> + + + + +This sample shows how to call GetQueuePosition with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = client.GetQueuePosition(""); +]]> + + + + +This sample shows how to call GetQueuePositionAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = await client.GetQueuePositionAsync("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("position").ToString()); +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("queueLength").ToString()); +Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); +]]> + + + + +This sample shows how to call GetQueuePosition with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = client.GetQueuePosition("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("position").ToString()); +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("queueLength").ToString()); +Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); +]]> + + + + +This sample shows how to call UnassignJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var unassignJobRequest = new UnassignJobRequest() +{ + SuspendMatching = true, +}; +var result = await client.UnassignJobAsync("", "", unassignJobRequest); +]]> + + + + +This sample shows how to call UnassignJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var unassignJobRequest = new UnassignJobRequest() +{ + SuspendMatching = true, +}; +var result = client.UnassignJob("", "", unassignJobRequest); +]]> + + + + +This sample shows how to call UnassignJobAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = await client.UnassignJobAsync("", "", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); +]]> +This sample shows how to call UnassignJobAsync with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + suspendMatching = true, +}; + +Response response = await client.UnassignJobAsync("", "", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); +]]> + + + + +This sample shows how to call UnassignJob with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = client.UnassignJob("", "", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); +]]> +This sample shows how to call UnassignJob with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + suspendMatching = true, +}; + +Response response = client.UnassignJob("", "", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); +]]> + + + + +This sample shows how to call AcceptJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = await client.AcceptJobAsync("", ""); +]]> + + + + +This sample shows how to call AcceptJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = client.AcceptJob("", ""); +]]> + + + + +This sample shows how to call AcceptJobAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = await client.AcceptJobAsync("", "", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("workerId").ToString()); +]]> + + + + +This sample shows how to call AcceptJob with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = client.AcceptJob("", "", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("workerId").ToString()); +]]> + + + + +This sample shows how to call DeclineJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var declineJobOfferRequest = new DeclineJobOfferRequest() +{ + RetryOfferAt = DateTimeOffset.UtcNow, +}; +var result = await client.DeclineJobAsync("", "", declineJobOfferRequest); +]]> + + + + +This sample shows how to call DeclineJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var declineJobOfferRequest = new DeclineJobOfferRequest() +{ + RetryOfferAt = DateTimeOffset.UtcNow, +}; +var result = client.DeclineJob("", "", declineJobOfferRequest); +]]> + + + + +This sample shows how to call DeclineJobAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = await client.DeclineJobAsync("", "", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeclineJobAsync with all parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + retryOfferAt = "2022-05-10T14:57:31.2311892-04:00", +}; + +Response response = await client.DeclineJobAsync("", "", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call DeclineJob with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = client.DeclineJob("", "", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeclineJob with all parameters and request content. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + retryOfferAt = "2022-05-10T14:57:31.2311892-04:00", +}; + +Response response = client.DeclineJob("", "", RequestContent.Create(data)); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call GetQueueStatisticsAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = await client.GetQueueStatisticsAsync(""); +]]> + + + + +This sample shows how to call GetQueueStatistics with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = client.GetQueueStatistics(""); +]]> + + + + +This sample shows how to call GetQueueStatisticsAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = await client.GetQueueStatisticsAsync("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("length").ToString()); +Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("longestJobWaitTimeMinutes").ToString()); +]]> + + + + +This sample shows how to call GetQueueStatistics with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = client.GetQueueStatistics("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("length").ToString()); +Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("longestJobWaitTimeMinutes").ToString()); +]]> + + + + +This sample shows how to call UpsertWorkerAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = await client.UpsertWorkerAsync("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertWorkerAsync with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + queueAssignments = new { + key = new {}, + }, + totalCapacity = 1234, + labels = new { + key = new {}, + }, + tags = new { + key = new {}, + }, + channelConfigurations = new { + key = new { + capacityCostPerJob = 1234, + maxNumberOfJobs = 1234, + }, + }, + availableForOffers = true, +}; + +Response response = await client.UpsertWorkerAsync("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("totalCapacity").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); +Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); +Console.WriteLine(result.GetProperty("loadRatio").ToString()); +Console.WriteLine(result.GetProperty("availableForOffers").ToString()); +]]> + + + + +This sample shows how to call UpsertWorker with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new {}; + +Response response = client.UpsertWorker("", RequestContent.Create(data)); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpsertWorker with all parameters and request content, and how to parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +var data = new { + queueAssignments = new { + key = new {}, + }, + totalCapacity = 1234, + labels = new { + key = new {}, + }, + tags = new { + key = new {}, + }, + channelConfigurations = new { + key = new { + capacityCostPerJob = 1234, + maxNumberOfJobs = 1234, + }, + }, + availableForOffers = true, +}; + +Response response = client.UpsertWorker("", RequestContent.Create(data), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("totalCapacity").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); +Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); +Console.WriteLine(result.GetProperty("loadRatio").ToString()); +Console.WriteLine(result.GetProperty("availableForOffers").ToString()); +]]> + + + + +This sample shows how to call GetWorkerAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = await client.GetWorkerAsync(""); +]]> + + + + +This sample shows how to call GetWorker with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +var result = client.GetWorker(""); +]]> + + + + +This sample shows how to call GetWorkerAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = await client.GetWorkerAsync("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("totalCapacity").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); +Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); +Console.WriteLine(result.GetProperty("loadRatio").ToString()); +Console.WriteLine(result.GetProperty("availableForOffers").ToString()); +]]> + + + + +This sample shows how to call GetWorker with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = client.GetWorker("", new RequestContext()); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("totalCapacity").ToString()); +Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); +Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); +Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); +Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); +Console.WriteLine(result.GetProperty("loadRatio").ToString()); +Console.WriteLine(result.GetProperty("availableForOffers").ToString()); +]]> + + + + +This sample shows how to call DeleteWorkerAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = await client.DeleteWorkerAsync(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call DeleteWorker with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +Response response = client.DeleteWorker(""); +Console.WriteLine(response.Status); +]]> + + + + +This sample shows how to call GetJobsAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +await foreach (var item in client.GetJobsAsync(null, "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) +{ +} +]]> + + + + +This sample shows how to call GetJobs with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +foreach (var item in client.GetJobs(null, "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) +{ +} +]]> + + + + +This sample shows how to call GetJobsAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +await foreach (var item in client.GetJobsAsync("", "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("modeType").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("suspendMode").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetJobs with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +foreach (var item in client.GetJobs("", "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("modeType").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("suspendMode").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetWorkersAsync with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +await foreach (var item in client.GetWorkersAsync(null, "", "", true, 1234)) +{ +} +]]> + + + + +This sample shows how to call GetWorkers with required parameters. +"); +var client = new JobRouterRestClient(endpoint); + +foreach (var item in client.GetWorkers(null, "", "", true, 1234)) +{ +} +]]> + + + + +This sample shows how to call GetWorkersAsync with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +await foreach (var item in client.GetWorkersAsync("", "", "", true, 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + +This sample shows how to call GetWorkers with required parameters and parse the result. +"); +var client = new JobRouterRestClient(endpoint); + +foreach (var item in client.GetWorkers("", "", "", true, 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + + \ No newline at end of file diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.Serialization.cs index 58d63c875aa34..1071df7151730 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class ExceptionAction : IUtf8JsonSerializable + public partial class ExceptionAction { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static ExceptionAction DeserializeExceptionAction(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +29,13 @@ internal static ExceptionAction DeserializeExceptionAction(JsonElement element) } return UnknownExceptionAction.DeserializeUnknownExceptionAction(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExceptionAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExceptionAction(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs similarity index 76% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs index 04f932639c9e4..cc41005a23af0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs @@ -15,10 +15,18 @@ namespace Azure.Communication.JobRouter public abstract partial class ExceptionAction { /// Initializes a new instance of ExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. + protected ExceptionAction() + { + } + + /// Initializes a new instance of ExceptionAction. + /// Discriminator. internal ExceptionAction(string kind) { Kind = kind; } + + /// Discriminator. + internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs index 53945af79ba52..0efde1c50a57a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs @@ -7,42 +7,21 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; namespace Azure.Communication.JobRouter.Models { - public partial class ExceptionPolicy : IUtf8JsonSerializable + public partial class ExceptionPolicy { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsCollectionDefined(_exceptionRules)) - { - writer.WritePropertyName("exceptionRules"u8); - writer.WriteStartObject(); - foreach (var item in _exceptionRules) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WriteEndObject(); - } - internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional name = default; Optional> exceptionRules = default; foreach (var property in element.EnumerateObject()) @@ -72,7 +51,15 @@ internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element) continue; } } - return new ExceptionPolicy(id.Value, name.Value, Optional.ToDictionary(exceptionRules)); + return new ExceptionPolicy(id, name.Value, Optional.ToDictionary(exceptionRules)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExceptionPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExceptionPolicy(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs index 7e5330581818d..05d790f49ca00 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs @@ -17,7 +17,10 @@ public partial class ExceptionPolicy /// Initializes a new instance of ExceptionPolicy. /// The Id of the exception policy. /// (Optional) The name of the exception policy. - /// (Optional) A dictionary collection of exception rules on the exception policy. Key is the Id of each exception rule. + /// + /// (Optional) A dictionary collection of exception rules on the exception policy. + /// Key is the Id of each exception rule. + /// internal ExceptionPolicy(string id, string name, IDictionary exceptionRules) { Id = id; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs similarity index 63% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs index 597ed20fa80ef..ba734381d5ae1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -18,16 +19,12 @@ internal static ExceptionPolicyItem DeserializeExceptionPolicyItem(JsonElement e { return null; } - Optional exceptionPolicy = default; - Optional etag = default; + ExceptionPolicy exceptionPolicy = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("exceptionPolicy"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } exceptionPolicy = ExceptionPolicy.DeserializeExceptionPolicy(property.Value); continue; } @@ -37,7 +34,15 @@ internal static ExceptionPolicyItem DeserializeExceptionPolicyItem(JsonElement e continue; } } - return new ExceptionPolicyItem(exceptionPolicy.Value, etag.Value); + return new ExceptionPolicyItem(exceptionPolicy, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExceptionPolicyItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExceptionPolicyItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs similarity index 75% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs index eb0e17f4d974f..9dad91fe0a4a5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs @@ -5,21 +5,23 @@ #nullable disable +using System; +using Azure.Core; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of ExceptionPolicy. public partial class ExceptionPolicyItem { - /// Initializes a new instance of ExceptionPolicyItem. - internal ExceptionPolicyItem() - { - } - /// Initializes a new instance of ExceptionPolicyItem. /// A policy that defines actions to execute when exception are triggered. /// (Optional) The Concurrency Token. + /// or is null. internal ExceptionPolicyItem(ExceptionPolicy exceptionPolicy, string etag) { + Argument.AssertNotNull(exceptionPolicy, nameof(exceptionPolicy)); + Argument.AssertNotNull(etag, nameof(etag)); + ExceptionPolicy = exceptionPolicy; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs index 0e02d1e33937e..a8fe0a89c30b0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs @@ -7,28 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ExceptionRule : IUtf8JsonSerializable + public partial class ExceptionRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("trigger"u8); - writer.WriteObjectValue(Trigger); - writer.WritePropertyName("actions"u8); - writer.WriteStartObject(); - foreach (var item in Actions) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - internal static ExceptionRule DeserializeExceptionRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -57,5 +42,13 @@ internal static ExceptionRule DeserializeExceptionRule(JsonElement element) } return new ExceptionRule(trigger, actions); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExceptionRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExceptionRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs similarity index 94% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs index 5b2dd805d7a1d..74245ac57ad48 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs @@ -19,6 +19,6 @@ public partial class ExceptionRule /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - public ExceptionTrigger Trigger { get; set; } + public ExceptionTrigger Trigger { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.Serialization.cs index a722b95af3f82..02be16d62778c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class ExceptionTrigger : IUtf8JsonSerializable + public partial class ExceptionTrigger { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static ExceptionTrigger DeserializeExceptionTrigger(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -36,5 +28,13 @@ internal static ExceptionTrigger DeserializeExceptionTrigger(JsonElement element } return UnknownExceptionTrigger.DeserializeUnknownExceptionTrigger(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExceptionTrigger FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExceptionTrigger(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs similarity index 87% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs index a4092743f2818..a060787cfd536 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs @@ -20,10 +20,13 @@ protected ExceptionTrigger() } /// Initializes a new instance of ExceptionTrigger. - /// The type discriminator describing a sub-type of ExceptionTrigger. + /// Discriminator. internal ExceptionTrigger(string kind) { Kind = kind; } + + /// Discriminator. + internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.Serialization.cs index 512472b165cbb..f48caf3880e64 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.Serialization.cs @@ -6,27 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ExpressionRouterRule : IUtf8JsonSerializable + public partial class ExpressionRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Language)) - { - writer.WritePropertyName("language"u8); - writer.WriteStringValue(Language); - } - writer.WritePropertyName("expression"u8); - writer.WriteStringValue(Expression); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static ExpressionRouterRule DeserializeExpressionRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -56,5 +42,13 @@ internal static ExpressionRouterRule DeserializeExpressionRouterRule(JsonElement } return new ExpressionRouterRule(kind, language.Value, expression); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ExpressionRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExpressionRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs similarity index 60% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs index 658f0c6a463fd..a5c32dbb509b5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs @@ -14,16 +14,21 @@ namespace Azure.Communication.JobRouter public partial class ExpressionRouterRule : RouterRule { /// Initializes a new instance of ExpressionRouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. /// The expression language to compile to and execute. - /// The string containing the expression to evaluate. Should contain return statement with calculated values. + /// + /// The string containing the expression to evaluate. Should contain return + /// statement with calculated values. + /// internal ExpressionRouterRule(string kind, string language, string expression) : base(kind) { Language = language; Expression = expression; - Kind = kind ?? "expression-rule"; } - /// The string containing the expression to evaluate. Should contain return statement with calculated values. - public string Expression { get; set; } + /// + /// The string containing the expression to evaluate. Should contain return + /// statement with calculated values. + /// + public string Expression { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRuleLanguage.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRuleLanguage.cs similarity index 89% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRuleLanguage.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRuleLanguage.cs index cb40ec95479a9..688f830a662f7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRuleLanguage.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRuleLanguage.cs @@ -10,8 +10,8 @@ namespace Azure.Communication.JobRouter { - /// The expression language to compile to and execute. - public readonly partial struct ExpressionRouterRuleLanguage : IEquatable + /// The available expression languages that can be configured. + internal readonly partial struct ExpressionRouterRuleLanguage : IEquatable { private readonly string _value; @@ -24,7 +24,7 @@ public ExpressionRouterRuleLanguage(string value) private const string PowerFxValue = "powerFx"; - /// powerFx. + /// PowerFx. public static ExpressionRouterRuleLanguage PowerFx { get; } = new ExpressionRouterRuleLanguage(PowerFxValue); /// Determines if two values are the same. public static bool operator ==(ExpressionRouterRuleLanguage left, ExpressionRouterRuleLanguage right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.Serialization.cs similarity index 72% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.Serialization.cs index 4e04e254b9c3d..a74af384a51b3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.Serialization.cs @@ -7,27 +7,13 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class FunctionRouterRule : IUtf8JsonSerializable + public partial class FunctionRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("functionUri"u8); - writer.WriteStringValue(FunctionUri.AbsoluteUri); - if (Optional.IsDefined(Credential)) - { - writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static FunctionRouterRule DeserializeFunctionRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -61,5 +47,13 @@ internal static FunctionRouterRule DeserializeFunctionRouterRule(JsonElement ele } return new FunctionRouterRule(kind, functionUri, credential.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new FunctionRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeFunctionRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs similarity index 81% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs index 5d1750a5d34fe..9e65631235f12 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs @@ -14,16 +14,15 @@ namespace Azure.Communication.JobRouter public partial class FunctionRouterRule : RouterRule { /// Initializes a new instance of FunctionRouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. /// URL for Azure Function. /// Credentials used to access Azure function rule. internal FunctionRouterRule(string kind, Uri functionUri, FunctionRouterRuleCredential credential) : base(kind) { FunctionUri = functionUri; Credential = credential; - Kind = kind ?? "azure-function-rule"; } /// Credentials used to access Azure function rule. - public FunctionRouterRuleCredential Credential { get; set; } + public FunctionRouterRuleCredential Credential { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.Serialization.cs index 7d7958ac9c54d..2b98e06f9c9ca 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.Serialization.cs @@ -6,33 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class FunctionRouterRuleCredential : IUtf8JsonSerializable + public partial class FunctionRouterRuleCredential { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(FunctionKey)) - { - writer.WritePropertyName("functionKey"u8); - writer.WriteStringValue(FunctionKey); - } - if (Optional.IsDefined(AppKey)) - { - writer.WritePropertyName("appKey"u8); - writer.WriteStringValue(AppKey); - } - if (Optional.IsDefined(ClientId)) - { - writer.WritePropertyName("clientId"u8); - writer.WriteStringValue(ClientId); - } - writer.WriteEndObject(); - } - internal static FunctionRouterRuleCredential DeserializeFunctionRouterRuleCredential(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -62,5 +42,13 @@ internal static FunctionRouterRuleCredential DeserializeFunctionRouterRuleCreden } return new FunctionRouterRuleCredential(functionKey.Value, appKey.Value, clientId.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FunctionRouterRuleCredential FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeFunctionRouterRuleCredential(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs similarity index 85% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs index 76b54979463b0..de1d09283948c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs @@ -14,11 +14,13 @@ public partial class FunctionRouterRuleCredential /// (Optional) Access key scoped to a particular function. /// /// (Optional) Access key scoped to a Azure Function app. - /// This key grants access to all functions under the app. + /// This key grants access to + /// all functions under the app. /// /// /// (Optional) Client id, when AppKey is provided - /// In context of Azure function, this is usually the name of the key + /// In context of Azure function, + /// this is usually the name of the key /// internal FunctionRouterRuleCredential(string functionKey, string appKey, string clientId) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchModeType.cs similarity index 85% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchModeType.cs index 0398c4518b36e..90176de4f9182 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchModeType.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// The JobMatchModeType. + /// Discriminator values for supported matching mode types. public readonly partial struct JobMatchModeType : IEquatable { private readonly string _value; @@ -26,11 +26,11 @@ public JobMatchModeType(string value) private const string ScheduleAndSuspendModeValue = "scheduleAndSuspendMode"; private const string SuspendModeValue = "suspendMode"; - /// queueAndMatchMode. + /// Discriminator used when matching worker to a job is required to be done right after job is queued. public static JobMatchModeType QueueAndMatchMode { get; } = new JobMatchModeType(QueueAndMatchModeValue); - /// scheduleAndSuspendMode. + /// Discriminator used for scheduling jobs to be queued at a future time. public static JobMatchModeType ScheduleAndSuspendMode { get; } = new JobMatchModeType(ScheduleAndSuspendModeValue); - /// suspendMode. + /// Discriminator used when matching workers to a job needs to be suspended. public static JobMatchModeType SuspendMode { get; } = new JobMatchModeType(SuspendModeValue); /// Determines if two values are the same. public static bool operator ==(JobMatchModeType left, JobMatchModeType right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.Serialization.cs similarity index 84% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.Serialization.cs index 0717ffcb5c16d..9686530aaabc4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.Serialization.cs @@ -6,11 +6,12 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class JobMatchingMode : IUtf8JsonSerializable + public partial class JobMatchingMode { internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element) { @@ -63,5 +64,13 @@ internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element) } return new JobMatchingMode(Optional.ToNullable(modeType), queueAndMatchMode.Value, scheduleAndSuspendMode.Value, suspendMode.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static JobMatchingMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeJobMatchingMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs new file mode 100644 index 0000000000000..155d649cc6632 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// + /// The matching mode to be applied to this job. + /// + /// Supported types: + /// + /// + /// QueueAndMatchMode: Used when matching worker to a job is required to be + /// done right after job is queued. + /// ScheduleAndSuspendMode: Used for scheduling + /// jobs to be queued at a future time. At specified time, matching of a worker to + /// the job will not start automatically. + /// SuspendMode: Used when matching workers + /// to a job needs to be suspended. + /// + public partial class JobMatchingMode + { + /// Initializes a new instance of JobMatchingMode. + /// Discriminator value used to differentiate between supported matching mode types. + /// + /// Describes a matching mode where matching worker to a job is automatically + /// started after job is queued successfully. + /// + /// + /// Describes a matching mode used for scheduling jobs to be queued at a future + /// time. + /// At the specified time, matching worker to a job will not start + /// automatically. + /// + /// Describes a matching mode where matching worker to a job is suspended. + internal JobMatchingMode(JobMatchModeType? modeType, object queueAndMatchMode, ScheduleAndSuspendMode scheduleAndSuspendMode, object suspendMode) + { + ModeType = modeType; + _queueAndMatchMode = queueAndMatchMode; + ScheduleAndSuspendMode = scheduleAndSuspendMode; + _suspendMode = suspendMode; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs index c484f7d1c336d..cf3861549b1a6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs @@ -6,9 +6,9 @@ #nullable disable using System; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure; using Azure.Communication.JobRouter.Models; using Azure.Core; @@ -16,133 +16,49 @@ namespace Azure.Communication.JobRouter { + // Data plane generated client. + /// The JobRouterAdministrationRest service client. internal partial class JobRouterAdministrationRestClient { private readonly HttpPipeline _pipeline; - private readonly string _endpoint; + private readonly Uri _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. internal ClientDiagnostics ClientDiagnostics { get; } - /// Initializes a new instance of JobRouterAdministrationRestClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The endpoint of the Azure Communication resource. - /// Api Version. - /// , , or is null. - public JobRouterAdministrationRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2022-07-18-preview") - { - ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint)); - _apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; - internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, ClassificationPolicy patch) + /// Initializes a new instance of JobRouterAdministrationRestClient for mocking. + protected JobRouterAdministrationRestClient() { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/classificationPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; - return message; } - /// Creates or updates a classification policy. - /// Id of the classification policy. - /// Model of classification policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public async Task> UpsertClassificationPolicyAsync(string id, ClassificationPolicy patch, CancellationToken cancellationToken = default) + /// Initializes a new instance of JobRouterAdministrationRestClient. + /// The Uri to use. + /// is null. + public JobRouterAdministrationRestClient(Uri endpoint) : this(endpoint, new AzureCommunicationJobRouterClientOptions()) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertClassificationPolicyRequest(id, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - ClassificationPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ClassificationPolicy.DeserializeClassificationPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } } - /// Creates or updates a classification policy. - /// Id of the classification policy. - /// Model of classification policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public Response UpsertClassificationPolicy(string id, ClassificationPolicy patch, CancellationToken cancellationToken = default) + /// Initializes a new instance of JobRouterAdministrationRestClient. + /// The Uri to use. + /// The options for configuring the client. + /// is null. + public JobRouterAdministrationRestClient(Uri endpoint, AzureCommunicationJobRouterClientOptions options) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertClassificationPolicyRequest(id, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - ClassificationPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ClassificationPolicy.DeserializeClassificationPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new AzureCommunicationJobRouterClientOptions(); - internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200201); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/classificationPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// - /// [Protocol Method] Creates or updates a classification policy. + /// [Protocol Method] Creates or updates a distribution policy. /// /// /// @@ -151,23 +67,28 @@ internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestC /// /// /// - /// Id of the classification policy. + /// The unique identifier of the policy. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual async Task UpsertClassificationPolicyAsync(string id, RequestContent content, RequestContext context = null) + /// + public virtual async Task UpsertDistributionPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertClassificationPolicy"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertDistributionPolicy"); scope.Start(); try { - using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, context); + using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -178,7 +99,7 @@ public virtual async Task UpsertClassificationPolicyAsync(string id, R } /// - /// [Protocol Method] Creates or updates a classification policy. + /// [Protocol Method] Creates or updates a distribution policy. /// /// /// @@ -187,23 +108,28 @@ public virtual async Task UpsertClassificationPolicyAsync(string id, R /// /// /// - /// Id of the classification policy. + /// The unique identifier of the policy. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual Response UpsertClassificationPolicy(string id, RequestContent content, RequestContext context = null) + /// + public virtual Response UpsertDistributionPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertClassificationPolicy"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertDistributionPolicy"); scope.Start(); try { - using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, context); + using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -213,298 +139,155 @@ public virtual Response UpsertClassificationPolicy(string id, RequestContent con } } - internal HttpMessage CreateGetClassificationPolicyRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/classificationPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Retrieves an existing classification policy by Id. - /// Id of the classification policy. + /// Retrieves an existing distribution policy by Id. + /// The unique identifier of the policy. /// The cancellation token to use. /// is null. - public async Task> GetClassificationPolicyAsync(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetDistributionPolicyAsync(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateGetClassificationPolicyRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ClassificationPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ClassificationPolicy.DeserializeClassificationPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDistributionPolicyAsync(id, context).ConfigureAwait(false); + return Response.FromValue(DistributionPolicy.FromResponse(response), response); } - /// Retrieves an existing classification policy by Id. - /// Id of the classification policy. + /// Retrieves an existing distribution policy by Id. + /// The unique identifier of the policy. /// The cancellation token to use. /// is null. - public Response GetClassificationPolicy(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetDistributionPolicy(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetClassificationPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ClassificationPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ClassificationPolicy.DeserializeClassificationPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - internal HttpMessage CreateDeleteClassificationPolicyRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/classificationPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDistributionPolicy(id, context); + return Response.FromValue(DistributionPolicy.FromResponse(response), response); } - /// Delete a classification policy by Id. - /// Id of the classification policy. - /// The cancellation token to use. + /// + /// [Protocol Method] Retrieves an existing distribution policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The unique identifier of the policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public async Task DeleteClassificationPolicyAsync(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetDistributionPolicyAsync(string id, RequestContext context) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteClassificationPolicyRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - /// Delete a classification policy by Id. - /// Id of the classification policy. - /// The cancellation token to use. - /// is null. - public Response DeleteClassificationPolicy(string id, CancellationToken cancellationToken = default) - { - if (id == null) + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetDistributionPolicy"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateGetDistributionPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateDeleteClassificationPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + catch (Exception e) { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateListClassificationPoliciesRequest(int? maxpagesize) + /// + /// [Protocol Method] Retrieves an existing distribution policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The unique identifier of the policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetDistributionPolicy(string id, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/classificationPolicies", false); - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - /// Retrieves existing classification policies. - /// Maximum page size. - /// The cancellation token to use. - public async Task> ListClassificationPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListClassificationPoliciesRequest(maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetDistributionPolicy"); + scope.Start(); + try { - case 200: - { - ClassificationPolicyCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ClassificationPolicyCollection.DeserializeClassificationPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateGetDistributionPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); } - } - - /// Retrieves existing classification policies. - /// Maximum page size. - /// The cancellation token to use. - public Response ListClassificationPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListClassificationPoliciesRequest(maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + catch (Exception e) { - case 200: - { - ClassificationPolicyCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ClassificationPolicyCollection.DeserializeClassificationPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, DistributionPolicy patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/distributionPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; - return message; - } - - /// Creates or updates a distribution policy. - /// Id of the distribution policy. - /// Model of distribution policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public async Task> UpsertDistributionPolicyAsync(string id, DistributionPolicy patch, CancellationToken cancellationToken = default) + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a distribution policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The unique identifier of the policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteDistributionPolicyAsync(string id, RequestContext context = null) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertDistributionPolicyRequest(id, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DistributionPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DistributionPolicy.DeserializeDistributionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - /// Creates or updates a distribution policy. - /// Id of the distribution policy. - /// Model of distribution policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public Response UpsertDistributionPolicy(string id, DistributionPolicy patch, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteDistributionPolicy"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(patch)); + using HttpMessage message = CreateDeleteDistributionPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateUpsertDistributionPolicyRequest(id, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + catch (Exception e) { - case 200: - case 201: - { - DistributionPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DistributionPolicy.DeserializeDistributionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200201); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/distributionPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Creates or updates a distribution policy. + /// [Protocol Method] Delete a distribution policy by Id. /// /// /// @@ -513,24 +296,23 @@ internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestCon /// /// /// - /// Id of the distribution policy. - /// The content to send as the body of the request. + /// The unique identifier of the policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual async Task UpsertDistributionPolicyAsync(string id, RequestContent content, RequestContext context = null) + /// + public virtual Response DeleteDistributionPolicy(string id, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertDistributionPolicy"); + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteDistributionPolicy"); scope.Start(); try { - using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + using HttpMessage message = CreateDeleteDistributionPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -540,7 +322,7 @@ public virtual async Task UpsertDistributionPolicyAsync(string id, Req } /// - /// [Protocol Method] Creates or updates a distribution policy. + /// [Protocol Method] Creates or updates a classification policy. /// /// /// @@ -549,24 +331,29 @@ public virtual async Task UpsertDistributionPolicyAsync(string id, Req /// /// /// - /// Id of the distribution policy. + /// Unique identifier of this policy. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual Response UpsertDistributionPolicy(string id, RequestContent content, RequestContext context = null) + /// + public virtual async Task UpsertClassificationPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertDistributionPolicy"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertClassificationPolicy"); scope.Start(); try { - using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, context); - return _pipeline.ProcessMessage(message, context); + using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -575,296 +362,229 @@ public virtual Response UpsertDistributionPolicy(string id, RequestContent conte } } - internal HttpMessage CreateGetDistributionPolicyRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/distributionPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Retrieves an existing distribution policy by Id. - /// Id of the distribution policy. - /// The cancellation token to use. - /// is null. - public async Task> GetDistributionPolicyAsync(string id, CancellationToken cancellationToken = default) + /// + /// [Protocol Method] Creates or updates a classification policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier of this policy. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UpsertClassificationPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - if (id == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertClassificationPolicy"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); } - - using var message = CreateGetDistributionPolicyRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + catch (Exception e) { - case 200: - { - DistributionPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DistributionPolicy.DeserializeDistributionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - /// Retrieves an existing distribution policy by Id. - /// Id of the distribution policy. + /// Retrieves an existing classification policy by Id. + /// Unique identifier of this policy. /// The cancellation token to use. /// is null. - public Response GetDistributionPolicy(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetClassificationPolicyAsync(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetDistributionPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DistributionPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DistributionPolicy.DeserializeDistributionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - internal HttpMessage CreateDeleteDistributionPolicyRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/distributionPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetClassificationPolicyAsync(id, context).ConfigureAwait(false); + return Response.FromValue(ClassificationPolicy.FromResponse(response), response); } - /// Delete a distribution policy by Id. - /// Id of the distribution policy. + /// Retrieves an existing classification policy by Id. + /// Unique identifier of this policy. /// The cancellation token to use. /// is null. - public async Task DeleteDistributionPolicyAsync(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetClassificationPolicy(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateDeleteDistributionPolicyRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetClassificationPolicy(id, context); + return Response.FromValue(ClassificationPolicy.FromResponse(response), response); } - /// Delete a distribution policy by Id. - /// Id of the distribution policy. - /// The cancellation token to use. + /// + /// [Protocol Method] Retrieves an existing classification policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique identifier of this policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public Response DeleteDistributionPolicy(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetClassificationPolicyAsync(string id, RequestContext context) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateDeleteDistributionPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetClassificationPolicy"); + scope.Start(); + try { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateGetClassificationPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - } - - internal HttpMessage CreateListDistributionPoliciesRequest(int? maxpagesize) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/distributionPolicies", false); - if (maxpagesize != null) + catch (Exception e) { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + scope.Failed(e); + throw; } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; } - /// Retrieves existing distribution policies. - /// Maximum page size. - /// The cancellation token to use. - public async Task> ListDistributionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + /// [Protocol Method] Retrieves an existing classification policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Unique identifier of this policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetClassificationPolicy(string id, RequestContext context) { - using var message = CreateListDistributionPoliciesRequest(maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetClassificationPolicy"); + scope.Start(); + try { - case 200: - { - DistributionPolicyCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DistributionPolicyCollection.DeserializeDistributionPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateGetClassificationPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); } - } - - /// Retrieves existing distribution policies. - /// Maximum page size. - /// The cancellation token to use. - public Response ListDistributionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListDistributionPoliciesRequest(maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + catch (Exception e) { - case 200: - { - DistributionPolicyCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DistributionPolicyCollection.DeserializeDistributionPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, ExceptionPolicy patch) + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a classification policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier of this policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteClassificationPolicyAsync(string id, RequestContext context = null) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/exceptionPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; - return message; - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - /// Creates or updates a exception policy. - /// Id of the exception policy. - /// Model of exception policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public async Task> UpsertExceptionPolicyAsync(string id, ExceptionPolicy patch, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteClassificationPolicy"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(patch)); + using HttpMessage message = CreateDeleteClassificationPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateUpsertExceptionPolicyRequest(id, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + catch (Exception e) { - case 200: - case 201: - { - ExceptionPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ExceptionPolicy.DeserializeExceptionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - /// Creates or updates a exception policy. - /// Id of the exception policy. - /// Model of exception policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public Response UpsertExceptionPolicy(string id, ExceptionPolicy patch, CancellationToken cancellationToken = default) + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a classification policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier of this policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteClassificationPolicy(string id, RequestContext context = null) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteClassificationPolicy"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(patch)); + using HttpMessage message = CreateDeleteClassificationPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); } - - using var message = CreateUpsertExceptionPolicyRequest(id, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + catch (Exception e) { - case 200: - case 201: - { - ExceptionPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ExceptionPolicy.DeserializeExceptionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200201); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/exceptionPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - /// /// [Protocol Method] Creates or updates a exception policy. /// @@ -875,23 +595,28 @@ internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestConten /// /// /// - /// Id of the exception policy. + /// The Id of the exception policy. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual async Task UpsertExceptionPolicyAsync(string id, RequestContent content, RequestContext context = null) + /// + public virtual async Task UpsertExceptionPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertExceptionPolicy"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertExceptionPolicy"); scope.Start(); try { - using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, context); + using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -911,23 +636,28 @@ public virtual async Task UpsertExceptionPolicyAsync(string id, Reques /// /// /// - /// Id of the exception policy. + /// The Id of the exception policy. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual Response UpsertExceptionPolicy(string id, RequestContent content, RequestContext context = null) + /// + public virtual Response UpsertExceptionPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertExceptionPolicy"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertExceptionPolicy"); scope.Start(); try { - using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, context); + using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -937,296 +667,188 @@ public virtual Response UpsertExceptionPolicy(string id, RequestContent content, } } - internal HttpMessage CreateGetExceptionPolicyRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/exceptionPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Retrieves an existing exception policy by Id. - /// Id of the exception policy to retrieve. + /// The Id of the exception policy. /// The cancellation token to use. /// is null. - public async Task> GetExceptionPolicyAsync(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetExceptionPolicyAsync(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateGetExceptionPolicyRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ExceptionPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ExceptionPolicy.DeserializeExceptionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetExceptionPolicyAsync(id, context).ConfigureAwait(false); + return Response.FromValue(ExceptionPolicy.FromResponse(response), response); } /// Retrieves an existing exception policy by Id. - /// Id of the exception policy to retrieve. + /// The Id of the exception policy. /// The cancellation token to use. /// is null. - public Response GetExceptionPolicy(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetExceptionPolicy(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetExceptionPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ExceptionPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ExceptionPolicy.DeserializeExceptionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - internal HttpMessage CreateDeleteExceptionPolicyRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/exceptionPolicies/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetExceptionPolicy(id, context); + return Response.FromValue(ExceptionPolicy.FromResponse(response), response); } - /// Deletes a exception policy by Id. - /// Id of the exception policy to delete. - /// The cancellation token to use. - /// is null. - public async Task DeleteExceptionPolicyAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteExceptionPolicyRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes a exception policy by Id. - /// Id of the exception policy to delete. - /// The cancellation token to use. + /// + /// [Protocol Method] Retrieves an existing exception policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The Id of the exception policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public Response DeleteExceptionPolicy(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetExceptionPolicyAsync(string id, RequestContext context) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateDeleteExceptionPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetExceptionPolicy"); + scope.Start(); + try { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateGetExceptionPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - } - - internal HttpMessage CreateListExceptionPoliciesRequest(int? maxpagesize) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/exceptionPolicies", false); - if (maxpagesize != null) + catch (Exception e) { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + scope.Failed(e); + throw; } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; } - /// Retrieves existing exception policies. - /// Number of objects to return per page. - /// The cancellation token to use. - public async Task> ListExceptionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + /// [Protocol Method] Retrieves an existing exception policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The Id of the exception policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetExceptionPolicy(string id, RequestContext context) { - using var message = CreateListExceptionPoliciesRequest(maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetExceptionPolicy"); + scope.Start(); + try { - case 200: - { - ExceptionPolicyCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ExceptionPolicyCollection.DeserializeExceptionPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateGetExceptionPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); } - } - - /// Retrieves existing exception policies. - /// Number of objects to return per page. - /// The cancellation token to use. - public Response ListExceptionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListExceptionPoliciesRequest(maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + catch (Exception e) { - case 200: - { - ExceptionPolicyCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ExceptionPolicyCollection.DeserializeExceptionPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateUpsertQueueRequest(string id, RouterQueue patch) + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a exception policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Id of the exception policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteExceptionPolicyAsync(string id, RequestContext context = null) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/queues/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; - return message; - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - /// Creates or updates a queue. - /// Id of the queue. - /// Model of queue properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public async Task> UpsertQueueAsync(string id, RouterQueue patch, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteExceptionPolicy"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(patch)); + using HttpMessage message = CreateDeleteExceptionPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateUpsertQueueRequest(id, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + catch (Exception e) { - case 200: - case 201: - { - RouterQueue value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterQueue.DeserializeRouterQueue(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - /// Creates or updates a queue. - /// Id of the queue. - /// Model of queue properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public Response UpsertQueue(string id, RouterQueue patch, CancellationToken cancellationToken = default) + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a exception policy by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Id of the exception policy. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteExceptionPolicy(string id, RequestContext context = null) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteExceptionPolicy"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(patch)); + using HttpMessage message = CreateDeleteExceptionPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); } - - using var message = CreateUpsertQueueRequest(id, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + catch (Exception e) { - case 200: - case 201: - { - RouterQueue value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterQueue.DeserializeRouterQueue(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200201); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/queues/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - /// /// [Protocol Method] Creates or updates a queue. /// @@ -1237,23 +859,28 @@ internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content, /// /// /// - /// Id of the queue. + /// The Id of this queue. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual async Task UpsertQueueAsync(string id, RequestContent content, RequestContext context = null) + /// + public virtual async Task UpsertQueueAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertQueue"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertQueue"); scope.Start(); try { - using HttpMessage message = CreateUpsertQueueRequest(id, content, context); + using HttpMessage message = CreateUpsertQueueRequest(id, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1273,23 +900,28 @@ public virtual async Task UpsertQueueAsync(string id, RequestContent c /// /// /// - /// Id of the queue. + /// The Id of this queue. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual Response UpsertQueue(string id, RequestContent content, RequestContext context = null) + /// + public virtual Response UpsertQueue(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertQueue"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertQueue"); scope.Start(); try { - using HttpMessage message = CreateUpsertQueueRequest(id, content, context); + using HttpMessage message = CreateUpsertQueueRequest(id, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1299,419 +931,780 @@ public virtual Response UpsertQueue(string id, RequestContent content, RequestCo } } - internal HttpMessage CreateGetQueueRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/queues/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Retrieves an existing queue by Id. - /// Id of the queue to retrieve. + /// The Id of this queue. /// The cancellation token to use. /// is null. - public async Task> GetQueueAsync(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetQueueAsync(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateGetQueueRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterQueue value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterQueue.DeserializeRouterQueue(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetQueueAsync(id, context).ConfigureAwait(false); + return Response.FromValue(RouterQueue.FromResponse(response), response); } /// Retrieves an existing queue by Id. - /// Id of the queue to retrieve. + /// The Id of this queue. /// The cancellation token to use. /// is null. - public Response GetQueue(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetQueue(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetQueueRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterQueue value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterQueue.DeserializeRouterQueue(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - internal HttpMessage CreateDeleteQueueRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/queues/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetQueue(id, context); + return Response.FromValue(RouterQueue.FromResponse(response), response); } - /// Deletes a queue by Id. - /// Id of the queue to delete. - /// The cancellation token to use. + /// + /// [Protocol Method] Retrieves an existing queue by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The Id of this queue. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public async Task DeleteQueueAsync(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetQueueAsync(string id, RequestContext context) { - if (id == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetQueue"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateGetQueueRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateDeleteQueueRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + catch (Exception e) { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - /// Deletes a queue by Id. - /// Id of the queue to delete. - /// The cancellation token to use. + /// + /// [Protocol Method] Retrieves an existing queue by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The Id of this queue. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public Response DeleteQueue(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetQueue(string id, RequestContext context) { - if (id == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetQueue"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateGetQueueRequest(id, context); + return _pipeline.ProcessMessage(message, context); } - - using var message = CreateDeleteQueueRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + catch (Exception e) { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateListQueuesRequest(int? maxpagesize) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/queues", false); - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a queue by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Id of this queue. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteQueueAsync(string id, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteQueue"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteQueueRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; } - /// Retrieves existing queues. - /// Number of objects to return per page. - /// The cancellation token to use. - public async Task> ListQueuesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a queue by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Id of this queue. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteQueue(string id, RequestContext context = null) { - using var message = CreateListQueuesRequest(maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteQueue"); + scope.Start(); + try { - case 200: - { - RouterQueueCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterQueueCollection.DeserializeRouterQueueCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateDeleteQueueRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; } } - /// Retrieves existing queues. - /// Number of objects to return per page. + /// Retrieves existing distribution policies. + /// Maximum page size. /// The cancellation token to use. - public Response ListQueues(int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual AsyncPageable GetDistributionPoliciesAsync(int maxpagesize, CancellationToken cancellationToken = default) { - using var message = CreateListQueuesRequest(maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterQueueCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterQueueCollection.DeserializeRouterQueueCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DistributionPolicyItem.DeserializeDistributionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetDistributionPolicies", "value", "nextLink", context); } - /// Retrieves existing classification policies. - /// The URL to the next page of results. + /// Retrieves existing distribution policies. /// Maximum page size. /// The cancellation token to use. - /// is null. - public async Task> ListClassificationPoliciesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual Pageable GetDistributionPolicies(int maxpagesize, CancellationToken cancellationToken = default) { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DistributionPolicyItem.DeserializeDistributionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetDistributionPolicies", "value", "nextLink", context); + } - using var message = CreateListClassificationPoliciesNextPageRequest(nextLink, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ClassificationPolicyCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ClassificationPolicyCollection.DeserializeClassificationPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + /// + /// [Protocol Method] Retrieves existing distribution policies. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Maximum page size. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetDistributionPoliciesAsync(int maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetDistributionPolicies", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves existing distribution policies. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Maximum page size. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetDistributionPolicies(int maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetDistributionPolicies", "value", "nextLink", context); } /// Retrieves existing classification policies. - /// The URL to the next page of results. /// Maximum page size. /// The cancellation token to use. - /// is null. - public Response ListClassificationPoliciesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual AsyncPageable GetClassificationPoliciesAsync(int maxpagesize, CancellationToken cancellationToken = default) { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListClassificationPoliciesNextPageRequest(nextLink, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ClassificationPolicyCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ClassificationPolicyCollection.DeserializeClassificationPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ClassificationPolicyItem.DeserializeClassificationPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetClassificationPolicies", "value", "nextLink", context); } - /// Retrieves existing distribution policies. - /// The URL to the next page of results. + /// Retrieves existing classification policies. /// Maximum page size. /// The cancellation token to use. - /// is null. - public async Task> ListDistributionPoliciesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual Pageable GetClassificationPolicies(int maxpagesize, CancellationToken cancellationToken = default) { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListDistributionPoliciesNextPageRequest(nextLink, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DistributionPolicyCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DistributionPolicyCollection.DeserializeDistributionPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ClassificationPolicyItem.DeserializeClassificationPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetClassificationPolicies", "value", "nextLink", context); } - /// Retrieves existing distribution policies. - /// The URL to the next page of results. + /// + /// [Protocol Method] Retrieves existing classification policies. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// /// Maximum page size. - /// The cancellation token to use. - /// is null. - public Response ListDistributionPoliciesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetClassificationPoliciesAsync(int maxpagesize, RequestContext context) { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetClassificationPolicies", "value", "nextLink", context); + } - using var message = CreateListDistributionPoliciesNextPageRequest(nextLink, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DistributionPolicyCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DistributionPolicyCollection.DeserializeDistributionPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + /// + /// [Protocol Method] Retrieves existing classification policies. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Maximum page size. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetClassificationPolicies(int maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetClassificationPolicies", "value", "nextLink", context); } /// Retrieves existing exception policies. - /// The URL to the next page of results. /// Number of objects to return per page. /// The cancellation token to use. - /// is null. - public async Task> ListExceptionPoliciesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual AsyncPageable GetExceptionPoliciesAsync(int maxpagesize, CancellationToken cancellationToken = default) { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListExceptionPoliciesNextPageRequest(nextLink, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ExceptionPolicyCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ExceptionPolicyCollection.DeserializeExceptionPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ExceptionPolicyItem.DeserializeExceptionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetExceptionPolicies", "value", "nextLink", context); } /// Retrieves existing exception policies. - /// The URL to the next page of results. /// Number of objects to return per page. /// The cancellation token to use. - /// is null. - public Response ListExceptionPoliciesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual Pageable GetExceptionPolicies(int maxpagesize, CancellationToken cancellationToken = default) { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ExceptionPolicyItem.DeserializeExceptionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetExceptionPolicies", "value", "nextLink", context); + } - using var message = CreateListExceptionPoliciesNextPageRequest(nextLink, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ExceptionPolicyCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ExceptionPolicyCollection.DeserializeExceptionPolicyCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + /// + /// [Protocol Method] Retrieves existing exception policies. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Number of objects to return per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetExceptionPoliciesAsync(int maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetExceptionPolicies", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves existing exception policies. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Number of objects to return per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetExceptionPolicies(int maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetExceptionPolicies", "value", "nextLink", context); + } + + /// Retrieves existing queues. + /// Number of objects to return per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetQueuesAsync(int maxpagesize, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterQueueItem.DeserializeRouterQueueItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetQueues", "value", "nextLink", context); } /// Retrieves existing queues. - /// The URL to the next page of results. /// Number of objects to return per page. /// The cancellation token to use. - /// is null. - public async Task> ListQueuesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual Pageable GetQueues(int maxpagesize, CancellationToken cancellationToken = default) { - if (nextLink == null) + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterQueueItem.DeserializeRouterQueueItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetQueues", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves existing queues. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Number of objects to return per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetQueuesAsync(int maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetQueues", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves existing queues. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Number of objects to return per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetQueues(int maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetQueues", "value", "nextLink", context); + } + + internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/distributionPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (requestConditions != null) { - throw new ArgumentNullException(nameof(nextLink)); + request.Headers.Add(requestConditions, "R"); } + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetDistributionPolicyRequest(string id, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/distributionPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } - using var message = CreateListQueuesNextPageRequest(nextLink, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + internal HttpMessage CreateGetDistributionPoliciesRequest(int maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/distributionPolicies", false); + uri.AppendQuery("maxpagesize", maxpagesize, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteDistributionPolicyRequest(string id, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/distributionPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/classificationPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (requestConditions != null) { - case 200: - { - RouterQueueCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterQueueCollection.DeserializeRouterQueueCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + request.Headers.Add(requestConditions, "R"); } + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; } - /// Retrieves existing queues. - /// The URL to the next page of results. - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public Response ListQueuesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetClassificationPolicyRequest(string id, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/classificationPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetClassificationPoliciesRequest(int maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/classificationPolicies", false); + uri.AppendQuery("maxpagesize", maxpagesize, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteClassificationPolicyRequest(string id, RequestContext context) { - if (nextLink == null) + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/classificationPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/exceptionPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (requestConditions != null) + { + request.Headers.Add(requestConditions, "R"); + } + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetExceptionPolicyRequest(string id, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/exceptionPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetExceptionPoliciesRequest(int maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/exceptionPolicies", false); + uri.AppendQuery("maxpagesize", maxpagesize, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteExceptionPolicyRequest(string id, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/exceptionPolicies/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/queues/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (requestConditions != null) { - throw new ArgumentNullException(nameof(nextLink)); + request.Headers.Add(requestConditions, "R"); } + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetQueueRequest(string id, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/queues/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetQueuesRequest(int maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/queues", false); + uri.AppendQuery("maxpagesize", maxpagesize, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } - using var message = CreateListQueuesNextPageRequest(nextLink, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + internal HttpMessage CreateDeleteQueueRequest(string id, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/queues/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) { - case 200: - { - RouterQueueCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterQueueCollection.DeserializeRouterQueueCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + return DefaultRequestContext; } + + return new RequestContext() { CancellationToken = cancellationToken }; } private static ResponseClassifier _responseClassifier200201; private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs index 15694ece3888b..e14735052f3a0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs @@ -6,9 +6,9 @@ #nullable disable using System; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure; using Azure.Communication.JobRouter.Models; using Azure.Core; @@ -16,129 +16,45 @@ namespace Azure.Communication.JobRouter { + // Data plane generated client. + /// The JobRouterRest service client. internal partial class JobRouterRestClient { private readonly HttpPipeline _pipeline; - private readonly string _endpoint; + private readonly Uri _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. internal ClientDiagnostics ClientDiagnostics { get; } - /// Initializes a new instance of JobRouterRestClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The endpoint of the Azure Communication resource. - /// Api Version. - /// , , or is null. - public JobRouterRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2022-07-18-preview") - { - ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint)); - _apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; - internal HttpMessage CreateUpsertJobRequest(string id, RouterJob patch) + /// Initializes a new instance of JobRouterRestClient for mocking. + protected JobRouterRestClient() { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; - return message; } - /// Creates or updates a router job. - /// Id of the job. - /// Model of job properties to be created or patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public async Task> UpsertJobAsync(string id, RouterJob patch, CancellationToken cancellationToken = default) + /// Initializes a new instance of JobRouterRestClient. + /// The Uri to use. + /// is null. + public JobRouterRestClient(Uri endpoint) : this(endpoint, new AzureCommunicationJobRouterClientOptions()) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertJobRequest(id, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - RouterJob value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterJob.DeserializeRouterJob(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } } - /// Creates or updates a router job. - /// Id of the job. - /// Model of job properties to be created or patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public Response UpsertJob(string id, RouterJob patch, CancellationToken cancellationToken = default) + /// Initializes a new instance of JobRouterRestClient. + /// The Uri to use. + /// The options for configuring the client. + /// is null. + public JobRouterRestClient(Uri endpoint, AzureCommunicationJobRouterClientOptions options) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertJobRequest(id, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - RouterJob value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterJob.DeserializeRouterJob(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new AzureCommunicationJobRouterClientOptions(); - internal HttpMessage CreateUpsertJobRequest(string id, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200201); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// @@ -151,23 +67,28 @@ internal HttpMessage CreateUpsertJobRequest(string id, RequestContent content, R /// /// /// - /// Id of the job. + /// The id of the job. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual async Task UpsertJobAsync(string id, RequestContent content, RequestContext context = null) + /// + public virtual async Task UpsertJobAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertJob"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.UpsertJob"); scope.Start(); try { - using HttpMessage message = CreateUpsertJobRequest(id, content, context); + using HttpMessage message = CreateUpsertJobRequest(id, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -187,23 +108,28 @@ public virtual async Task UpsertJobAsync(string id, RequestContent con /// /// /// - /// Id of the job. + /// The id of the job. /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - public virtual Response UpsertJob(string id, RequestContent content, RequestContext context = null) + /// + public virtual Response UpsertJob(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertJob"); + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.UpsertJob"); scope.Start(); try { - using HttpMessage message = CreateUpsertJobRequest(id, content, context); + using HttpMessage message = CreateUpsertJobRequest(id, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -213,1177 +139,2030 @@ public virtual Response UpsertJob(string id, RequestContent content, RequestCont } } - internal HttpMessage CreateGetJobRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Retrieves an existing job by Id. - /// Id of the job to retrieve. + /// The id of the job. /// The cancellation token to use. /// is null. - public async Task> GetJobAsync(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetJobAsync(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateGetJobRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterJob value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterJob.DeserializeRouterJob(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetJobAsync(id, context).ConfigureAwait(false); + return Response.FromValue(RouterJob.FromResponse(response), response); } /// Retrieves an existing job by Id. - /// Id of the job to retrieve. + /// The id of the job. /// The cancellation token to use. /// is null. - public Response GetJob(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetJob(string id, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetJobRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterJob value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterJob.DeserializeRouterJob(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - internal HttpMessage CreateDeleteJobRequest(string id) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetJob(id, context); + return Response.FromValue(RouterJob.FromResponse(response), response); } - /// Deletes a job and all of its traces. - /// Id of the job. - /// The cancellation token to use. + /// + /// [Protocol Method] Retrieves an existing job by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The id of the job. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public async Task DeleteJobAsync(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetJobAsync(string id, RequestContext context) { - if (id == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetJob"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateGetJobRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateDeleteJobRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + catch (Exception e) { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - /// Deletes a job and all of its traces. - /// Id of the job. - /// The cancellation token to use. + /// + /// [Protocol Method] Retrieves an existing job by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The id of the job. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public Response DeleteJob(string id, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetJob(string id, RequestContext context) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateDeleteJobRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetJob"); + scope.Start(); + try { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateGetJobRequest(id, context); + return _pipeline.ProcessMessage(message, context); } - } - - internal HttpMessage CreateReclassifyJobActionRequest(string id, object reclassifyJobRequest) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); - uri.AppendPath(":reclassify", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (reclassifyJobRequest != null) + catch (Exception e) { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(reclassifyJobRequest); - request.Content = content; + scope.Failed(e); + throw; } - return message; } - /// Reclassify a job. - /// Id of the job. - /// Request object for reclassifying a job. - /// The cancellation token to use. + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a job and all of its traces. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The id of the job. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public async Task> ReclassifyJobActionAsync(string id, object reclassifyJobRequest = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteJobAsync(string id, RequestContext context = null) { - if (id == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.DeleteJob"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateDeleteJobRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateReclassifyJobActionRequest(id, reclassifyJobRequest); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + catch (Exception e) { - case 200: - { - object value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - /// Reclassify a job. - /// Id of the job. - /// Request object for reclassifying a job. - /// The cancellation token to use. + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a job and all of its traces. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The id of the job. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. - public Response ReclassifyJobAction(string id, object reclassifyJobRequest = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteJob(string id, RequestContext context = null) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + Argument.AssertNotNullOrEmpty(id, nameof(id)); - using var message = CreateReclassifyJobActionRequest(id, reclassifyJobRequest); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.DeleteJob"); + scope.Start(); + try { - case 200: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateDeleteJobRequest(id, context); + return _pipeline.ProcessMessage(message, context); } - } - - internal HttpMessage CreateCancelJobActionRequest(string id, string note, string dispositionCode) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); - uri.AppendPath(":cancel", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var model = new CancelJobRequest() + catch (Exception e) { - Note = note, - DispositionCode = dispositionCode - }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; - return message; + scope.Failed(e); + throw; + } } - /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. + // The convenience method of this operation is omitted because it is using at least one anonymous model + /// + /// [Protocol Method] Reclassify a job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// /// Id of the job. - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. - /// - /// Indicates the outcome of the job, populate this field with your own custom values. - /// If not provided, default value of "Cancelled" is set. - /// - /// The cancellation token to use. - /// is null. - public async Task> CancelJobActionAsync(string id, string note = null, string dispositionCode = null, CancellationToken cancellationToken = default) + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task ReclassifyJobAsync(string id, RequestContent content, RequestContext context = null) { - if (id == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.ReclassifyJob"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateReclassifyJobRequest(id, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateCancelJobActionRequest(id, note, dispositionCode); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + catch (Exception e) { - case 200: - { - object value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. - /// Id of the job. - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. - /// - /// Indicates the outcome of the job, populate this field with your own custom values. - /// If not provided, default value of "Cancelled" is set. - /// - /// The cancellation token to use. - /// is null. - public Response CancelJobAction(string id, string note = null, string dispositionCode = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + // The convenience method of this operation is omitted because it is using at least one anonymous model + /// + /// [Protocol Method] Reclassify a job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response ReclassifyJob(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCancelJobActionRequest(id, note, dispositionCode); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.ReclassifyJob"); + scope.Start(); + try + { + using HttpMessage message = CreateReclassifyJobRequest(id, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) { - case 200: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateCompleteJobActionRequest(string id, string assignmentId, string note) + /// + /// Submits request to cancel an existing job by Id while supplying free-form + /// cancellation reason. + /// + /// Id of the job. + /// Request model for cancelling job. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CancelJobAsync(string id, CancelJobRequest cancelJobRequest, CancellationToken cancellationToken = default) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); - uri.AppendPath(":complete", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var model = new CompleteJobRequest(assignmentId) - { - Note = note - }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; - return message; + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(cancelJobRequest, nameof(cancelJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CancelJobAsync(id, cancelJobRequest.ToRequestContent(), context).ConfigureAwait(false); + return response; } - /// Completes an assigned job. + /// + /// Submits request to cancel an existing job by Id while supplying free-form + /// cancellation reason. + /// /// Id of the job. - /// The assignment within the job to complete. - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. + /// Request model for cancelling job. /// The cancellation token to use. - /// or is null. - public async Task> CompleteJobActionAsync(string id, string assignmentId, string note = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CancelJob(string id, CancelJobRequest cancelJobRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(cancelJobRequest, nameof(cancelJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CancelJob(id, cancelJobRequest.ToRequestContent(), context); + return response; + } + + /// + /// [Protocol Method] Submits request to cancel an existing job by Id while supplying free-form + /// cancellation reason. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CancelJobAsync(string id, RequestContent content, RequestContext context = null) { - if (id == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.CancelJob"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateCancelJobRequest(id, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - if (assignmentId == null) + catch (Exception e) { - throw new ArgumentNullException(nameof(assignmentId)); + scope.Failed(e); + throw; } + } + + /// + /// [Protocol Method] Submits request to cancel an existing job by Id while supplying free-form + /// cancellation reason. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CancelJob(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCompleteJobActionRequest(id, assignmentId, note); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.CancelJob"); + scope.Start(); + try { - case 200: - { - object value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + using HttpMessage message = CreateCancelJobRequest(id, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; } } /// Completes an assigned job. /// Id of the job. - /// The assignment within the job to complete. - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. + /// Request model for completing job. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CompleteJobAsync(string id, CompleteJobRequest completeJobRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(completeJobRequest, nameof(completeJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CompleteJobAsync(id, completeJobRequest.ToRequestContent(), context).ConfigureAwait(false); + return response; + } + + /// Completes an assigned job. + /// Id of the job. + /// Request model for completing job. /// The cancellation token to use. - /// or is null. - public Response CompleteJobAction(string id, string assignmentId, string note = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CompleteJob(string id, CompleteJobRequest completeJobRequest, CancellationToken cancellationToken = default) { - if (id == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(completeJobRequest, nameof(completeJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CompleteJob(id, completeJobRequest.ToRequestContent(), context); + return response; + } + + /// + /// [Protocol Method] Completes an assigned job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CompleteJobAsync(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.CompleteJob"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(id)); + using HttpMessage message = CreateCompleteJobRequest(id, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - if (assignmentId == null) + catch (Exception e) { - throw new ArgumentNullException(nameof(assignmentId)); + scope.Failed(e); + throw; } + } + + /// + /// [Protocol Method] Completes an assigned job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CompleteJob(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCompleteJobActionRequest(id, assignmentId, note); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.CompleteJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCompleteJobRequest(id, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) { - case 200: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - internal HttpMessage CreateCloseJobActionRequest(string id, string assignmentId, string dispositionCode, DateTimeOffset? closeAt, string note) + /// Closes a completed job. + /// Id of the job. + /// Request model for closing job. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CloseJobAsync(string id, CloseJobRequest closeJobRequest, CancellationToken cancellationToken = default) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); - uri.AppendPath(":close", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var model = new CloseJobRequest(assignmentId) - { - DispositionCode = dispositionCode, - CloseAt = closeAt, - Note = note - }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; - return message; + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(closeJobRequest, nameof(closeJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CloseJobAsync(id, closeJobRequest.ToRequestContent(), context).ConfigureAwait(false); + return response; } /// Closes a completed job. /// Id of the job. - /// The assignment within which the job is to be closed. - /// Indicates the outcome of the job, populate this field with your own custom values. - /// - /// If not provided, worker capacity is released immediately along with a JobClosedEvent notification. - /// If provided, worker capacity is released along with a JobClosedEvent notification at a future time in UTC. - /// - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. + /// Request model for closing job. /// The cancellation token to use. - /// or is null. - public async Task> CloseJobActionAsync(string id, string assignmentId, string dispositionCode = null, DateTimeOffset? closeAt = null, string note = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CloseJob(string id, CloseJobRequest closeJobRequest, CancellationToken cancellationToken = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(closeJobRequest, nameof(closeJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CloseJob(id, closeJobRequest.ToRequestContent(), context); + return response; + } + + /// + /// [Protocol Method] Closes a completed job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CloseJobAsync(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.CloseJob"); + scope.Start(); + try { - throw new ArgumentNullException(nameof(assignmentId)); + using HttpMessage message = CreateCloseJobRequest(id, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - - using var message = CreateCloseJobActionRequest(id, assignmentId, dispositionCode, closeAt, note); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + catch (Exception e) { - case 200: - case 202: - { - object value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + scope.Failed(e); + throw; } } - /// Closes a completed job. - /// Id of the job. - /// The assignment within which the job is to be closed. - /// Indicates the outcome of the job, populate this field with your own custom values. - /// - /// If not provided, worker capacity is released immediately along with a JobClosedEvent notification. - /// If provided, worker capacity is released along with a JobClosedEvent notification at a future time in UTC. + /// + /// [Protocol Method] Closes a completed job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CloseJob(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.CloseJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCloseJobRequest(id, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a job's position details. + /// Id of the job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetQueuePositionAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetQueuePositionAsync(id, context).ConfigureAwait(false); + return Response.FromValue(RouterJobPositionDetails.FromResponse(response), response); + } + + /// Gets a job's position details. + /// Id of the job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetQueuePosition(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetQueuePosition(id, context); + return Response.FromValue(RouterJobPositionDetails.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets a job's position details. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetQueuePositionAsync(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetQueuePosition"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueuePositionRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a job's position details. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetQueuePosition(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetQueuePosition"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueuePositionRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Un-assign a job. + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// Request body for unassign route. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> UnassignJobAsync(string id, string assignmentId, UnassignJobRequest unassignJobRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + Argument.AssertNotNull(unassignJobRequest, nameof(unassignJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await UnassignJobAsync(id, assignmentId, unassignJobRequest.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(UnassignJobResult.FromResponse(response), response); + } + + /// Un-assign a job. + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// Request body for unassign route. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response UnassignJob(string id, string assignmentId, UnassignJobRequest unassignJobRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + Argument.AssertNotNull(unassignJobRequest, nameof(unassignJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = UnassignJob(id, assignmentId, unassignJobRequest.ToRequestContent(), context); + return Response.FromValue(UnassignJobResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Un-assign a job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UnassignJobAsync(string id, string assignmentId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.UnassignJob"); + scope.Start(); + try + { + using HttpMessage message = CreateUnassignJobRequest(id, assignmentId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Un-assign a job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UnassignJob(string id, string assignmentId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.UnassignJob"); + scope.Start(); + try + { + using HttpMessage message = CreateUnassignJobRequest(id, assignmentId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Accepts an offer to work on a job and returns a 409/Conflict if another agent + /// accepted the job already. + /// + /// Id of the worker. + /// Id of the offer. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> AcceptJobAsync(string workerId, string offerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AcceptJobAsync(workerId, offerId, context).ConfigureAwait(false); + return Response.FromValue(AcceptJobOfferResult.FromResponse(response), response); + } + + /// + /// Accepts an offer to work on a job and returns a 409/Conflict if another agent + /// accepted the job already. + /// + /// Id of the worker. + /// Id of the offer. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response AcceptJob(string workerId, string offerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AcceptJob(workerId, offerId, context); + return Response.FromValue(AcceptJobOfferResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Accepts an offer to work on a job and returns a 409/Conflict if another agent + /// accepted the job already. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the worker. + /// Id of the offer. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AcceptJobAsync(string workerId, string offerId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.AcceptJob"); + scope.Start(); + try + { + using HttpMessage message = CreateAcceptJobRequest(workerId, offerId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Accepts an offer to work on a job and returns a 409/Conflict if another agent + /// accepted the job already. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the worker. + /// Id of the offer. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AcceptJob(string workerId, string offerId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.AcceptJob"); + scope.Start(); + try + { + using HttpMessage message = CreateAcceptJobRequest(workerId, offerId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Declines an offer to work on a job. + /// Id of the worker. + /// Id of the offer. + /// Request model for declining offer. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task DeclineJobAsync(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + Argument.AssertNotNull(declineJobOfferRequest, nameof(declineJobOfferRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await DeclineJobAsync(workerId, offerId, declineJobOfferRequest.ToRequestContent(), context).ConfigureAwait(false); + return response; + } + + /// Declines an offer to work on a job. + /// Id of the worker. + /// Id of the offer. + /// Request model for declining offer. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response DeclineJob(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + Argument.AssertNotNull(declineJobOfferRequest, nameof(declineJobOfferRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = DeclineJob(workerId, offerId, declineJobOfferRequest.ToRequestContent(), context); + return response; + } + + /// + /// [Protocol Method] Declines an offer to work on a job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the worker. + /// Id of the offer. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeclineJobAsync(string workerId, string offerId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.DeclineJob"); + scope.Start(); + try + { + using HttpMessage message = CreateDeclineJobRequest(workerId, offerId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Declines an offer to work on a job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the worker. + /// Id of the offer. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeclineJob(string workerId, string offerId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.DeclineJob"); + scope.Start(); + try + { + using HttpMessage message = CreateDeclineJobRequest(workerId, offerId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves a queue's statistics. + /// Id of the queue to retrieve statistics. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetQueueStatisticsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetQueueStatisticsAsync(id, context).ConfigureAwait(false); + return Response.FromValue(RouterQueueStatistics.FromResponse(response), response); + } + + /// Retrieves a queue's statistics. + /// Id of the queue to retrieve statistics. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetQueueStatistics(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetQueueStatistics(id, context); + return Response.FromValue(RouterQueueStatistics.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves a queue's statistics. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the queue to retrieve statistics. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetQueueStatisticsAsync(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetQueueStatistics"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueueStatisticsRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves a queue's statistics. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the queue to retrieve statistics. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetQueueStatistics(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetQueueStatistics"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueueStatisticsRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a worker. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UpsertWorkerAsync(string workerId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.UpsertWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a worker. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UpsertWorker(string workerId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.UpsertWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves an existing worker by Id. + /// Id of the worker. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetWorkerAsync(string workerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetWorkerAsync(workerId, context).ConfigureAwait(false); + return Response.FromValue(RouterWorker.FromResponse(response), response); + } + + /// Retrieves an existing worker by Id. + /// Id of the worker. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetWorker(string workerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetWorker(workerId, context); + return Response.FromValue(RouterWorker.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves an existing worker by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the worker. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetWorkerAsync(string workerId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkerRequest(workerId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves an existing worker by Id. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Id of the worker. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetWorker(string workerId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkerRequest(workerId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a worker and all of its traces. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteWorkerAsync(string workerId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.DeleteWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteWorkerRequest(workerId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a worker and all of its traces. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteWorker(string workerId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.DeleteWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteWorkerRequest(workerId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves list of jobs based on filter parameters. + /// If specified, filter jobs by status. + /// If specified, filter jobs by queue. + /// If specified, filter jobs by channel. + /// If specified, filter jobs by classificationPolicy. + /// + /// If specified, filter on jobs that was scheduled before or at given timestamp. + /// Range: (-Inf, scheduledBefore]. + /// + /// + /// If specified, filter on jobs that was scheduled at or after given value. Range: + /// [scheduledAfter, +Inf). + /// + /// Number of objects to return per page. + /// The cancellation token to use. + /// , or is null. + /// + public virtual AsyncPageable GetJobsAsync(RouterJobStatusSelector status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset scheduledBefore, DateTimeOffset scheduledAfter, int maxpagesize, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(queueId, nameof(queueId)); + Argument.AssertNotNull(channelId, nameof(channelId)); + Argument.AssertNotNull(classificationPolicyId, nameof(classificationPolicyId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(status.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, status.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterJobItem.DeserializeRouterJobItem, ClientDiagnostics, _pipeline, "JobRouterRestClient.GetJobs", "value", "nextLink", context); + } + + /// Retrieves list of jobs based on filter parameters. + /// If specified, filter jobs by status. + /// If specified, filter jobs by queue. + /// If specified, filter jobs by channel. + /// If specified, filter jobs by classificationPolicy. + /// + /// If specified, filter on jobs that was scheduled before or at given timestamp. + /// Range: (-Inf, scheduledBefore]. + /// + /// + /// If specified, filter on jobs that was scheduled at or after given value. Range: + /// [scheduledAfter, +Inf). + /// + /// Number of objects to return per page. + /// The cancellation token to use. + /// , or is null. + /// + public virtual Pageable GetJobs(RouterJobStatusSelector status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset scheduledBefore, DateTimeOffset scheduledAfter, int maxpagesize, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(queueId, nameof(queueId)); + Argument.AssertNotNull(channelId, nameof(channelId)); + Argument.AssertNotNull(classificationPolicyId, nameof(classificationPolicyId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(status.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, status.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterJobItem.DeserializeRouterJobItem, ClientDiagnostics, _pipeline, "JobRouterRestClient.GetJobs", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of jobs based on filter parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// If specified, filter jobs by status. Allowed values: "all" | "pendingClassification" | "queued" | "assigned" | "completed" | "closed" | "cancelled" | "classificationFailed" | "created" | "pendingSchedule" | "scheduled" | "scheduleFailed" | "waitingForActivation" | "active". + /// If specified, filter jobs by queue. + /// If specified, filter jobs by channel. + /// If specified, filter jobs by classificationPolicy. + /// + /// If specified, filter on jobs that was scheduled before or at given timestamp. + /// Range: (-Inf, scheduledBefore]. + /// + /// + /// If specified, filter on jobs that was scheduled at or after given value. Range: + /// [scheduledAfter, +Inf). + /// + /// Number of objects to return per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetJobsAsync(string status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset scheduledBefore, DateTimeOffset scheduledAfter, int maxpagesize, RequestContext context = null) + { + Argument.AssertNotNull(status, nameof(status)); + Argument.AssertNotNull(queueId, nameof(queueId)); + Argument.AssertNotNull(channelId, nameof(channelId)); + Argument.AssertNotNull(classificationPolicyId, nameof(classificationPolicyId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterRestClient.GetJobs", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of jobs based on filter parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// If specified, filter jobs by status. Allowed values: "all" | "pendingClassification" | "queued" | "assigned" | "completed" | "closed" | "cancelled" | "classificationFailed" | "created" | "pendingSchedule" | "scheduled" | "scheduleFailed" | "waitingForActivation" | "active". + /// If specified, filter jobs by queue. + /// If specified, filter jobs by channel. + /// If specified, filter jobs by classificationPolicy. + /// + /// If specified, filter on jobs that was scheduled before or at given timestamp. + /// Range: (-Inf, scheduledBefore]. + /// + /// + /// If specified, filter on jobs that was scheduled at or after given value. Range: + /// [scheduledAfter, +Inf). + /// + /// Number of objects to return per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetJobs(string status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset scheduledBefore, DateTimeOffset scheduledAfter, int maxpagesize, RequestContext context = null) + { + Argument.AssertNotNull(status, nameof(status)); + Argument.AssertNotNull(queueId, nameof(queueId)); + Argument.AssertNotNull(channelId, nameof(channelId)); + Argument.AssertNotNull(classificationPolicyId, nameof(classificationPolicyId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterRestClient.GetJobs", "value", "nextLink", context); + } + + /// Retrieves existing workers. + /// If specified, select workers by worker state. + /// If specified, select workers who have a channel configuration with this channel. + /// If specified, select workers who are assigned to this queue. + /// + /// If set to true, select only workers who have capacity for the channel specified + /// by `channelId` or for any channel if `channelId` not specified. If set to + /// false, then will return all workers including workers without any capacity for + /// jobs. Defaults to false. + /// + /// Number of objects to return per page. + /// The cancellation token to use. + /// or is null. + /// + public virtual AsyncPageable GetWorkersAsync(RouterWorkerStateSelector state, string channelId, string queueId, bool hasCapacity, int maxpagesize, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(channelId, nameof(channelId)); + Argument.AssertNotNull(queueId, nameof(queueId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(state.ToString(), channelId, queueId, hasCapacity, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, state.ToString(), channelId, queueId, hasCapacity, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterWorkerItem.DeserializeRouterWorkerItem, ClientDiagnostics, _pipeline, "JobRouterRestClient.GetWorkers", "value", "nextLink", context); + } + + /// Retrieves existing workers. + /// If specified, select workers by worker state. + /// If specified, select workers who have a channel configuration with this channel. + /// If specified, select workers who are assigned to this queue. + /// + /// If set to true, select only workers who have capacity for the channel specified + /// by `channelId` or for any channel if `channelId` not specified. If set to + /// false, then will return all workers including workers without any capacity for + /// jobs. Defaults to false. + /// + /// Number of objects to return per page. + /// The cancellation token to use. + /// or is null. + /// + public virtual Pageable GetWorkers(RouterWorkerStateSelector state, string channelId, string queueId, bool hasCapacity, int maxpagesize, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(channelId, nameof(channelId)); + Argument.AssertNotNull(queueId, nameof(queueId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(state.ToString(), channelId, queueId, hasCapacity, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, state.ToString(), channelId, queueId, hasCapacity, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterWorkerItem.DeserializeRouterWorkerItem, ClientDiagnostics, _pipeline, "JobRouterRestClient.GetWorkers", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves existing workers. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// If specified, select workers by worker state. Allowed values: "active" | "draining" | "inactive" | "all". + /// If specified, select workers who have a channel configuration with this channel. + /// If specified, select workers who are assigned to this queue. + /// + /// If set to true, select only workers who have capacity for the channel specified + /// by `channelId` or for any channel if `channelId` not specified. If set to + /// false, then will return all workers including workers without any capacity for + /// jobs. Defaults to false. + /// + /// Number of objects to return per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetWorkersAsync(string state, string channelId, string queueId, bool hasCapacity, int maxpagesize, RequestContext context = null) + { + Argument.AssertNotNull(state, nameof(state)); + Argument.AssertNotNull(channelId, nameof(channelId)); + Argument.AssertNotNull(queueId, nameof(queueId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(state, channelId, queueId, hasCapacity, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, state, channelId, queueId, hasCapacity, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterRestClient.GetWorkers", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves existing workers. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// If specified, select workers by worker state. Allowed values: "active" | "draining" | "inactive" | "all". + /// If specified, select workers who have a channel configuration with this channel. + /// If specified, select workers who are assigned to this queue. + /// + /// If set to true, select only workers who have capacity for the channel specified + /// by `channelId` or for any channel if `channelId` not specified. If set to + /// false, then will return all workers including workers without any capacity for + /// jobs. Defaults to false. /// - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. - /// The cancellation token to use. - /// or is null. - public Response CloseJobAction(string id, string assignmentId, string dispositionCode = null, DateTimeOffset? closeAt = null, string note = null, CancellationToken cancellationToken = default) + /// Number of objects to return per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetWorkers(string state, string channelId, string queueId, bool hasCapacity, int maxpagesize, RequestContext context = null) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } + Argument.AssertNotNull(state, nameof(state)); + Argument.AssertNotNull(channelId, nameof(channelId)); + Argument.AssertNotNull(queueId, nameof(queueId)); - using var message = CreateCloseJobActionRequest(id, assignmentId, dispositionCode, closeAt, note); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(state, channelId, queueId, hasCapacity, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, state, channelId, queueId, hasCapacity, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterRestClient.GetWorkers", "value", "nextLink", context); } - internal HttpMessage CreateListJobsRequest(RouterJobStatusSelector? status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset? scheduledBefore, DateTimeOffset? scheduledAfter, int? maxpagesize) + internal HttpMessage CreateUpsertJobRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/jobs", false); - if (status != null) - { - uri.AppendQuery("status", status.Value.ToString(), true); - } - if (queueId != null) - { - uri.AppendQuery("queueId", queueId, true); - } - if (channelId != null) - { - uri.AppendQuery("channelId", channelId, true); - } - if (classificationPolicyId != null) - { - uri.AppendQuery("classificationPolicyId", classificationPolicyId, true); - } - if (scheduledBefore != null) - { - uri.AppendQuery("scheduledBefore", scheduledBefore.Value, "O", true); - } - if (scheduledAfter != null) - { - uri.AppendQuery("scheduledAfter", scheduledAfter.Value, "O", true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Retrieves list of jobs based on filter parameters. - /// If specified, filter jobs by status. - /// If specified, filter jobs by queue. - /// If specified, filter jobs by channel. - /// If specified, filter jobs by classificationPolicy. - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// Number of objects to return per page. - /// The cancellation token to use. - public async Task> ListJobsAsync(RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListJobsRequest(status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterJobCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterJobCollection.DeserializeRouterJobCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves list of jobs based on filter parameters. - /// If specified, filter jobs by status. - /// If specified, filter jobs by queue. - /// If specified, filter jobs by channel. - /// If specified, filter jobs by classificationPolicy. - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// Number of objects to return per page. - /// The cancellation token to use. - public Response ListJobs(RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListJobsRequest(status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (requestConditions != null) { - case 200: - { - RouterJobCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterJobCollection.DeserializeRouterJobCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + request.Headers.Add(requestConditions, "R"); } + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; } - internal HttpMessage CreateGetInQueuePositionRequest(string id) + internal HttpMessage CreateGetJobRequest(string id, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); uri.AppendPath(id, true); - uri.AppendPath("/position", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a job's position details. - /// Id of the job. - /// The cancellation token to use. - /// is null. - public async Task> GetInQueuePositionAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetInQueuePositionRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterJobPositionDetails value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterJobPositionDetails.DeserializeRouterJobPositionDetails(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a job's position details. - /// Id of the job. - /// The cancellation token to use. - /// is null. - public Response GetInQueuePosition(string id, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteJobRequest(string id, RequestContext context) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetInQueuePositionRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterJobPositionDetails value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterJobPositionDetails.DeserializeRouterJobPositionDetails(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; } - internal HttpMessage CreateUnassignJobActionRequest(string id, string assignmentId, UnassignJobRequest unassignJobRequest) + internal HttpMessage CreateReclassifyJobRequest(string id, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); uri.AppendPath(id, true); - uri.AppendPath("/assignments/", false); - uri.AppendPath(assignmentId, true); - uri.AppendPath(":unassign", false); + uri.AppendPath(":reclassify", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - if (unassignJobRequest != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(unassignJobRequest); - request.Content = content; - } + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; return message; } - /// Un-assign a job. - /// Id of the job to un-assign. - /// Id of the assignment to un-assign. - /// Request body for unassign route. - /// The cancellation token to use. - /// or is null. - public async Task> UnassignJobActionAsync(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - - using var message = CreateUnassignJobActionRequest(id, assignmentId, unassignJobRequest); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - UnassignJobResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = UnassignJobResult.DeserializeUnassignJobResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Un-assign a job. - /// Id of the job to un-assign. - /// Id of the assignment to un-assign. - /// Request body for unassign route. - /// The cancellation token to use. - /// or is null. - public Response UnassignJobAction(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - - using var message = CreateUnassignJobActionRequest(id, assignmentId, unassignJobRequest); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - UnassignJobResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = UnassignJobResult.DeserializeUnassignJobResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateAcceptJobActionRequest(string workerId, string offerId) + internal HttpMessage CreateCancelJobRequest(string id, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/workers/", false); - uri.AppendPath(workerId, true); - uri.AppendPath("/offers/", false); - uri.AppendPath(offerId, true); - uri.AppendPath(":accept", false); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath(":cancel", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; return message; } - /// Accepts an offer to work on a job and returns a 409/Conflict if another agent accepted the job already. - /// Id of the worker. - /// Id of the offer. - /// The cancellation token to use. - /// or is null. - public async Task> AcceptJobActionAsync(string workerId, string offerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (offerId == null) - { - throw new ArgumentNullException(nameof(offerId)); - } - - using var message = CreateAcceptJobActionRequest(workerId, offerId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AcceptJobOfferResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AcceptJobOfferResult.DeserializeAcceptJobOfferResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Accepts an offer to work on a job and returns a 409/Conflict if another agent accepted the job already. - /// Id of the worker. - /// Id of the offer. - /// The cancellation token to use. - /// or is null. - public Response AcceptJobAction(string workerId, string offerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (offerId == null) - { - throw new ArgumentNullException(nameof(offerId)); - } - - using var message = CreateAcceptJobActionRequest(workerId, offerId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AcceptJobOfferResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AcceptJobOfferResult.DeserializeAcceptJobOfferResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeclineJobActionRequest(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest) + internal HttpMessage CreateCompleteJobRequest(string id, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/workers/", false); - uri.AppendPath(workerId, true); - uri.AppendPath("/offers/", false); - uri.AppendPath(offerId, true); - uri.AppendPath(":decline", false); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath(":complete", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - if (declineJobOfferRequest != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(declineJobOfferRequest); - request.Content = content; - } + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; return message; } - /// Declines an offer to work on a job. - /// Id of the worker. - /// Id of the offer. - /// Request model for declining offer. - /// The cancellation token to use. - /// or is null. - public async Task> DeclineJobActionAsync(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateCloseJobRequest(string id, RequestContent content, RequestContext context) { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (offerId == null) - { - throw new ArgumentNullException(nameof(offerId)); - } - - using var message = CreateDeclineJobActionRequest(workerId, offerId, declineJobOfferRequest); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - object value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath(":close", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; } - /// Declines an offer to work on a job. - /// Id of the worker. - /// Id of the offer. - /// Request model for declining offer. - /// The cancellation token to use. - /// or is null. - public Response DeclineJobAction(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetJobsRequest(string status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset scheduledBefore, DateTimeOffset scheduledAfter, int maxpagesize, RequestContext context) { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (offerId == null) - { - throw new ArgumentNullException(nameof(offerId)); - } - - using var message = CreateDeclineJobActionRequest(workerId, offerId, declineJobOfferRequest); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs", false); + uri.AppendQuery("status", status, true); + uri.AppendQuery("queueId", queueId, true); + uri.AppendQuery("channelId", channelId, true); + uri.AppendQuery("classificationPolicyId", classificationPolicyId, true); + uri.AppendQuery("scheduledBefore", scheduledBefore, "O", true); + uri.AppendQuery("scheduledAfter", scheduledAfter, "O", true); + uri.AppendQuery("maxpagesize", maxpagesize, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; } - internal HttpMessage CreateGetQueueStatisticsRequest(string id) + internal HttpMessage CreateGetQueuePositionRequest(string id, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/queues/", false); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); uri.AppendPath(id, true); - uri.AppendPath("/statistics", false); + uri.AppendPath("/position", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Retrieves a queue's statistics. - /// Id of the queue to retrieve statistics. - /// The cancellation token to use. - /// is null. - public async Task> GetQueueStatisticsAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetQueueStatisticsRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterQueueStatistics value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterQueueStatistics.DeserializeRouterQueueStatistics(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves a queue's statistics. - /// Id of the queue to retrieve statistics. - /// The cancellation token to use. - /// is null. - public Response GetQueueStatistics(string id, CancellationToken cancellationToken = default) + internal HttpMessage CreateUnassignJobRequest(string id, string assignmentId, RequestContent content, RequestContext context) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetQueueStatisticsRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterQueueStatistics value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterQueueStatistics.DeserializeRouterQueueStatistics(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath("/assignments/", false); + uri.AppendPath(assignmentId, true); + uri.AppendPath(":unassign", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateUpsertWorkerRequest(string workerId, RouterWorker patch) + internal HttpMessage CreateAcceptJobRequest(string workerId, string offerId, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/routing/workers/", false); uri.AppendPath(workerId, true); + uri.AppendPath("/offers/", false); + uri.AppendPath(offerId, true); + uri.AppendPath(":accept", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; return message; } - /// Creates or updates a worker. - /// Id of the worker. - /// Model of worker properties to be created or patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public async Task> UpsertWorkerAsync(string workerId, RouterWorker patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeclineJobRequest(string workerId, string offerId, RequestContent content, RequestContext context) { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertWorkerRequest(workerId, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - RouterWorker value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterWorker.DeserializeRouterWorker(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/workers/", false); + uri.AppendPath(workerId, true); + uri.AppendPath("/offers/", false); + uri.AppendPath(offerId, true); + uri.AppendPath(":decline", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; } - /// Creates or updates a worker. - /// Id of the worker. - /// Model of worker properties to be created or patched. See also: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// or is null. - public Response UpsertWorker(string workerId, RouterWorker patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetQueueStatisticsRequest(string id, RequestContext context) { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertWorkerRequest(workerId, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - RouterWorker value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterWorker.DeserializeRouterWorker(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/queues/", false); + uri.AppendPath(id, true); + uri.AppendPath("/statistics", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; } - internal HttpMessage CreateUpsertWorkerRequest(string workerId, RequestContent content, RequestContext context) + internal HttpMessage CreateUpsertWorkerRequest(string workerId, RequestContent content, RequestConditions requestConditions, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/routing/workers/", false); uri.AppendPath(workerId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + if (requestConditions != null) + { + request.Headers.Add(requestConditions, "R"); + } request.Headers.Add("Content-Type", "application/merge-patch+json"); request.Content = content; return message; } - /// - /// [Protocol Method] Creates or updates a worker. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the worker. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task UpsertWorkerAsync(string workerId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertWorker"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates or updates a worker. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the worker. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual Response UpsertWorker(string workerId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertWorker"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateGetWorkerRequest(string workerId) + internal HttpMessage CreateGetWorkerRequest(string workerId, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/routing/workers/", false); uri.AppendPath(workerId, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -1392,67 +2171,13 @@ internal HttpMessage CreateGetWorkerRequest(string workerId) return message; } - /// Retrieves an existing worker by Id. - /// Id of the worker to retrieve. - /// The cancellation token to use. - /// is null. - public async Task> GetWorkerAsync(string workerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - using var message = CreateGetWorkerRequest(workerId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterWorker value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterWorker.DeserializeRouterWorker(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves an existing worker by Id. - /// Id of the worker to retrieve. - /// The cancellation token to use. - /// is null. - public Response GetWorker(string workerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - using var message = CreateGetWorkerRequest(workerId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterWorker value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterWorker.DeserializeRouterWorker(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteWorkerRequest(string workerId) + internal HttpMessage CreateDeleteWorkerRequest(string workerId, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/routing/workers/", false); uri.AppendPath(workerId, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -1461,279 +2186,41 @@ internal HttpMessage CreateDeleteWorkerRequest(string workerId) return message; } - /// Deletes a worker and all of its traces. - /// Id of the worker to delete. - /// The cancellation token to use. - /// is null. - public async Task DeleteWorkerAsync(string workerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - using var message = CreateDeleteWorkerRequest(workerId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes a worker and all of its traces. - /// Id of the worker to delete. - /// The cancellation token to use. - /// is null. - public Response DeleteWorker(string workerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - using var message = CreateDeleteWorkerRequest(workerId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListWorkersRequest(RouterWorkerStateSelector? state, string channelId, string queueId, bool? hasCapacity, int? maxpagesize) + internal HttpMessage CreateGetWorkersRequest(string state, string channelId, string queueId, bool hasCapacity, int maxpagesize, RequestContext context) { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendPath("/routing/workers", false); - if (state != null) - { - uri.AppendQuery("state", state.Value.ToString(), true); - } - if (channelId != null) - { - uri.AppendQuery("channelId", channelId, true); - } - if (queueId != null) - { - uri.AppendQuery("queueId", queueId, true); - } - if (hasCapacity != null) - { - uri.AppendQuery("hasCapacity", hasCapacity.Value, true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } + uri.AppendQuery("state", state, true); + uri.AppendQuery("channelId", channelId, true); + uri.AppendQuery("queueId", queueId, true); + uri.AppendQuery("hasCapacity", hasCapacity, true); + uri.AppendQuery("maxpagesize", maxpagesize, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Retrieves existing workers. - /// If specified, select workers by worker state. - /// If specified, select workers who have a channel configuration with this channel. - /// If specified, select workers who are assigned to this queue. - /// - /// If set to true, select only workers who have capacity for the channel specified by `channelId` or for any channel - /// if `channelId` not specified. If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - /// Number of objects to return per page. - /// The cancellation token to use. - public async Task> ListWorkersAsync(RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListWorkersRequest(state, channelId, queueId, hasCapacity, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterWorkerCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterWorkerCollection.DeserializeRouterWorkerCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves existing workers. - /// If specified, select workers by worker state. - /// If specified, select workers who have a channel configuration with this channel. - /// If specified, select workers who are assigned to this queue. - /// - /// If set to true, select only workers who have capacity for the channel specified by `channelId` or for any channel - /// if `channelId` not specified. If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - /// Number of objects to return per page. - /// The cancellation token to use. - public Response ListWorkers(RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListWorkersRequest(state, channelId, queueId, hasCapacity, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterWorkerCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterWorkerCollection.DeserializeRouterWorkerCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves list of jobs based on filter parameters. - /// The URL to the next page of results. - /// If specified, filter jobs by status. - /// If specified, filter jobs by queue. - /// If specified, filter jobs by channel. - /// If specified, filter jobs by classificationPolicy. - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public async Task> ListJobsNextPageAsync(string nextLink, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListJobsNextPageRequest(nextLink, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterJobCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterJobCollection.DeserializeRouterJobCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves list of jobs based on filter parameters. - /// The URL to the next page of results. - /// If specified, filter jobs by status. - /// If specified, filter jobs by queue. - /// If specified, filter jobs by channel. - /// If specified, filter jobs by classificationPolicy. - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public Response ListJobsNextPage(string nextLink, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListJobsNextPageRequest(nextLink, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterJobCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterJobCollection.DeserializeRouterJobCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves existing workers. - /// The URL to the next page of results. - /// If specified, select workers by worker state. - /// If specified, select workers who have a channel configuration with this channel. - /// If specified, select workers who are assigned to this queue. - /// - /// If set to true, select only workers who have capacity for the channel specified by `channelId` or for any channel - /// if `channelId` not specified. If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public async Task> ListWorkersNextPageAsync(string nextLink, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListWorkersNextPageRequest(nextLink, state, channelId, queueId, hasCapacity, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterWorkerCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterWorkerCollection.DeserializeRouterWorkerCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves existing workers. - /// The URL to the next page of results. - /// If specified, select workers by worker state. - /// If specified, select workers who have a channel configuration with this channel. - /// If specified, select workers who are assigned to this queue. - /// - /// If set to true, select only workers who have capacity for the channel specified by `channelId` or for any channel - /// if `channelId` not specified. If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public Response ListWorkersNextPage(string nextLink, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) { - if (nextLink == null) + if (!cancellationToken.CanBeCanceled) { - throw new ArgumentNullException(nameof(nextLink)); + return DefaultRequestContext; } - using var message = CreateListWorkersNextPageRequest(nextLink, state, channelId, queueId, hasCapacity, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterWorkerCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterWorkerCollection.DeserializeRouterWorkerCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + return new RequestContext() { CancellationToken = cancellationToken }; } private static ResponseClassifier _responseClassifier200201; private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LabelOperator.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs similarity index 88% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LabelOperator.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs index c801400b0395f..37821aec00066 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LabelOperator.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// Describes how the value of the label is compared to the value pass through. + /// Describes supported operations on label values. public readonly partial struct LabelOperator : IEquatable { private readonly string _value; @@ -29,17 +29,17 @@ public LabelOperator(string value) private const string GreaterThanValue = "greaterThan"; private const string GreaterThanEqualValue = "greaterThanEqual"; - /// equal. + /// Equal. public static LabelOperator Equal { get; } = new LabelOperator(EqualValue); - /// notEqual. + /// Not Equal. public static LabelOperator NotEqual { get; } = new LabelOperator(NotEqualValue); - /// lessThan. + /// Less than. public static LabelOperator LessThan { get; } = new LabelOperator(LessThanValue); - /// lessThanEqual. + /// Less than or equal. public static LabelOperator LessThanEqual { get; } = new LabelOperator(LessThanEqualValue); - /// greaterThan. + /// Greater than. public static LabelOperator GreaterThan { get; } = new LabelOperator(GreaterThanValue); - /// greaterThanEqual. + /// Greater than or equal. public static LabelOperator GreaterThanEqual { get; } = new LabelOperator(GreaterThanEqualValue); /// Determines if two values are the same. public static bool operator ==(LabelOperator left, LabelOperator right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs index 2eead67d7af95..bbf151268ae42 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs @@ -6,35 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class LongestIdleMode : IUtf8JsonSerializable + public partial class LongestIdleMode { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - if (Optional.IsDefined(MinConcurrentOffers)) - { - writer.WritePropertyName("minConcurrentOffers"u8); - writer.WriteNumberValue(MinConcurrentOffers); - } - if (Optional.IsDefined(MaxConcurrentOffers)) - { - writer.WritePropertyName("maxConcurrentOffers"u8); - writer.WriteNumberValue(MaxConcurrentOffers); - } - if (Optional.IsDefined(BypassSelectors)) - { - writer.WritePropertyName("bypassSelectors"u8); - writer.WriteBooleanValue(BypassSelectors.Value); - } - writer.WriteEndObject(); - } - internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -82,5 +60,13 @@ internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element) } return new LongestIdleMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new LongestIdleMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLongestIdleMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs similarity index 74% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs index a1286abc78710..3ec5c0b8ae0cf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs @@ -11,19 +11,21 @@ namespace Azure.Communication.JobRouter public partial class LongestIdleMode : DistributionMode { /// Initializes a new instance of LongestIdleMode. - /// The type discriminator describing a sub-type of Mode. + /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// /// (Optional) - /// If set to true, then router will match workers to jobs even if they don't match label selectors. - /// Warning: You may get workers that are not qualified for the job they are matched with if you set this - /// variable to true. This flag is intended more for temporary usage. + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. /// By default, set to false. /// internal LongestIdleMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) { - Kind = kind ?? "longest-idle"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs index aa1024d136ebb..7565c4c96130c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs @@ -7,40 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ManualReclassifyExceptionAction : IUtf8JsonSerializable + public partial class ManualReclassifyExceptionAction { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - if (Optional.IsCollectionDefined(WorkerSelectors)) - { - writer.WritePropertyName("workerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in WorkerSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExceptionAction(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -49,7 +22,7 @@ internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExcep } Optional queueId = default; Optional priority = default; - Optional> workerSelectors = default; + Optional> workerSelectors = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -89,5 +62,13 @@ internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExcep } return new ManualReclassifyExceptionAction(kind, queueId.Value, Optional.ToNullable(priority), Optional.ToList(workerSelectors)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ManualReclassifyExceptionAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeManualReclassifyExceptionAction(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs index d4cd4a08f1062..5dbe406dd12f7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs @@ -10,27 +10,29 @@ namespace Azure.Communication.JobRouter { - /// An action that manually reclassifies a job by providing the queue, priority and worker selectors. + /// + /// An action that manually reclassifies a job by providing the queue, priority and + /// worker selectors. + /// public partial class ManualReclassifyExceptionAction : ExceptionAction { /// Initializes a new instance of ManualReclassifyExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. + /// Discriminator. /// Updated QueueId. /// Updated Priority. /// Updated WorkerSelectors. - internal ManualReclassifyExceptionAction(string kind, string queueId, int? priority, IList workerSelectors) : base(kind) + internal ManualReclassifyExceptionAction(string kind, string queueId, int? priority, IReadOnlyList workerSelectors) : base(kind) { QueueId = queueId; Priority = priority; WorkerSelectors = workerSelectors; - Kind = kind ?? "manual-reclassify"; } /// Updated QueueId. - public string QueueId { get; set; } + public string QueueId { get; } /// Updated Priority. - public int? Priority { get; set; } + public int? Priority { get; } /// Updated WorkerSelectors. - public IList WorkerSelectors { get; } + public IReadOnlyList WorkerSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs deleted file mode 100644 index 42eb31dfe4820..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// An action that marks a job as cancelled. - public partial class CancelExceptionAction : ExceptionAction - { - /// Initializes a new instance of CancelExceptionAction. - public CancelExceptionAction() - { - Kind = "cancel"; - } - - /// Initializes a new instance of CancelExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. - /// (Optional) A note that will be appended to the jobs' Notes collection with th current timestamp. - /// (Optional) Indicates the outcome of the job, populate this field with your own custom values. - internal CancelExceptionAction(string kind, string note, string dispositionCode) : base(kind) - { - Note = note; - DispositionCode = dispositionCode; - Kind = kind ?? "cancel"; - } - - /// (Optional) A note that will be appended to the jobs' Notes collection with th current timestamp. - public string Note { get; set; } - /// (Optional) Indicates the outcome of the job, populate this field with your own custom values. - public string DispositionCode { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs deleted file mode 100644 index 9b18b0cce9106..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// Request payload for deleting a job. - internal partial class CancelJobRequest - { - /// Initializes a new instance of CancelJobRequest. - public CancelJobRequest() - { - } - - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. - public string Note { get; set; } - /// - /// Indicates the outcome of the job, populate this field with your own custom values. - /// If not provided, default value of "Cancelled" is set. - /// - public string DispositionCode { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs deleted file mode 100644 index cb984d54490af..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Communication.JobRouter; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// A container for the rules that govern how jobs are classified. - public partial class ClassificationPolicy - { - /// Initializes a new instance of ClassificationPolicy. - /// Unique identifier of this policy. - /// Friendly name of this policy. - /// The fallback queue to select if the queue selector doesn't find a match. - /// - /// The queue selectors to resolve a queue for a given job. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - /// - /// The worker label selectors to attach to a given job. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - internal ClassificationPolicy(string id, string name, string fallbackQueueId, IList queueSelectors, RouterRule prioritizationRule, IList workerSelectors) - { - Id = id; - Name = name; - FallbackQueueId = fallbackQueueId; - _queueSelectors = queueSelectors; - PrioritizationRule = prioritizationRule; - _workerSelectors = workerSelectors; - } - - /// Unique identifier of this policy. - public string Id { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs deleted file mode 100644 index 6652a5ef1178a..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class ClassificationPolicyCollection - { - internal static ClassificationPolicyCollection DeserializeClassificationPolicyCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ClassificationPolicyItem.DeserializeClassificationPolicyItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new ClassificationPolicyCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs deleted file mode 100644 index 0a9c016418537..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// A paged collection of classification policies. - internal partial class ClassificationPolicyCollection - { - /// Initializes a new instance of ClassificationPolicyCollection. - /// - /// is null. - internal ClassificationPolicyCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of ClassificationPolicyCollection. - /// - /// - internal ClassificationPolicyCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs deleted file mode 100644 index 7e98c345de30b..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Request payload for closing jobs. - internal partial class CloseJobRequest - { - /// Initializes a new instance of CloseJobRequest. - /// The assignment within which the job is to be closed. - /// is null. - public CloseJobRequest(string assignmentId) - { - Argument.AssertNotNull(assignmentId, nameof(assignmentId)); - - AssignmentId = assignmentId; - } - - /// The assignment within which the job is to be closed. - public string AssignmentId { get; } - /// Indicates the outcome of the job, populate this field with your own custom values. - public string DispositionCode { get; set; } - /// - /// If not provided, worker capacity is released immediately along with a JobClosedEvent notification. - /// If provided, worker capacity is released along with a JobClosedEvent notification at a future time in UTC. - /// - public DateTimeOffset? CloseAt { get; set; } - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. - public string Note { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs deleted file mode 100644 index e25a471186de1..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class CommunicationError - { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string code = default; - string message = default; - Optional target = default; - Optional> details = default; - Optional innererror = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = property.Value.GetString(); - continue; - } - if (property.NameEquals("details"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DeserializeCommunicationError(item)); - } - details = array; - continue; - } - if (property.NameEquals("innererror"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - innererror = DeserializeCommunicationError(property.Value); - continue; - } - } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs deleted file mode 100644 index dc84a9b221a8e..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// The Communication Services error. - internal partial class CommunicationError - { - /// Initializes a new instance of CommunicationError. - /// The error code. - /// The error message. - /// or is null. - internal CommunicationError(string code, string message) - { - Argument.AssertNotNull(code, nameof(code)); - Argument.AssertNotNull(message, nameof(message)); - - Code = code; - Message = message; - Details = new ChangeTrackingList(); - } - - /// Initializes a new instance of CommunicationError. - /// The error code. - /// The error message. - /// The error target. - /// Further details about specific errors that led to this error. - /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) - { - Code = code; - Message = message; - Target = target; - Details = details; - InnerError = innerError; - } - - /// The error code. - public string Code { get; } - /// The error message. - public string Message { get; } - /// The error target. - public string Target { get; } - /// Further details about specific errors that led to this error. - public IReadOnlyList Details { get; } - /// The inner error if any. - public CommunicationError InnerError { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs deleted file mode 100644 index 839a1bf90f4c9..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Communication.JobRouter.Models; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - internal partial class CommunicationErrorResponse - { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationError error = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("error"u8)) - { - error = CommunicationError.DeserializeCommunicationError(property.Value); - continue; - } - } - return new CommunicationErrorResponse(error); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs deleted file mode 100644 index a36c24212d0cd..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Communication.JobRouter.Models; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// The Communication Services error. - internal partial class CommunicationErrorResponse - { - /// Initializes a new instance of CommunicationErrorResponse. - /// The Communication Services error. - /// is null. - internal CommunicationErrorResponse(CommunicationError error) - { - Argument.AssertNotNull(error, nameof(error)); - - Error = error; - } - - /// The Communication Services error. - public CommunicationError Error { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs deleted file mode 100644 index b3f43c4218d34..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Describes a set of queue selectors that will be attached if the given condition resolves to true. - public partial class ConditionalQueueSelectorAttachment : QueueSelectorAttachment - { - /// Initializes a new instance of ConditionalQueueSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - /// The queue selectors to attach. - /// or is null. - public ConditionalQueueSelectorAttachment(RouterRule condition, IEnumerable queueSelectors) - { - Argument.AssertNotNull(condition, nameof(condition)); - Argument.AssertNotNull(queueSelectors, nameof(queueSelectors)); - - Condition = condition; - QueueSelectors = queueSelectors.ToList(); - Kind = "conditional"; - } - - /// Initializes a new instance of ConditionalQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - /// The queue selectors to attach. - internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, IList queueSelectors) : base(kind) - { - Condition = condition; - QueueSelectors = queueSelectors; - Kind = kind ?? "conditional"; - } - - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - public RouterRule Condition { get; set; } - /// The queue selectors to attach. - public IList QueueSelectors { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs deleted file mode 100644 index 74d82d55228a0..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Describes a set of worker selectors that will be attached if the given condition resolves to true. - public partial class ConditionalWorkerSelectorAttachment : WorkerSelectorAttachment - { - /// Initializes a new instance of ConditionalWorkerSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - /// The worker selectors to attach. - /// or is null. - public ConditionalWorkerSelectorAttachment(RouterRule condition, IEnumerable workerSelectors) - { - Argument.AssertNotNull(condition, nameof(condition)); - Argument.AssertNotNull(workerSelectors, nameof(workerSelectors)); - - Condition = condition; - WorkerSelectors = workerSelectors.ToList(); - Kind = "conditional"; - } - - /// Initializes a new instance of ConditionalWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - /// The worker selectors to attach. - internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, IList workerSelectors) : base(kind) - { - Condition = condition; - WorkerSelectors = workerSelectors; - Kind = kind ?? "conditional"; - } - - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - public RouterRule Condition { get; set; } - /// The worker selectors to attach. - public IList WorkerSelectors { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs deleted file mode 100644 index fd876e060478a..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Communication.JobRouter -{ - /// Request payload for declining offers. - public partial class DeclineJobOfferRequest - { - /// Initializes a new instance of DeclineJobOfferRequest. - public DeclineJobOfferRequest() - { - } - - /// - /// If the RetryOfferAt is not provided, then this job will not be offered again to the worker who declined this job unless - /// the worker is de-registered and re-registered. If a RetryOfferAt time is provided, then the job will be re-matched to - /// eligible workers at the retry time in UTC. The worker that declined the job will also be eligible for the job at that time. - /// - public DateTimeOffset? RetryOfferAt { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs deleted file mode 100644 index 839b2a80c35cc..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class DistributionPolicyCollection - { - internal static DistributionPolicyCollection DeserializeDistributionPolicyCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DistributionPolicyItem.DeserializeDistributionPolicyItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new DistributionPolicyCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs deleted file mode 100644 index e7b8722ec7985..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// A paged collection of distribution policies. - internal partial class DistributionPolicyCollection - { - /// Initializes a new instance of DistributionPolicyCollection. - /// - /// is null. - internal DistributionPolicyCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of DistributionPolicyCollection. - /// - /// - internal DistributionPolicyCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs deleted file mode 100644 index b9241b4e8c6fe..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class ExceptionPolicyCollection - { - internal static ExceptionPolicyCollection DeserializeExceptionPolicyCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ExceptionPolicyItem.DeserializeExceptionPolicyItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new ExceptionPolicyCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs deleted file mode 100644 index 3212f5c1a48bf..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// A paged collection of exception policies. - internal partial class ExceptionPolicyCollection - { - /// Initializes a new instance of ExceptionPolicyCollection. - /// - /// is null. - internal ExceptionPolicyCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of ExceptionPolicyCollection. - /// - /// - internal ExceptionPolicyCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs deleted file mode 100644 index 84205d1b33a55..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// The JobMatchingMode. - public partial class JobMatchingMode - { - /// Initializes a new instance of JobMatchingMode. - /// - /// Any object. - /// - /// Any object. - internal JobMatchingMode(JobMatchModeType? modeType, object queueAndMatchMode, ScheduleAndSuspendMode scheduleAndSuspendMode, object suspendMode) - { - ModeType = modeType; - _queueAndMatchMode = queueAndMatchMode; - ScheduleAndSuspendMode = scheduleAndSuspendMode; - _suspendMode = suspendMode; - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs deleted file mode 100644 index e678674f3ba74..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class RouterJobCollection - { - internal static RouterJobCollection DeserializeRouterJobCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RouterJobItem.DeserializeRouterJobItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new RouterJobCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs deleted file mode 100644 index 6328876bca3a4..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// A paged collection of jobs. - internal partial class RouterJobCollection - { - /// Initializes a new instance of RouterJobCollection. - /// - /// is null. - internal RouterJobCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of RouterJobCollection. - /// - /// - internal RouterJobCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs deleted file mode 100644 index 560cee718b5ae..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class RouterQueueCollection - { - internal static RouterQueueCollection DeserializeRouterQueueCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RouterQueueItem.DeserializeRouterQueueItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new RouterQueueCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs deleted file mode 100644 index d6b977f711a0e..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// A paged collection of queues. - internal partial class RouterQueueCollection - { - /// Initializes a new instance of RouterQueueCollection. - /// - /// is null. - internal RouterQueueCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of RouterQueueCollection. - /// - /// - internal RouterQueueCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs deleted file mode 100644 index 3735293d80d29..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class RouterWorkerCollection - { - internal static RouterWorkerCollection DeserializeRouterWorkerCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RouterWorkerItem.DeserializeRouterWorkerItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new RouterWorkerCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs deleted file mode 100644 index e2c66e639b38c..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// A paged collection of workers. - internal partial class RouterWorkerCollection - { - /// Initializes a new instance of RouterWorkerCollection. - /// - /// is null. - internal RouterWorkerCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of RouterWorkerCollection. - /// - /// - internal RouterWorkerCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs deleted file mode 100644 index fac53692e8a6c..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Attaches queue selectors to a job when the RouterRule is resolved. - public partial class RuleEngineQueueSelectorAttachment : QueueSelectorAttachment - { - /// Initializes a new instance of RuleEngineQueueSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - /// is null. - public RuleEngineQueueSelectorAttachment(RouterRule rule) - { - Argument.AssertNotNull(rule, nameof(rule)); - - Rule = rule; - Kind = "rule-engine"; - } - - /// Initializes a new instance of RuleEngineQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - internal RuleEngineQueueSelectorAttachment(string kind, RouterRule rule) : base(kind) - { - Rule = rule; - Kind = kind ?? "rule-engine"; - } - - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - public RouterRule Rule { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs deleted file mode 100644 index f7d17afe7719d..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Attaches worker selectors to a job when a RouterRule is resolved. - public partial class RuleEngineWorkerSelectorAttachment : WorkerSelectorAttachment - { - /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - /// is null. - public RuleEngineWorkerSelectorAttachment(RouterRule rule) - { - Argument.AssertNotNull(rule, nameof(rule)); - - Rule = rule; - Kind = "rule-engine"; - } - - /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - internal RuleEngineWorkerSelectorAttachment(string kind, RouterRule rule) : base(kind) - { - Rule = rule; - Kind = kind ?? "rule-engine"; - } - - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - public RouterRule Rule { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs deleted file mode 100644 index b4ab199fe3a0c..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Communication.JobRouter -{ - /// The ScheduleAndSuspendMode. - public partial class ScheduleAndSuspendMode - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs deleted file mode 100644 index 5d16a85f8c18e..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// Request payload for unassigning a job. - internal partial class UnassignJobRequest - { - /// Initializes a new instance of UnassignJobRequest. - public UnassignJobRequest() - { - } - - /// If WaitForActivation is true, then the job is not queued for re-matching with a worker. - public bool? SuspendMatching { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs index 55802736c7d09..dd0c64fee6a3b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs @@ -6,28 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class Oauth2ClientCredential : IUtf8JsonSerializable + public partial class Oauth2ClientCredential { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ClientId)) - { - writer.WritePropertyName("clientId"u8); - writer.WriteStringValue(ClientId); - } - if (Optional.IsDefined(ClientSecret)) - { - writer.WritePropertyName("clientSecret"u8); - writer.WriteStringValue(ClientSecret); - } - writer.WriteEndObject(); - } - internal static Oauth2ClientCredential DeserializeOauth2ClientCredential(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -51,5 +36,13 @@ internal static Oauth2ClientCredential DeserializeOauth2ClientCredential(JsonEle } return new Oauth2ClientCredential(clientId.Value, clientSecret.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Oauth2ClientCredential FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOauth2ClientCredential(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs index 4721bad448dfc..6f5dac058549e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs @@ -9,12 +9,13 @@ namespace Azure.Communication.JobRouter { /// /// OAuth2.0 Credentials used to Contoso's Authorization server. - /// Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// public partial class Oauth2ClientCredential { /// Initializes a new instance of Oauth2ClientCredential. - public Oauth2ClientCredential() + internal Oauth2ClientCredential() { } @@ -28,8 +29,8 @@ internal Oauth2ClientCredential(string clientId, string clientSecret) } /// ClientId for Contoso Authorization server. - public string ClientId { get; set; } + public string ClientId { get; } /// Client secret for Contoso Authorization server. - public string ClientSecret { get; set; } + public string ClientSecret { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.Serialization.cs similarity index 72% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.Serialization.cs index a9a92874e708c..cfed478056063 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.Serialization.cs @@ -6,24 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class PassThroughQueueSelectorAttachment : IUtf8JsonSerializable + public partial class PassThroughQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static PassThroughQueueSelectorAttachment DeserializePassThroughQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -53,5 +42,13 @@ internal static PassThroughQueueSelectorAttachment DeserializePassThroughQueueSe } return new PassThroughQueueSelectorAttachment(kind, key, labelOperator); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PassThroughQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePassThroughQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs similarity index 76% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs index 39482420243a7..a45de58f834cc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs @@ -10,36 +10,38 @@ namespace Azure.Communication.JobRouter { - /// Attaches a queue selector where the value is passed through from the job label with the same key. + /// + /// Attaches a queue selector where the value is passed through from the job label + /// with the same key + /// public partial class PassThroughQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of PassThroughQueueSelectorAttachment. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// is null. - public PassThroughQueueSelectorAttachment(string key, LabelOperator labelOperator) + internal PassThroughQueueSelectorAttachment(string key, LabelOperator labelOperator) { Argument.AssertNotNull(key, nameof(key)); + Kind = "pass-through"; Key = key; LabelOperator = labelOperator; - Kind = "pass-through"; } /// Initializes a new instance of PassThroughQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. + /// Discriminator. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. internal PassThroughQueueSelectorAttachment(string kind, string key, LabelOperator labelOperator) : base(kind) { Key = key; LabelOperator = labelOperator; - Kind = kind ?? "pass-through"; } /// The label key to query against. - public string Key { get; set; } + public string Key { get; } /// Describes how the value of the label is compared to the value pass through. - public LabelOperator LabelOperator { get; set; } + public LabelOperator LabelOperator { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.Serialization.cs index 211f9d123e05f..cdf94f115c0a4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.Serialization.cs @@ -6,29 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class PassThroughWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class PassThroughWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - if (Optional.IsDefined(_expiresAfterSeconds)) - { - writer.WritePropertyName("expiresAfterSeconds"u8); - writer.WriteNumberValue(_expiresAfterSeconds.Value); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static PassThroughWorkerSelectorAttachment DeserializePassThroughWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -68,5 +52,13 @@ internal static PassThroughWorkerSelectorAttachment DeserializePassThroughWorker } return new PassThroughWorkerSelectorAttachment(kind, key, labelOperator, Optional.ToNullable(expiresAfterSeconds)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PassThroughWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePassThroughWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs similarity index 78% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs index e964b31767f78..fac252b68b54b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs @@ -10,24 +10,27 @@ namespace Azure.Communication.JobRouter { - /// Attaches a worker selector where the value is passed through from the job label with the same key. + /// + /// Attaches a worker selector where the value is passed through from the job label + /// with the same key + /// public partial class PassThroughWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of PassThroughWorkerSelectorAttachment. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// is null. - public PassThroughWorkerSelectorAttachment(string key, LabelOperator labelOperator) + internal PassThroughWorkerSelectorAttachment(string key, LabelOperator labelOperator) { Argument.AssertNotNull(key, nameof(key)); + Kind = "pass-through"; Key = key; LabelOperator = labelOperator; - Kind = "pass-through"; } /// Initializes a new instance of PassThroughWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. + /// Discriminator. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// Describes how long the attached label selector is valid in seconds. @@ -36,12 +39,11 @@ internal PassThroughWorkerSelectorAttachment(string kind, string key, LabelOpera Key = key; LabelOperator = labelOperator; _expiresAfterSeconds = expiresAfterSeconds; - Kind = kind ?? "pass-through"; } /// The label key to query against. - public string Key { get; set; } + public string Key { get; } /// Describes how the value of the label is compared to the value pass through. - public LabelOperator LabelOperator { get; set; } + public LabelOperator LabelOperator { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.Serialization.cs index 2dde905ad99af..d56e3b016eeaf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.Serialization.cs @@ -6,22 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class QueueLengthExceptionTrigger : IUtf8JsonSerializable + public partial class QueueLengthExceptionTrigger { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("threshold"u8); - writer.WriteNumberValue(Threshold); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static QueueLengthExceptionTrigger DeserializeQueueLengthExceptionTrigger(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +36,13 @@ internal static QueueLengthExceptionTrigger DeserializeQueueLengthExceptionTrigg } return new QueueLengthExceptionTrigger(kind, threshold); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new QueueLengthExceptionTrigger FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueueLengthExceptionTrigger(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs similarity index 80% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs index 0ec31d1af709c..65c2a215a7fab 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs @@ -11,15 +11,14 @@ namespace Azure.Communication.JobRouter public partial class QueueLengthExceptionTrigger : ExceptionTrigger { /// Initializes a new instance of QueueLengthExceptionTrigger. - /// The type discriminator describing a sub-type of ExceptionTrigger. + /// Discriminator. /// Threshold of number of jobs ahead in the queue to for this trigger to fire. internal QueueLengthExceptionTrigger(string kind, int threshold) : base(kind) { Threshold = threshold; - Kind = kind ?? "queue-length"; } /// Threshold of number of jobs ahead in the queue to for this trigger to fire. - public int Threshold { get; set; } + public int Threshold { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.Serialization.cs similarity index 76% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.Serialization.cs index 0d715f56708eb..51a3f0767034c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class QueueSelectorAttachment : IUtf8JsonSerializable + public partial class QueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static QueueSelectorAttachment DeserializeQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,5 +31,13 @@ internal static QueueSelectorAttachment DeserializeQueueSelectorAttachment(JsonE } return UnknownQueueSelectorAttachment.DeserializeUnknownQueueSelectorAttachment(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static QueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs similarity index 75% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs index 6c7db52199120..7e90dfcddcdab 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs @@ -8,17 +8,26 @@ namespace Azure.Communication.JobRouter { /// - /// An attachment of queue selectors to resolve a queue to a job from a classification policy + /// An attachment of queue selectors to resolve a queue to a job from a + /// classification policy /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// public abstract partial class QueueSelectorAttachment { /// Initializes a new instance of QueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. + protected QueueSelectorAttachment() + { + } + + /// Initializes a new instance of QueueSelectorAttachment. + /// Discriminator. internal QueueSelectorAttachment(string kind) { Kind = kind; } + + /// Discriminator. + internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.Serialization.cs similarity index 68% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.Serialization.cs index c513707f29986..81bcad23fc9cc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.Serialization.cs @@ -7,27 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class QueueWeightedAllocation : IUtf8JsonSerializable + public partial class QueueWeightedAllocation { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("weight"u8); - writer.WriteNumberValue(Weight); - writer.WritePropertyName("queueSelectors"u8); - writer.WriteStartArray(); - foreach (var item in QueueSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -35,7 +21,7 @@ internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonE return null; } double weight = default; - IList queueSelectors = default; + IReadOnlyList queueSelectors = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("weight"u8)) @@ -56,5 +42,13 @@ internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonE } return new QueueWeightedAllocation(weight, queueSelectors); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static QueueWeightedAllocation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueueWeightedAllocation(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs similarity index 54% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs index bf55da81d188a..eef8faa92f875 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs @@ -12,14 +12,20 @@ namespace Azure.Communication.JobRouter { - /// Contains the weight percentage and queue selectors to be applied if selected for weighted distributions. + /// + /// Contains the weight percentage and queue selectors to be applied if selected + /// for weighted distributions. + /// public partial class QueueWeightedAllocation { /// Initializes a new instance of QueueWeightedAllocation. /// The percentage of this weight, expressed as a fraction of 1. - /// A collection of queue selectors that will be applied if this allocation is selected. + /// + /// A collection of queue selectors that will be applied if this allocation is + /// selected. + /// /// is null. - public QueueWeightedAllocation(double weight, IEnumerable queueSelectors) + internal QueueWeightedAllocation(double weight, IEnumerable queueSelectors) { Argument.AssertNotNull(queueSelectors, nameof(queueSelectors)); @@ -29,16 +35,22 @@ public QueueWeightedAllocation(double weight, IEnumerable q /// Initializes a new instance of QueueWeightedAllocation. /// The percentage of this weight, expressed as a fraction of 1. - /// A collection of queue selectors that will be applied if this allocation is selected. - internal QueueWeightedAllocation(double weight, IList queueSelectors) + /// + /// A collection of queue selectors that will be applied if this allocation is + /// selected. + /// + internal QueueWeightedAllocation(double weight, IReadOnlyList queueSelectors) { Weight = weight; QueueSelectors = queueSelectors; } /// The percentage of this weight, expressed as a fraction of 1. - public double Weight { get; set; } - /// A collection of queue selectors that will be applied if this allocation is selected. - public IList QueueSelectors { get; } + public double Weight { get; } + /// + /// A collection of queue selectors that will be applied if this allocation is + /// selected. + /// + public IReadOnlyList QueueSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs index 6d002947efcfe..346af55b8c088 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs @@ -7,41 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ReclassifyExceptionAction : IUtf8JsonSerializable + public partial class ReclassifyExceptionAction { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ClassificationPolicyId)) - { - writer.WritePropertyName("classificationPolicyId"u8); - writer.WriteStringValue(ClassificationPolicyId); - } - if (Optional.IsCollectionDefined(_labelsToUpsert)) - { - writer.WritePropertyName("labelsToUpsert"u8); - writer.WriteStartObject(); - foreach (var item in _labelsToUpsert) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -87,5 +59,13 @@ internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(J } return new ReclassifyExceptionAction(kind, classificationPolicyId.Value, Optional.ToDictionary(labelsToUpsert)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ReclassifyExceptionAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReclassifyExceptionAction(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs similarity index 54% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs index 14036bed516f1..ac97bdb8a8a1c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs @@ -14,17 +14,25 @@ namespace Azure.Communication.JobRouter public partial class ReclassifyExceptionAction : ExceptionAction { /// Initializes a new instance of ReclassifyExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. - /// (optional) The new classification policy that will determine queue, priority and worker selectors. - /// (optional) Dictionary containing the labels to update (or add if not existing) in key-value pairs. + /// Discriminator. + /// + /// (optional) The new classification policy that will determine queue, priority + /// and worker selectors. + /// + /// + /// (optional) Dictionary containing the labels to update (or add if not existing) + /// in key-value pairs + /// internal ReclassifyExceptionAction(string kind, string classificationPolicyId, IDictionary labelsToUpsert) : base(kind) { ClassificationPolicyId = classificationPolicyId; _labelsToUpsert = labelsToUpsert; - Kind = kind ?? "reclassify"; } - /// (optional) The new classification policy that will determine queue, priority and worker selectors. - public string ClassificationPolicyId { get; set; } + /// + /// (optional) The new classification policy that will determine queue, priority + /// and worker selectors. + /// + public string ClassificationPolicyId { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs index a678e2c74982b..cc520870d602e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs @@ -6,35 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class RoundRobinMode : IUtf8JsonSerializable + public partial class RoundRobinMode { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - if (Optional.IsDefined(MinConcurrentOffers)) - { - writer.WritePropertyName("minConcurrentOffers"u8); - writer.WriteNumberValue(MinConcurrentOffers); - } - if (Optional.IsDefined(MaxConcurrentOffers)) - { - writer.WritePropertyName("maxConcurrentOffers"u8); - writer.WriteNumberValue(MaxConcurrentOffers); - } - if (Optional.IsDefined(BypassSelectors)) - { - writer.WritePropertyName("bypassSelectors"u8); - writer.WriteBooleanValue(BypassSelectors.Value); - } - writer.WriteEndObject(); - } - internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -82,5 +60,13 @@ internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element) } return new RoundRobinMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RoundRobinMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRoundRobinMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs index eac5da7ef27db..d0d4ecbb85e4c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs @@ -7,23 +7,28 @@ namespace Azure.Communication.JobRouter { - /// Jobs are distributed in order to workers, starting with the worker that is after the last worker to receive a job. + /// + /// Jobs are distributed in order to workers, starting with the worker that is + /// after the last worker to receive a job. + /// public partial class RoundRobinMode : DistributionMode { /// Initializes a new instance of RoundRobinMode. - /// The type discriminator describing a sub-type of Mode. + /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// /// (Optional) - /// If set to true, then router will match workers to jobs even if they don't match label selectors. - /// Warning: You may get workers that are not qualified for the job they are matched with if you set this - /// variable to true. This flag is intended more for temporary usage. + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. /// By default, set to false. /// internal RoundRobinMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) { - Kind = kind ?? "round-robin"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs similarity index 63% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs index e2009385449a1..6536b3bfbd686 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs @@ -8,114 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; -using Azure.Communication.JobRouter; +using Azure; +using Azure.Communication.JobRouter.Models; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { - public partial class RouterJob : IUtf8JsonSerializable + public partial class RouterJob { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ChannelReference)) - { - writer.WritePropertyName("channelReference"u8); - writer.WriteStringValue(ChannelReference); - } - if (Optional.IsDefined(ChannelId)) - { - writer.WritePropertyName("channelId"u8); - writer.WriteStringValue(ChannelId); - } - if (Optional.IsDefined(ClassificationPolicyId)) - { - writer.WritePropertyName("classificationPolicyId"u8); - writer.WriteStringValue(ClassificationPolicyId); - } - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - if (Optional.IsDefined(DispositionCode)) - { - writer.WritePropertyName("dispositionCode"u8); - writer.WriteStringValue(DispositionCode); - } - if (Optional.IsCollectionDefined(_requestedWorkerSelectors)) - { - writer.WritePropertyName("requestedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in _requestedWorkerSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(_labels)) - { - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in _labels) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(_tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in _tags) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(_notes)) - { - writer.WritePropertyName("notes"u8); - writer.WriteStartObject(); - foreach (var item in _notes) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(MatchingMode)) - { - writer.WritePropertyName("matchingMode"u8); - writer.WriteObjectValue(MatchingMode); - } - writer.WriteEndObject(); - } - internal static RouterJob DeserializeRouterJob(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional channelReference = default; Optional status = default; Optional enqueuedAt = default; @@ -126,9 +33,9 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) Optional dispositionCode = default; Optional> requestedWorkerSelectors = default; Optional> attachedWorkerSelectors = default; - Optional> labels = default; + Optional> labels = default; Optional> assignments = default; - Optional> tags = default; + Optional> tags = default; Optional> notes = default; Optional scheduledAt = default; Optional matchingMode = default; @@ -225,7 +132,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -234,7 +141,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } labels = dictionary; @@ -260,7 +167,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -269,7 +176,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } tags = dictionary; @@ -308,7 +215,15 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) continue; } } - return new RouterJob(id.Value, channelReference.Value, Optional.ToNullable(status), Optional.ToNullable(enqueuedAt), channelId.Value, classificationPolicyId.Value, queueId.Value, Optional.ToNullable(priority), dispositionCode.Value, Optional.ToList(requestedWorkerSelectors), Optional.ToList(attachedWorkerSelectors), Optional.ToDictionary(labels), Optional.ToDictionary(assignments), Optional.ToDictionary(tags), Optional.ToDictionary(notes), Optional.ToNullable(scheduledAt), matchingMode.Value); + return new RouterJob(id, channelReference.Value, Optional.ToNullable(status), Optional.ToNullable(enqueuedAt), channelId.Value, classificationPolicyId.Value, queueId.Value, Optional.ToNullable(priority), dispositionCode.Value, Optional.ToList(requestedWorkerSelectors), Optional.ToList(attachedWorkerSelectors), Optional.ToDictionary(labels), Optional.ToDictionary(assignments), Optional.ToDictionary(tags), Optional.ToDictionary(notes), Optional.ToNullable(scheduledAt), matchingMode.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJob FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJob(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs index 9f9f34901fe67..421a63ec4f63a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs @@ -7,10 +7,10 @@ using System; using System.Collections.Generic; -using Azure.Communication.JobRouter; +using Azure.Communication.JobRouter.Models; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// A unit of work to be routed. public partial class RouterJob @@ -25,9 +25,18 @@ public partial class RouterJob /// The Id of the Queue that this job is queued to. /// The priority of this job. /// Reason code for cancelled or closed jobs. - /// A collection of manually specified label selectors, which a worker must satisfy in order to process this job. - /// A collection of label selectors attached by a classification policy, which a worker must satisfy in order to process this job. - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. + /// + /// A collection of manually specified label selectors, which a worker must satisfy + /// in order to process this job. + /// + /// + /// A collection of label selectors attached by a classification policy, which a + /// worker must satisfy in order to process this job. + /// + /// + /// A set of key/value pairs that are identifying attributes used by the rules + /// engines to make decisions. + /// /// /// A collection of the assignments of the job. /// Key is AssignmentId. @@ -35,8 +44,21 @@ public partial class RouterJob /// A set of non-identifying attributes attached to this job. /// Notes attached to a job, sorted by timestamp. /// If set, job will be scheduled to be enqueued at a given time. - /// - internal RouterJob(string id, string channelReference, RouterJobStatus? status, DateTimeOffset? enqueuedAt, string channelId, string classificationPolicyId, string queueId, int? priority, string dispositionCode, IList requestedWorkerSelectors, IReadOnlyList attachedWorkerSelectors, IDictionary labels, IReadOnlyDictionary assignments, IDictionary tags, IDictionary notes, DateTimeOffset? scheduledAt, JobMatchingMode matchingMode) + /// + /// The matching mode to be applied to this job. + /// + /// Supported types: + /// + /// + /// QueueAndMatchMode: Used when matching worker to a job is required to be + /// done right after job is queued. + /// ScheduleAndSuspendMode: Used for scheduling + /// jobs to be queued at a future time. At specified time, matching of a worker to + /// the job will not start automatically. + /// SuspendMode: Used when matching workers + /// to a job needs to be suspended. + /// + internal RouterJob(string id, string channelReference, RouterJobStatus? status, DateTimeOffset? enqueuedAt, string channelId, string classificationPolicyId, string queueId, int? priority, string dispositionCode, IList requestedWorkerSelectors, IReadOnlyList attachedWorkerSelectors, IDictionary labels, IReadOnlyDictionary assignments, IDictionary tags, IDictionary notes, DateTimeOffset? scheduledAt, JobMatchingMode matchingMode) { Id = id; ChannelReference = channelReference; @@ -63,7 +85,10 @@ internal RouterJob(string id, string channelReference, RouterJobStatus? status, public RouterJobStatus? Status { get; } /// The time a job was queued in UTC. public DateTimeOffset? EnqueuedAt { get; } - /// A collection of label selectors attached by a classification policy, which a worker must satisfy in order to process this job. + /// + /// A collection of label selectors attached by a classification policy, which a + /// worker must satisfy in order to process this job. + /// public IReadOnlyList AttachedWorkerSelectors { get; } /// /// A collection of the assignments of the job. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.Serialization.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.Serialization.cs index ded886157399f..690cb61a0a81e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.Serialization.cs @@ -7,9 +7,10 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterJobAssignment { @@ -62,5 +63,13 @@ internal static RouterJobAssignment DeserializeRouterJobAssignment(JsonElement e } return new RouterJobAssignment(assignmentId, workerId.Value, assignedAt, Optional.ToNullable(completedAt), Optional.ToNullable(closedAt)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobAssignment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobAssignment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.cs similarity index 98% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.cs index 4c3f4fb5f8fe4..ad680e8d62ed5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.cs @@ -8,7 +8,7 @@ using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// Assignment details of a job to a worker. public partial class RouterJobAssignment diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs similarity index 62% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs index f36b43a30ef58..9a2c2ef4af621 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs @@ -6,6 +6,8 @@ #nullable disable using System.Text.Json; +using Azure; +using Azure.Communication.JobRouter; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -18,16 +20,12 @@ internal static RouterJobItem DeserializeRouterJobItem(JsonElement element) { return null; } - Optional job = default; - Optional etag = default; + RouterJob job = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("job"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } job = RouterJob.DeserializeRouterJob(property.Value); continue; } @@ -37,7 +35,15 @@ internal static RouterJobItem DeserializeRouterJobItem(JsonElement element) continue; } } - return new RouterJobItem(job.Value, etag.Value); + return new RouterJobItem(job, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs index 164f65bc97305..2493e78aace3f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs @@ -5,21 +5,24 @@ #nullable disable +using System; +using Azure.Communication.JobRouter; +using Azure.Core; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of RouterJob. public partial class RouterJobItem { - /// Initializes a new instance of RouterJobItem. - internal RouterJobItem() - { - } - /// Initializes a new instance of RouterJobItem. /// A unit of work to be routed. /// (Optional) The Concurrency Token. + /// or is null. internal RouterJobItem(RouterJob job, string etag) { + Argument.AssertNotNull(job, nameof(job)); + Argument.AssertNotNull(etag, nameof(etag)); + Job = job; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.Serialization.cs similarity index 84% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.Serialization.cs index f361747e7be1d..460429f98a296 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.Serialization.cs @@ -7,6 +7,7 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -62,5 +63,13 @@ internal static RouterJobOffer DeserializeRouterJobOffer(JsonElement element) } return new RouterJobOffer(offerId, jobId, capacityCost, Optional.ToNullable(offeredAt), Optional.ToNullable(expiresAt)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobOffer FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobOffer(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.cs similarity index 100% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.cs diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.Serialization.cs similarity index 81% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.Serialization.cs index d054449b6bcf3..4df8ca5dd05fa 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -53,5 +54,13 @@ internal static RouterJobPositionDetails DeserializeRouterJobPositionDetails(Jso } return new RouterJobPositionDetails(jobId, position, queueId, queueLength, estimatedWaitTimeMinutes); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobPositionDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobPositionDetails(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.cs similarity index 100% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.cs diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatus.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatus.cs similarity index 83% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatus.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatus.cs index af78cdc21ca24..e67d4baf88023 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatus.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatus.cs @@ -35,29 +35,29 @@ public RouterJobStatus(string value) private const string ScheduleFailedValue = "scheduleFailed"; private const string WaitingForActivationValue = "waitingForActivation"; - /// pendingClassification. + /// Job is waiting to be classified. public static RouterJobStatus PendingClassification { get; } = new RouterJobStatus(PendingClassificationValue); - /// queued. + /// Job has been queued. public static RouterJobStatus Queued { get; } = new RouterJobStatus(QueuedValue); - /// assigned. + /// Job has been assigned to a worker. public static RouterJobStatus Assigned { get; } = new RouterJobStatus(AssignedValue); - /// completed. + /// Job has been completed by a worker. public static RouterJobStatus Completed { get; } = new RouterJobStatus(CompletedValue); - /// closed. + /// Job has been closed by a worker. public static RouterJobStatus Closed { get; } = new RouterJobStatus(ClosedValue); - /// cancelled. + /// Job has been cancelled. public static RouterJobStatus Cancelled { get; } = new RouterJobStatus(CancelledValue); - /// classificationFailed. + /// Classification process failed for the job. public static RouterJobStatus ClassificationFailed { get; } = new RouterJobStatus(ClassificationFailedValue); - /// created. + /// Job has been created. public static RouterJobStatus Created { get; } = new RouterJobStatus(CreatedValue); - /// pendingSchedule. + /// Job has been created but not been scheduled yet. public static RouterJobStatus PendingSchedule { get; } = new RouterJobStatus(PendingScheduleValue); - /// scheduled. + /// Job has been scheduled successfully. public static RouterJobStatus Scheduled { get; } = new RouterJobStatus(ScheduledValue); - /// scheduleFailed. + /// Job scheduling failed. public static RouterJobStatus ScheduleFailed { get; } = new RouterJobStatus(ScheduleFailedValue); - /// waitingForActivation. + /// Job is in a suspended state and waiting for an update. public static RouterJobStatus WaitingForActivation { get; } = new RouterJobStatus(WaitingForActivationValue); /// Determines if two values are the same. public static bool operator ==(RouterJobStatus left, RouterJobStatus right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatusSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatusSelector.cs similarity index 80% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatusSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatusSelector.cs index c3bf7ecb224f2..e154c07929bf9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatusSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatusSelector.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// The RouterJobStatusSelector. + /// Enums used to filters jobs by state. public readonly partial struct RouterJobStatusSelector : IEquatable { private readonly string _value; @@ -37,33 +37,33 @@ public RouterJobStatusSelector(string value) private const string WaitingForActivationValue = "waitingForActivation"; private const string ActiveValue = "active"; - /// all. + /// Default. public static RouterJobStatusSelector All { get; } = new RouterJobStatusSelector(AllValue); - /// pendingClassification. + /// Job is waiting to be classified. public static RouterJobStatusSelector PendingClassification { get; } = new RouterJobStatusSelector(PendingClassificationValue); - /// queued. + /// Job has been queued. public static RouterJobStatusSelector Queued { get; } = new RouterJobStatusSelector(QueuedValue); - /// assigned. + /// Job has been assigned to a worker. public static RouterJobStatusSelector Assigned { get; } = new RouterJobStatusSelector(AssignedValue); - /// completed. + /// Job has been completed by a worker. public static RouterJobStatusSelector Completed { get; } = new RouterJobStatusSelector(CompletedValue); - /// closed. + /// Job has been closed by a worker. public static RouterJobStatusSelector Closed { get; } = new RouterJobStatusSelector(ClosedValue); - /// cancelled. + /// Job has been cancelled. public static RouterJobStatusSelector Cancelled { get; } = new RouterJobStatusSelector(CancelledValue); - /// classificationFailed. + /// Classification process failed for the job. public static RouterJobStatusSelector ClassificationFailed { get; } = new RouterJobStatusSelector(ClassificationFailedValue); - /// created. + /// Job has been created. public static RouterJobStatusSelector Created { get; } = new RouterJobStatusSelector(CreatedValue); - /// pendingSchedule. + /// Job has been created but not been scheduled yet. public static RouterJobStatusSelector PendingSchedule { get; } = new RouterJobStatusSelector(PendingScheduleValue); - /// scheduled. + /// Job has been scheduled successfully. public static RouterJobStatusSelector Scheduled { get; } = new RouterJobStatusSelector(ScheduledValue); - /// scheduleFailed. + /// Job scheduling failed. public static RouterJobStatusSelector ScheduleFailed { get; } = new RouterJobStatusSelector(ScheduleFailedValue); - /// waitingForActivation. + /// Job is in a suspended state and waiting for an update. public static RouterJobStatusSelector WaitingForActivation { get; } = new RouterJobStatusSelector(WaitingForActivationValue); - /// active. + /// Job is in a state of PendingClassification or Queued or Assigned or ClassificationFailed or Completed or PendingSchedule or Scheduled or ScheduleFailed or WaitingForActivation. public static RouterJobStatusSelector Active { get; } = new RouterJobStatusSelector(ActiveValue); /// Determines if two values are the same. public static bool operator ==(RouterJobStatusSelector left, RouterJobStatusSelector right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs index 942f13e0b1bbd..0c3fbbfa0624e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs @@ -7,56 +7,20 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models { - public partial class RouterQueue : IUtf8JsonSerializable + public partial class RouterQueue { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(DistributionPolicyId)) - { - writer.WritePropertyName("distributionPolicyId"u8); - writer.WriteStringValue(DistributionPolicyId); - } - if (Optional.IsCollectionDefined(_labels)) - { - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in _labels) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(ExceptionPolicyId)) - { - writer.WritePropertyName("exceptionPolicyId"u8); - writer.WriteStringValue(ExceptionPolicyId); - } - writer.WriteEndObject(); - } - internal static RouterQueue DeserializeRouterQueue(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional name = default; Optional distributionPolicyId = default; Optional> labels = default; @@ -105,7 +69,15 @@ internal static RouterQueue DeserializeRouterQueue(JsonElement element) continue; } } - return new RouterQueue(id.Value, name.Value, distributionPolicyId.Value, Optional.ToDictionary(labels), exceptionPolicyId.Value); + return new RouterQueue(id, name.Value, distributionPolicyId.Value, Optional.ToDictionary(labels), exceptionPolicyId.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueue FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueue(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs index 0345ead4dbb11..1f1ea02d43292 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs @@ -16,9 +16,18 @@ public partial class RouterQueue /// Initializes a new instance of RouterQueue. /// The Id of this queue. /// The name of this queue. - /// The ID of the distribution policy that will determine how a job is distributed to workers. - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. - /// (Optional) The ID of the exception policy that determines various job escalation rules. + /// + /// The ID of the distribution policy that will determine how a job is distributed + /// to workers. + /// + /// + /// A set of key/value pairs that are identifying attributes used by the rules + /// engines to make decisions. + /// + /// + /// (Optional) The ID of the exception policy that determines various job + /// escalation rules. + /// internal RouterQueue(string id, string name, string distributionPolicyId, IDictionary labels, string exceptionPolicyId) { Id = id; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs index c83b801be6e9e..12edf3ab1a1b0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -18,16 +19,12 @@ internal static RouterQueueItem DeserializeRouterQueueItem(JsonElement element) { return null; } - Optional queue = default; - Optional etag = default; + RouterQueue queue = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queue"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } queue = RouterQueue.DeserializeRouterQueue(property.Value); continue; } @@ -37,7 +34,15 @@ internal static RouterQueueItem DeserializeRouterQueueItem(JsonElement element) continue; } } - return new RouterQueueItem(queue.Value, etag.Value); + return new RouterQueueItem(queue, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueueItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueueItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs similarity index 74% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs index 500f148cb4116..9dc6c9cc8215b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs @@ -5,21 +5,23 @@ #nullable disable +using System; +using Azure.Core; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of RouterQueue. public partial class RouterQueueItem { - /// Initializes a new instance of RouterQueueItem. - internal RouterQueueItem() - { - } - /// Initializes a new instance of RouterQueueItem. /// A queue that can contain jobs to be routed. /// (Optional) The Concurrency Token. + /// or is null. internal RouterQueueItem(RouterQueue queue, string etag) { + Argument.AssertNotNull(queue, nameof(queue)); + Argument.AssertNotNull(etag, nameof(etag)); + Queue = queue; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.Serialization.cs index 3e7a657830bb8..549ea1c648f3f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.Serialization.cs @@ -5,28 +5,15 @@ #nullable disable +using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class RouterQueueSelector : IUtf8JsonSerializable + public partial class RouterQueueSelector { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - if (Optional.IsDefined(_value)) - { - writer.WritePropertyName("value"u8); - writer.WriteObjectValue(_value); - } - writer.WriteEndObject(); - } - internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -35,7 +22,7 @@ internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement e } string key = default; LabelOperator labelOperator = default; - Optional value = default; + Optional value = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -54,11 +41,19 @@ internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement e { continue; } - value = property.Value.GetObject(); + value = BinaryData.FromString(property.Value.GetRawText()); continue; } } return new RouterQueueSelector(key, labelOperator, value.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueueSelector FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueueSelector(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs similarity index 57% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs index dc22889395e6d..5845fa71a7cc2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs @@ -10,14 +10,20 @@ namespace Azure.Communication.JobRouter { - /// Describes a condition that must be met against a set of labels for queue selection. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// public partial class RouterQueueSelector { /// Initializes a new instance of RouterQueueSelector. /// The label key to query against. - /// Describes how the value of the label is compared to the value defined on the label selector. + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// /// The value to compare against the actual label value with the given operator. - internal RouterQueueSelector(string key, LabelOperator labelOperator, object value) + internal RouterQueueSelector(string key, LabelOperator labelOperator, BinaryData value) { Key = key; LabelOperator = labelOperator; @@ -25,8 +31,11 @@ internal RouterQueueSelector(string key, LabelOperator labelOperator, object val } /// The label key to query against. - public string Key { get; set; } - /// Describes how the value of the label is compared to the value defined on the label selector. - public LabelOperator LabelOperator { get; set; } + public string Key { get; } + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// + public LabelOperator LabelOperator { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs similarity index 85% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs index fcb2fe0017376..a49dc50877968 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -61,5 +62,13 @@ internal static RouterQueueStatistics DeserializeRouterQueueStatistics(JsonEleme } return new RouterQueueStatistics(queueId, length, Optional.ToDictionary(estimatedWaitTimeMinutes), Optional.ToNullable(longestJobWaitTimeMinutes)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueueStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueueStatistics(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs similarity index 86% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs index c1ab84bb27d24..f898a78c15efb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs @@ -30,7 +30,10 @@ internal RouterQueueStatistics(string queueId, int length) /// Initializes a new instance of RouterQueueStatistics. /// Id of the queue these details are about. /// Length of the queue: total number of enqueued jobs. - /// The estimated wait time of this queue rounded up to the nearest minute, grouped by job priority. + /// + /// The estimated wait time of this queue rounded up to the nearest minute, grouped + /// by job priority + /// /// The wait time of the job that has been enqueued in this queue for the longest. internal RouterQueueStatistics(string queueId, int length, IReadOnlyDictionary estimatedWaitTimeMinutes, double? longestJobWaitTimeMinutes) { @@ -44,7 +47,10 @@ internal RouterQueueStatistics(string queueId, int length, IReadOnlyDictionary Length of the queue: total number of enqueued jobs. public int Length { get; } - /// The estimated wait time of this queue rounded up to the nearest minute, grouped by job priority. + /// + /// The estimated wait time of this queue rounded up to the nearest minute, grouped + /// by job priority + /// public IReadOnlyDictionary EstimatedWaitTimeMinutes { get; } /// The wait time of the job that has been enqueued in this queue for the longest. public double? LongestJobWaitTimeMinutes { get; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.Serialization.cs similarity index 75% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.Serialization.cs index 23fc431e3c0c7..c677ae8f27836 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class RouterRule : IUtf8JsonSerializable + public partial class RouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static RouterRule DeserializeRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -30,14 +22,22 @@ internal static RouterRule DeserializeRouterRule(JsonElement element) { switch (discriminator.GetString()) { - case "azure-function-rule": return FunctionRouterRule.DeserializeFunctionRouterRule(element); case "direct-map-rule": return DirectMapRouterRule.DeserializeDirectMapRouterRule(element); case "expression-rule": return ExpressionRouterRule.DeserializeExpressionRouterRule(element); + case "azure-function-rule": return FunctionRouterRule.DeserializeFunctionRouterRule(element); case "static-rule": return StaticRouterRule.DeserializeStaticRouterRule(element); case "webhook-rule": return WebhookRouterRule.DeserializeWebhookRouterRule(element); } } return UnknownRouterRule.DeserializeUnknownRouterRule(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs similarity index 55% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs index 23e1b33de56d6..4aeb6381642bf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs @@ -10,21 +10,30 @@ namespace Azure.Communication.JobRouter /// /// A rule of one of the following types: /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol. + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , and . /// public abstract partial class RouterRule { /// Initializes a new instance of RouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. internal RouterRule(string kind) { Kind = kind; } + + /// Discriminator. + internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs similarity index 62% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs index e6acdf529900c..0eb3b131bd489 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs @@ -5,102 +5,29 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; namespace Azure.Communication.JobRouter.Models { - public partial class RouterWorker : IUtf8JsonSerializable + public partial class RouterWorker { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(_queueAssignments)) - { - writer.WritePropertyName("queueAssignments"u8); - writer.WriteStartObject(); - foreach (var item in _queueAssignments) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(TotalCapacity)) - { - writer.WritePropertyName("totalCapacity"u8); - writer.WriteNumberValue(TotalCapacity.Value); - } - if (Optional.IsCollectionDefined(_labels)) - { - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in _labels) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(_tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in _tags) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(_channelConfigurations)) - { - writer.WritePropertyName("channelConfigurations"u8); - writer.WriteStartObject(); - foreach (var item in _channelConfigurations) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(AvailableForOffers)) - { - writer.WritePropertyName("availableForOffers"u8); - writer.WriteBooleanValue(AvailableForOffers.Value); - } - writer.WriteEndObject(); - } - internal static RouterWorker DeserializeRouterWorker(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional state = default; - Optional> queueAssignments = default; + Optional> queueAssignments = default; Optional totalCapacity = default; - Optional> labels = default; - Optional> tags = default; + Optional> labels = default; + Optional> tags = default; Optional> channelConfigurations = default; Optional> offers = default; Optional> assignedJobs = default; @@ -128,7 +55,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -137,7 +64,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } queueAssignments = dictionary; @@ -158,7 +85,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -167,7 +94,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } labels = dictionary; @@ -179,7 +106,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -188,7 +115,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } tags = dictionary; @@ -255,7 +182,15 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) continue; } } - return new RouterWorker(id.Value, Optional.ToNullable(state), Optional.ToDictionary(queueAssignments), Optional.ToNullable(totalCapacity), Optional.ToDictionary(labels), Optional.ToDictionary(tags), Optional.ToDictionary(channelConfigurations), Optional.ToList(offers), Optional.ToList(assignedJobs), Optional.ToNullable(loadRatio), Optional.ToNullable(availableForOffers)); + return new RouterWorker(id, Optional.ToNullable(state), Optional.ToDictionary(queueAssignments), Optional.ToNullable(totalCapacity), Optional.ToDictionary(labels), Optional.ToDictionary(tags), Optional.ToDictionary(channelConfigurations), Optional.ToList(offers), Optional.ToList(assignedJobs), Optional.ToNullable(loadRatio), Optional.ToNullable(availableForOffers)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterWorker FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterWorker(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs similarity index 67% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs index 16667760d9e9b..746db82457333 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication.JobRouter; using Azure.Core; @@ -15,18 +16,24 @@ namespace Azure.Communication.JobRouter.Models public partial class RouterWorker { /// Initializes a new instance of RouterWorker. - /// + /// Id of the worker. /// The current state of the worker. /// The queue(s) that this worker can receive work from. /// The total capacity score this worker has to manage multiple concurrent jobs. - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. + /// + /// A set of key/value pairs that are identifying attributes used by the rules + /// engines to make decisions. + /// /// A set of non-identifying attributes attached to this worker. /// The channel(s) this worker can handle and their impact on the workers capacity. /// A list of active offers issued to this worker. /// A list of assigned jobs attached to this worker. - /// A value indicating the workers capacity. A value of '1' means all capacity is consumed. A value of '0' means no capacity is currently consumed. + /// + /// A value indicating the workers capacity. A value of '1' means all capacity is + /// consumed. A value of '0' means no capacity is currently consumed. + /// /// A flag indicating this worker is open to receive offers or not. - internal RouterWorker(string id, RouterWorkerState? state, IDictionary queueAssignments, int? totalCapacity, IDictionary labels, IDictionary tags, IDictionary channelConfigurations, IReadOnlyList offers, IReadOnlyList assignedJobs, double? loadRatio, bool? availableForOffers) + internal RouterWorker(string id, RouterWorkerState? state, IDictionary queueAssignments, int? totalCapacity, IDictionary labels, IDictionary tags, IDictionary channelConfigurations, IReadOnlyList offers, IReadOnlyList assignedJobs, double? loadRatio, bool? availableForOffers) { Id = id; State = state; @@ -41,7 +48,7 @@ internal RouterWorker(string id, RouterWorkerState? state, IDictionary Gets the id. + /// Id of the worker. public string Id { get; } /// The current state of the worker. public RouterWorkerState? State { get; } @@ -49,7 +56,10 @@ internal RouterWorker(string id, RouterWorkerState? state, IDictionary Offers { get; } /// A list of assigned jobs attached to this worker. public IReadOnlyList AssignedJobs { get; } - /// A value indicating the workers capacity. A value of '1' means all capacity is consumed. A value of '0' means no capacity is currently consumed. + /// + /// A value indicating the workers capacity. A value of '1' means all capacity is + /// consumed. A value of '0' means no capacity is currently consumed. + /// public double? LoadRatio { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.Serialization.cs similarity index 79% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.Serialization.cs index 1e6728c1de31e..04981dea5db05 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.Serialization.cs @@ -7,6 +7,7 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -48,5 +49,13 @@ internal static RouterWorkerAssignment DeserializeRouterWorkerAssignment(JsonEle } return new RouterWorkerAssignment(assignmentId, jobId, capacityCost, assignedAt); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterWorkerAssignment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterWorkerAssignment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.cs similarity index 100% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.cs diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs index 2cb7705355134..ddd10d08904e1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -18,16 +19,12 @@ internal static RouterWorkerItem DeserializeRouterWorkerItem(JsonElement element { return null; } - Optional worker = default; - Optional etag = default; + RouterWorker worker = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("worker"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } worker = RouterWorker.DeserializeRouterWorker(property.Value); continue; } @@ -37,7 +34,15 @@ internal static RouterWorkerItem DeserializeRouterWorkerItem(JsonElement element continue; } } - return new RouterWorkerItem(worker.Value, etag.Value); + return new RouterWorkerItem(worker, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterWorkerItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterWorkerItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs similarity index 74% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs index 4dcce17c844b9..477f6148ce7bd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs @@ -5,21 +5,23 @@ #nullable disable +using System; +using Azure.Core; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of RouterWorker. public partial class RouterWorkerItem { - /// Initializes a new instance of RouterWorkerItem. - internal RouterWorkerItem() - { - } - /// Initializes a new instance of RouterWorkerItem. /// An entity for jobs to be routed to. /// (Optional) The Concurrency Token. + /// or is null. internal RouterWorkerItem(RouterWorker worker, string etag) { + Argument.AssertNotNull(worker, nameof(worker)); + Argument.AssertNotNull(etag, nameof(etag)); + Worker = worker; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.Serialization.cs similarity index 73% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.Serialization.cs index e9325552eff88..9957f5be7d943 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.Serialization.cs @@ -7,38 +7,13 @@ using System; using System.Text.Json; -using Azure.Communication.JobRouter.Models; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class RouterWorkerSelector : IUtf8JsonSerializable + public partial class RouterWorkerSelector { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - if (Optional.IsDefined(_value)) - { - writer.WritePropertyName("value"u8); - writer.WriteObjectValue(_value); - } - if (Optional.IsDefined(_expiresAfterSeconds)) - { - writer.WritePropertyName("expiresAfterSeconds"u8); - writer.WriteNumberValue(_expiresAfterSeconds.Value); - } - if (Optional.IsDefined(Expedite)) - { - writer.WritePropertyName("expedite"u8); - writer.WriteBooleanValue(Expedite.Value); - } - writer.WriteEndObject(); - } - internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -47,7 +22,7 @@ internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement } string key = default; LabelOperator labelOperator = default; - Optional value = default; + Optional value = default; Optional expiresAfterSeconds = default; Optional expedite = default; Optional status = default; @@ -70,7 +45,7 @@ internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement { continue; } - value = property.Value.GetObject(); + value = BinaryData.FromString(property.Value.GetRawText()); continue; } if (property.NameEquals("expiresAfterSeconds"u8)) @@ -112,5 +87,13 @@ internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement } return new RouterWorkerSelector(key, labelOperator, value.Value, Optional.ToNullable(expiresAfterSeconds), Optional.ToNullable(expedite), Optional.ToNullable(status), Optional.ToNullable(expiresAt)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterWorkerSelector FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterWorkerSelector(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs index 05552a8b80519..f2d41bcbd23e7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs @@ -6,23 +6,28 @@ #nullable disable using System; -using Azure.Communication.JobRouter.Models; using Azure.Core; namespace Azure.Communication.JobRouter { - /// Describes a condition that must be met against a set of labels for worker selection. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// public partial class RouterWorkerSelector { /// Initializes a new instance of RouterWorkerSelector. /// The label key to query against. - /// Describes how the value of the label is compared to the value defined on the label selector. + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// /// The value to compare against the actual label value with the given operator. /// Describes how long this label selector is valid in seconds. /// Pushes the job to the front of the queue as long as this selector is active. /// The status of the worker selector. /// The time at which this worker selector expires in UTC. - internal RouterWorkerSelector(string key, LabelOperator labelOperator, object value, double? expiresAfterSeconds, bool? expedite, RouterWorkerSelectorStatus? status, DateTimeOffset? expiresAt) + internal RouterWorkerSelector(string key, LabelOperator labelOperator, BinaryData value, double? expiresAfterSeconds, bool? expedite, RouterWorkerSelectorStatus? status, DateTimeOffset? expiresAt) { Key = key; LabelOperator = labelOperator; @@ -34,11 +39,14 @@ internal RouterWorkerSelector(string key, LabelOperator labelOperator, object va } /// The label key to query against. - public string Key { get; set; } - /// Describes how the value of the label is compared to the value defined on the label selector. - public LabelOperator LabelOperator { get; set; } + public string Key { get; } + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// + public LabelOperator LabelOperator { get; } /// Pushes the job to the front of the queue as long as this selector is active. - public bool? Expedite { get; set; } + public bool? Expedite { get; } /// The status of the worker selector. public RouterWorkerSelectorStatus? Status { get; } /// The time at which this worker selector expires in UTC. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelectorStatus.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelectorStatus.cs similarity index 94% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelectorStatus.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelectorStatus.cs index e3cb273b0b254..4f8b793e1c3ae 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelectorStatus.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelectorStatus.cs @@ -8,7 +8,7 @@ using System; using System.ComponentModel; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// The status of the worker selector. public readonly partial struct RouterWorkerSelectorStatus : IEquatable @@ -25,9 +25,9 @@ public RouterWorkerSelectorStatus(string value) private const string ActiveValue = "active"; private const string ExpiredValue = "expired"; - /// active. + /// Active. public static RouterWorkerSelectorStatus Active { get; } = new RouterWorkerSelectorStatus(ActiveValue); - /// expired. + /// Expired. public static RouterWorkerSelectorStatus Expired { get; } = new RouterWorkerSelectorStatus(ExpiredValue); /// Determines if two values are the same. public static bool operator ==(RouterWorkerSelectorStatus left, RouterWorkerSelectorStatus right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerState.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerState.cs similarity index 87% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerState.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerState.cs index 1b2ffe255577e..35b83c0442144 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerState.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerState.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// The current state of the worker. + /// Enums for worker status. public readonly partial struct RouterWorkerState : IEquatable { private readonly string _value; @@ -26,11 +26,11 @@ public RouterWorkerState(string value) private const string DrainingValue = "draining"; private const string InactiveValue = "inactive"; - /// active. + /// Worker is active and available to take offers. public static RouterWorkerState Active { get; } = new RouterWorkerState(ActiveValue); - /// draining. + /// Worker is not active, if there are existing offers they are being revoked. No new offers are sent. public static RouterWorkerState Draining { get; } = new RouterWorkerState(DrainingValue); - /// inactive. + /// Worker is not active. No new offers are sent. public static RouterWorkerState Inactive { get; } = new RouterWorkerState(InactiveValue); /// Determines if two values are the same. public static bool operator ==(RouterWorkerState left, RouterWorkerState right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerStateSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerStateSelector.cs similarity index 86% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerStateSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerStateSelector.cs index 363479c7c260b..3329716d96044 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerStateSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerStateSelector.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// The RouterWorkerStateSelector. + /// Enums used to filters workers by state. public readonly partial struct RouterWorkerStateSelector : IEquatable { private readonly string _value; @@ -27,13 +27,13 @@ public RouterWorkerStateSelector(string value) private const string InactiveValue = "inactive"; private const string AllValue = "all"; - /// active. + /// Worker is active and available to take offers. public static RouterWorkerStateSelector Active { get; } = new RouterWorkerStateSelector(ActiveValue); - /// draining. + /// Worker is not active, if there are existing offers they are being revoked. No new offers are sent. public static RouterWorkerStateSelector Draining { get; } = new RouterWorkerStateSelector(DrainingValue); - /// inactive. + /// Worker is not active. No new offers are sent. public static RouterWorkerStateSelector Inactive { get; } = new RouterWorkerStateSelector(InactiveValue); - /// all. + /// Worker is active or draining or inactive. public static RouterWorkerStateSelector All { get; } = new RouterWorkerStateSelector(AllValue); /// Determines if two values are the same. public static bool operator ==(RouterWorkerStateSelector left, RouterWorkerStateSelector right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.Serialization.cs index 714d96bd0e8df..12aeac99b7945 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.Serialization.cs @@ -6,22 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class RuleEngineQueueSelectorAttachment : IUtf8JsonSerializable + public partial class RuleEngineQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("rule"u8); - writer.WriteObjectValue(Rule); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static RuleEngineQueueSelectorAttachment DeserializeRuleEngineQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +36,13 @@ internal static RuleEngineQueueSelectorAttachment DeserializeRuleEngineQueueSele } return new RuleEngineQueueSelectorAttachment(kind, rule); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RuleEngineQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRuleEngineQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs new file mode 100644 index 0000000000000..cb56981ecf8ae --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Attaches queue selectors to a job when the RouterRule is resolved. + public partial class RuleEngineQueueSelectorAttachment : QueueSelectorAttachment + { + /// Initializes a new instance of RuleEngineQueueSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// is null. + internal RuleEngineQueueSelectorAttachment(RouterRule rule) + { + Argument.AssertNotNull(rule, nameof(rule)); + + Kind = "rule-engine"; + Rule = rule; + } + + /// Initializes a new instance of RuleEngineQueueSelectorAttachment. + /// Discriminator. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + internal RuleEngineQueueSelectorAttachment(string kind, RouterRule rule) : base(kind) + { + Rule = rule; + } + + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , and . + /// + public RouterRule Rule { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.Serialization.cs index 0b2db2ff0c89c..49e65dd1f9159 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.Serialization.cs @@ -6,22 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class RuleEngineWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class RuleEngineWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("rule"u8); - writer.WriteObjectValue(Rule); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static RuleEngineWorkerSelectorAttachment DeserializeRuleEngineWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +36,13 @@ internal static RuleEngineWorkerSelectorAttachment DeserializeRuleEngineWorkerSe } return new RuleEngineWorkerSelectorAttachment(kind, rule); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RuleEngineWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRuleEngineWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs new file mode 100644 index 0000000000000..ad23a454d56b4 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Attaches worker selectors to a job when a RouterRule is resolved. + public partial class RuleEngineWorkerSelectorAttachment : WorkerSelectorAttachment + { + /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// is null. + internal RuleEngineWorkerSelectorAttachment(RouterRule rule) + { + Argument.AssertNotNull(rule, nameof(rule)); + + Kind = "rule-engine"; + Rule = rule; + } + + /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. + /// Discriminator. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + internal RuleEngineWorkerSelectorAttachment(string kind, RouterRule rule) : base(kind) + { + Rule = rule; + } + + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , and . + /// + public RouterRule Rule { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.Serialization.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.Serialization.cs index 96abdd31f9f35..543ae1b2d1679 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.Serialization.cs @@ -7,23 +7,13 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ScheduleAndSuspendMode : IUtf8JsonSerializable + public partial class ScheduleAndSuspendMode { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ScheduleAt)) - { - writer.WritePropertyName("scheduleAt"u8); - writer.WriteStringValue(ScheduleAt, "O"); - } - writer.WriteEndObject(); - } - internal static ScheduleAndSuspendMode DeserializeScheduleAndSuspendMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -43,7 +33,15 @@ internal static ScheduleAndSuspendMode DeserializeScheduleAndSuspendMode(JsonEle continue; } } - return new ScheduleAndSuspendMode(scheduleAt); + return new ScheduleAndSuspendMode(Optional.ToNullable(scheduleAt)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ScheduleAndSuspendMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeScheduleAndSuspendMode(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs new file mode 100644 index 0000000000000..951a0a9e04a9e --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Communication.JobRouter +{ + /// + /// Describes a matching mode used for scheduling jobs to be queued at a future + /// time. + /// At the specified time, matching worker to a job will not start + /// automatically. + /// + public partial class ScheduleAndSuspendMode + { + /// Scheduled time. + public DateTimeOffset? ScheduleAt { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs index 02012cc87f00c..df4aa0fa90e1e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs @@ -7,44 +7,14 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; namespace Azure.Communication.JobRouter.Models { - public partial class ScoringRuleOptions : IUtf8JsonSerializable + public partial class ScoringRuleOptions { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(BatchSize)) - { - writer.WritePropertyName("batchSize"u8); - writer.WriteNumberValue(BatchSize.Value); - } - if (Optional.IsCollectionDefined(ScoringParameters)) - { - writer.WritePropertyName("scoringParameters"u8); - writer.WriteStartArray(); - foreach (var item in ScoringParameters) - { - writer.WriteStringValue(item.ToString()); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(AllowScoringBatchOfWorkers)) - { - writer.WritePropertyName("allowScoringBatchOfWorkers"u8); - writer.WriteBooleanValue(AllowScoringBatchOfWorkers.Value); - } - if (Optional.IsDefined(DescendingOrder)) - { - writer.WritePropertyName("descendingOrder"u8); - writer.WriteBooleanValue(DescendingOrder.Value); - } - writer.WriteEndObject(); - } - internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -101,5 +71,13 @@ internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement ele } return new ScoringRuleOptions(Optional.ToNullable(batchSize), Optional.ToList(scoringParameters), Optional.ToNullable(allowScoringBatchOfWorkers), Optional.ToNullable(descendingOrder)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ScoringRuleOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeScoringRuleOptions(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs similarity index 50% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs index e92ce48766ad7..69d77e2b4c80a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs @@ -11,26 +11,40 @@ namespace Azure.Communication.JobRouter.Models { - /// Encapsulates all options that can be passed as parameters for scoring rule with BestWorkerMode. + /// + /// Encapsulates all options that can be passed as parameters for scoring rule with + /// BestWorkerMode + /// public partial class ScoringRuleOptions { /// Initializes a new instance of ScoringRuleOptions. - /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. Defaults to 20 if not configured. + /// + /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. + /// Defaults to 20 if not configured. + /// /// - /// (Optional) List of extra parameters from the job that will be sent as part of the payload to scoring rule. - /// If not set, the job's labels (sent in the payload as `job`) and the job's worker selectors (sent in the payload as `selectors`) + /// (Optional) List of extra parameters from the job that will be sent as part of + /// the payload to scoring rule. + /// If not set, the job's labels (sent in the payload + /// as `job`) and the job's worker selectors (sent in the payload as + /// `selectors`) /// are added to the payload of the scoring rule by default. - /// Note: Worker labels are always sent with scoring payload. + /// Note: + /// Worker labels are always sent with scoring payload. /// /// /// (Optional) - /// If set to true, will score workers in batches, and the parameter name of the worker labels will be sent as `workers`. - /// By default, set to false and the parameter name for the worker labels will be sent as `worker`. - /// Note: If enabled, use BatchSize to set batch size. + /// If set to true, will score workers in batches, and the parameter + /// name of the worker labels will be sent as `workers`. + /// By default, set to false + /// and the parameter name for the worker labels will be sent as `worker`. + /// Note: If + /// enabled, use BatchSize to set batch size. /// /// /// (Optional) - /// If false, will sort scores by ascending order. By default, set to true. + /// If false, will sort scores by ascending order. By default, set to + /// true. /// internal ScoringRuleOptions(int? batchSize, IList scoringParameters, bool? allowScoringBatchOfWorkers, bool? descendingOrder) { @@ -40,19 +54,26 @@ internal ScoringRuleOptions(int? batchSize, IList DescendingOrder = descendingOrder; } - /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. Defaults to 20 if not configured. - public int? BatchSize { get; set; } + /// + /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. + /// Defaults to 20 if not configured. + /// + public int? BatchSize { get; } /// /// (Optional) - /// If set to true, will score workers in batches, and the parameter name of the worker labels will be sent as `workers`. - /// By default, set to false and the parameter name for the worker labels will be sent as `worker`. - /// Note: If enabled, use BatchSize to set batch size. + /// If set to true, will score workers in batches, and the parameter + /// name of the worker labels will be sent as `workers`. + /// By default, set to false + /// and the parameter name for the worker labels will be sent as `worker`. + /// Note: If + /// enabled, use BatchSize to set batch size. /// - public bool? AllowScoringBatchOfWorkers { get; set; } + public bool? AllowScoringBatchOfWorkers { get; } /// /// (Optional) - /// If false, will sort scores by ascending order. By default, set to true. + /// If false, will sort scores by ascending order. By default, set to + /// true. /// - public bool? DescendingOrder { get; set; } + public bool? DescendingOrder { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleParameterSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleParameterSelector.cs similarity index 91% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleParameterSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleParameterSelector.cs index 17a9209a264dd..892d4c8012960 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleParameterSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleParameterSelector.cs @@ -25,9 +25,9 @@ public ScoringRuleParameterSelector(string value) private const string JobLabelsValue = "jobLabels"; private const string WorkerSelectorsValue = "workerSelectors"; - /// jobLabels. + /// Parameter to add job labels to scoring payload. Property is sent as `job`. public static ScoringRuleParameterSelector JobLabels { get; } = new ScoringRuleParameterSelector(JobLabelsValue); - /// workerSelectors. + /// Parameter to add worker selectors from the job to scoring payload. Property is sent as `selectors`. public static ScoringRuleParameterSelector WorkerSelectors { get; } = new ScoringRuleParameterSelector(WorkerSelectorsValue); /// Determines if two values are the same. public static bool operator ==(ScoringRuleParameterSelector left, ScoringRuleParameterSelector right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.Serialization.cs index 08c2ea517a421..8fb41d9c715de 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.Serialization.cs @@ -6,22 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class StaticQueueSelectorAttachment : IUtf8JsonSerializable + public partial class StaticQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("queueSelector"u8); - writer.WriteObjectValue(QueueSelector); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static StaticQueueSelectorAttachment DeserializeStaticQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +36,13 @@ internal static StaticQueueSelectorAttachment DeserializeStaticQueueSelectorAtta } return new StaticQueueSelectorAttachment(kind, queueSelector); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new StaticQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeStaticQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs similarity index 60% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs index 278e5cc7c70dc..491eb4335cdec 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs @@ -14,26 +14,34 @@ namespace Azure.Communication.JobRouter public partial class StaticQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of StaticQueueSelectorAttachment. - /// Describes a condition that must be met against a set of labels for queue selection. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// /// is null. - public StaticQueueSelectorAttachment(RouterQueueSelector queueSelector) + internal StaticQueueSelectorAttachment(RouterQueueSelector queueSelector) { Argument.AssertNotNull(queueSelector, nameof(queueSelector)); - QueueSelector = queueSelector; Kind = "static"; + QueueSelector = queueSelector; } /// Initializes a new instance of StaticQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. - /// Describes a condition that must be met against a set of labels for queue selection. + /// Discriminator. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// internal StaticQueueSelectorAttachment(string kind, RouterQueueSelector queueSelector) : base(kind) { QueueSelector = queueSelector; - Kind = kind ?? "static"; } - /// Describes a condition that must be met against a set of labels for queue selection. - public RouterQueueSelector QueueSelector { get; set; } + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// + public RouterQueueSelector QueueSelector { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.Serialization.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.Serialization.cs index cea28aad59aa2..2b2a3bedbb944 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.Serialization.cs @@ -5,33 +5,22 @@ #nullable disable +using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class StaticRouterRule : IUtf8JsonSerializable + public partial class StaticRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(_value)) - { - writer.WritePropertyName("value"u8); - writer.WriteObjectValue(_value); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional value = default; + Optional value = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -41,7 +30,7 @@ internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element { continue; } - value = property.Value.GetObject(); + value = BinaryData.FromString(property.Value.GetRawText()); continue; } if (property.NameEquals("kind"u8)) @@ -52,5 +41,13 @@ internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element } return new StaticRouterRule(kind, value.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new StaticRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeStaticRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs similarity index 50% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs index d5ad0339475d8..1ce755e397f62 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs @@ -5,18 +5,28 @@ #nullable disable +using System; + namespace Azure.Communication.JobRouter { - /// A rule providing static rules that always return the same result, regardless of input. + /// + /// A rule providing static rules that always return the same result, regardless of + /// input. + /// public partial class StaticRouterRule : RouterRule { /// Initializes a new instance of StaticRouterRule. - /// The type discriminator describing a sub-type of Rule. + internal StaticRouterRule() + { + Kind = "static-rule"; + } + + /// Initializes a new instance of StaticRouterRule. + /// Discriminator. /// The static value this rule always returns. - internal StaticRouterRule(string kind, object value) : base(kind) + internal StaticRouterRule(string kind, BinaryData value) : base(kind) { _value = value; - Kind = kind ?? "static-rule"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.Serialization.cs index 3d43861eae327..c4bcdc25bba79 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.Serialization.cs @@ -6,22 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class StaticWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class StaticWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("workerSelector"u8); - writer.WriteObjectValue(WorkerSelector); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static StaticWorkerSelectorAttachment DeserializeStaticWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +36,13 @@ internal static StaticWorkerSelectorAttachment DeserializeStaticWorkerSelectorAt } return new StaticWorkerSelectorAttachment(kind, workerSelector); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new StaticWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeStaticWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs similarity index 60% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs index e82a89e461326..31d1a60e47a12 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs @@ -14,26 +14,34 @@ namespace Azure.Communication.JobRouter public partial class StaticWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of StaticWorkerSelectorAttachment. - /// Describes a condition that must be met against a set of labels for worker selection. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// /// is null. - public StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector) + internal StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector) { Argument.AssertNotNull(workerSelector, nameof(workerSelector)); - WorkerSelector = workerSelector; Kind = "static"; + WorkerSelector = workerSelector; } /// Initializes a new instance of StaticWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. - /// Describes a condition that must be met against a set of labels for worker selection. + /// Discriminator. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// internal StaticWorkerSelectorAttachment(string kind, RouterWorkerSelector workerSelector) : base(kind) { WorkerSelector = workerSelector; - Kind = kind ?? "static"; } - /// Describes a condition that must be met against a set of labels for worker selection. - public RouterWorkerSelector WorkerSelector { get; set; } + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// + public RouterWorkerSelector WorkerSelector { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs index 83225de580186..4c14246a8a3d3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs @@ -22,5 +22,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.cs new file mode 100644 index 0000000000000..5ae1aa9119f3a --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Request payload for unassigning a job. + internal partial class UnassignJobRequest + { + /// Initializes a new instance of UnassignJobRequest. + public UnassignJobRequest() + { + } + + /// Initializes a new instance of UnassignJobRequest. + /// + /// If SuspendMatching is true, then the job is not queued for re-matching with a + /// worker. + /// + internal UnassignJobRequest(bool? suspendMatching) + { + SuspendMatching = suspendMatching; + } + + /// + /// If SuspendMatching is true, then the job is not queued for re-matching with a + /// worker. + /// + public bool? SuspendMatching { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.Serialization.cs similarity index 73% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.Serialization.cs index 7c56e903fee2a..0ebbf6a879c6d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -35,5 +36,13 @@ internal static UnassignJobResult DeserializeUnassignJobResult(JsonElement eleme } return new UnassignJobResult(jobId, unassignmentCount); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UnassignJobResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnassignJobResult(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.cs similarity index 100% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.cs diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs index 93c905cd442fa..1092d82b05771 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs @@ -6,35 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - internal partial class UnknownDistributionMode : IUtf8JsonSerializable + internal partial class UnknownDistributionMode { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - if (Optional.IsDefined(MinConcurrentOffers)) - { - writer.WritePropertyName("minConcurrentOffers"u8); - writer.WriteNumberValue(MinConcurrentOffers); - } - if (Optional.IsDefined(MaxConcurrentOffers)) - { - writer.WritePropertyName("maxConcurrentOffers"u8); - writer.WriteNumberValue(MaxConcurrentOffers); - } - if (Optional.IsDefined(BypassSelectors)) - { - writer.WritePropertyName("bypassSelectors"u8); - writer.WriteBooleanValue(BypassSelectors.Value); - } - writer.WriteEndObject(); - } - internal static UnknownDistributionMode DeserializeUnknownDistributionMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -82,5 +60,13 @@ internal static UnknownDistributionMode DeserializeUnknownDistributionMode(JsonE } return new UnknownDistributionMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownDistributionMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownDistributionMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs index d981b091109f3..ae426ad8ff339 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs @@ -7,23 +7,30 @@ namespace Azure.Communication.JobRouter { - /// The UnknownDistributionMode. + /// Unknown version of DistributionMode. internal partial class UnknownDistributionMode : DistributionMode { /// Initializes a new instance of UnknownDistributionMode. - /// The type discriminator describing a sub-type of Mode. + internal UnknownDistributionMode() + { + } + + /// Initializes a new instance of UnknownDistributionMode. + /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// /// (Optional) - /// If set to true, then router will match workers to jobs even if they don't match label selectors. - /// Warning: You may get workers that are not qualified for the job they are matched with if you set this - /// variable to true. This flag is intended more for temporary usage. + /// If set to true, then router will match workers to jobs even if they + /// don't match label selectors. + /// Warning: You may get workers that are not + /// qualified for the job they are matched with if you set this + /// variable to true. + /// This flag is intended more for temporary usage. /// By default, set to false. /// internal UnknownDistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs index 1cd0e49c19efa..abc272df6207f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs @@ -6,20 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - internal partial class UnknownExceptionAction : IUtf8JsonSerializable + internal partial class UnknownExceptionAction { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownExceptionAction DeserializeUnknownExceptionAction(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +30,13 @@ internal static UnknownExceptionAction DeserializeUnknownExceptionAction(JsonEle } return new UnknownExceptionAction(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownExceptionAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownExceptionAction(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs index 087f6eb8b9ec6..a336aa38e90f9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownExceptionAction. + /// Unknown version of ExceptionAction. internal partial class UnknownExceptionAction : ExceptionAction { /// Initializes a new instance of UnknownExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. + internal UnknownExceptionAction() + { + } + + /// Initializes a new instance of UnknownExceptionAction. + /// Discriminator. internal UnknownExceptionAction(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.Serialization.cs index 4298ee82cfc54..791992055c877 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.Serialization.cs @@ -6,20 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - internal partial class UnknownExceptionTrigger : IUtf8JsonSerializable + internal partial class UnknownExceptionTrigger { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownExceptionTrigger DeserializeUnknownExceptionTrigger(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +30,13 @@ internal static UnknownExceptionTrigger DeserializeUnknownExceptionTrigger(JsonE } return new UnknownExceptionTrigger(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownExceptionTrigger FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownExceptionTrigger(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs index 9640b811683f5..18efc690d3606 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownExceptionTrigger. + /// Unknown version of ExceptionTrigger. internal partial class UnknownExceptionTrigger : ExceptionTrigger { /// Initializes a new instance of UnknownExceptionTrigger. - /// The type discriminator describing a sub-type of ExceptionTrigger. + internal UnknownExceptionTrigger() + { + } + + /// Initializes a new instance of UnknownExceptionTrigger. + /// Discriminator. internal UnknownExceptionTrigger(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.Serialization.cs index 6ee8c8edd9fda..893ebfbffde23 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.Serialization.cs @@ -6,20 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - internal partial class UnknownQueueSelectorAttachment : IUtf8JsonSerializable + internal partial class UnknownQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownQueueSelectorAttachment DeserializeUnknownQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +30,13 @@ internal static UnknownQueueSelectorAttachment DeserializeUnknownQueueSelectorAt } return new UnknownQueueSelectorAttachment(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs index f2b29cc725dfd..8fba081e56f7d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownQueueSelectorAttachment. + /// Unknown version of QueueSelectorAttachment. internal partial class UnknownQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of UnknownQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. + internal UnknownQueueSelectorAttachment() + { + } + + /// Initializes a new instance of UnknownQueueSelectorAttachment. + /// Discriminator. internal UnknownQueueSelectorAttachment(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.Serialization.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.Serialization.cs index 4ba98c5546c90..eb4a40d25d9e5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.Serialization.cs @@ -6,20 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - internal partial class UnknownRouterRule : IUtf8JsonSerializable + internal partial class UnknownRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownRouterRule DeserializeUnknownRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +30,13 @@ internal static UnknownRouterRule DeserializeUnknownRouterRule(JsonElement eleme } return new UnknownRouterRule(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs index 7800194d4c9c6..e5eaa318b5b1f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownRouterRule. + /// Unknown version of RouterRule. internal partial class UnknownRouterRule : RouterRule { /// Initializes a new instance of UnknownRouterRule. - /// The type discriminator describing a sub-type of Rule. + internal UnknownRouterRule() + { + } + + /// Initializes a new instance of UnknownRouterRule. + /// Discriminator. internal UnknownRouterRule(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.Serialization.cs index 85bf372c8d2c9..07eb1a1a6e1d6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.Serialization.cs @@ -6,20 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - internal partial class UnknownWorkerSelectorAttachment : IUtf8JsonSerializable + internal partial class UnknownWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownWorkerSelectorAttachment DeserializeUnknownWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +30,13 @@ internal static UnknownWorkerSelectorAttachment DeserializeUnknownWorkerSelector } return new UnknownWorkerSelectorAttachment(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs index cd671a758fab8..7c1d37def27c2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownWorkerSelectorAttachment. + /// Unknown version of WorkerSelectorAttachment. internal partial class UnknownWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of UnknownWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. + internal UnknownWorkerSelectorAttachment() + { + } + + /// Initializes a new instance of UnknownWorkerSelectorAttachment. + /// Discriminator. internal UnknownWorkerSelectorAttachment(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.Serialization.cs index 0cfa0a7227edc..d80152e92370c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.Serialization.cs @@ -6,22 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class WaitTimeExceptionTrigger : IUtf8JsonSerializable + public partial class WaitTimeExceptionTrigger { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("thresholdSeconds"u8); - writer.WriteNumberValue(_thresholdSeconds); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WaitTimeExceptionTrigger DeserializeWaitTimeExceptionTrigger(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +36,13 @@ internal static WaitTimeExceptionTrigger DeserializeWaitTimeExceptionTrigger(Jso } return new WaitTimeExceptionTrigger(kind, thresholdSeconds); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WaitTimeExceptionTrigger FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWaitTimeExceptionTrigger(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs index 8442b67c6755b..dd5cc19ce2d2b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs @@ -11,12 +11,11 @@ namespace Azure.Communication.JobRouter public partial class WaitTimeExceptionTrigger : ExceptionTrigger { /// Initializes a new instance of WaitTimeExceptionTrigger. - /// The type discriminator describing a sub-type of ExceptionTrigger. + /// Discriminator. /// Threshold for wait time for this trigger. internal WaitTimeExceptionTrigger(string kind, double thresholdSeconds) : base(kind) { _thresholdSeconds = thresholdSeconds; - Kind = kind ?? "wait-time"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs index 752d885c8323e..f1fa3ddc265d2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs @@ -7,35 +7,13 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class WebhookRouterRule : IUtf8JsonSerializable + public partial class WebhookRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(AuthorizationServerUri)) - { - writer.WritePropertyName("authorizationServerUri"u8); - writer.WriteStringValue(AuthorizationServerUri.AbsoluteUri); - } - if (Optional.IsDefined(ClientCredential)) - { - writer.WritePropertyName("clientCredential"u8); - writer.WriteObjectValue(ClientCredential); - } - if (Optional.IsDefined(WebhookUri)) - { - writer.WritePropertyName("webhookUri"u8); - writer.WriteStringValue(WebhookUri.AbsoluteUri); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -83,5 +61,13 @@ internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement eleme } return new WebhookRouterRule(kind, authorizationServerUri.Value, clientCredential.Value, webhookUri.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WebhookRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWebhookRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs similarity index 72% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs index 1a187ccf2eaa5..e0b97118d5943 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs @@ -13,17 +13,18 @@ namespace Azure.Communication.JobRouter public partial class WebhookRouterRule : RouterRule { /// Initializes a new instance of WebhookRouterRule. - public WebhookRouterRule() + internal WebhookRouterRule() { Kind = "webhook-rule"; } /// Initializes a new instance of WebhookRouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. /// Uri for Authorization Server. /// /// OAuth2.0 Credentials used to Contoso's Authorization server. - /// Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// /// Uri for Contoso's Web Server. internal WebhookRouterRule(string kind, Uri authorizationServerUri, Oauth2ClientCredential clientCredential, Uri webhookUri) : base(kind) @@ -31,17 +32,17 @@ internal WebhookRouterRule(string kind, Uri authorizationServerUri, Oauth2Client AuthorizationServerUri = authorizationServerUri; ClientCredential = clientCredential; WebhookUri = webhookUri; - Kind = kind ?? "webhook-rule"; } /// Uri for Authorization Server. - public Uri AuthorizationServerUri { get; set; } + public Uri AuthorizationServerUri { get; } /// /// OAuth2.0 Credentials used to Contoso's Authorization server. - /// Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// - public Oauth2ClientCredential ClientCredential { get; set; } + public Oauth2ClientCredential ClientCredential { get; } /// Uri for Contoso's Web Server. - public Uri WebhookUri { get; set; } + public Uri WebhookUri { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.Serialization.cs similarity index 72% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.Serialization.cs index 5fca27cd4c566..8fb48adc00426 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.Serialization.cs @@ -7,34 +7,20 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class WeightedAllocationQueueSelectorAttachment : IUtf8JsonSerializable + public partial class WeightedAllocationQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("allocations"u8); - writer.WriteStartArray(); - foreach (var item in Allocations) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WeightedAllocationQueueSelectorAttachment DeserializeWeightedAllocationQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList allocations = default; + IReadOnlyList allocations = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -56,5 +42,13 @@ internal static WeightedAllocationQueueSelectorAttachment DeserializeWeightedAll } return new WeightedAllocationQueueSelectorAttachment(kind, allocations); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WeightedAllocationQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWeightedAllocationQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs index 6f943be27048f..078afe0b3ce59 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs @@ -12,30 +12,32 @@ namespace Azure.Communication.JobRouter { - /// Describes multiple sets of queue selectors, of which one will be selected and attached according to a weighting. + /// + /// Describes multiple sets of queue selectors, of which one will be selected and + /// attached according to a weighting + /// public partial class WeightedAllocationQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. /// A collection of percentage based weighted allocations. /// is null. - public WeightedAllocationQueueSelectorAttachment(IEnumerable allocations) + internal WeightedAllocationQueueSelectorAttachment(IEnumerable allocations) { Argument.AssertNotNull(allocations, nameof(allocations)); - Allocations = allocations.ToList(); Kind = "weighted-allocation-queue-selector"; + Allocations = allocations.ToList(); } /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. + /// Discriminator. /// A collection of percentage based weighted allocations. - internal WeightedAllocationQueueSelectorAttachment(string kind, IList allocations) : base(kind) + internal WeightedAllocationQueueSelectorAttachment(string kind, IReadOnlyList allocations) : base(kind) { Allocations = allocations; - Kind = kind ?? "weighted-allocation-queue-selector"; } /// A collection of percentage based weighted allocations. - public IList Allocations { get; } + public IReadOnlyList Allocations { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.Serialization.cs similarity index 72% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.Serialization.cs index f6850f96f9dd2..6df4cbf7a8038 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.Serialization.cs @@ -7,34 +7,20 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class WeightedAllocationWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class WeightedAllocationWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("allocations"u8); - writer.WriteStartArray(); - foreach (var item in Allocations) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WeightedAllocationWorkerSelectorAttachment DeserializeWeightedAllocationWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList allocations = default; + IReadOnlyList allocations = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -56,5 +42,13 @@ internal static WeightedAllocationWorkerSelectorAttachment DeserializeWeightedAl } return new WeightedAllocationWorkerSelectorAttachment(kind, allocations); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WeightedAllocationWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWeightedAllocationWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs index ffc4e566a9cad..bc1aa5d2f7b3a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs @@ -12,30 +12,32 @@ namespace Azure.Communication.JobRouter { - /// Describes multiple sets of worker selectors, of which one will be selected and attached according to a weighting. + /// + /// Describes multiple sets of worker selectors, of which one will be selected and + /// attached according to a weighting + /// public partial class WeightedAllocationWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. /// A collection of percentage based weighted allocations. /// is null. - public WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations) + internal WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations) { Argument.AssertNotNull(allocations, nameof(allocations)); - Allocations = allocations.ToList(); Kind = "weighted-allocation-worker-selector"; + Allocations = allocations.ToList(); } /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. + /// Discriminator. /// A collection of percentage based weighted allocations. - internal WeightedAllocationWorkerSelectorAttachment(string kind, IList allocations) : base(kind) + internal WeightedAllocationWorkerSelectorAttachment(string kind, IReadOnlyList allocations) : base(kind) { Allocations = allocations; - Kind = kind ?? "weighted-allocation-worker-selector"; } /// A collection of percentage based weighted allocations. - public IList Allocations { get; } + public IReadOnlyList Allocations { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.Serialization.cs similarity index 76% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.Serialization.cs index 5cb29f56a1430..ae2dbafa91b75 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class WorkerSelectorAttachment : IUtf8JsonSerializable + public partial class WorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WorkerSelectorAttachment DeserializeWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,5 +31,13 @@ internal static WorkerSelectorAttachment DeserializeWorkerSelectorAttachment(Jso } return UnknownWorkerSelectorAttachment.DeserializeUnknownWorkerSelectorAttachment(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static WorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs similarity index 78% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs index 9562cc3084fbd..ef1125b80b267 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs @@ -15,10 +15,18 @@ namespace Azure.Communication.JobRouter public abstract partial class WorkerSelectorAttachment { /// Initializes a new instance of WorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. + protected WorkerSelectorAttachment() + { + } + + /// Initializes a new instance of WorkerSelectorAttachment. + /// Discriminator. internal WorkerSelectorAttachment(string kind) { Kind = kind; } + + /// Discriminator. + internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.Serialization.cs similarity index 68% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.Serialization.cs index 640d4310c86eb..44f1a992f2b85 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.Serialization.cs @@ -7,27 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class WorkerWeightedAllocation : IUtf8JsonSerializable + public partial class WorkerWeightedAllocation { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("weight"u8); - writer.WriteNumberValue(Weight); - writer.WritePropertyName("workerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in WorkerSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -35,7 +21,7 @@ internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(Jso return null; } double weight = default; - IList workerSelectors = default; + IReadOnlyList workerSelectors = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("weight"u8)) @@ -56,5 +42,13 @@ internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(Jso } return new WorkerWeightedAllocation(weight, workerSelectors); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static WorkerWeightedAllocation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWorkerWeightedAllocation(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs similarity index 54% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs index 6ca21f045df62..5ef90941d0495 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs @@ -12,14 +12,20 @@ namespace Azure.Communication.JobRouter { - /// Contains the weight percentage and worker selectors to be applied if selected for weighted distributions. + /// + /// Contains the weight percentage and worker selectors to be applied if selected + /// for weighted distributions. + /// public partial class WorkerWeightedAllocation { /// Initializes a new instance of WorkerWeightedAllocation. /// The percentage of this weight, expressed as a fraction of 1. - /// A collection of worker selectors that will be applied if this allocation is selected. + /// + /// A collection of worker selectors that will be applied if this allocation is + /// selected. + /// /// is null. - public WorkerWeightedAllocation(double weight, IEnumerable workerSelectors) + internal WorkerWeightedAllocation(double weight, IEnumerable workerSelectors) { Argument.AssertNotNull(workerSelectors, nameof(workerSelectors)); @@ -29,16 +35,22 @@ public WorkerWeightedAllocation(double weight, IEnumerable /// Initializes a new instance of WorkerWeightedAllocation. /// The percentage of this weight, expressed as a fraction of 1. - /// A collection of worker selectors that will be applied if this allocation is selected. - internal WorkerWeightedAllocation(double weight, IList workerSelectors) + /// + /// A collection of worker selectors that will be applied if this allocation is + /// selected. + /// + internal WorkerWeightedAllocation(double weight, IReadOnlyList workerSelectors) { Weight = weight; WorkerSelectors = workerSelectors; } /// The percentage of this weight, expressed as a fraction of 1. - public double Weight { get; set; } - /// A collection of worker selectors that will be applied if this allocation is selected. - public IList WorkerSelectors { get; } + public double Weight { get; } + /// + /// A collection of worker selectors that will be applied if this allocation is + /// selected. + /// + public IReadOnlyList WorkerSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json b/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json new file mode 100644 index 0000000000000..5fa0965a499bf --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json @@ -0,0 +1,8438 @@ +{ + "$id": "1", + "Name": "AzureCommunicationRoutingService", + "Description": "Azure Communication Routing Service", + "ApiVersions": [ + "2023-11-01" + ], + "Enums": [ + { + "$id": "2", + "Name": "ExpressionRouterRuleLanguage", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "3", + "Name": "powerFx", + "Value": "powerFx", + "Description": "PowerFx" + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "The available expression languages that can be configured", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "4", + "Name": "ScoringRuleParameterSelector", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "5", + "Name": "jobLabels", + "Value": "jobLabels", + "Description": "Parameter to add job labels to scoring payload. Property is sent as `job`." + }, + { + "$id": "6", + "Name": "workerSelectors", + "Value": "workerSelectors", + "Description": "Parameter to add worker selectors from the job to scoring payload. Property is sent as `selectors`." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "Supported parameters for scoring workers", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "7", + "Name": "LabelOperator", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "8", + "Name": "equal", + "Value": "equal", + "Description": "Equal" + }, + { + "$id": "9", + "Name": "notEqual", + "Value": "notEqual", + "Description": "Not Equal" + }, + { + "$id": "10", + "Name": "lessThan", + "Value": "lessThan", + "Description": "Less than" + }, + { + "$id": "11", + "Name": "lessThanEqual", + "Value": "lessThanEqual", + "Description": "Less than or equal" + }, + { + "$id": "12", + "Name": "greaterThan", + "Value": "greaterThan", + "Description": "Greater than" + }, + { + "$id": "13", + "Name": "greaterThanEqual", + "Value": "greaterThanEqual", + "Description": "Greater than or equal" + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes supported operations on label values.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "14", + "Name": "RouterWorkerSelectorStatus", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "15", + "Name": "active", + "Value": "active", + "Description": "Active" + }, + { + "$id": "16", + "Name": "expired", + "Value": "expired", + "Description": "Expired" + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "The status of the worker selector.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "17", + "Name": "RouterJobStatus", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "18", + "Name": "pendingClassification", + "Value": "pendingClassification", + "Description": "Job is waiting to be classified." + }, + { + "$id": "19", + "Name": "queued", + "Value": "queued", + "Description": "Job has been queued." + }, + { + "$id": "20", + "Name": "assigned", + "Value": "assigned", + "Description": "Job has been assigned to a worker." + }, + { + "$id": "21", + "Name": "completed", + "Value": "completed", + "Description": "Job has been completed by a worker." + }, + { + "$id": "22", + "Name": "closed", + "Value": "closed", + "Description": "Job has been closed by a worker." + }, + { + "$id": "23", + "Name": "cancelled", + "Value": "cancelled", + "Description": "Job has been cancelled." + }, + { + "$id": "24", + "Name": "classificationFailed", + "Value": "classificationFailed", + "Description": "Classification process failed for the job." + }, + { + "$id": "25", + "Name": "created", + "Value": "created", + "Description": "Job has been created." + }, + { + "$id": "26", + "Name": "pendingSchedule", + "Value": "pendingSchedule", + "Description": "Job has been created but not been scheduled yet." + }, + { + "$id": "27", + "Name": "scheduled", + "Value": "scheduled", + "Description": "Job has been scheduled successfully." + }, + { + "$id": "28", + "Name": "scheduleFailed", + "Value": "scheduleFailed", + "Description": "Job scheduling failed." + }, + { + "$id": "29", + "Name": "waitingForActivation", + "Value": "waitingForActivation", + "Description": "Job is in a suspended state and waiting for an update." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "The status of the Job.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "30", + "Name": "JobMatchModeType", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "31", + "Name": "queueAndMatchMode", + "Value": "queueAndMatchMode", + "Description": "Discriminator used when matching worker to a job is required to be done right after job is queued." + }, + { + "$id": "32", + "Name": "scheduleAndSuspendMode", + "Value": "scheduleAndSuspendMode", + "Description": "Discriminator used for scheduling jobs to be queued at a future time." + }, + { + "$id": "33", + "Name": "suspendMode", + "Value": "suspendMode", + "Description": "Discriminator used when matching workers to a job needs to be suspended." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "Discriminator values for supported matching mode types.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "34", + "Name": "RouterJobStatusSelector", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "35", + "Name": "all", + "Value": "all", + "Description": "Default" + }, + { + "$id": "36", + "Name": "pendingClassification", + "Value": "pendingClassification", + "Description": "Job is waiting to be classified." + }, + { + "$id": "37", + "Name": "queued", + "Value": "queued", + "Description": "Job has been queued." + }, + { + "$id": "38", + "Name": "assigned", + "Value": "assigned", + "Description": "Job has been assigned to a worker." + }, + { + "$id": "39", + "Name": "completed", + "Value": "completed", + "Description": "Job has been completed by a worker." + }, + { + "$id": "40", + "Name": "closed", + "Value": "closed", + "Description": "Job has been closed by a worker." + }, + { + "$id": "41", + "Name": "cancelled", + "Value": "cancelled", + "Description": "Job has been cancelled." + }, + { + "$id": "42", + "Name": "classificationFailed", + "Value": "classificationFailed", + "Description": "Classification process failed for the job." + }, + { + "$id": "43", + "Name": "created", + "Value": "created", + "Description": "Job has been created." + }, + { + "$id": "44", + "Name": "pendingSchedule", + "Value": "pendingSchedule", + "Description": "Job has been created but not been scheduled yet." + }, + { + "$id": "45", + "Name": "scheduled", + "Value": "scheduled", + "Description": "Job has been scheduled successfully." + }, + { + "$id": "46", + "Name": "scheduleFailed", + "Value": "scheduleFailed", + "Description": "Job scheduling failed." + }, + { + "$id": "47", + "Name": "waitingForActivation", + "Value": "waitingForActivation", + "Description": "Job is in a suspended state and waiting for an update." + }, + { + "$id": "48", + "Name": "active", + "Value": "active", + "Description": "Job is in a state of PendingClassification or Queued or Assigned or ClassificationFailed or Completed or PendingSchedule or Scheduled or ScheduleFailed or WaitingForActivation." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "Enums used to filters jobs by state", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Input" + }, + { + "$id": "49", + "Name": "RouterWorkerState", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "50", + "Name": "active", + "Value": "active", + "Description": "Worker is active and available to take offers." + }, + { + "$id": "51", + "Name": "draining", + "Value": "draining", + "Description": "Worker is not active, if there are existing offers they are being revoked. No new offers are sent." + }, + { + "$id": "52", + "Name": "inactive", + "Value": "inactive", + "Description": "Worker is not active. No new offers are sent." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "Enums for worker status", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "53", + "Name": "RouterWorkerStateSelector", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "54", + "Name": "active", + "Value": "active", + "Description": "Worker is active and available to take offers." + }, + { + "$id": "55", + "Name": "draining", + "Value": "draining", + "Description": "Worker is not active, if there are existing offers they are being revoked. No new offers are sent." + }, + { + "$id": "56", + "Name": "inactive", + "Value": "inactive", + "Description": "Worker is not active. No new offers are sent." + }, + { + "$id": "57", + "Name": "all", + "Value": "all", + "Description": "Worker is active or draining or inactive." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "Enums used to filters workers by state", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Input" + } + ], + "Models": [ + { + "$id": "58", + "Name": "DistributionPolicy", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Policy governing how jobs are distributed to workers", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "59", + "Name": "id", + "SerializedName": "id", + "Description": "The unique identifier of the policy.", + "Type": { + "$id": "60", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "61", + "Name": "name", + "SerializedName": "name", + "Description": "The human readable name of the policy.", + "Type": { + "$id": "62", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "63", + "Name": "offerExpiresAfterSeconds", + "SerializedName": "offerExpiresAfterSeconds", + "Description": "The number of seconds after which any offers created under this policy will be\nexpired.", + "Type": { + "$id": "64", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "65", + "Name": "mode", + "SerializedName": "mode", + "Description": "Abstract base class for defining a distribution mode", + "Type": { + "$id": "66", + "Name": "DistributionMode", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Abstract base class for defining a distribution mode", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "67", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "68", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + }, + { + "$id": "69", + "Name": "minConcurrentOffers", + "SerializedName": "minConcurrentOffers", + "Description": "Governs the minimum desired number of active concurrent offers a job can have.", + "Type": { + "$id": "70", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "71", + "Name": "maxConcurrentOffers", + "SerializedName": "maxConcurrentOffers", + "Description": "Governs the maximum number of active concurrent offers a job can have.", + "Type": { + "$id": "72", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "73", + "Name": "bypassSelectors", + "SerializedName": "bypassSelectors", + "Description": "(Optional)\nIf set to true, then router will match workers to jobs even if they\ndon't match label selectors.\nWarning: You may get workers that are not\nqualified for the job they are matched with if you set this\nvariable to true.\nThis flag is intended more for temporary usage.\nBy default, set to false.", + "Type": { + "$id": "74", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ], + "DerivedModels": [ + { + "$id": "75", + "Name": "BestWorkerMode", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Jobs are distributed to the worker with the strongest abilities available.", + "IsNullable": false, + "DiscriminatorValue": "best-worker", + "BaseModel": { + "$ref": "66" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "76", + "Name": "scoringRule", + "SerializedName": "scoringRule", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$id": "77", + "Name": "RouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "78", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "79", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "80", + "Name": "DirectMapRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A rule that return the same labels as the input labels.", + "IsNullable": false, + "DiscriminatorValue": "direct-map-rule", + "BaseModel": { + "$ref": "77" + }, + "Usage": "Output", + "Properties": [] + }, + { + "$id": "81", + "Name": "ExpressionRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A rule providing inline expression rules.", + "IsNullable": false, + "DiscriminatorValue": "expression-rule", + "BaseModel": { + "$ref": "77" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "82", + "Name": "language", + "SerializedName": "language", + "Description": "The expression language to compile to and execute", + "Type": { + "$ref": "2" + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "83", + "Name": "expression", + "SerializedName": "expression", + "Description": "The string containing the expression to evaluate. Should contain return\nstatement with calculated values.", + "Type": { + "$id": "84", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "85", + "Name": "FunctionRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A rule providing a binding to an HTTP Triggered Azure Function.", + "IsNullable": false, + "DiscriminatorValue": "azure-function-rule", + "BaseModel": { + "$ref": "77" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "86", + "Name": "functionUri", + "SerializedName": "functionUri", + "Description": "URL for Azure Function", + "Type": { + "$id": "87", + "Name": "url", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "88", + "Name": "credential", + "SerializedName": "credential", + "Description": "Credentials used to access Azure function rule", + "Type": { + "$id": "89", + "Name": "FunctionRouterRuleCredential", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Credentials used to access Azure function rule", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "90", + "Name": "functionKey", + "SerializedName": "functionKey", + "Description": "(Optional) Access key scoped to a particular function", + "Type": { + "$id": "91", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "92", + "Name": "appKey", + "SerializedName": "appKey", + "Description": "(Optional) Access key scoped to a Azure Function app.\nThis key grants access to\nall functions under the app.", + "Type": { + "$id": "93", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "94", + "Name": "clientId", + "SerializedName": "clientId", + "Description": "(Optional) Client id, when AppKey is provided\nIn context of Azure function,\nthis is usually the name of the key", + "Type": { + "$id": "95", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "96", + "Name": "StaticRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A rule providing static rules that always return the same result, regardless of\ninput.", + "IsNullable": false, + "DiscriminatorValue": "static-rule", + "BaseModel": { + "$ref": "77" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "97", + "Name": "value", + "SerializedName": "value", + "Description": "The static value this rule always returns.", + "Type": { + "$id": "98", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "99", + "Name": "WebhookRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A rule providing a binding to an external web server.", + "IsNullable": false, + "DiscriminatorValue": "webhook-rule", + "BaseModel": { + "$ref": "77" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "100", + "Name": "authorizationServerUri", + "SerializedName": "authorizationServerUri", + "Description": "Uri for Authorization Server.", + "Type": { + "$id": "101", + "Name": "url", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "102", + "Name": "clientCredential", + "SerializedName": "clientCredential", + "Description": "OAuth2.0 Credentials used to Contoso's Authorization server.\nReference:\nhttps://www.oauth.com/oauth2-servers/access-tokens/client-credentials/", + "Type": { + "$id": "103", + "Name": "Oauth2ClientCredential", + "Namespace": "AzureCommunicationRoutingService", + "Description": "OAuth2.0 Credentials used to Contoso's Authorization server.\nReference:\nhttps://www.oauth.com/oauth2-servers/access-tokens/client-credentials/", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "104", + "Name": "clientId", + "SerializedName": "clientId", + "Description": "ClientId for Contoso Authorization server.", + "Type": { + "$id": "105", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "106", + "Name": "clientSecret", + "SerializedName": "clientSecret", + "Description": "Client secret for Contoso Authorization server.", + "Type": { + "$id": "107", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "108", + "Name": "webhookUri", + "SerializedName": "webhookUri", + "Description": "Uri for Contoso's Web Server.", + "Type": { + "$id": "109", + "Name": "url", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "110", + "Name": "scoringRuleOptions", + "SerializedName": "scoringRuleOptions", + "Description": "Encapsulates all options that can be passed as parameters for scoring rule with\nBestWorkerMode", + "Type": { + "$id": "111", + "Name": "ScoringRuleOptions", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Encapsulates all options that can be passed as parameters for scoring rule with\nBestWorkerMode", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "112", + "Name": "batchSize", + "SerializedName": "batchSize", + "Description": "(Optional) Set batch size when AllowScoringBatchOfWorkers is set to true.\nDefaults to 20 if not configured.", + "Type": { + "$id": "113", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "114", + "Name": "scoringParameters", + "SerializedName": "scoringParameters", + "Description": "(Optional) List of extra parameters from the job that will be sent as part of\nthe payload to scoring rule.\nIf not set, the job's labels (sent in the payload\nas `job`) and the job's worker selectors (sent in the payload as\n`selectors`)\nare added to the payload of the scoring rule by default.\nNote:\nWorker labels are always sent with scoring payload.", + "Type": { + "$id": "115", + "Name": "Array", + "ElementType": { + "$ref": "4" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "116", + "Name": "allowScoringBatchOfWorkers", + "SerializedName": "allowScoringBatchOfWorkers", + "Description": "(Optional)\nIf set to true, will score workers in batches, and the parameter\nname of the worker labels will be sent as `workers`.\nBy default, set to false\nand the parameter name for the worker labels will be sent as `worker`.\nNote: If\nenabled, use BatchSize to set batch size.", + "Type": { + "$id": "117", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "118", + "Name": "descendingOrder", + "SerializedName": "descendingOrder", + "Description": "(Optional)\nIf false, will sort scores by ascending order. By default, set to\ntrue.", + "Type": { + "$id": "119", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "120", + "Name": "LongestIdleMode", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Jobs are directed to the worker who has been idle longest.", + "IsNullable": false, + "DiscriminatorValue": "longest-idle", + "BaseModel": { + "$ref": "66" + }, + "Usage": "Output", + "Properties": [] + }, + { + "$id": "121", + "Name": "RoundRobinMode", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Jobs are distributed in order to workers, starting with the worker that is\nafter the last worker to receive a job.", + "IsNullable": false, + "DiscriminatorValue": "round-robin", + "BaseModel": { + "$ref": "66" + }, + "Usage": "Output", + "Properties": [] + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "66" + }, + { + "$ref": "75" + }, + { + "$ref": "77" + }, + { + "$ref": "80" + }, + { + "$ref": "81" + }, + { + "$ref": "85" + }, + { + "$ref": "89" + }, + { + "$ref": "96" + }, + { + "$ref": "99" + }, + { + "$ref": "103" + }, + { + "$ref": "111" + }, + { + "$ref": "120" + }, + { + "$ref": "121" + }, + { + "$id": "122", + "Name": "PagedDistributionPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of distribution policies.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "123", + "Name": "value", + "SerializedName": "value", + "Description": "The DistributionPolicyItem items on this page", + "Type": { + "$id": "124", + "Name": "Array", + "ElementType": { + "$id": "125", + "Name": "DistributionPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of DistributionPolicy", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "126", + "Name": "distributionPolicy", + "SerializedName": "distributionPolicy", + "Description": "Policy governing how jobs are distributed to workers", + "Type": { + "$ref": "58" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "127", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "128", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "129", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "130", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "125" + }, + { + "$id": "131", + "Name": "ClassificationPolicy", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A container for the rules that govern how jobs are classified.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "132", + "Name": "id", + "SerializedName": "id", + "Description": "Unique identifier of this policy.", + "Type": { + "$id": "133", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "134", + "Name": "name", + "SerializedName": "name", + "Description": "Friendly name of this policy.", + "Type": { + "$id": "135", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "136", + "Name": "fallbackQueueId", + "SerializedName": "fallbackQueueId", + "Description": "The fallback queue to select if the queue selector doesn't find a match.", + "Type": { + "$id": "137", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "138", + "Name": "queueSelectors", + "SerializedName": "queueSelectors", + "Description": "The queue selectors to resolve a queue for a given job.", + "Type": { + "$id": "139", + "Name": "Array", + "ElementType": { + "$id": "140", + "Name": "QueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "An attachment of queue selectors to resolve a queue to a job from a\nclassification policy", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "141", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "142", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "143", + "Name": "ConditionalQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes a set of queue selectors that will be attached if the given condition\nresolves to true", + "IsNullable": false, + "DiscriminatorValue": "conditional", + "BaseModel": { + "$ref": "140" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "144", + "Name": "condition", + "SerializedName": "condition", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "77" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "145", + "Name": "queueSelectors", + "SerializedName": "queueSelectors", + "Description": "The queue selectors to attach", + "Type": { + "$id": "146", + "Name": "Array", + "ElementType": { + "$id": "147", + "Name": "RouterQueueSelector", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes a condition that must be met against a set of labels for queue\nselection", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "148", + "Name": "key", + "SerializedName": "key", + "Description": "The label key to query against", + "Type": { + "$id": "149", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "150", + "Name": "labelOperator", + "SerializedName": "labelOperator", + "Description": "Describes how the value of the label is compared to the value defined on the\nlabel selector", + "Type": { + "$ref": "7" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "151", + "Name": "value", + "SerializedName": "value", + "Description": "The value to compare against the actual label value with the given operator", + "Type": { + "$id": "152", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "153", + "Name": "PassThroughQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Attaches a queue selector where the value is passed through from the job label\nwith the same key", + "IsNullable": false, + "DiscriminatorValue": "pass-through", + "BaseModel": { + "$ref": "140" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "154", + "Name": "key", + "SerializedName": "key", + "Description": "The label key to query against", + "Type": { + "$id": "155", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "156", + "Name": "labelOperator", + "SerializedName": "labelOperator", + "Description": "Describes how the value of the label is compared to the value pass through", + "Type": { + "$ref": "7" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "157", + "Name": "RuleEngineQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Attaches queue selectors to a job when the RouterRule is resolved", + "IsNullable": false, + "DiscriminatorValue": "rule-engine", + "BaseModel": { + "$ref": "140" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "158", + "Name": "rule", + "SerializedName": "rule", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "77" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "159", + "Name": "StaticQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes a queue selector that will be attached to the job", + "IsNullable": false, + "DiscriminatorValue": "static", + "BaseModel": { + "$ref": "140" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "160", + "Name": "queueSelector", + "SerializedName": "queueSelector", + "Description": "Describes a condition that must be met against a set of labels for queue\nselection", + "Type": { + "$ref": "147" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "161", + "Name": "WeightedAllocationQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes multiple sets of queue selectors, of which one will be selected and\nattached according to a weighting", + "IsNullable": false, + "DiscriminatorValue": "weighted-allocation-queue-selector", + "BaseModel": { + "$ref": "140" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "162", + "Name": "allocations", + "SerializedName": "allocations", + "Description": "A collection of percentage based weighted allocations.", + "Type": { + "$id": "163", + "Name": "Array", + "ElementType": { + "$id": "164", + "Name": "QueueWeightedAllocation", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Contains the weight percentage and queue selectors to be applied if selected\nfor weighted distributions.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "165", + "Name": "weight", + "SerializedName": "weight", + "Description": "The percentage of this weight, expressed as a fraction of 1.", + "Type": { + "$id": "166", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "167", + "Name": "queueSelectors", + "SerializedName": "queueSelectors", + "Description": "A collection of queue selectors that will be applied if this allocation is\nselected.", + "Type": { + "$id": "168", + "Name": "Array", + "ElementType": { + "$ref": "147" + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "169", + "Name": "prioritizationRule", + "SerializedName": "prioritizationRule", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "77" + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "170", + "Name": "workerSelectors", + "SerializedName": "workerSelectors", + "Description": "The worker label selectors to attach to a given job.", + "Type": { + "$id": "171", + "Name": "Array", + "ElementType": { + "$id": "172", + "Name": "WorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "An attachment which attaches worker selectors to a job", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "173", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "174", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "175", + "Name": "ConditionalWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes a set of worker selectors that will be attached if the given\ncondition resolves to true", + "IsNullable": false, + "DiscriminatorValue": "conditional", + "BaseModel": { + "$ref": "172" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "176", + "Name": "condition", + "SerializedName": "condition", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "77" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "177", + "Name": "workerSelectors", + "SerializedName": "workerSelectors", + "Description": "The worker selectors to attach", + "Type": { + "$id": "178", + "Name": "Array", + "ElementType": { + "$id": "179", + "Name": "RouterWorkerSelector", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes a condition that must be met against a set of labels for worker\nselection", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "180", + "Name": "key", + "SerializedName": "key", + "Description": "The label key to query against", + "Type": { + "$id": "181", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "182", + "Name": "labelOperator", + "SerializedName": "labelOperator", + "Description": "Describes how the value of the label is compared to the value defined on the\nlabel selector", + "Type": { + "$ref": "7" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "183", + "Name": "value", + "SerializedName": "value", + "Description": "The value to compare against the actual label value with the given operator", + "Type": { + "$id": "184", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "185", + "Name": "expiresAfterSeconds", + "SerializedName": "expiresAfterSeconds", + "Description": "Describes how long this label selector is valid in seconds.", + "Type": { + "$id": "186", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "187", + "Name": "expedite", + "SerializedName": "expedite", + "Description": "Pushes the job to the front of the queue as long as this selector is active.", + "Type": { + "$id": "188", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "189", + "Name": "status", + "SerializedName": "status", + "Description": "The status of the worker selector.", + "Type": { + "$ref": "14" + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "190", + "Name": "expiresAt", + "SerializedName": "expiresAt", + "Description": "The time at which this worker selector expires in UTC", + "Type": { + "$id": "191", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "192", + "Name": "PassThroughWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Attaches a worker selector where the value is passed through from the job label\nwith the same key", + "IsNullable": false, + "DiscriminatorValue": "pass-through", + "BaseModel": { + "$ref": "172" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "193", + "Name": "key", + "SerializedName": "key", + "Description": "The label key to query against", + "Type": { + "$id": "194", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "195", + "Name": "labelOperator", + "SerializedName": "labelOperator", + "Description": "Describes how the value of the label is compared to the value pass through", + "Type": { + "$ref": "7" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "196", + "Name": "expiresAfterSeconds", + "SerializedName": "expiresAfterSeconds", + "Description": "Describes how long the attached label selector is valid in seconds.", + "Type": { + "$id": "197", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "198", + "Name": "RuleEngineWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Attaches worker selectors to a job when a RouterRule is resolved", + "IsNullable": false, + "DiscriminatorValue": "rule-engine", + "BaseModel": { + "$ref": "172" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "199", + "Name": "rule", + "SerializedName": "rule", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "77" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "200", + "Name": "StaticWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes a worker selector that will be attached to the job", + "IsNullable": false, + "DiscriminatorValue": "static", + "BaseModel": { + "$ref": "172" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "201", + "Name": "workerSelector", + "SerializedName": "workerSelector", + "Description": "Describes a condition that must be met against a set of labels for worker\nselection", + "Type": { + "$ref": "179" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "202", + "Name": "WeightedAllocationWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes multiple sets of worker selectors, of which one will be selected and\nattached according to a weighting", + "IsNullable": false, + "DiscriminatorValue": "weighted-allocation-worker-selector", + "BaseModel": { + "$ref": "172" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "203", + "Name": "allocations", + "SerializedName": "allocations", + "Description": "A collection of percentage based weighted allocations.", + "Type": { + "$id": "204", + "Name": "Array", + "ElementType": { + "$id": "205", + "Name": "WorkerWeightedAllocation", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Contains the weight percentage and worker selectors to be applied if selected\nfor weighted distributions.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "206", + "Name": "weight", + "SerializedName": "weight", + "Description": "The percentage of this weight, expressed as a fraction of 1.", + "Type": { + "$id": "207", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "208", + "Name": "workerSelectors", + "SerializedName": "workerSelectors", + "Description": "A collection of worker selectors that will be applied if this allocation is\nselected.", + "Type": { + "$id": "209", + "Name": "Array", + "ElementType": { + "$ref": "179" + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "140" + }, + { + "$ref": "143" + }, + { + "$ref": "147" + }, + { + "$ref": "153" + }, + { + "$ref": "157" + }, + { + "$ref": "159" + }, + { + "$ref": "161" + }, + { + "$ref": "164" + }, + { + "$ref": "172" + }, + { + "$ref": "175" + }, + { + "$ref": "179" + }, + { + "$ref": "192" + }, + { + "$ref": "198" + }, + { + "$ref": "200" + }, + { + "$ref": "202" + }, + { + "$ref": "205" + }, + { + "$id": "210", + "Name": "PagedClassificationPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of classification policies.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "211", + "Name": "value", + "SerializedName": "value", + "Description": "The ClassificationPolicyItem items on this page", + "Type": { + "$id": "212", + "Name": "Array", + "ElementType": { + "$id": "213", + "Name": "ClassificationPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of ClassificationPolicy", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "214", + "Name": "classificationPolicy", + "SerializedName": "classificationPolicy", + "Description": "A container for the rules that govern how jobs are classified.", + "Type": { + "$ref": "131" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "215", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "216", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "217", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "218", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "213" + }, + { + "$id": "219", + "Name": "ExceptionPolicy", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A policy that defines actions to execute when exception are triggered.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "220", + "Name": "id", + "SerializedName": "id", + "Description": "The Id of the exception policy", + "Type": { + "$id": "221", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "222", + "Name": "name", + "SerializedName": "name", + "Description": "(Optional) The name of the exception policy.", + "Type": { + "$id": "223", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "224", + "Name": "exceptionRules", + "SerializedName": "exceptionRules", + "Description": "(Optional) A dictionary collection of exception rules on the exception policy.\nKey is the Id of each exception rule.", + "Type": { + "$id": "225", + "Name": "Dictionary", + "KeyType": { + "$id": "226", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "227", + "Name": "ExceptionRule", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A rule that defines actions to execute upon a specific trigger.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "228", + "Name": "trigger", + "SerializedName": "trigger", + "Description": "The trigger for this exception rule", + "Type": { + "$id": "229", + "Name": "ExceptionTrigger", + "Namespace": "AzureCommunicationRoutingService", + "Description": "The trigger for this exception rule", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "230", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "231", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "232", + "Name": "QueueLengthExceptionTrigger", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Trigger for an exception action on exceeding queue length", + "IsNullable": false, + "DiscriminatorValue": "queue-length", + "BaseModel": { + "$ref": "229" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "233", + "Name": "threshold", + "SerializedName": "threshold", + "Description": "Threshold of number of jobs ahead in the queue to for this trigger to fire.", + "Type": { + "$id": "234", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "235", + "Name": "WaitTimeExceptionTrigger", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Trigger for an exception action on exceeding wait time", + "IsNullable": false, + "DiscriminatorValue": "wait-time", + "BaseModel": { + "$ref": "229" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "236", + "Name": "thresholdSeconds", + "SerializedName": "thresholdSeconds", + "Description": "Threshold for wait time for this trigger.", + "Type": { + "$id": "237", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + } + ] + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "238", + "Name": "actions", + "SerializedName": "actions", + "Description": "A dictionary collection of actions to perform once the exception is triggered.\nKey is the Id of each exception action.", + "Type": { + "$id": "239", + "Name": "Dictionary", + "KeyType": { + "$id": "240", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "241", + "Name": "ExceptionAction", + "Namespace": "AzureCommunicationRoutingService", + "Description": "The action to take when the exception is triggered", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "242", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "243", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "244", + "Name": "CancelExceptionAction", + "Namespace": "AzureCommunicationRoutingService", + "Description": "An action that marks a job as cancelled", + "IsNullable": false, + "DiscriminatorValue": "cancel", + "BaseModel": { + "$ref": "241" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "245", + "Name": "note", + "SerializedName": "note", + "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", + "Type": { + "$id": "246", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "247", + "Name": "dispositionCode", + "SerializedName": "dispositionCode", + "Description": "(Optional) Indicates the outcome of the job, populate this field with your own\ncustom values.", + "Type": { + "$id": "248", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "249", + "Name": "ManualReclassifyExceptionAction", + "Namespace": "AzureCommunicationRoutingService", + "Description": "An action that manually reclassifies a job by providing the queue, priority and\nworker selectors.", + "IsNullable": false, + "DiscriminatorValue": "manual-reclassify", + "BaseModel": { + "$ref": "241" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "250", + "Name": "queueId", + "SerializedName": "queueId", + "Description": "Updated QueueId.", + "Type": { + "$id": "251", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "252", + "Name": "priority", + "SerializedName": "priority", + "Description": "Updated Priority.", + "Type": { + "$id": "253", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "254", + "Name": "workerSelectors", + "SerializedName": "workerSelectors", + "Description": "Updated WorkerSelectors.", + "Type": { + "$id": "255", + "Name": "Array", + "ElementType": { + "$ref": "179" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "256", + "Name": "ReclassifyExceptionAction", + "Namespace": "AzureCommunicationRoutingService", + "Description": "An action that modifies labels on a job and then reclassifies it", + "IsNullable": false, + "DiscriminatorValue": "reclassify", + "BaseModel": { + "$ref": "241" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "257", + "Name": "classificationPolicyId", + "SerializedName": "classificationPolicyId", + "Description": "(optional) The new classification policy that will determine queue, priority\nand worker selectors.", + "Type": { + "$id": "258", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "259", + "Name": "labelsToUpsert", + "SerializedName": "labelsToUpsert", + "Description": "(optional) Dictionary containing the labels to update (or add if not existing)\nin key-value pairs", + "Type": { + "$id": "260", + "Name": "Dictionary", + "KeyType": { + "$id": "261", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "262", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "227" + }, + { + "$ref": "229" + }, + { + "$ref": "232" + }, + { + "$ref": "235" + }, + { + "$ref": "241" + }, + { + "$ref": "244" + }, + { + "$ref": "249" + }, + { + "$ref": "256" + }, + { + "$id": "263", + "Name": "PagedExceptionPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of exception policies.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "264", + "Name": "value", + "SerializedName": "value", + "Description": "The ExceptionPolicyItem items on this page", + "Type": { + "$id": "265", + "Name": "Array", + "ElementType": { + "$id": "266", + "Name": "ExceptionPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of ExceptionPolicy", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "267", + "Name": "exceptionPolicy", + "SerializedName": "exceptionPolicy", + "Description": "A policy that defines actions to execute when exception are triggered.", + "Type": { + "$ref": "219" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "268", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "269", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "270", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "271", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "266" + }, + { + "$id": "272", + "Name": "RouterQueue", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A queue that can contain jobs to be routed.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "273", + "Name": "id", + "SerializedName": "id", + "Description": "The Id of this queue", + "Type": { + "$id": "274", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "275", + "Name": "name", + "SerializedName": "name", + "Description": "The name of this queue.", + "Type": { + "$id": "276", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "277", + "Name": "distributionPolicyId", + "SerializedName": "distributionPolicyId", + "Description": "The ID of the distribution policy that will determine how a job is distributed\nto workers.", + "Type": { + "$id": "278", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "279", + "Name": "labels", + "SerializedName": "labels", + "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", + "Type": { + "$id": "280", + "Name": "Dictionary", + "KeyType": { + "$id": "281", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "282", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "283", + "Name": "exceptionPolicyId", + "SerializedName": "exceptionPolicyId", + "Description": "(Optional) The ID of the exception policy that determines various job\nescalation rules.", + "Type": { + "$id": "284", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "285", + "Name": "PagedRouterQueueItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of queues.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "286", + "Name": "value", + "SerializedName": "value", + "Description": "The RouterQueueItem items on this page", + "Type": { + "$id": "287", + "Name": "Array", + "ElementType": { + "$id": "288", + "Name": "RouterQueueItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of RouterQueue", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "289", + "Name": "queue", + "SerializedName": "queue", + "Description": "A queue that can contain jobs to be routed.", + "Type": { + "$ref": "272" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "290", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "291", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "292", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "293", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "288" + }, + { + "$id": "294", + "Name": "RouterJob", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A unit of work to be routed", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "295", + "Name": "id", + "SerializedName": "id", + "Description": "The id of the job.", + "Type": { + "$id": "296", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "297", + "Name": "channelReference", + "SerializedName": "channelReference", + "Description": "Reference to an external parent context, eg. call ID.", + "Type": { + "$id": "298", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "299", + "Name": "status", + "SerializedName": "status", + "Description": "The status of the Job.", + "Type": { + "$ref": "17" + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "300", + "Name": "enqueuedAt", + "SerializedName": "enqueuedAt", + "Description": "The time a job was queued in UTC.", + "Type": { + "$id": "301", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "302", + "Name": "channelId", + "SerializedName": "channelId", + "Description": "The channel identifier. eg. voice, chat, etc.", + "Type": { + "$id": "303", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "304", + "Name": "classificationPolicyId", + "SerializedName": "classificationPolicyId", + "Description": "The Id of the Classification policy used for classifying a job.", + "Type": { + "$id": "305", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "306", + "Name": "queueId", + "SerializedName": "queueId", + "Description": "The Id of the Queue that this job is queued to.", + "Type": { + "$id": "307", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "308", + "Name": "priority", + "SerializedName": "priority", + "Description": "The priority of this job.", + "Type": { + "$id": "309", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "310", + "Name": "dispositionCode", + "SerializedName": "dispositionCode", + "Description": "Reason code for cancelled or closed jobs.", + "Type": { + "$id": "311", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "312", + "Name": "requestedWorkerSelectors", + "SerializedName": "requestedWorkerSelectors", + "Description": "A collection of manually specified label selectors, which a worker must satisfy\nin order to process this job.", + "Type": { + "$id": "313", + "Name": "Array", + "ElementType": { + "$ref": "179" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "314", + "Name": "attachedWorkerSelectors", + "SerializedName": "attachedWorkerSelectors", + "Description": "A collection of label selectors attached by a classification policy, which a\nworker must satisfy in order to process this job.", + "Type": { + "$id": "315", + "Name": "Array", + "ElementType": { + "$ref": "179" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "316", + "Name": "labels", + "SerializedName": "labels", + "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", + "Type": { + "$id": "317", + "Name": "Dictionary", + "KeyType": { + "$id": "318", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "319", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "320", + "Name": "assignments", + "SerializedName": "assignments", + "Description": "A collection of the assignments of the job.\nKey is AssignmentId.", + "Type": { + "$id": "321", + "Name": "Dictionary", + "KeyType": { + "$id": "322", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "323", + "Name": "RouterJobAssignment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Assignment details of a job to a worker", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "324", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The Id of the job assignment.", + "Type": { + "$id": "325", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "326", + "Name": "workerId", + "SerializedName": "workerId", + "Description": "The Id of the Worker assigned to the job.", + "Type": { + "$id": "327", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "328", + "Name": "assignedAt", + "SerializedName": "assignedAt", + "Description": "The assignment time of the job in UTC.", + "Type": { + "$id": "329", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "330", + "Name": "completedAt", + "SerializedName": "completedAt", + "Description": "The time the job was marked as completed after being assigned in UTC.", + "Type": { + "$id": "331", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "332", + "Name": "closedAt", + "SerializedName": "closedAt", + "Description": "The time the job was marked as closed after being completed in UTC.", + "Type": { + "$id": "333", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "334", + "Name": "tags", + "SerializedName": "tags", + "Description": "A set of non-identifying attributes attached to this job", + "Type": { + "$id": "335", + "Name": "Dictionary", + "KeyType": { + "$id": "336", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "337", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "338", + "Name": "notes", + "SerializedName": "notes", + "Description": "Notes attached to a job, sorted by timestamp", + "Type": { + "$id": "339", + "Name": "Dictionary", + "KeyType": { + "$id": "340", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "341", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "342", + "Name": "scheduledAt", + "SerializedName": "scheduledAt", + "Description": "If set, job will be scheduled to be enqueued at a given time", + "Type": { + "$id": "343", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "344", + "Name": "matchingMode", + "SerializedName": "matchingMode", + "Description": "The matching mode to be applied to this job.\n \nSupported types:\n \n \nQueueAndMatchMode: Used when matching worker to a job is required to be\ndone right after job is queued.\nScheduleAndSuspendMode: Used for scheduling\njobs to be queued at a future time. At specified time, matching of a worker to\nthe job will not start automatically.\nSuspendMode: Used when matching workers\nto a job needs to be suspended.", + "Type": { + "$id": "345", + "Name": "JobMatchingMode", + "Namespace": "AzureCommunicationRoutingService", + "Description": "The matching mode to be applied to this job.\n \nSupported types:\n \n \nQueueAndMatchMode: Used when matching worker to a job is required to be\ndone right after job is queued.\nScheduleAndSuspendMode: Used for scheduling\njobs to be queued at a future time. At specified time, matching of a worker to\nthe job will not start automatically.\nSuspendMode: Used when matching workers\nto a job needs to be suspended.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "346", + "Name": "modeType", + "SerializedName": "modeType", + "Description": "Discriminator value used to differentiate between supported matching mode types.", + "Type": { + "$ref": "30" + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "347", + "Name": "queueAndMatchMode", + "SerializedName": "queueAndMatchMode", + "Description": "Describes a matching mode where matching worker to a job is automatically\nstarted after job is queued successfully.", + "Type": { + "$id": "348", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "349", + "Name": "scheduleAndSuspendMode", + "SerializedName": "scheduleAndSuspendMode", + "Description": "Describes a matching mode used for scheduling jobs to be queued at a future\ntime.\nAt the specified time, matching worker to a job will not start\nautomatically.", + "Type": { + "$id": "350", + "Name": "ScheduleAndSuspendMode", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Describes a matching mode used for scheduling jobs to be queued at a future\ntime.\nAt the specified time, matching worker to a job will not start\nautomatically.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "351", + "Name": "scheduleAt", + "SerializedName": "scheduleAt", + "Description": "Scheduled time.", + "Type": { + "$id": "352", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "353", + "Name": "suspendMode", + "SerializedName": "suspendMode", + "Description": "Describes a matching mode where matching worker to a job is suspended.", + "Type": { + "$id": "354", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "323" + }, + { + "$ref": "345" + }, + { + "$ref": "350" + }, + { + "$id": "355", + "Name": "", + "Namespace": "AzureCommunicationRoutingService", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "356", + "Name": "CancelJobRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for deleting a job", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "357", + "Name": "note", + "SerializedName": "note", + "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", + "Type": { + "$id": "358", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "359", + "Name": "dispositionCode", + "SerializedName": "dispositionCode", + "Description": "Indicates the outcome of the job, populate this field with your own custom\nvalues.\nIf not provided, default value of \"Cancelled\" is set.", + "Type": { + "$id": "360", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "361", + "Name": "CompleteJobRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for completing jobs", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "362", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The assignment within the job to complete.", + "Type": { + "$id": "363", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "364", + "Name": "note", + "SerializedName": "note", + "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", + "Type": { + "$id": "365", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "366", + "Name": "CloseJobRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for closing jobs", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "367", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The assignment within which the job is to be closed.", + "Type": { + "$id": "368", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "369", + "Name": "dispositionCode", + "SerializedName": "dispositionCode", + "Description": "Indicates the outcome of the job, populate this field with your own custom\nvalues.", + "Type": { + "$id": "370", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "371", + "Name": "closeAt", + "SerializedName": "closeAt", + "Description": "If not provided, worker capacity is released immediately along with a\nJobClosedEvent notification.\nIf provided, worker capacity is released along\nwith a JobClosedEvent notification at a future time in UTC.", + "Type": { + "$id": "372", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "373", + "Name": "note", + "SerializedName": "note", + "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", + "Type": { + "$id": "374", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "375", + "Name": "PagedRouterJobItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of jobs.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "376", + "Name": "value", + "SerializedName": "value", + "Description": "The RouterJobItem items on this page", + "Type": { + "$id": "377", + "Name": "Array", + "ElementType": { + "$id": "378", + "Name": "RouterJobItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of RouterJob", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "379", + "Name": "job", + "SerializedName": "job", + "Description": "A unit of work to be routed", + "Type": { + "$ref": "294" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "380", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "381", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "382", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "383", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "378" + }, + { + "$id": "384", + "Name": "RouterJobPositionDetails", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Position and estimated wait time for a job.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "385", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "Id of the job these details are about.", + "Type": { + "$id": "386", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "387", + "Name": "position", + "SerializedName": "position", + "Description": "Position of the job in question within that queue.", + "Type": { + "$id": "388", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "389", + "Name": "queueId", + "SerializedName": "queueId", + "Description": "Id of the queue this job is enqueued in.", + "Type": { + "$id": "390", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "391", + "Name": "queueLength", + "SerializedName": "queueLength", + "Description": "Length of the queue: total number of enqueued jobs.", + "Type": { + "$id": "392", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "393", + "Name": "estimatedWaitTimeMinutes", + "SerializedName": "estimatedWaitTimeMinutes", + "Description": "Estimated wait time of the job rounded up to the nearest minute", + "Type": { + "$id": "394", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "395", + "Name": "UnassignJobRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for unassigning a job.", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "396", + "Name": "suspendMatching", + "SerializedName": "suspendMatching", + "Description": "If SuspendMatching is true, then the job is not queued for re-matching with a\nworker.", + "Type": { + "$id": "397", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "398", + "Name": "UnassignJobResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response payload after a job has been successfully unassigned.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "399", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "The Id of the job unassigned.", + "Type": { + "$id": "400", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "401", + "Name": "unassignmentCount", + "SerializedName": "unassignmentCount", + "Description": "The number of times a job is unassigned. At a maximum 3.", + "Type": { + "$id": "402", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "403", + "Name": "AcceptJobOfferResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response containing Id's for the worker, job, and assignment from an accepted\noffer", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "404", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The assignment Id that assigns a worker that has accepted an offer to a job.", + "Type": { + "$id": "405", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "406", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "The Id of the job assigned.", + "Type": { + "$id": "407", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "408", + "Name": "workerId", + "SerializedName": "workerId", + "Description": "The Id of the worker that has been assigned this job.", + "Type": { + "$id": "409", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "410", + "Name": "DeclineJobOfferRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for declining offers", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "411", + "Name": "retryOfferAt", + "SerializedName": "retryOfferAt", + "Description": "If the RetryOfferAt is not provided, then this job will not be offered again to\nthe worker who declined this job unless\nthe worker is de-registered and\nre-registered. If a RetryOfferAt time is provided, then the job will be\nre-matched to\neligible workers at the retry time in UTC. The worker that\ndeclined the job will also be eligible for the job at that time.", + "Type": { + "$id": "412", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "413", + "Name": "RouterQueueStatistics", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Statistics for the queue", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "414", + "Name": "queueId", + "SerializedName": "queueId", + "Description": "Id of the queue these details are about.", + "Type": { + "$id": "415", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "416", + "Name": "length", + "SerializedName": "length", + "Description": "Length of the queue: total number of enqueued jobs.", + "Type": { + "$id": "417", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "418", + "Name": "estimatedWaitTimeMinutes", + "SerializedName": "estimatedWaitTimeMinutes", + "Description": "The estimated wait time of this queue rounded up to the nearest minute, grouped\nby job priority", + "Type": { + "$id": "419", + "Name": "Dictionary", + "KeyType": { + "$id": "420", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "421", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "422", + "Name": "longestJobWaitTimeMinutes", + "SerializedName": "longestJobWaitTimeMinutes", + "Description": "The wait time of the job that has been enqueued in this queue for the longest.", + "Type": { + "$id": "423", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "424", + "Name": "RouterWorker", + "Namespace": "AzureCommunicationRoutingService", + "Description": "An entity for jobs to be routed to", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "425", + "Name": "id", + "SerializedName": "id", + "Description": "Id of the worker.", + "Type": { + "$id": "426", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "427", + "Name": "state", + "SerializedName": "state", + "Description": "The current state of the worker.", + "Type": { + "$ref": "49" + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "428", + "Name": "queueAssignments", + "SerializedName": "queueAssignments", + "Description": "The queue(s) that this worker can receive work from.", + "Type": { + "$id": "429", + "Name": "Dictionary", + "KeyType": { + "$id": "430", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "431", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "432", + "Name": "totalCapacity", + "SerializedName": "totalCapacity", + "Description": "The total capacity score this worker has to manage multiple concurrent jobs.", + "Type": { + "$id": "433", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "434", + "Name": "labels", + "SerializedName": "labels", + "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", + "Type": { + "$id": "435", + "Name": "Dictionary", + "KeyType": { + "$id": "436", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "437", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "438", + "Name": "tags", + "SerializedName": "tags", + "Description": "A set of non-identifying attributes attached to this worker.", + "Type": { + "$id": "439", + "Name": "Dictionary", + "KeyType": { + "$id": "440", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "441", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "442", + "Name": "channelConfigurations", + "SerializedName": "channelConfigurations", + "Description": "The channel(s) this worker can handle and their impact on the workers capacity.", + "Type": { + "$id": "443", + "Name": "Dictionary", + "KeyType": { + "$id": "444", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "445", + "Name": "ChannelConfiguration", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Represents the capacity a job in this channel will consume from a worker", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "446", + "Name": "capacityCostPerJob", + "SerializedName": "capacityCostPerJob", + "Description": "The amount of capacity that an instance of a job of this channel will consume\nof the total worker capacity.", + "Type": { + "$id": "447", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "448", + "Name": "maxNumberOfJobs", + "SerializedName": "maxNumberOfJobs", + "Description": "The maximum number of jobs that can be supported concurrently for this channel.", + "Type": { + "$id": "449", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "450", + "Name": "offers", + "SerializedName": "offers", + "Description": "A list of active offers issued to this worker.", + "Type": { + "$id": "451", + "Name": "Array", + "ElementType": { + "$id": "452", + "Name": "RouterJobOffer", + "Namespace": "AzureCommunicationRoutingService", + "Description": "An offer of a job to a worker", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "453", + "Name": "offerId", + "SerializedName": "offerId", + "Description": "The Id of the offer.", + "Type": { + "$id": "454", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "455", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "The Id of the job.", + "Type": { + "$id": "456", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "457", + "Name": "capacityCost", + "SerializedName": "capacityCost", + "Description": "The capacity cost consumed by the job offer.", + "Type": { + "$id": "458", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "459", + "Name": "offeredAt", + "SerializedName": "offeredAt", + "Description": "The time the offer was created in UTC.", + "Type": { + "$id": "460", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "461", + "Name": "expiresAt", + "SerializedName": "expiresAt", + "Description": "The time that the offer will expire in UTC.", + "Type": { + "$id": "462", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "463", + "Name": "assignedJobs", + "SerializedName": "assignedJobs", + "Description": "A list of assigned jobs attached to this worker.", + "Type": { + "$id": "464", + "Name": "Array", + "ElementType": { + "$id": "465", + "Name": "RouterWorkerAssignment", + "Namespace": "AzureCommunicationRoutingService", + "Description": "The assignment for a worker to a job", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "466", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The Id of the assignment.", + "Type": { + "$id": "467", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "468", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "The Id of the Job assigned.", + "Type": { + "$id": "469", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "470", + "Name": "capacityCost", + "SerializedName": "capacityCost", + "Description": "The amount of capacity this assignment has consumed on the worker.", + "Type": { + "$id": "471", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "472", + "Name": "assignedAt", + "SerializedName": "assignedAt", + "Description": "The assignment time of the job in UTC.", + "Type": { + "$id": "473", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "474", + "Name": "loadRatio", + "SerializedName": "loadRatio", + "Description": "A value indicating the workers capacity. A value of '1' means all capacity is\nconsumed. A value of '0' means no capacity is currently consumed.", + "Type": { + "$id": "475", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "476", + "Name": "availableForOffers", + "SerializedName": "availableForOffers", + "Description": "A flag indicating this worker is open to receive offers or not.", + "Type": { + "$id": "477", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "445" + }, + { + "$ref": "452" + }, + { + "$ref": "465" + }, + { + "$id": "478", + "Name": "PagedRouterWorkerItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of workers.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "479", + "Name": "value", + "SerializedName": "value", + "Description": "The RouterWorkerItem items on this page", + "Type": { + "$id": "480", + "Name": "Array", + "ElementType": { + "$id": "481", + "Name": "RouterWorkerItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of RouterWorker", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "482", + "Name": "worker", + "SerializedName": "worker", + "Description": "An entity for jobs to be routed to", + "Type": { + "$ref": "424" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "483", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "484", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "485", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "486", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "481" + } + ], + "Clients": [ + { + "$id": "487", + "Name": "JobRouterAdministrationRestClient", + "Description": "", + "Operations": [ + { + "$id": "488", + "Name": "upsertDistributionPolicy", + "ResourceName": "DistributionPolicy", + "Summary": "Creates or updates a distribution policy.", + "Description": "Creates or updates a distribution policy.", + "Parameters": [ + { + "$id": "489", + "Name": "endpoint", + "NameInRequest": "endpoint", + "Type": { + "$id": "490", + "Name": "Uri", + "Kind": "Uri", + "IsNullable": false + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client" + }, + { + "$id": "491", + "Name": "apiVersion", + "NameInRequest": "api-version", + "Description": "", + "Type": { + "$id": "492", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": true, + "IsContentType": false, + "IsEndpoint": false, + "IsResourceParameter": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "493", + "Type": { + "$id": "494", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "2023-11-01" + } + }, + { + "$id": "495", + "Name": "id", + "NameInRequest": "id", + "Description": "The unique identifier of the policy.", + "Type": { + "$id": "496", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "497", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "498", + "Name": "Literal", + "LiteralValueType": { + "$id": "499", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "500", + "Type": { + "$ref": "498" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "501", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "502", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "503", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "504", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "505", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "58" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "506", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "507", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "508", + "Type": { + "$ref": "507" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "509", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "58" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "510", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "511", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "512", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "513", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "514", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "58" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "515", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "516", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "517", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "518", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/distributionPolicies/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "519", + "Name": "getDistributionPolicy", + "ResourceName": "DistributionPolicy", + "Summary": "Retrieves an existing distribution policy by Id.", + "Description": "Retrieves an existing distribution policy by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "520", + "Name": "id", + "NameInRequest": "id", + "Description": "The unique identifier of the policy.", + "Type": { + "$id": "521", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "522", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "523", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "524", + "Type": { + "$ref": "523" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "525", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "58" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "526", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "527", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "528", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "529", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/distributionPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "530", + "Name": "listDistributionPolicies", + "ResourceName": "JobRouterAdministrationRestClient", + "Summary": "Retrieves existing distribution policies.", + "Description": "Retrieves existing distribution policies.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "531", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Maximum page size.", + "Type": { + "$id": "532", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "533", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "534", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "535", + "Type": { + "$ref": "534" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "536", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "122" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/distributionPolicies", + "BufferResponse": true, + "Paging": { + "$id": "537", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "538", + "Name": "deleteDistributionPolicy", + "ResourceName": "DistributionPolicy", + "Summary": "Delete a distribution policy by Id.", + "Description": "Delete a distribution policy by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "539", + "Name": "id", + "NameInRequest": "id", + "Description": "The unique identifier of the policy.", + "Type": { + "$id": "540", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "541", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "542", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "543", + "Type": { + "$ref": "542" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "544", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/distributionPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "545", + "Name": "upsertClassificationPolicy", + "ResourceName": "ClassificationPolicy", + "Summary": "Creates or updates a classification policy.", + "Description": "Creates or updates a classification policy.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "546", + "Name": "id", + "NameInRequest": "id", + "Description": "Unique identifier of this policy.", + "Type": { + "$id": "547", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "548", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "549", + "Name": "Literal", + "LiteralValueType": { + "$id": "550", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "551", + "Type": { + "$ref": "549" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "552", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "553", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "554", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "555", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "556", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "131" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "557", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "558", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "559", + "Type": { + "$ref": "558" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "560", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "131" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "561", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "562", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "563", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "564", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "565", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "131" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "566", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "567", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "568", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "569", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/classificationPolicies/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "570", + "Name": "getClassificationPolicy", + "ResourceName": "ClassificationPolicy", + "Summary": "Retrieves an existing classification policy by Id.", + "Description": "Retrieves an existing classification policy by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "571", + "Name": "id", + "NameInRequest": "id", + "Description": "Unique identifier of this policy.", + "Type": { + "$id": "572", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "573", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "574", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "575", + "Type": { + "$ref": "574" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "576", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "131" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "577", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "578", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "579", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "580", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/classificationPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "581", + "Name": "listClassificationPolicies", + "ResourceName": "JobRouterAdministrationRestClient", + "Summary": "Retrieves existing classification policies.", + "Description": "Retrieves existing classification policies.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "582", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Maximum page size.", + "Type": { + "$id": "583", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "584", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "585", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "586", + "Type": { + "$ref": "585" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "587", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "210" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/classificationPolicies", + "BufferResponse": true, + "Paging": { + "$id": "588", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "589", + "Name": "deleteClassificationPolicy", + "ResourceName": "ClassificationPolicy", + "Summary": "Delete a classification policy by Id.", + "Description": "Delete a classification policy by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "590", + "Name": "id", + "NameInRequest": "id", + "Description": "Unique identifier of this policy.", + "Type": { + "$id": "591", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "592", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "593", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "594", + "Type": { + "$ref": "593" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "595", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/classificationPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "596", + "Name": "upsertExceptionPolicy", + "ResourceName": "ExceptionPolicy", + "Summary": "Creates or updates a exception policy.", + "Description": "Creates or updates a exception policy.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "597", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of the exception policy", + "Type": { + "$id": "598", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "599", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "600", + "Name": "Literal", + "LiteralValueType": { + "$id": "601", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "602", + "Type": { + "$ref": "600" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "603", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "604", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "605", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "606", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "607", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "219" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "608", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "609", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "610", + "Type": { + "$ref": "609" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "611", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "219" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "612", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "613", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "614", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "615", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "616", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "219" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "617", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "618", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "619", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "620", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/exceptionPolicies/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "621", + "Name": "getExceptionPolicy", + "ResourceName": "ExceptionPolicy", + "Summary": "Retrieves an existing exception policy by Id.", + "Description": "Retrieves an existing exception policy by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "622", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of the exception policy", + "Type": { + "$id": "623", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "624", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "625", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "626", + "Type": { + "$ref": "625" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "627", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "219" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "628", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "629", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "630", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "631", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/exceptionPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "632", + "Name": "listExceptionPolicies", + "ResourceName": "JobRouterAdministrationRestClient", + "Summary": "Retrieves existing exception policies.", + "Description": "Retrieves existing exception policies.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "633", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "634", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "635", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "636", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "637", + "Type": { + "$ref": "636" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "638", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "263" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/exceptionPolicies", + "BufferResponse": true, + "Paging": { + "$id": "639", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "640", + "Name": "deleteExceptionPolicy", + "ResourceName": "ExceptionPolicy", + "Summary": "Deletes a exception policy by Id.", + "Description": "Deletes a exception policy by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "641", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of the exception policy", + "Type": { + "$id": "642", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "643", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "644", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "645", + "Type": { + "$ref": "644" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "646", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/exceptionPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "647", + "Name": "upsertQueue", + "ResourceName": "RouterQueue", + "Summary": "Creates or updates a queue.", + "Description": "Creates or updates a queue.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "648", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of this queue", + "Type": { + "$id": "649", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "650", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "651", + "Name": "Literal", + "LiteralValueType": { + "$id": "652", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "653", + "Type": { + "$ref": "651" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "654", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "655", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "656", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "657", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "658", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "272" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "659", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "660", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "661", + "Type": { + "$ref": "660" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "662", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "272" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "663", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "664", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "665", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "666", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "667", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "272" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "668", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "669", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "670", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "671", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/queues/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "672", + "Name": "getQueue", + "ResourceName": "RouterQueue", + "Summary": "Retrieves an existing queue by Id.", + "Description": "Retrieves an existing queue by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "673", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of this queue", + "Type": { + "$id": "674", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "675", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "676", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "677", + "Type": { + "$ref": "676" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "678", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "272" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "679", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "680", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "681", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "682", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/queues/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "683", + "Name": "listQueues", + "ResourceName": "JobRouterAdministrationRestClient", + "Summary": "Retrieves existing queues.", + "Description": "Retrieves existing queues.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "684", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "685", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "686", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "687", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "688", + "Type": { + "$ref": "687" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "689", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "285" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/queues", + "BufferResponse": true, + "Paging": { + "$id": "690", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "691", + "Name": "deleteQueue", + "ResourceName": "RouterQueue", + "Summary": "Deletes a queue by Id.", + "Description": "Deletes a queue by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "692", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of this queue", + "Type": { + "$id": "693", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "694", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "695", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "696", + "Type": { + "$ref": "695" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "697", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/queues/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "698" + }, + "Creatable": true + }, + { + "$id": "699", + "Name": "JobRouterRestClient", + "Description": "", + "Operations": [ + { + "$id": "700", + "Name": "upsertJob", + "ResourceName": "RouterJob", + "Summary": "Creates or updates a router job.", + "Description": "Creates or updates a router job.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "701", + "Name": "id", + "NameInRequest": "id", + "Description": "The id of the job.", + "Type": { + "$id": "702", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "703", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "704", + "Name": "Literal", + "LiteralValueType": { + "$id": "705", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "706", + "Type": { + "$ref": "704" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "707", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "708", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "709", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "710", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "711", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "294" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "712", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "713", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "714", + "Type": { + "$ref": "713" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "715", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "294" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "716", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "717", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "718", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "719", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "720", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "294" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "721", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "722", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "723", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "724", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "725", + "Name": "getJob", + "ResourceName": "RouterJob", + "Summary": "Retrieves an existing job by Id.", + "Description": "Retrieves an existing job by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "726", + "Name": "id", + "NameInRequest": "id", + "Description": "The id of the job.", + "Type": { + "$id": "727", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "728", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "729", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "730", + "Type": { + "$ref": "729" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "731", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "294" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "732", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "733", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "734", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "735", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "736", + "Name": "deleteJob", + "ResourceName": "RouterJob", + "Summary": "Deletes a job and all of its traces.", + "Description": "Deletes a job and all of its traces.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "737", + "Name": "id", + "NameInRequest": "id", + "Description": "The id of the job.", + "Type": { + "$id": "738", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "739", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "740", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "741", + "Type": { + "$ref": "740" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "742", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "743", + "Name": "reclassifyJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Reclassify a job.", + "Description": "Reclassify a job.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "744", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "745", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "746", + "Name": "reclassifyJobRequest", + "NameInRequest": "reclassifyJobRequest", + "Description": "Request object for reclassifying a job.", + "Type": { + "$ref": "355" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "747", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "748", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "749", + "Type": { + "$ref": "748" + }, + "Value": "application/json" + } + }, + { + "$id": "750", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "751", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "752", + "Type": { + "$ref": "751" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "753", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}:reclassify", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "754", + "Name": "cancelJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Submits request to cancel an existing job by Id while supplying free-form\ncancellation reason.", + "Description": "Submits request to cancel an existing job by Id while supplying free-form\ncancellation reason.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "755", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "756", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "757", + "Name": "cancelJobRequest", + "NameInRequest": "cancelJobRequest", + "Description": "Request model for cancelling job.", + "Type": { + "$ref": "356" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "758", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "759", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "760", + "Type": { + "$ref": "759" + }, + "Value": "application/json" + } + }, + { + "$id": "761", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "762", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "763", + "Type": { + "$ref": "762" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "764", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}:cancel", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "765", + "Name": "completeJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Completes an assigned job.", + "Description": "Completes an assigned job.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "766", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "767", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "768", + "Name": "completeJobRequest", + "NameInRequest": "completeJobRequest", + "Description": "Request model for completing job.", + "Type": { + "$ref": "361" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "769", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "770", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "771", + "Type": { + "$ref": "770" + }, + "Value": "application/json" + } + }, + { + "$id": "772", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "773", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "774", + "Type": { + "$ref": "773" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "775", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}:complete", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "776", + "Name": "closeJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Closes a completed job.", + "Description": "Closes a completed job.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "777", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "778", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "779", + "Name": "closeJobRequest", + "NameInRequest": "closeJobRequest", + "Description": "Request model for closing job.", + "Type": { + "$ref": "366" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "780", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "781", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "782", + "Type": { + "$ref": "781" + }, + "Value": "application/json" + } + }, + { + "$id": "783", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "784", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "785", + "Type": { + "$ref": "784" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "786", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}:close", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "787", + "Name": "listJobs", + "ResourceName": "JobRouterRestClient", + "Summary": "Retrieves list of jobs based on filter parameters.", + "Description": "Retrieves list of jobs based on filter parameters.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "788", + "Name": "status", + "NameInRequest": "status", + "Description": "If specified, filter jobs by status.", + "Type": { + "$ref": "34" + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "789", + "Name": "queueId", + "NameInRequest": "queueId", + "Description": "If specified, filter jobs by queue.", + "Type": { + "$id": "790", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "791", + "Name": "channelId", + "NameInRequest": "channelId", + "Description": "If specified, filter jobs by channel.", + "Type": { + "$id": "792", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "793", + "Name": "classificationPolicyId", + "NameInRequest": "classificationPolicyId", + "Description": "If specified, filter jobs by classificationPolicy.", + "Type": { + "$id": "794", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "795", + "Name": "scheduledBefore", + "NameInRequest": "scheduledBefore", + "Description": "If specified, filter on jobs that was scheduled before or at given timestamp.\nRange: (-Inf, scheduledBefore].", + "Type": { + "$id": "796", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "797", + "Name": "scheduledAfter", + "NameInRequest": "scheduledAfter", + "Description": "If specified, filter on jobs that was scheduled at or after given value. Range:\n[scheduledAfter, +Inf).", + "Type": { + "$id": "798", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "799", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "800", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "801", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "802", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "803", + "Type": { + "$ref": "802" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "804", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "375" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/jobs", + "BufferResponse": true, + "Paging": { + "$id": "805", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "806", + "Name": "getQueuePosition", + "ResourceName": "JobRouterRestClient", + "Summary": "Gets a job's position details.", + "Description": "Gets a job's position details.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "807", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "808", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "809", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "810", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "811", + "Type": { + "$ref": "810" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "812", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "384" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}/position", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "813", + "Name": "unassignJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Un-assign a job.", + "Description": "Un-assign a job.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "814", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job to un-assign.", + "Type": { + "$id": "815", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "816", + "Name": "assignmentId", + "NameInRequest": "assignmentId", + "Description": "Id of the assignment to un-assign.", + "Type": { + "$id": "817", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "818", + "Name": "unassignJobRequest", + "NameInRequest": "unassignJobRequest", + "Description": "Request body for unassign route.", + "Type": { + "$ref": "395" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "819", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "820", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "821", + "Type": { + "$ref": "820" + }, + "Value": "application/json" + } + }, + { + "$id": "822", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "823", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "824", + "Type": { + "$ref": "823" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "825", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "398" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}/assignments/{assignmentId}:unassign", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "826", + "Name": "acceptJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Accepts an offer to work on a job and returns a 409/Conflict if another agent\naccepted the job already.", + "Description": "Accepts an offer to work on a job and returns a 409/Conflict if another agent\naccepted the job already.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "827", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "828", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "829", + "Name": "offerId", + "NameInRequest": "offerId", + "Description": "Id of the offer.", + "Type": { + "$id": "830", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "831", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "832", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "833", + "Type": { + "$ref": "832" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "834", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "403" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}/offers/{offerId}:accept", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "835", + "Name": "declineJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Declines an offer to work on a job.", + "Description": "Declines an offer to work on a job.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "836", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "837", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "838", + "Name": "offerId", + "NameInRequest": "offerId", + "Description": "Id of the offer.", + "Type": { + "$id": "839", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "840", + "Name": "declineJobOfferRequest", + "NameInRequest": "declineJobOfferRequest", + "Description": "Request model for declining offer.", + "Type": { + "$ref": "410" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "841", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "842", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "843", + "Type": { + "$ref": "842" + }, + "Value": "application/json" + } + }, + { + "$id": "844", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "845", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "846", + "Type": { + "$ref": "845" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "847", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}/offers/{offerId}:decline", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "848", + "Name": "getQueueStatistics", + "ResourceName": "JobRouterRestClient", + "Summary": "Retrieves a queue's statistics.", + "Description": "Retrieves a queue's statistics.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "849", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the queue to retrieve statistics.", + "Type": { + "$id": "850", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "851", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "852", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "853", + "Type": { + "$ref": "852" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "854", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "413" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/queues/{id}/statistics", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "855", + "Name": "upsertWorker", + "ResourceName": "RouterWorker", + "Summary": "Creates or updates a worker.", + "Description": "Creates or updates a worker.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "856", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "857", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "858", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "859", + "Name": "Literal", + "LiteralValueType": { + "$id": "860", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "861", + "Type": { + "$ref": "859" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "862", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "863", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "864", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "865", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "866", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "424" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "867", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "868", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "869", + "Type": { + "$ref": "868" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "870", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "424" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "871", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "872", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "873", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "874", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "875", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "424" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "876", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "877", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "878", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "879", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "880", + "Name": "getWorker", + "ResourceName": "RouterWorker", + "Summary": "Retrieves an existing worker by Id.", + "Description": "Retrieves an existing worker by Id.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "881", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "882", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "883", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "884", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "885", + "Type": { + "$ref": "884" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "886", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "424" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "887", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "888", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "889", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "890", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "891", + "Name": "deleteWorker", + "ResourceName": "RouterWorker", + "Summary": "Deletes a worker and all of its traces.", + "Description": "Deletes a worker and all of its traces.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "892", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "893", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "894", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "895", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "896", + "Type": { + "$ref": "895" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "897", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "898", + "Name": "listWorkers", + "ResourceName": "JobRouterRestClient", + "Summary": "Retrieves existing workers.", + "Description": "Retrieves existing workers.", + "Parameters": [ + { + "$ref": "489" + }, + { + "$ref": "491" + }, + { + "$id": "899", + "Name": "state", + "NameInRequest": "state", + "Description": "If specified, select workers by worker state.", + "Type": { + "$ref": "53" + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "900", + "Name": "channelId", + "NameInRequest": "channelId", + "Description": "If specified, select workers who have a channel configuration with this channel.", + "Type": { + "$id": "901", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "902", + "Name": "queueId", + "NameInRequest": "queueId", + "Description": "If specified, select workers who are assigned to this queue.", + "Type": { + "$id": "903", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "904", + "Name": "hasCapacity", + "NameInRequest": "hasCapacity", + "Description": "If set to true, select only workers who have capacity for the channel specified\nby `channelId` or for any channel if `channelId` not specified. If set to\nfalse, then will return all workers including workers without any capacity for\njobs. Defaults to false.", + "Type": { + "$id": "905", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "906", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "907", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "908", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "909", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "910", + "Type": { + "$ref": "909" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "911", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "478" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/workers", + "BufferResponse": true, + "Paging": { + "$id": "912", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "913" + }, + "Creatable": true + } + ] +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs index 9e7142773d44b..7dab435f7fbcd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs @@ -5,7 +5,7 @@ using System.Linq; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("ClassificationPolicy")] [CodeGenSuppress("ClassificationPolicy")] diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyCollection.cs deleted file mode 100644 index 676119595ba22..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("ClassificationPolicyCollection")] - internal partial class ClassificationPolicyCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationError.cs deleted file mode 100644 index d9cbe3c330420..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationError.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Text; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// - /// Error model. - /// - [CodeGenModel("CommunicationError")] - internal partial class CommunicationError - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationJobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationJobRouterModelFactory.cs deleted file mode 100644 index ff49fecc15d40..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationJobRouterModelFactory.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("CommunicationJobRouterModelFactory")] - public static partial class CommunicationJobRouterModelFactory - { - /// Initializes a new instance of CommunicationError. - /// The error code. - /// The error message. - /// The error target. - /// Further details about specific errors that led to this error. - /// The inner error if any. - /// A new instance for mocking. - internal static CommunicationError CommunicationError(string code = null, string message = null, string target = null, IEnumerable details = null, CommunicationError innerError = null) - { - details ??= new List(); - - return new CommunicationError(code, message, target, details?.ToList(), innerError); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyCollection.cs deleted file mode 100644 index d1e689d32d267..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("DistributionPolicyCollection")] - internal partial class DistributionPolicyCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs index 2f0700be6690a..61d59a58a2dd4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs @@ -11,12 +11,5 @@ namespace Azure.Communication.JobRouter [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class ExceptionAction { - /// Initializes a new instance of ExceptionAction. - internal ExceptionAction() - { - } - - /// The type discriminator describing a sub-type of ExceptionAction. - protected string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyCollection.cs deleted file mode 100644 index f09e9ae8a696c..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("ExceptionPolicyCollection")] - internal partial class ExceptionPolicyCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs index 59c89997ccd16..0b8f005102260 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs @@ -11,7 +11,5 @@ namespace Azure.Communication.JobRouter [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class ExceptionTrigger { - /// The type discriminator describing a sub-type of ExceptionTrigger. - protected string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationRestClient.cs index adca80004f341..2f3587365ccb6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationRestClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationRestClient.cs @@ -10,22 +10,22 @@ namespace Azure.Communication.JobRouter { - [CodeGenSuppress("CreateListExceptionPoliciesNextPageRequest", typeof(string), typeof(int?))] - [CodeGenSuppress("CreateListClassificationPoliciesNextPageRequest", typeof(string), typeof(int?))] - [CodeGenSuppress("CreateListQueuesNextPageRequest", typeof(string), typeof(int?))] - [CodeGenSuppress("CreateListDistributionPoliciesNextPageRequest", typeof(string), typeof(int?))] + [CodeGenSuppress("CreateGetExceptionPoliciesNextPageRequest", typeof(string), typeof(int), typeof(RequestContext))] + [CodeGenSuppress("CreateGetClassificationPoliciesNextPageRequest", typeof(string), typeof(int), typeof(RequestContext))] + [CodeGenSuppress("CreateGetQueuesNextPageRequest", typeof(string), typeof(int), typeof(RequestContext))] + [CodeGenSuppress("CreateGetDistributionPoliciesNextPageRequest", typeof(string), typeof(int), typeof(RequestContext))] internal partial class JobRouterAdministrationRestClient { #pragma warning disable CA1801 // Review unused parameters // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListExceptionPoliciesNextPageRequest(string nextLink, int? maxpagesize) + internal HttpMessage CreateGetExceptionPoliciesNextPageRequest(string nextLink, int maxpagesize, RequestContext context) #pragma warning restore CA1801 // Review unused parameters { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendRawNextLink(nextLink, false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -35,14 +35,14 @@ internal HttpMessage CreateListExceptionPoliciesNextPageRequest(string nextLink, #pragma warning disable CA1801 // Review unused parameters // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListClassificationPoliciesNextPageRequest(string nextLink, int? maxpagesize) + internal HttpMessage CreateGetClassificationPoliciesNextPageRequest(string nextLink, int maxpagesize, RequestContext context) #pragma warning restore CA1801 // Review unused parameters { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendRawNextLink(nextLink, false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -52,14 +52,14 @@ internal HttpMessage CreateListClassificationPoliciesNextPageRequest(string next #pragma warning disable CA1801 // Review unused parameters // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListQueuesNextPageRequest(string nextLink, int? maxpagesize) + internal HttpMessage CreateGetQueuesNextPageRequest(string nextLink, int maxpagesize, RequestContext context) #pragma warning restore CA1801 // Review unused parameters { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendRawNextLink(nextLink, false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -69,14 +69,14 @@ internal HttpMessage CreateListQueuesNextPageRequest(string nextLink, int? maxpa #pragma warning disable CA1801 // Review unused parameters // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListDistributionPoliciesNextPageRequest(string nextLink, int? maxpagesize) + internal HttpMessage CreateGetDistributionPoliciesNextPageRequest(string nextLink, int maxpagesize, RequestContext context) #pragma warning restore CA1801 // Review unused parameters { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendRawNextLink(nextLink, false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterRestClient.cs index b12557bba7d6c..7189361f41d2a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterRestClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterRestClient.cs @@ -10,20 +10,20 @@ namespace Azure.Communication.JobRouter { - [CodeGenSuppress("CreateListJobsNextPageRequest", typeof(string), typeof(RouterJobStatusSelector?), typeof(string), typeof(string), typeof(string), typeof(DateTimeOffset?), typeof(DateTimeOffset?), typeof(int?))] - [CodeGenSuppress("CreateListWorkersNextPageRequest", typeof(string), typeof(RouterWorkerStateSelector?), typeof(string), typeof(string), typeof(bool?), typeof(int?))] + [CodeGenSuppress("CreateGetJobsNextPageRequest", typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(DateTimeOffset), typeof(DateTimeOffset), typeof(int), typeof(RequestContext))] + [CodeGenSuppress("CreateGetWorkersNextPageRequest", typeof(string), typeof(string), typeof(string), typeof(string), typeof(bool), typeof(int), typeof(RequestContext))] internal partial class JobRouterRestClient { #pragma warning disable CA1801 // Review unused parameters // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListJobsNextPageRequest(string nextLink, RouterJobStatusSelector? status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset? scheduledBefore, DateTimeOffset? scheduledAfter, int? maxPageSize) + internal HttpMessage CreateGetJobsNextPageRequest(string nextLink, string status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset scheduledBefore, DateTimeOffset scheduledAfter, int maxPageSize, RequestContext context) #pragma warning restore CA1801 // Review unused parameters { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendRawNextLink(nextLink, false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -33,14 +33,14 @@ internal HttpMessage CreateListJobsNextPageRequest(string nextLink, RouterJobSta #pragma warning disable CA1801 // Review unused parameters // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListWorkersNextPageRequest(string nextLink, RouterWorkerStateSelector? state, string channelId, string queueId, bool? hasCapacity, int? maxpagesize) + internal HttpMessage CreateGetWorkersNextPageRequest(string nextLink, string state, string channelId, string queueId, bool hasCapacity, int maxpagesize, RequestContext context) #pragma warning restore CA1801 // Review unused parameters { - var message = _pipeline.CreateMessage(); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.Reset(_endpoint); uri.AppendRawNextLink(nextLink, false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs index ae2c15772ff6b..3083b4d1f5d45 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs @@ -10,12 +10,5 @@ namespace Azure.Communication.JobRouter [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class QueueSelectorAttachment { - /// Initializes a new instance of QueueSelectorAttachment. - internal QueueSelectorAttachment() - { - } - - /// The type discriminator describing the type of label selector attachment. - protected string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobRequest.cs deleted file mode 100644 index 0ba66ea08ad7d..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobRequest.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// An assignment of a worker to a queue. - /// - internal class ReclassifyJobRequest : IUtf8JsonSerializable - { - /// - /// Write empty object. - /// - /// - void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs index c8887150f83e1..c4e69672dfcb4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs @@ -8,7 +8,7 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterJob")] [CodeGenSuppress("RouterJob")] @@ -20,8 +20,8 @@ internal RouterJob() AttachedWorkerSelectors = new ChangeTrackingList(); Assignments = new ChangeTrackingDictionary(); _requestedWorkerSelectors = new ChangeTrackingList(); - _labels = new ChangeTrackingDictionary(); - _tags = new ChangeTrackingDictionary(); + _labels = new ChangeTrackingDictionary(); + _tags = new ChangeTrackingDictionary(); _notes = new ChangeTrackingDictionary(); } @@ -61,13 +61,13 @@ internal RouterJob() public JobMatchingMode MatchingMode { get; internal set; } [CodeGenMember("Labels")] - internal IDictionary _labels + internal IDictionary _labels { get { return Labels != null && Labels.Count != 0 - ? Labels?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? Labels?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { @@ -82,13 +82,13 @@ internal IDictionary _labels } [CodeGenMember("Tags")] - internal IDictionary _tags + internal IDictionary _tags { get { return Tags != null && Tags.Count != 0 - ? Tags?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? Tags?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs index 82ce8083a058a..c0358a38e9c8d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterJobAssignment")] public partial class RouterJobAssignment diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobCollection.cs deleted file mode 100644 index 084175ff5686d..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("RouterJobCollection")] - internal partial class RouterJobCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueCollection.cs deleted file mode 100644 index c26f0b26933c6..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("RouterQueueCollection")] - internal partial class RouterQueueCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs index 65e749efc2a55..9e32cd212a187 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Text.Json.Serialization; using Azure.Core; @@ -11,14 +12,14 @@ namespace Azure.Communication.JobRouter public partial class RouterQueueSelector { [CodeGenMember("Value")] - private object _value { + private BinaryData _value { get { - return Value.Value; + return BinaryData.FromObjectAsJson(Value.Value); } set { - Value = new LabelValue(value); + Value = new LabelValue(value.ToObjectFromJson()); } } /// The value to compare against the actual label value with the given operator. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs index 6684ce9e52261..5d98cb4927df9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs @@ -11,12 +11,5 @@ namespace Azure.Communication.JobRouter [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class RouterRule { - /// Initializes a new instance of RouterRule. - internal RouterRule() - { - } - - /// The type discriminator describing a sub-type of Rule. - public string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs index ee5f7148c08c7..4f5d2139498e7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Linq; using System.Text.Json.Serialization; @@ -14,9 +15,9 @@ public partial class RouterWorker /// Initializes a new instance of RouterWorker. internal RouterWorker() { - _queueAssignments = new ChangeTrackingDictionary(); - _labels = new ChangeTrackingDictionary(); - _tags = new ChangeTrackingDictionary(); + _queueAssignments = new ChangeTrackingDictionary(); + _labels = new ChangeTrackingDictionary(); + _tags = new ChangeTrackingDictionary(); _channelConfigurations = new ChangeTrackingDictionary(); Offers = new ChangeTrackingList(); AssignedJobs = new ChangeTrackingList(); @@ -45,13 +46,13 @@ internal RouterWorker() public bool? AvailableForOffers { get; internal set; } [CodeGenMember("Labels")] - internal IDictionary _labels + internal IDictionary _labels { get { return Labels != null && Labels.Count != 0 - ? Labels?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? Labels?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { @@ -59,20 +60,20 @@ internal IDictionary _labels { foreach (var label in value) { - Labels[label.Key] = new LabelValue(label.Value); + Labels[label.Key] = new LabelValue(label.Value.ToObjectFromJson()); } } } } [CodeGenMember("Tags")] - internal IDictionary _tags + internal IDictionary _tags { get { return Tags != null && Tags.Count != 0 - ? Tags?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? Tags?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { @@ -105,14 +106,14 @@ internal IDictionary _channelConfigurations { } [CodeGenMember("QueueAssignments")] - internal IDictionary _queueAssignments + internal IDictionary _queueAssignments { get { return QueueAssignments != null ? QueueAssignments.ToDictionary(x => x.Key, - x => (object)x.Value) - : new ChangeTrackingDictionary(); + x => BinaryData.FromObjectAsJson( new {})) + : new ChangeTrackingDictionary(); } set { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerCollection.cs deleted file mode 100644 index 8e9b3d7aaf5a5..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("RouterWorkerCollection")] - internal partial class RouterWorkerCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs index b9438f2322330..1200b28999d15 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs @@ -28,15 +28,15 @@ internal double? _expiresAfterSeconds { } [CodeGenMember("Value")] - private object _value + private BinaryData _value { get { - return Value.Value; + return BinaryData.FromObjectAsJson(Value.Value); } set { - Value = new LabelValue(value); + Value = new LabelValue(value.ToObjectFromJson()); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelectorStatus.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelectorStatus.cs deleted file mode 100644 index 4afa6d42fd55d..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelectorStatus.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("RouterWorkerSelectorStatus")] - public readonly partial struct RouterWorkerSelectorStatus - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs index 2b4756efab8f8..77c39e52dc7f5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs @@ -20,8 +20,5 @@ public ScheduleAndSuspendMode(DateTimeOffset scheduleAt) Argument.AssertNotNull(scheduleAt, nameof(scheduleAt)); ScheduleAt = scheduleAt; } - - /// Gets or sets the schedule at. - public DateTimeOffset ScheduleAt { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs index 70fc26cb5347d..9aa9a1ace248d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs @@ -9,28 +9,28 @@ namespace Azure.Communication.JobRouter { [CodeGenModel("StaticRouterRule")] - [CodeGenSuppress("StaticRouterRule")] public partial class StaticRouterRule : RouterRule { /// The static value this rule always returns. public LabelValue Value { get; set; } [CodeGenMember("Value")] - internal object _value { + internal BinaryData _value { get { - return Value.Value; + return BinaryData.FromObjectAsJson(Value.Value); } set { - Value = new LabelValue(value); + Value = new LabelValue(value.ToObjectFromJson()); } } /// Initializes a new instance of StaticRule. /// The static value this rule always returns. - public StaticRouterRule(LabelValue value) : this(null, value.Value) + public StaticRouterRule(LabelValue value) : this(null, BinaryData.FromObjectAsJson(value.Value)) { + Kind = "static-rule"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs index cef497bb5ea66..7bdb3d9454304 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs @@ -10,12 +10,5 @@ namespace Azure.Communication.JobRouter [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class WorkerSelectorAttachment { - /// Initializes a new instance of QueueSelectorAttachment. - internal WorkerSelectorAttachment() - { - } - - /// The type discriminator describing the type of label selector attachment. - protected string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/autorest.md b/sdk/communication/Azure.Communication.JobRouter/src/autorest.md deleted file mode 100644 index 9fb1dbc8b78f8..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/autorest.md +++ /dev/null @@ -1,27 +0,0 @@ -# Azure.Communication.JobRouter - -When a new version of the swagger needs to be updated: -1. Go to sdk\communication\Azure.Communication.JobRouter\src, and run `dotnet msbuild /t:GenerateCode` to generate code. -2. In root folder, run `eng\scripts\Export-API.ps1 -ServiceDirectory communication/Azure.Communication.JobRouter` -3. In root folder, run `eng\scripts\Update-Snippets.ps1 -ServiceDirectory communication/Azure.Communication.JobRouter` - -> see [https://aka.ms/autorest](https://aka.ms/autorest) - -## Configuration - -```yaml -tag: package-jobrouter-2022-07-18-preview -model-namespace: false -require: - - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/29159d148372f5f61cb04b76fc87252b13c62515/specification/communication/data-plane/JobRouter/readme.md - -generation1-convenience-client: true -reflect-api-versions: true -protocol-method-list: - - JobRouterAdministration_UpsertClassificationPolicy - - JobRouterAdministration_UpsertDistributionPolicy - - JobRouterAdministration_UpsertExceptionPolicy - - JobRouterAdministration_UpsertQueue - - JobRouter_UpsertJob - - JobRouter_UpsertWorker -``` diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationRestClient.cs new file mode 100644 index 0000000000000..bd477b926a3c8 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationRestClient.cs @@ -0,0 +1,1274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.JobRouter.Samples +{ + public class Samples_JobRouterAdministrationRestClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertDistributionPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new { }; + + Response response = client.UpsertDistributionPolicy("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertDistributionPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new + { + name = "", + offerExpiresAfterSeconds = 123.45d, + mode = new + { + scoringRule = new + { + kind = "direct-map-rule", + }, + scoringRuleOptions = new + { + batchSize = 1234, + scoringParameters = new[] { + "jobLabels" + }, + allowScoringBatchOfWorkers = true, + descendingOrder = true, + }, + kind = "best-worker", + minConcurrentOffers = 1234, + maxConcurrentOffers = 1234, + bypassSelectors = true, + }, + }; + + Response response = client.UpsertDistributionPolicy("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertDistributionPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new { }; + + Response response = await client.UpsertDistributionPolicyAsync("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertDistributionPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new + { + name = "", + offerExpiresAfterSeconds = 123.45d, + mode = new + { + scoringRule = new + { + kind = "direct-map-rule", + }, + scoringRuleOptions = new + { + batchSize = 1234, + scoringParameters = new[] { + "jobLabels" + }, + allowScoringBatchOfWorkers = true, + descendingOrder = true, + }, + kind = "best-worker", + minConcurrentOffers = 1234, + maxConcurrentOffers = 1234, + bypassSelectors = true, + }, + }; + + Response response = await client.UpsertDistributionPolicyAsync("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.GetDistributionPolicy("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.GetDistributionPolicy("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.GetDistributionPolicyAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.GetDistributionPolicyAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicy_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var result = await client.GetDistributionPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteDistributionPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.DeleteDistributionPolicy(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteDistributionPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.DeleteDistributionPolicy(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteDistributionPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.DeleteDistributionPolicyAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteDistributionPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.DeleteDistributionPolicyAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertClassificationPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new { }; + + Response response = client.UpsertClassificationPolicy("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertClassificationPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new + { + name = "", + fallbackQueueId = "", + queueSelectors = new[] { + new { + condition = new { + kind = "direct-map-rule", + }, + queueSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + } + }, + kind = "conditional", + } + }, + prioritizationRule = new + { + kind = "direct-map-rule", + }, + workerSelectors = new[] { + new { + condition = new { + kind = "direct-map-rule", + }, + workerSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + expiresAfterSeconds = 123.45d, + expedite = true, + } + }, + kind = "conditional", + } + }, + }; + + Response response = client.UpsertClassificationPolicy("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertClassificationPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new { }; + + Response response = await client.UpsertClassificationPolicyAsync("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertClassificationPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new + { + name = "", + fallbackQueueId = "", + queueSelectors = new[] { + new { + condition = new { + kind = "direct-map-rule", + }, + queueSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + } + }, + kind = "conditional", + } + }, + prioritizationRule = new + { + kind = "direct-map-rule", + }, + workerSelectors = new[] { + new { + condition = new { + kind = "direct-map-rule", + }, + workerSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + expiresAfterSeconds = 123.45d, + expedite = true, + } + }, + kind = "conditional", + } + }, + }; + + Response response = await client.UpsertClassificationPolicyAsync("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.GetClassificationPolicy("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.GetClassificationPolicy("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.GetClassificationPolicyAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.GetClassificationPolicyAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicy_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var result = await client.GetClassificationPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteClassificationPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.DeleteClassificationPolicy(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteClassificationPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.DeleteClassificationPolicy(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteClassificationPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.DeleteClassificationPolicyAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteClassificationPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.DeleteClassificationPolicyAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertExceptionPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new { }; + + Response response = client.UpsertExceptionPolicy("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertExceptionPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new + { + name = "", + exceptionRules = new + { + key = new + { + trigger = new + { + threshold = 1234, + kind = "queue-length", + }, + actions = new + { + key = new + { + note = "", + dispositionCode = "", + kind = "cancel", + }, + }, + }, + }, + }; + + Response response = client.UpsertExceptionPolicy("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertExceptionPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new { }; + + Response response = await client.UpsertExceptionPolicyAsync("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertExceptionPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new + { + name = "", + exceptionRules = new + { + key = new + { + trigger = new + { + threshold = 1234, + kind = "queue-length", + }, + actions = new + { + key = new + { + note = "", + dispositionCode = "", + kind = "cancel", + }, + }, + }, + }, + }; + + Response response = await client.UpsertExceptionPolicyAsync("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.GetExceptionPolicy("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.GetExceptionPolicy("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.GetExceptionPolicyAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.GetExceptionPolicyAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicy_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var result = await client.GetExceptionPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteExceptionPolicy() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.DeleteExceptionPolicy(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteExceptionPolicy_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.DeleteExceptionPolicy(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteExceptionPolicy_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.DeleteExceptionPolicyAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteExceptionPolicy_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.DeleteExceptionPolicyAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertQueue() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new { }; + + Response response = client.UpsertQueue("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertQueue_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new + { + name = "", + distributionPolicyId = "", + labels = new + { + key = new { }, + }, + exceptionPolicyId = "", + }; + + Response response = client.UpsertQueue("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertQueue_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new { }; + + Response response = await client.UpsertQueueAsync("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertQueue_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var data = new + { + name = "", + distributionPolicyId = "", + labels = new + { + key = new { }, + }, + exceptionPolicyId = "", + }; + + Response response = await client.UpsertQueueAsync("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueue() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.GetQueue("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueue_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.GetQueue("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueue_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.GetQueueAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueue_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.GetQueueAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueue_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + var result = await client.GetQueueAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteQueue() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.DeleteQueue(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteQueue_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = client.DeleteQueue(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteQueue_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.DeleteQueueAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteQueue_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + Response response = await client.DeleteQueueAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicies() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + foreach (var item in client.GetDistributionPolicies(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicies_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + foreach (var item in client.GetDistributionPolicies(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicies_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetDistributionPoliciesAsync(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicies_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetDistributionPoliciesAsync(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicies_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetDistributionPoliciesAsync(1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicies() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + foreach (var item in client.GetClassificationPolicies(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicies_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + foreach (var item in client.GetClassificationPolicies(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicies_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetClassificationPoliciesAsync(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicies_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetClassificationPoliciesAsync(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicies_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetClassificationPoliciesAsync(1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicies() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + foreach (var item in client.GetExceptionPolicies(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicies_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + foreach (var item in client.GetExceptionPolicies(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicies_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetExceptionPoliciesAsync(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicies_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetExceptionPoliciesAsync(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicies_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetExceptionPoliciesAsync(1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueues() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + foreach (var item in client.GetQueues(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueues_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + foreach (var item in client.GetQueues(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueues_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetQueuesAsync(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueues_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetQueuesAsync(1234, new RequestContext())) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueues_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterAdministrationRestClient(endpoint); + + await foreach (var item in client.GetQueuesAsync(1234)) + { + } + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterRestClient.cs new file mode 100644 index 0000000000000..13ce873ebd524 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterRestClient.cs @@ -0,0 +1,1609 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.JobRouter.Samples +{ + public class Samples_JobRouterRestClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = client.UpsertJob("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + channelReference = "", + channelId = "", + classificationPolicyId = "", + queueId = "", + priority = 1234, + dispositionCode = "", + requestedWorkerSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + expiresAfterSeconds = 123.45d, + expedite = true, + } + }, + labels = new + { + key = new { }, + }, + tags = new + { + key = new { }, + }, + notes = new + { + key = "", + }, + matchingMode = new + { + modeType = "queueAndMatchMode", + queueAndMatchMode = new { }, + scheduleAndSuspendMode = new + { + scheduleAt = "2022-05-10T14:57:31.2311892-04:00", + }, + suspendMode = new { }, + }, + }; + + Response response = client.UpsertJob("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = await client.UpsertJobAsync("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + channelReference = "", + channelId = "", + classificationPolicyId = "", + queueId = "", + priority = 1234, + dispositionCode = "", + requestedWorkerSelectors = new[] { + new { + key = "", + labelOperator = "equal", + value = new {}, + expiresAfterSeconds = 123.45d, + expedite = true, + } + }, + labels = new + { + key = new { }, + }, + tags = new + { + key = new { }, + }, + notes = new + { + key = "", + }, + matchingMode = new + { + modeType = "queueAndMatchMode", + queueAndMatchMode = new { }, + scheduleAndSuspendMode = new + { + scheduleAt = "2022-05-10T14:57:31.2311892-04:00", + }, + suspendMode = new { }, + }, + }; + + Response response = await client.UpsertJobAsync("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.GetJob("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.GetJob("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.GetJobAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.GetJobAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJob_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var result = await client.GetJobAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.DeleteJob(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.DeleteJob(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.DeleteJobAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.DeleteJobAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ReclassifyJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = client.ReclassifyJob("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ReclassifyJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = client.ReclassifyJob("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ReclassifyJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = await client.ReclassifyJobAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ReclassifyJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = await client.ReclassifyJobAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = client.CancelJob("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + note = "", + dispositionCode = "", + }; + + Response response = client.CancelJob("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CancelJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = await client.CancelJobAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CancelJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + note = "", + dispositionCode = "", + }; + + Response response = await client.CancelJobAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CancelJob_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var cancelJobRequest = new CancelJobRequest() + { + Note = "", + DispositionCode = "", + }; + var result = await client.CancelJobAsync("", cancelJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CompleteJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + assignmentId = "", + }; + + Response response = client.CompleteJob("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CompleteJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + assignmentId = "", + note = "", + }; + + Response response = client.CompleteJob("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CompleteJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + assignmentId = "", + }; + + Response response = await client.CompleteJobAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CompleteJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + assignmentId = "", + note = "", + }; + + Response response = await client.CompleteJobAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CompleteJob_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var completeJobRequest = new CompleteJobRequest("") + { + Note = "", + }; + var result = await client.CompleteJobAsync("", completeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CloseJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + assignmentId = "", + }; + + Response response = client.CloseJob("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CloseJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + assignmentId = "", + dispositionCode = "", + closeAt = "2022-05-10T14:57:31.2311892-04:00", + note = "", + }; + + Response response = client.CloseJob("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CloseJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + assignmentId = "", + }; + + Response response = await client.CloseJobAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CloseJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + assignmentId = "", + dispositionCode = "", + closeAt = "2022-05-10T14:57:31.2311892-04:00", + note = "", + }; + + Response response = await client.CloseJobAsync("", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CloseJob_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var closeJobRequest = new CloseJobRequest("") + { + DispositionCode = "", + CloseAt = DateTimeOffset.UtcNow, + Note = "", + }; + var result = await client.CloseJobAsync("", closeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueuePosition() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.GetQueuePosition("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("position").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("queueLength").ToString()); + Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueuePosition_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.GetQueuePosition("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("position").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("queueLength").ToString()); + Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueuePosition_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.GetQueuePositionAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("position").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("queueLength").ToString()); + Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueuePosition_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.GetQueuePositionAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("position").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("queueLength").ToString()); + Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueuePosition_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var result = await client.GetQueuePositionAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UnassignJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = client.UnassignJob("", "", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UnassignJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + suspendMatching = true, + }; + + Response response = client.UnassignJob("", "", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UnassignJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = await client.UnassignJobAsync("", "", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UnassignJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + suspendMatching = true, + }; + + Response response = await client.UnassignJobAsync("", "", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UnassignJob_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var unassignJobRequest = new UnassignJobRequest() + { + SuspendMatching = true, + }; + var result = await client.UnassignJobAsync("", "", unassignJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AcceptJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.AcceptJob("", "", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("workerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AcceptJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.AcceptJob("", "", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("workerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AcceptJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.AcceptJobAsync("", "", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("workerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AcceptJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.AcceptJobAsync("", "", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("workerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AcceptJob_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var result = await client.AcceptJobAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeclineJob() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = client.DeclineJob("", "", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeclineJob_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + retryOfferAt = "2022-05-10T14:57:31.2311892-04:00", + }; + + Response response = client.DeclineJob("", "", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeclineJob_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = await client.DeclineJobAsync("", "", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeclineJob_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + retryOfferAt = "2022-05-10T14:57:31.2311892-04:00", + }; + + Response response = await client.DeclineJobAsync("", "", RequestContent.Create(data)); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeclineJob_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var declineJobOfferRequest = new DeclineJobOfferRequest() + { + RetryOfferAt = DateTimeOffset.UtcNow, + }; + var result = await client.DeclineJobAsync("", "", declineJobOfferRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueueStatistics() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.GetQueueStatistics("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("length").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueueStatistics_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.GetQueueStatistics("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("length").ToString()); + Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("longestJobWaitTimeMinutes").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueueStatistics_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.GetQueueStatisticsAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("length").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueueStatistics_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.GetQueueStatisticsAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("length").ToString()); + Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("longestJobWaitTimeMinutes").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueueStatistics_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var result = await client.GetQueueStatisticsAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertWorker() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = client.UpsertWorker("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpsertWorker_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + queueAssignments = new + { + key = new { }, + }, + totalCapacity = 1234, + labels = new + { + key = new { }, + }, + tags = new + { + key = new { }, + }, + channelConfigurations = new + { + key = new + { + capacityCostPerJob = 1234, + maxNumberOfJobs = 1234, + }, + }, + availableForOffers = true, + }; + + Response response = client.UpsertWorker("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("availableForOffers").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertWorker_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new { }; + + Response response = await client.UpsertWorkerAsync("", RequestContent.Create(data)); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UpsertWorker_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var data = new + { + queueAssignments = new + { + key = new { }, + }, + totalCapacity = 1234, + labels = new + { + key = new { }, + }, + tags = new + { + key = new { }, + }, + channelConfigurations = new + { + key = new + { + capacityCostPerJob = 1234, + maxNumberOfJobs = 1234, + }, + }, + availableForOffers = true, + }; + + Response response = await client.UpsertWorkerAsync("", RequestContent.Create(data), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("availableForOffers").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorker() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.GetWorker("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorker_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.GetWorker("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("availableForOffers").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorker_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.GetWorkerAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorker_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.GetWorkerAsync("", new RequestContext()); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("availableForOffers").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorker_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + var result = await client.GetWorkerAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteWorker() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.DeleteWorker(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteWorker_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = client.DeleteWorker(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteWorker_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.DeleteWorkerAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteWorker_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + Response response = await client.DeleteWorkerAsync(""); + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJobs() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + foreach (var item in client.GetJobs("", "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJobs_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + foreach (var item in client.GetJobs("", "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("modeType").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("suspendMode").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJobs_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + await foreach (var item in client.GetJobsAsync("", "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJobs_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + await foreach (var item in client.GetJobsAsync("", "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("modeType").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString()); + Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("suspendMode").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJobs_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + await foreach (var item in client.GetJobsAsync(null, "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkers() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + foreach (var item in client.GetWorkers("", "", "", true, 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkers_AllParameters() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + foreach (var item in client.GetWorkers("", "", "", true, 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkers_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + await foreach (var item in client.GetWorkersAsync("", "", "", true, 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkers_AllParameters_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + await foreach (var item in client.GetWorkersAsync("", "", "", true, 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkers_Convenience_Async() + { + var endpoint = new Uri(""); + var client = new JobRouterRestClient(endpoint); + + await foreach (var item in client.GetWorkersAsync(null, "", "", true, 1234)) + { + } + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml b/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml index b9bb1648aab8c..bb35622be8106 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml +++ b/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml @@ -1,4 +1,4 @@ -commit: c5a26fbd5d03326139ab69edda64dc09fb1ce9f7 +commit: a7c1dda01f340fca57d0592b53a9fa0fb5e9f090 directory: specification/communication/Communication.JobRouter additionalDirectories: [] repo: sarkar-rajarshi/azure-rest-api-specs