| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using Azure.Core; |
| | 6 | |
|
| | 7 | | namespace Azure.DigitalTwins.Core |
| | 8 | | { |
| | 9 | | /// <summary> |
| | 10 | | /// Options that allow configuration of requests sent to the digital twins service. |
| | 11 | | /// </summary> |
| | 12 | | public class DigitalTwinsClientOptions : ClientOptions |
| | 13 | | { |
| | 14 | | internal const ServiceVersion LatestVersion = ServiceVersion.V2020_05_31_preview; |
| | 15 | |
|
| | 16 | | /// <summary> |
| | 17 | | /// The versions of Azure Digital Twins supported by this client |
| | 18 | | /// library. |
| | 19 | | /// </summary> |
| | 20 | | public enum ServiceVersion |
| | 21 | | { |
| | 22 | | #pragma warning disable CA1707 // Identifiers should not contain underscores |
| | 23 | |
|
| | 24 | | /// <summary> |
| | 25 | | /// 2020-05-31-preview |
| | 26 | | /// </summary> |
| | 27 | | V2020_05_31_preview = 1 |
| | 28 | |
|
| | 29 | | #pragma warning restore CA1707 // Identifiers should not contain underscores |
| | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Gets the <see cref="ServiceVersion"/> of the service API used when |
| | 34 | | /// making requests. |
| | 35 | | /// </summary> |
| 180 | 36 | | public ServiceVersion Version { get; } |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Initializes a new instance of the <see cref="DigitalTwinsClientOptions"/> |
| | 40 | | /// class. |
| | 41 | | /// </summary> |
| | 42 | | /// <param name="version"> |
| | 43 | | /// The <see cref="ServiceVersion"/> of the service API used when |
| | 44 | | /// making requests. |
| | 45 | | /// </param> |
| 60 | 46 | | public DigitalTwinsClientOptions(ServiceVersion version = LatestVersion) |
| | 47 | | { |
| 60 | 48 | | Version = version; |
| 60 | 49 | | } |
| | 50 | |
|
| | 51 | | internal string GetVersionString() |
| | 52 | | { |
| 180 | 53 | | return Version switch |
| 180 | 54 | | { |
| 360 | 55 | | ServiceVersion.V2020_05_31_preview => "2020-05-31-preview", |
| 0 | 56 | | _ => throw new ArgumentException(Version.ToString()), |
| 180 | 57 | | }; |
| | 58 | | } |
| | 59 | | } |
| | 60 | | } |