From 864ef549f3879f7352a4997825b1c67aecae1e92 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Thu, 20 May 2021 11:53:33 -0700 Subject: [PATCH] [Farmbeats] Initial Package Generation (#20818) --- .../Azure.Verticals.AgriFood.Farming.sln | 49 + .../CHANGELOG.md | 5 + .../Directory.Build.props | 6 + .../README.md | 112 + ...rticals.AgriFood.Farming.netstandard2.0.cs | 317 +++ .../Azure.Verticals.AgriFood.Farming.csproj | 31 + .../src/Generated/ApplicationDataClient.cs | 1358 +++++++++++ .../src/Generated/AttachmentsClient.cs | 684 ++++++ .../src/Generated/BoundariesClient.cs | 2099 +++++++++++++++++ .../src/Generated/CropVarietiesClient.cs | 966 ++++++++ .../src/Generated/CropsClient.cs | 699 ++++++ .../src/Generated/FarmBeatsClientOptions.cs | 37 + .../src/Generated/FarmClient.cs | 483 ++++ .../src/Generated/FarmersClient.cs | 880 +++++++ .../src/Generated/FarmsClient.cs | 1104 +++++++++ .../src/Generated/FieldsClient.cs | 1154 +++++++++ .../src/Generated/HarvestDataClient.cs | 1554 ++++++++++++ .../src/Generated/ImageProcessingClient.cs | 471 ++++ .../src/Generated/OAuthProvidersClient.cs | 740 ++++++ .../src/Generated/OAuthTokensClient.cs | 599 +++++ .../src/Generated/PlantingDataClient.cs | 1398 +++++++++++ .../src/Generated/ScenesClient.cs | 860 +++++++ .../src/Generated/SeasonalFieldsClient.cs | 1430 +++++++++++ .../src/Generated/SeasonsClient.cs | 751 ++++++ .../src/Generated/TillageDataClient.cs | 1280 ++++++++++ .../src/Generated/WeatherClient.cs | 1136 +++++++++ .../src/autorest.md | 24 + .../src/properties/AssemblyInfo.cs | 13 + ...re.Verticals.AgriFood.Farming.Tests.csproj | 17 + sdk/farmbeats/ci.yml | 35 + sdk/farmbeats/tests.yml | 6 + 31 files changed, 20298 insertions(+) create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/Azure.Verticals.AgriFood.Farming.sln create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/CHANGELOG.md create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/Directory.Build.props create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/README.md create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/api/Azure.Verticals.AgriFood.Farming.netstandard2.0.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Azure.Verticals.AgriFood.Farming.csproj create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationDataClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/AttachmentsClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/BoundariesClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/CropVarietiesClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/CropsClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmBeatsClientOptions.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmersClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmsClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FieldsClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestDataClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ImageProcessingClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProvidersClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthTokensClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingDataClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ScenesClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFieldsClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonsClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/TillageDataClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/WeatherClient.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/autorest.md create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/properties/AssemblyInfo.cs create mode 100644 sdk/farmbeats/Azure.Verticals.AgriFood.Farming/tests/Azure.Verticals.AgriFood.Farming.Tests.csproj create mode 100644 sdk/farmbeats/ci.yml create mode 100644 sdk/farmbeats/tests.yml diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/Azure.Verticals.AgriFood.Farming.sln b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/Azure.Verticals.AgriFood.Farming.sln new file mode 100644 index 0000000000000..144b8f65280dd --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/Azure.Verticals.AgriFood.Farming.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Analytics.FarmBeats", "src\Azure.Verticals.AgriFood.Farming.csproj", "{E33D09D9-D809-472C-82E6-6A26BDB86FC2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Analytics.FarmBeats.Tests", "tests\Azure.Verticals.AgriFood.Farming.Tests.csproj", "{4F476D56-DDE7-43D3-8CB4-BA1E77F5A300}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{8052009B-2126-44A3-88CD-4F3B17894C64}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Stress", "..\..\..\common\Stress\Azure.Test.Stress\Azure.Test.Stress.csproj", "{0B991CA1-E570-4292-BABF-E011D9613C7B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj", "{0ED9C8A0-9A19-4750-8DD3-61D086288283}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E33D09D9-D809-472C-82E6-6A26BDB86FC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E33D09D9-D809-472C-82E6-6A26BDB86FC2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E33D09D9-D809-472C-82E6-6A26BDB86FC2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E33D09D9-D809-472C-82E6-6A26BDB86FC2}.Release|Any CPU.Build.0 = Release|Any CPU + {4F476D56-DDE7-43D3-8CB4-BA1E77F5A300}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F476D56-DDE7-43D3-8CB4-BA1E77F5A300}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F476D56-DDE7-43D3-8CB4-BA1E77F5A300}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F476D56-DDE7-43D3-8CB4-BA1E77F5A300}.Release|Any CPU.Build.0 = Release|Any CPU + {8052009B-2126-44A3-88CD-4F3B17894C64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8052009B-2126-44A3-88CD-4F3B17894C64}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8052009B-2126-44A3-88CD-4F3B17894C64}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8052009B-2126-44A3-88CD-4F3B17894C64}.Release|Any CPU.Build.0 = Release|Any CPU + {0B991CA1-E570-4292-BABF-E011D9613C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B991CA1-E570-4292-BABF-E011D9613C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B991CA1-E570-4292-BABF-E011D9613C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B991CA1-E570-4292-BABF-E011D9613C7B}.Release|Any CPU.Build.0 = Release|Any CPU + {0ED9C8A0-9A19-4750-8DD3-61D086288283}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0ED9C8A0-9A19-4750-8DD3-61D086288283}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0ED9C8A0-9A19-4750-8DD3-61D086288283}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0ED9C8A0-9A19-4750-8DD3-61D086288283}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/CHANGELOG.md b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/CHANGELOG.md new file mode 100644 index 0000000000000..c0d06b1c26867 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Initial Preview Release diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/Directory.Build.props b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/Directory.Build.props new file mode 100644 index 0000000000000..1a9611bd49242 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/README.md b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/README.md new file mode 100644 index 0000000000000..2e9eeda146abb --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/README.md @@ -0,0 +1,112 @@ +# Azure FarmBeats client library for .NET + +Azure FarmBeats is a business-to-business offering available in Azure Marketplace. It enables aggregation of agriculture data sets across providers. Azure FarmBeats enables you to build artificial intelligence (AI) or machine learning (ML) models based on fused data sets. By using Azure FarmBeats, agriculture businesses can focus on core value-adds instead of the undifferentiated heavy lifting of data engineering. +**Please rely heavily on the [service's documentation][catalog_product_documentation] and our [protocol client docs][protocol_client_quickstart] to use this library** + +[Source code][source_code] | [Package (NuGet)][client_nuget_package] | [Product documentation][product_documentation] + +## Getting started + +### Install the package + +Install the Azure FarmBeats client library for .NET with [NuGet][client_nuget_package]: + +``` +dotnet add package Azure.Verticals.AgriFood.Farming --prerelease +``` + +### Prerequisites + +- You must have an [Azure subscription][azure_subscription] and a Farmbeats resource to use this package. + +### Authenticate the client + +#### Using Azure Active Directory + +This document demonstrates using [DefaultAzureCredential][default_cred_ref] to authenticate via Azure Active Directory. However, any of the credentials offered by the [Azure.Identity][azure_identity] will be accepted. See the [Azure.Identity][azure_identity] documentation for more information about other credentials. + +Once you have chosen and configured your credential, you can create instances of any client types, for example, `FarmClient`. + +```C# +var credential = new DefaultAzureCredential(); +var client = new FarmClient(new Url("https://.farmbeats.azure.net"), credential); +``` + +## Key concepts + +### Protocol Methods + +Operations exposed by the FarmBeats SDK for .NET use *protocol methods* to expose the underlying REST operations. You can learn more about how to use SDK Clients which use protocol methods in our [documentation][protocol_client_quickstart]. + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +The following section shows you how to initialize and authenticate your client, then list all of your data sources. + +### List All Farmers + +```C# +var credential = new DefaultAzureCredential(); +var client = new FamersClient(new Uri("https://.farmbeats.azure.net"), credential); + +var response = await client.ListAsync(); +var responseDocument = JsonDocument.Parse(response.Content); +Console.WriteLine(responseDocument.RootElement.GetProperty("value")); +``` + +## Troubleshooting + +### Setting up console logging +The simplest way to see the logs is to enable the console logging. +To create an Azure SDK log listener that outputs messages to console use AzureEventSourceListener.CreateConsoleLogger method. + +```C# +// Setup a listener to monitor logged events. +using AzureEventSourceListener listener = AzureEventSourceListener.CreateConsoleLogger(); +``` + +To learn more about other logging mechanisms see [here][azure_core_diagnostics]. + +## Next steps + +This client SDK exposes operations using *protocol methods*, you can learn more about how to use SDK Clients which use protocol methods in our [documentation][protocol_client_quickstart]. + +## Contributing + +See the [CONTRIBUTING.md][contributing] for details on building, testing, and contributing to this library. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla]. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments. + + +[source_code]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/farmbeats/Azure.Verticals.AgriFood.Farming +[client_nuget_package]: https://www.nuget.org/packages?q=Azure.Verticals.AgriFood.Farming +[product_documentation]: https://docs.microsoft.com/azure/industry/agriculture/overview-azure-farmbeats +[azure_identity]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/identity/Azure.Identity +[protocol_client_quickstart]: https://aka.ms/azsdk/net/protocol/quickstart +[default_cred_ref]: https://docs.microsoft.com/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_core_diagnostics]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Diagnostics.md +[cla]: https://cla.microsoft.com +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ +[coc_contact]: mailto:opencode@microsoft.com + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ffarmbeats%2FAzure.Verticals.AgriFood.Farming%2FREADME.png) \ No newline at end of file diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/api/Azure.Verticals.AgriFood.Farming.netstandard2.0.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/api/Azure.Verticals.AgriFood.Farming.netstandard2.0.cs new file mode 100644 index 0000000000000..15855c5320ea4 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/api/Azure.Verticals.AgriFood.Farming.netstandard2.0.cs @@ -0,0 +1,317 @@ +namespace Azure.Verticals.AgriFood.Farming +{ + public partial class ApplicationDataClient + { + protected ApplicationDataClient() { } + public ApplicationDataClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string farmerId, string applicationDataId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string applicationDataId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string applicationDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string applicationDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string applicationDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string applicationDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class AttachmentsClient + { + protected AttachmentsClient() { } + public AttachmentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string farmerId, string attachmentId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string attachmentId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string attachmentId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string attachmentId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Download(string farmerId, string attachmentId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DownloadAsync(string farmerId, string attachmentId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string attachmentId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string attachmentId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, System.Collections.Generic.IEnumerable resourceIds = null, System.Collections.Generic.IEnumerable resourceTypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, System.Collections.Generic.IEnumerable resourceIds = null, System.Collections.Generic.IEnumerable resourceTypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class BoundariesClient + { + protected BoundariesClient() { } + public BoundariesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateCascadeDeleteJob(string jobId, string farmerId, string boundaryId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string boundaryId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response CreateOrUpdate(string farmerId, string boundaryId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string boundaryId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string boundaryId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string boundaryId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string boundaryId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string boundaryId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetOverlap(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetOverlapAsync(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Search(Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task SearchAsync(Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response SearchByFarmerId(string farmerId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task SearchByFarmerIdAsync(string farmerId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class CropsClient + { + protected CropsClient() { } + public CropsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string cropId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string cropId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string cropId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string cropId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string cropId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string cropId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.Collections.Generic.IEnumerable phenotypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable phenotypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class CropVarietiesClient + { + protected CropVarietiesClient() { } + public CropVarietiesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string cropId, string cropVarietyId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string cropId, string cropVarietyId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string cropId, string cropVarietyId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string cropId, string cropVarietyId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string cropId, string cropVarietyId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string cropId, string cropVarietyId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByCropId(string cropId, System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByCropIdAsync(string cropId, System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class FarmBeatsClientOptions : Azure.Core.ClientOptions + { + public FarmBeatsClientOptions(Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions.ServiceVersion version = Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions.ServiceVersion.V2021_03_31_preview) { } + public enum ServiceVersion + { + V2021_03_31_preview = 1, + } + } + public partial class FarmClient + { + protected FarmClient() { } + public FarmClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateDataIngestionJob(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateDataIngestionJobAsync(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetDataIngestionJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class FarmersClient + { + protected FarmersClient() { } + public FarmersClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateCascadeDeleteJob(string jobId, string farmerId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response CreateOrUpdate(string farmerId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class FarmsClient + { + protected FarmsClient() { } + public FarmsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateCascadeDeleteJob(string jobId, string farmerId, string farmId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string farmId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response CreateOrUpdate(string farmerId, string farmId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string farmId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string farmId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string farmId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string farmId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string farmId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class FieldsClient + { + protected FieldsClient() { } + public FieldsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateCascadeDeleteJob(string jobId, string farmerId, string fieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string fieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response CreateOrUpdate(string farmerId, string fieldId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string fieldId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string fieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string fieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string fieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string fieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class HarvestDataClient + { + protected HarvestDataClient() { } + public HarvestDataClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string farmerId, string harvestDataId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string harvestDataId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string harvestDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string harvestDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string harvestDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string harvestDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class ImageProcessingClient + { + protected ImageProcessingClient() { } + public ImageProcessingClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateRasterizeJob(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateRasterizeJobAsync(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetRasterizeJob(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetRasterizeJobAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class OAuthProvidersClient + { + protected OAuthProvidersClient() { } + public OAuthProvidersClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string oauthProviderId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string oauthProviderId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string oauthProviderId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string oauthProviderId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string oauthProviderId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string oauthProviderId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class OAuthTokensClient + { + protected OAuthTokensClient() { } + public OAuthTokensClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateCascadeDeleteJob(string jobId, string farmerId, string oauthProviderId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string oauthProviderId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetOAuthConnectionLink(Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetOAuthConnectionLinkAsync(Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.Collections.Generic.IEnumerable authProviderIds = null, System.Collections.Generic.IEnumerable farmerIds = null, bool? isValid = default(bool?), System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable authProviderIds = null, System.Collections.Generic.IEnumerable farmerIds = null, bool? isValid = default(bool?), System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class PlantingDataClient + { + protected PlantingDataClient() { } + public PlantingDataClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string farmerId, string plantingDataId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string plantingDataId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string plantingDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string plantingDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string plantingDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string plantingDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class ScenesClient + { + protected ScenesClient() { } + public ScenesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateSatelliteDataIngestionJob(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateSatelliteDataIngestionJobAsync(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Download(string filePath, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DownloadAsync(string filePath, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetSatelliteDataIngestionJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetSatelliteDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(string provider, string farmerId, string boundaryId, string source = null, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), double? maxCloudCoveragePercentage = default(double?), double? maxDarkPixelCoveragePercentage = default(double?), System.Collections.Generic.IEnumerable imageNames = null, System.Collections.Generic.IEnumerable imageResolutions = null, System.Collections.Generic.IEnumerable imageFormats = null, int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(string provider, string farmerId, string boundaryId, string source = null, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), double? maxCloudCoveragePercentage = default(double?), double? maxDarkPixelCoveragePercentage = default(double?), System.Collections.Generic.IEnumerable imageNames = null, System.Collections.Generic.IEnumerable imageResolutions = null, System.Collections.Generic.IEnumerable imageFormats = null, int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class SeasonalFieldsClient + { + protected SeasonalFieldsClient() { } + public SeasonalFieldsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateCascadeDeleteJob(string jobId, string farmerId, string seasonalFieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string seasonalFieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response CreateOrUpdate(string farmerId, string seasonalFieldId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string seasonalFieldId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string seasonalFieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string seasonalFieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string seasonalFieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string seasonalFieldId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class SeasonsClient + { + protected SeasonsClient() { } + public SeasonsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string seasonId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string seasonId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string seasonId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string seasonId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string seasonId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string seasonId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(System.DateTimeOffset? minStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxEndDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable years = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(System.DateTimeOffset? minStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxEndDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable years = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class TillageDataClient + { + protected TillageDataClient() { } + public TillageDataClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrUpdate(string farmerId, string tillageDataId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string tillageDataId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Delete(string farmerId, string tillageDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string tillageDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string tillageDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string tillageDataId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response ListByFarmerId(string farmerId, double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } + public partial class WeatherClient + { + protected WeatherClient() { } + public WeatherClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Verticals.AgriFood.Farming.FarmBeatsClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateDataDeleteJob(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateDataDeleteJobAsync(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response CreateDataIngestionJob(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateDataIngestionJobAsync(string jobId, Azure.Core.RequestContent requestBody, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetDataDeleteJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetDataDeleteJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response GetDataIngestionJobDetails(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task GetDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual Azure.Response List(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + public virtual System.Threading.Tasks.Task ListAsync(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions requestOptions = null) { throw null; } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Azure.Verticals.AgriFood.Farming.csproj b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Azure.Verticals.AgriFood.Farming.csproj new file mode 100644 index 0000000000000..d3b503238f132 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Azure.Verticals.AgriFood.Farming.csproj @@ -0,0 +1,31 @@ + + + This client library enables working with the Microsoft Azure FarmBeats service + Azure FarmBeats SDK + 1.0.0-beta.1 + Azure FarmBeats + $(RequiredTargetFrameworks) + $(NoWarn);AZC0001 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationDataClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationDataClient.cs new file mode 100644 index 0000000000000..eee27e28f8e3c --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationDataClient.cs @@ -0,0 +1,1358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The ApplicationData service client. + public partial class ApplicationDataClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of ApplicationDataClient for mocking. + protected ApplicationDataClient() + { + } + + /// Initializes a new instance of ApplicationDataClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public ApplicationDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of application data resources under a particular farm. + /// ID of the associated farmer. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of application data resources under a particular farm. + /// ID of the associated farmer. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/application-data", false); + if (minAvgMaterial != null) + { + uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); + } + if (maxAvgMaterial != null) + { + uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); + } + if (minTotalMaterial != null) + { + uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); + } + if (maxTotalMaterial != null) + { + uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); + } + if (sources != null) + { + uri.AppendQueryDelimited("sources", sources, ",", true); + } + if (associatedBoundaryIds != null) + { + uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); + } + if (operationBoundaryIds != null) + { + uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns a paginated list of application data resources across all farmers. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of application data resources across all farmers. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/application-data", false); + if (minAvgMaterial != null) + { + uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); + } + if (maxAvgMaterial != null) + { + uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); + } + if (minTotalMaterial != null) + { + uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); + } + if (maxTotalMaterial != null) + { + uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); + } + if (sources != null) + { + uri.AppendQueryDelimited("sources", sources, ",", true); + } + if (associatedBoundaryIds != null) + { + uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); + } + if (operationBoundaryIds != null) + { + uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get a specified application data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the application data resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string applicationDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, applicationDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a specified application data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the application data resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string applicationDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, applicationDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the application data resource. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string applicationDataId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/application-data/", false); + uri.AppendPath(applicationDataId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates an application data resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// applicationProductDetails + /// ApplicationProductDetail[] + /// + /// Application product details. + /// + /// + /// avgMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// source + /// string + /// + /// Source of the operation data. + /// + /// + /// operationModifiedDateTime + /// string (ISO 8601 Format) + /// + /// + /// Modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Note: this will be specified by the source provider itself. + /// + /// + /// + /// operationStartDateTime + /// string (ISO 8601 Format) + /// + /// Start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// operationEndDateTime + /// string (ISO 8601 Format) + /// + /// End date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// attachmentsLink + /// string + /// + /// Link for attachments. + /// + /// + /// associatedBoundaryId + /// string + /// + /// Optional boundary ID of the field for which operation was applied. + /// + /// + /// operationBoundaryId + /// string + /// + /// Optional boundary ID of the actual area for which operation was applied inside the specified field. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID which belongs to the operation data. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for Measure: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// unit + /// string + /// + /// Data unit. + /// + /// + /// value + /// number + /// + /// Data value. + /// + /// + /// Schema for ApplicationProductDetail: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// productName + /// string + /// + /// Name of the product applied. + /// + /// + /// isCarrier + /// boolean + /// + /// A flag indicating whether product is a carrier for a tank mix. + /// + /// + /// avgMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// + /// ID of the associated farmer. + /// ID of the application data resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string applicationDataId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, applicationDataId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an application data resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// applicationProductDetails + /// ApplicationProductDetail[] + /// + /// Application product details. + /// + /// + /// avgMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// source + /// string + /// + /// Source of the operation data. + /// + /// + /// operationModifiedDateTime + /// string (ISO 8601 Format) + /// + /// + /// Modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Note: this will be specified by the source provider itself. + /// + /// + /// + /// operationStartDateTime + /// string (ISO 8601 Format) + /// + /// Start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// operationEndDateTime + /// string (ISO 8601 Format) + /// + /// End date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// attachmentsLink + /// string + /// + /// Link for attachments. + /// + /// + /// associatedBoundaryId + /// string + /// + /// Optional boundary ID of the field for which operation was applied. + /// + /// + /// operationBoundaryId + /// string + /// + /// Optional boundary ID of the actual area for which operation was applied inside the specified field. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID which belongs to the operation data. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for Measure: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// unit + /// string + /// + /// Data unit. + /// + /// + /// value + /// number + /// + /// Data value. + /// + /// + /// Schema for ApplicationProductDetail: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// productName + /// string + /// + /// Name of the product applied. + /// + /// + /// isCarrier + /// boolean + /// + /// A flag indicating whether product is a carrier for a tank mix. + /// + /// + /// avgMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// + /// ID of the associated farmer. + /// ID of the application data resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string applicationDataId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, applicationDataId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// ID of the application data resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string applicationDataId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/application-data/", false); + uri.AppendPath(applicationDataId, 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 = requestBody; + return message; + } + + /// Deletes a specified application data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the application data. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string applicationDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, applicationDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified application data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the application data. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string applicationDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, applicationDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the application data. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string applicationDataId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/application-data/", false); + uri.AppendPath(applicationDataId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/AttachmentsClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/AttachmentsClient.cs new file mode 100644 index 0000000000000..fc9feda64fdf8 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/AttachmentsClient.cs @@ -0,0 +1,684 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Attachments service client. + public partial class AttachmentsClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of AttachmentsClient for mocking. + protected AttachmentsClient() + { + } + + /// Initializes a new instance of AttachmentsClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public AttachmentsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of attachment resources under a particular farmer. + /// ID of the associated farmer. + /// Resource Ids of the resource. + /// Resource Types of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumerable resourceIds = null, IEnumerable resourceTypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of attachment resources under a particular farmer. + /// ID of the associated farmer. + /// Resource Ids of the resource. + /// Resource Types of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, IEnumerable resourceIds = null, IEnumerable resourceTypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Resource Ids of the resource. + /// Resource Types of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable resourceIds = null, IEnumerable resourceTypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments", false); + if (resourceIds != null) + { + uri.AppendQueryDelimited("resourceIds", resourceIds, ",", true); + } + if (resourceTypes != null) + { + uri.AppendQueryDelimited("resourceTypes", resourceTypes, ",", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified attachment resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the attachment. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string attachmentId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, attachmentId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified attachment resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the attachment. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string attachmentId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, attachmentId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// ID of the attachment. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string attachmentId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments/", false); + uri.AppendPath(attachmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates an attachment resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the attachment resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string attachmentId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, attachmentId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an attachment resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the attachment resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string attachmentId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, attachmentId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the attachment resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string attachmentId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments/", false); + uri.AppendPath(attachmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "multipart/form-data"); + request.Content = requestBody; + return message; + } + + /// Deletes a specified attachment resource under a particular farmer. + /// ID of the farmer. + /// ID of the attachment. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string attachmentId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, attachmentId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified attachment resource under a particular farmer. + /// ID of the farmer. + /// ID of the attachment. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string attachmentId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, attachmentId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer. + /// ID of the attachment. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string attachmentId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments/", false); + uri.AppendPath(attachmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Downloads and returns attachment as response for the given input filePath. + /// ID of the associated farmer. + /// ID of attachment to be downloaded. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DownloadAsync(string farmerId, string attachmentId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDownloadRequest(farmerId, attachmentId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Download"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Downloads and returns attachment as response for the given input filePath. + /// ID of the associated farmer. + /// ID of attachment to be downloaded. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Download(string farmerId, string attachmentId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDownloadRequest(farmerId, attachmentId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Download"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// ID of attachment to be downloaded. + /// The request options. + private HttpMessage CreateDownloadRequest(string farmerId, string attachmentId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments/", false); + uri.AppendPath(attachmentId, true); + uri.AppendPath("/file", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/octet-stream, application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/BoundariesClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/BoundariesClient.cs new file mode 100644 index 0000000000000..5699492a8acba --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/BoundariesClient.cs @@ -0,0 +1,2099 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Boundaries service client. + public partial class BoundariesClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of BoundariesClient for mocking. + protected BoundariesClient() + { + } + + /// Initializes a new instance of BoundariesClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public BoundariesClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of boundary resources under a particular farmer. + /// ID of the associated farmer. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of boundary resources under a particular farmer. + /// ID of the associated farmer. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries", false); + if (isPrimary != null) + { + uri.AppendQuery("isPrimary", isPrimary.Value, true); + } + if (parentType != null) + { + uri.AppendQuery("parentType", parentType, true); + } + if (parentIds != null) + { + uri.AppendQueryDelimited("parentIds", parentIds, ",", true); + } + if (minAcreage != null) + { + uri.AppendQuery("minAcreage", minAcreage.Value, true); + } + if (maxAcreage != null) + { + uri.AppendQuery("maxAcreage", maxAcreage.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Search for boundaries by fields and intersecting geometry. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// ids + /// string[] + /// + /// Ids of the resource. + /// + /// + /// names + /// string[] + /// + /// Names of the resource. + /// + /// + /// propertyFilters + /// string[] + /// + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// + /// + /// statuses + /// string[] + /// + /// Statuses of the resource. + /// + /// + /// minCreatedDateTime + /// string (ISO 8601 Format) + /// + /// Minimum creation date of resource (inclusive). + /// + /// + /// maxCreatedDateTime + /// string (ISO 8601 Format) + /// + /// Maximum creation date of resource (inclusive). + /// + /// + /// minLastModifiedDateTime + /// string (ISO 8601 Format) + /// + /// Minimum last modified date of resource (inclusive). + /// + /// + /// maxLastModifiedDateTime + /// string (ISO 8601 Format) + /// + /// Maximum last modified date of resource (inclusive). + /// + /// + /// $maxPageSize + /// number + /// + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// + /// + /// $skipToken + /// string + /// + /// Skip token for getting next set of results. + /// + /// + /// isPrimary + /// boolean + /// + /// Is the boundary primary. + /// + /// + /// parentType + /// string + /// + /// Type of the parent it belongs to. + /// + /// + /// parentIds + /// string[] + /// + /// Parent Ids of the resource. + /// + /// + /// minAcreage + /// number + /// + /// Minimum acreage of the boundary (inclusive). + /// + /// + /// maxAcreage + /// number + /// + /// Maximum acreage of the boundary (inclusive). + /// + /// + /// intersectsWithGeometry + /// GeoJsonObject + /// + /// GeoJSON abstract class. + /// + /// + /// Schema for GeoJsonObject: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// type + /// "Point" | "Polygon" | "MultiPolygon" + /// Yes + /// GeoJSON object type. + /// + /// + /// + /// ID of the farmer. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task SearchByFarmerIdAsync(string farmerId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateSearchByFarmerIdRequest(farmerId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.SearchByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Search for boundaries by fields and intersecting geometry. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// ids + /// string[] + /// + /// Ids of the resource. + /// + /// + /// names + /// string[] + /// + /// Names of the resource. + /// + /// + /// propertyFilters + /// string[] + /// + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// + /// + /// statuses + /// string[] + /// + /// Statuses of the resource. + /// + /// + /// minCreatedDateTime + /// string (ISO 8601 Format) + /// + /// Minimum creation date of resource (inclusive). + /// + /// + /// maxCreatedDateTime + /// string (ISO 8601 Format) + /// + /// Maximum creation date of resource (inclusive). + /// + /// + /// minLastModifiedDateTime + /// string (ISO 8601 Format) + /// + /// Minimum last modified date of resource (inclusive). + /// + /// + /// maxLastModifiedDateTime + /// string (ISO 8601 Format) + /// + /// Maximum last modified date of resource (inclusive). + /// + /// + /// $maxPageSize + /// number + /// + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// + /// + /// $skipToken + /// string + /// + /// Skip token for getting next set of results. + /// + /// + /// isPrimary + /// boolean + /// + /// Is the boundary primary. + /// + /// + /// parentType + /// string + /// + /// Type of the parent it belongs to. + /// + /// + /// parentIds + /// string[] + /// + /// Parent Ids of the resource. + /// + /// + /// minAcreage + /// number + /// + /// Minimum acreage of the boundary (inclusive). + /// + /// + /// maxAcreage + /// number + /// + /// Maximum acreage of the boundary (inclusive). + /// + /// + /// intersectsWithGeometry + /// GeoJsonObject + /// + /// GeoJSON abstract class. + /// + /// + /// Schema for GeoJsonObject: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// type + /// "Point" | "Polygon" | "MultiPolygon" + /// Yes + /// GeoJSON object type. + /// + /// + /// + /// ID of the farmer. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response SearchByFarmerId(string farmerId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateSearchByFarmerIdRequest(farmerId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.SearchByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer. + /// The request body. + /// The request options. + private HttpMessage CreateSearchByFarmerIdRequest(string farmerId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries", 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 = requestBody; + return message; + } + + /// Returns a paginated list of boundary resources across all farmers. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of boundary resources across all farmers. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/boundaries", false); + if (isPrimary != null) + { + uri.AppendQuery("isPrimary", isPrimary.Value, true); + } + if (parentType != null) + { + uri.AppendQuery("parentType", parentType, true); + } + if (parentIds != null) + { + uri.AppendQueryDelimited("parentIds", parentIds, ",", true); + } + if (minAcreage != null) + { + uri.AppendQuery("minAcreage", minAcreage.Value, true); + } + if (maxAcreage != null) + { + uri.AppendQuery("maxAcreage", maxAcreage.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Search for boundaries across all farmers by fields and intersecting geometry. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// ids + /// string[] + /// + /// Ids of the resource. + /// + /// + /// names + /// string[] + /// + /// Names of the resource. + /// + /// + /// propertyFilters + /// string[] + /// + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// + /// + /// statuses + /// string[] + /// + /// Statuses of the resource. + /// + /// + /// minCreatedDateTime + /// string (ISO 8601 Format) + /// + /// Minimum creation date of resource (inclusive). + /// + /// + /// maxCreatedDateTime + /// string (ISO 8601 Format) + /// + /// Maximum creation date of resource (inclusive). + /// + /// + /// minLastModifiedDateTime + /// string (ISO 8601 Format) + /// + /// Minimum last modified date of resource (inclusive). + /// + /// + /// maxLastModifiedDateTime + /// string (ISO 8601 Format) + /// + /// Maximum last modified date of resource (inclusive). + /// + /// + /// $maxPageSize + /// number + /// + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// + /// + /// $skipToken + /// string + /// + /// Skip token for getting next set of results. + /// + /// + /// isPrimary + /// boolean + /// + /// Is the boundary primary. + /// + /// + /// parentType + /// string + /// + /// Type of the parent it belongs to. + /// + /// + /// parentIds + /// string[] + /// + /// Parent Ids of the resource. + /// + /// + /// minAcreage + /// number + /// + /// Minimum acreage of the boundary (inclusive). + /// + /// + /// maxAcreage + /// number + /// + /// Maximum acreage of the boundary (inclusive). + /// + /// + /// intersectsWithGeometry + /// GeoJsonObject + /// + /// GeoJSON abstract class. + /// + /// + /// Schema for GeoJsonObject: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// type + /// "Point" | "Polygon" | "MultiPolygon" + /// Yes + /// GeoJSON object type. + /// + /// + /// + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task SearchAsync(RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateSearchRequest(requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Search"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Search for boundaries across all farmers by fields and intersecting geometry. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// ids + /// string[] + /// + /// Ids of the resource. + /// + /// + /// names + /// string[] + /// + /// Names of the resource. + /// + /// + /// propertyFilters + /// string[] + /// + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// + /// + /// statuses + /// string[] + /// + /// Statuses of the resource. + /// + /// + /// minCreatedDateTime + /// string (ISO 8601 Format) + /// + /// Minimum creation date of resource (inclusive). + /// + /// + /// maxCreatedDateTime + /// string (ISO 8601 Format) + /// + /// Maximum creation date of resource (inclusive). + /// + /// + /// minLastModifiedDateTime + /// string (ISO 8601 Format) + /// + /// Minimum last modified date of resource (inclusive). + /// + /// + /// maxLastModifiedDateTime + /// string (ISO 8601 Format) + /// + /// Maximum last modified date of resource (inclusive). + /// + /// + /// $maxPageSize + /// number + /// + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// + /// + /// $skipToken + /// string + /// + /// Skip token for getting next set of results. + /// + /// + /// isPrimary + /// boolean + /// + /// Is the boundary primary. + /// + /// + /// parentType + /// string + /// + /// Type of the parent it belongs to. + /// + /// + /// parentIds + /// string[] + /// + /// Parent Ids of the resource. + /// + /// + /// minAcreage + /// number + /// + /// Minimum acreage of the boundary (inclusive). + /// + /// + /// maxAcreage + /// number + /// + /// Maximum acreage of the boundary (inclusive). + /// + /// + /// intersectsWithGeometry + /// GeoJsonObject + /// + /// GeoJSON abstract class. + /// + /// + /// Schema for GeoJsonObject: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// type + /// "Point" | "Polygon" | "MultiPolygon" + /// Yes + /// GeoJSON object type. + /// + /// + /// + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Search(RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateSearchRequest(requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Search"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// The request body. + /// The request options. + private HttpMessage CreateSearchRequest(RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/boundaries", 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 = requestBody; + return message; + } + + /// Get cascade delete job for specified boundary. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get cascade delete job for specified boundary. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/boundaries/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a cascade delete job for specified boundary. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the boundary to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string boundaryId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, boundaryId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a cascade delete job for specified boundary. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the boundary to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateCascadeDeleteJob(string jobId, string farmerId, string boundaryId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, boundaryId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the boundary to be deleted. + /// The request options. + private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string boundaryId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/boundaries/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("boundaryId", boundaryId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified boundary resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the boundary. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string boundaryId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, boundaryId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified boundary resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the boundary. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string boundaryId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, boundaryId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// ID of the boundary. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string boundaryId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries/", false); + uri.AppendPath(boundaryId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates a boundary resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// + /// Farmer ID. + /// + /// + /// parentId + /// string + /// + /// ID of the parent(field or seasonalField) it belongs to. + /// + /// + /// geometry + /// GeoJsonObject + /// + /// GeoJSON abstract class. + /// + /// + /// isPrimary + /// boolean + /// + /// Is the boundary primary. + /// + /// + /// acreage + /// number + /// + /// Boundary area in acres. + /// + /// + /// parentType + /// string + /// + /// Type of the parent it belongs to. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for GeoJsonObject: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// type + /// "Point" | "Polygon" | "MultiPolygon" + /// Yes + /// GeoJSON object type. + /// + /// + /// + /// ID of the farmer resource. + /// ID of the boundary resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string boundaryId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, boundaryId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a boundary resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// + /// Farmer ID. + /// + /// + /// parentId + /// string + /// + /// ID of the parent(field or seasonalField) it belongs to. + /// + /// + /// geometry + /// GeoJsonObject + /// + /// GeoJSON abstract class. + /// + /// + /// isPrimary + /// boolean + /// + /// Is the boundary primary. + /// + /// + /// acreage + /// number + /// + /// Boundary area in acres. + /// + /// + /// parentType + /// string + /// + /// Type of the parent it belongs to. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for GeoJsonObject: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// type + /// "Point" | "Polygon" | "MultiPolygon" + /// Yes + /// GeoJSON object type. + /// + /// + /// + /// ID of the farmer resource. + /// ID of the boundary resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string boundaryId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, boundaryId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer resource. + /// ID of the boundary resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string boundaryId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries/", false); + uri.AppendPath(boundaryId, 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 = requestBody; + return message; + } + + /// Deletes a specified boundary resource under a particular farmer. + /// ID of the farmer. + /// ID of the boundary. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string boundaryId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, boundaryId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified boundary resource under a particular farmer. + /// ID of the farmer. + /// ID of the boundary. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string boundaryId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, boundaryId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer. + /// ID of the boundary. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string boundaryId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries/", false); + uri.AppendPath(boundaryId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns overlapping acreage between two boundary Ids. + /// ID of the farmer. + /// ID of the boundary. + /// FarmerId of the other field. + /// ID of the other boundary. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetOverlapAsync(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetOverlapRequest(farmerId, boundaryId, otherFarmerId, otherBoundaryId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetOverlap"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns overlapping acreage between two boundary Ids. + /// ID of the farmer. + /// ID of the boundary. + /// FarmerId of the other field. + /// ID of the other boundary. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetOverlap(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetOverlapRequest(farmerId, boundaryId, otherFarmerId, otherBoundaryId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetOverlap"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer. + /// ID of the boundary. + /// FarmerId of the other field. + /// ID of the other boundary. + /// The request options. + private HttpMessage CreateGetOverlapRequest(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries/", false); + uri.AppendPath(boundaryId, true); + uri.AppendPath("/overlap", false); + uri.AppendQuery("otherFarmerId", otherFarmerId, true); + uri.AppendQuery("otherBoundaryId", otherBoundaryId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/CropVarietiesClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/CropVarietiesClient.cs new file mode 100644 index 0000000000000..4daf21867317a --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/CropVarietiesClient.cs @@ -0,0 +1,966 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The CropVarieties service client. + public partial class CropVarietiesClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of CropVarietiesClient for mocking. + protected CropVarietiesClient() + { + } + + /// Initializes a new instance of CropVarietiesClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public CropVarietiesClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of crop variety resources under a particular crop. + /// ID of the associated crop. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByCropIdAsync(string cropId, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByCropIdRequest(cropId, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.ListByCropId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of crop variety resources under a particular crop. + /// ID of the associated crop. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByCropId(string cropId, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByCropIdRequest(cropId, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.ListByCropId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated crop. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByCropIdRequest(string cropId, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendPath("/crop-varieties", false); + if (cropIds != null) + { + uri.AppendQueryDelimited("cropIds", cropIds, ",", true); + } + if (brands != null) + { + uri.AppendQueryDelimited("brands", brands, ",", true); + } + if (products != null) + { + uri.AppendQueryDelimited("products", products, ",", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns a paginated list of crop variety resources across all crops. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of crop variety resources across all crops. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crop-varieties", false); + if (cropIds != null) + { + uri.AppendQueryDelimited("cropIds", cropIds, ",", true); + } + if (brands != null) + { + uri.AppendQueryDelimited("brands", brands, ",", true); + } + if (products != null) + { + uri.AppendQueryDelimited("products", products, ",", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified crop variety resource under a particular crop. + /// ID of the associated crop. + /// ID of the crop variety. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string cropId, string cropVarietyId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(cropId, cropVarietyId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified crop variety resource under a particular crop. + /// ID of the associated crop. + /// ID of the crop variety. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string cropId, string cropVarietyId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(cropId, cropVarietyId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated crop. + /// ID of the crop variety. + /// The request options. + private HttpMessage CreateGetRequest(string cropId, string cropVarietyId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendPath("/crop-varieties/", false); + uri.AppendPath(cropVarietyId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates a crop variety resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// cropId + /// string + /// + /// ID of the crop it belongs to. + /// + /// + /// brand + /// string + /// + /// CropVariety Brand. + /// + /// + /// product + /// string + /// + /// CropVariety product. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the crop resource. + /// ID of the crop variety resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string cropId, string cropVarietyId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(cropId, cropVarietyId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a crop variety resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// cropId + /// string + /// + /// ID of the crop it belongs to. + /// + /// + /// brand + /// string + /// + /// CropVariety Brand. + /// + /// + /// product + /// string + /// + /// CropVariety product. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the crop resource. + /// ID of the crop variety resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string cropId, string cropVarietyId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(cropId, cropVarietyId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the crop resource. + /// ID of the crop variety resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string cropId, string cropVarietyId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendPath("/crop-varieties/", false); + uri.AppendPath(cropVarietyId, 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 = requestBody; + return message; + } + + /// Deletes a specified crop variety resource under a particular crop. + /// ID of the crop. + /// ID of the crop variety. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string cropId, string cropVarietyId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(cropId, cropVarietyId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified crop variety resource under a particular crop. + /// ID of the crop. + /// ID of the crop variety. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string cropId, string cropVarietyId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(cropId, cropVarietyId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the crop. + /// ID of the crop variety. + /// The request options. + private HttpMessage CreateDeleteRequest(string cropId, string cropVarietyId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendPath("/crop-varieties/", false); + uri.AppendPath(cropVarietyId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/CropsClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/CropsClient.cs new file mode 100644 index 0000000000000..4fdbc8d0ca13d --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/CropsClient.cs @@ -0,0 +1,699 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Crops service client. + public partial class CropsClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of CropsClient for mocking. + protected CropsClient() + { + } + + /// Initializes a new instance of CropsClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public CropsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of crop resources. + /// Crop phenotypes of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(IEnumerable phenotypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(phenotypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropsClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of crop resources. + /// Crop phenotypes of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(IEnumerable phenotypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(phenotypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropsClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Crop phenotypes of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(IEnumerable phenotypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crops", false); + if (phenotypes != null) + { + uri.AppendQueryDelimited("phenotypes", phenotypes, ",", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified crop resource. + /// ID of the crop. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string cropId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(cropId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropsClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified crop resource. + /// ID of the crop. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string cropId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(cropId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropsClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the crop. + /// The request options. + private HttpMessage CreateGetRequest(string cropId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates a crop resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// phenotype + /// string + /// + /// Crop phenotype. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the crop resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string cropId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(cropId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropsClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a crop resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// phenotype + /// string + /// + /// Crop phenotype. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the crop resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string cropId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(cropId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropsClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the crop resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string cropId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, 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 = requestBody; + return message; + } + + /// Deletes Crop for given crop id. + /// ID of crop to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string cropId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(cropId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropsClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes Crop for given crop id. + /// ID of crop to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string cropId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(cropId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("CropsClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of crop to be deleted. + /// The request options. + private HttpMessage CreateDeleteRequest(string cropId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmBeatsClientOptions.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmBeatsClientOptions.cs new file mode 100644 index 0000000000000..87ab449eecb36 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmBeatsClientOptions.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.Verticals.AgriFood.Farming +{ + /// Client options for FarmBeatsClient. + public partial class FarmBeatsClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2021_03_31_preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2021-03-31-preview". + V2021_03_31_preview = 1, + } + + internal string Version { get; } + + /// Initializes new instance of FarmBeatsClientOptions. + public FarmBeatsClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2021_03_31_preview => "2021-03-31-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmClient.cs new file mode 100644 index 0000000000000..e8fbe4bf20795 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmClient.cs @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Farm service client. + public partial class FarmClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of FarmClient for mocking. + protected FarmClient() + { + } + + /// Initializes a new instance of FarmClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public FarmClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Create a farm operation data ingestion job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// Yes + /// Farmer ID. + /// + /// + /// authProviderId + /// string + /// Yes + /// Authentication provider ID. + /// + /// + /// operations + /// string[] + /// + /// List of operation types for which data needs to be downloaded. Available values: AllOperations, Application, Planting, Harvest, Tillage. + /// + /// + /// startYear + /// number + /// Yes + /// Start Year (Minimum = 2000, Maximum = CurrentYear). + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// Job ID supplied by user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateDataIngestionJobAsync(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmClient.CreateDataIngestionJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a farm operation data ingestion job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// Yes + /// Farmer ID. + /// + /// + /// authProviderId + /// string + /// Yes + /// Authentication provider ID. + /// + /// + /// operations + /// string[] + /// + /// List of operation types for which data needs to be downloaded. Available values: AllOperations, Application, Planting, Harvest, Tillage. + /// + /// + /// startYear + /// number + /// Yes + /// Start Year (Minimum = 2000, Maximum = CurrentYear). + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// Job ID supplied by user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateDataIngestionJob(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmClient.CreateDataIngestionJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job ID supplied by user. + /// The request body. + /// The request options. + private HttpMessage CreateCreateDataIngestionJobRequest(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farm-operations/ingest-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return message; + } + + /// Get a farm operation data ingestion job. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetDataIngestionJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmClient.GetDataIngestionJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a farm operation data ingestion job. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetDataIngestionJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmClient.GetDataIngestionJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetDataIngestionJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farm-operations/ingest-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmersClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmersClient.cs new file mode 100644 index 0000000000000..d0e9fdd8e9a4d --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmersClient.cs @@ -0,0 +1,880 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Farmers service client. + public partial class FarmersClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of FarmersClient for mocking. + protected FarmersClient() + { + } + + /// Initializes a new instance of FarmersClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public FarmersClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of farmer resources. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of farmer resources. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers", false); + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified farmer resource. + /// ID of the associated farmer. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified farmer resource. + /// ID of the associated farmer. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates a farmer resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the farmer resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a farmer resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the farmer resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, 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 = requestBody; + return message; + } + + /// Deletes a specified farmer resource. + /// ID of farmer to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified farmer resource. + /// ID of farmer to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of farmer to be deleted. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get a cascade delete job for specified farmer. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a cascade delete job for specified farmer. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a cascade delete job for specified farmer. + /// Job ID supplied by end user. + /// ID of the farmer to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a cascade delete job for specified farmer. + /// Job ID supplied by end user. + /// ID of the farmer to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateCascadeDeleteJob(string jobId, string farmerId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmersClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job ID supplied by end user. + /// ID of the farmer to be deleted. + /// The request options. + private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmsClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmsClient.cs new file mode 100644 index 0000000000000..6d01fd8822c3b --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FarmsClient.cs @@ -0,0 +1,1104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Farms service client. + public partial class FarmsClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of FarmsClient for mocking. + protected FarmsClient() + { + } + + /// Initializes a new instance of FarmsClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public FarmsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of farm resources under a particular farmer. + /// ID of the associated farmer. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of farm resources under a particular farmer. + /// ID of the associated farmer. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/farms", false); + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns a paginated list of farm resources across all farmers. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of farm resources across all farmers. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farms", false); + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified farm resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string farmId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, farmId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified farm resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string farmId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, farmId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string farmId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/farms/", false); + uri.AppendPath(farmId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates a farm resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// + /// Farmer ID. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string farmId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, farmId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a farm resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// + /// Farmer ID. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string farmId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, farmId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string farmId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/farms/", false); + uri.AppendPath(farmId, 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 = requestBody; + return message; + } + + /// Deletes a specified farm resource under a particular farmer. + /// ID of the farmer. + /// ID of the farm. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string farmId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, farmId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified farm resource under a particular farmer. + /// ID of the farmer. + /// ID of the farm. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string farmId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, farmId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer. + /// ID of the farm. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string farmId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/farms/", false); + uri.AppendPath(farmId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get a cascade delete job for specified farm. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a cascade delete job for specified farm. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farms/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a cascade delete job for specified farm. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the farm to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string farmId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, farmId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a cascade delete job for specified farm. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the farm to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateCascadeDeleteJob(string jobId, string farmerId, string farmId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, farmId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the farm to be deleted. + /// The request options. + private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string farmId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farms/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("farmId", farmId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FieldsClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FieldsClient.cs new file mode 100644 index 0000000000000..add601563872e --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/FieldsClient.cs @@ -0,0 +1,1154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Fields service client. + public partial class FieldsClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of FieldsClient for mocking. + protected FieldsClient() + { + } + + /// Initializes a new instance of FieldsClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public FieldsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of field resources under a particular farmer. + /// ID of the associated farmer. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of field resources under a particular farmer. + /// ID of the associated farmer. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/fields", false); + if (farmIds != null) + { + uri.AppendQueryDelimited("farmIds", farmIds, ",", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns a paginated list of field resources across all farmers. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of field resources across all farmers. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/fields", false); + if (farmIds != null) + { + uri.AppendQueryDelimited("farmIds", farmIds, ",", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified field resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the field. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string fieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, fieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified field resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the field. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string fieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, fieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// ID of the field. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string fieldId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/fields/", false); + uri.AppendPath(fieldId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or Updates a field resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmId + /// string + /// + /// ID of the associated Farm. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID. + /// + /// + /// primaryBoundaryId + /// string + /// + /// Primary boundary id. + /// + /// + /// boundaryIds + /// string[] + /// + /// Boundary Ids. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the associated farmer resource. + /// ID of the field resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string fieldId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, fieldId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or Updates a field resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmId + /// string + /// + /// ID of the associated Farm. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID. + /// + /// + /// primaryBoundaryId + /// string + /// + /// Primary boundary id. + /// + /// + /// boundaryIds + /// string[] + /// + /// Boundary Ids. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the associated farmer resource. + /// ID of the field resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string fieldId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, fieldId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the field resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string fieldId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/fields/", false); + uri.AppendPath(fieldId, 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 = requestBody; + return message; + } + + /// Deletes a specified field resource under a particular farmer. + /// ID of the farmer. + /// ID of the field. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string fieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, fieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified field resource under a particular farmer. + /// ID of the farmer. + /// ID of the field. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string fieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, fieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer. + /// ID of the field. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string fieldId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/fields/", false); + uri.AppendPath(fieldId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get a cascade delete job for specified field. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a cascade delete job for specified field. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/fields/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a cascade delete job for specified field. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the field to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string fieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, fieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a cascade delete job for specified field. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the field to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateCascadeDeleteJob(string jobId, string farmerId, string fieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, fieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the field to be deleted. + /// The request options. + private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string fieldId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/fields/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("fieldId", fieldId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestDataClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestDataClient.cs new file mode 100644 index 0000000000000..343fcceaf78b8 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestDataClient.cs @@ -0,0 +1,1554 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The HarvestData service client. + public partial class HarvestDataClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of HarvestDataClient for mocking. + protected HarvestDataClient() + { + } + + /// Initializes a new instance of HarvestDataClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public HarvestDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of harvest data resources under a particular farm. + /// ID of the associated farmer. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of harvest data resources under a particular farm. + /// ID of the associated farmer. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/harvest-data", false); + if (minTotalYield != null) + { + uri.AppendQuery("minTotalYield", minTotalYield.Value, true); + } + if (maxTotalYield != null) + { + uri.AppendQuery("maxTotalYield", maxTotalYield.Value, true); + } + if (minAvgYield != null) + { + uri.AppendQuery("minAvgYield", minAvgYield.Value, true); + } + if (maxAvgYield != null) + { + uri.AppendQuery("maxAvgYield", maxAvgYield.Value, true); + } + if (minTotalWetMass != null) + { + uri.AppendQuery("minTotalWetMass", minTotalWetMass.Value, true); + } + if (maxTotalWetMass != null) + { + uri.AppendQuery("maxTotalWetMass", maxTotalWetMass.Value, true); + } + if (minAvgWetMass != null) + { + uri.AppendQuery("minAvgWetMass", minAvgWetMass.Value, true); + } + if (maxAvgWetMass != null) + { + uri.AppendQuery("maxAvgWetMass", maxAvgWetMass.Value, true); + } + if (minAvgMoisture != null) + { + uri.AppendQuery("minAvgMoisture", minAvgMoisture.Value, true); + } + if (maxAvgMoisture != null) + { + uri.AppendQuery("maxAvgMoisture", maxAvgMoisture.Value, true); + } + if (minAvgSpeed != null) + { + uri.AppendQuery("minAvgSpeed", minAvgSpeed.Value, true); + } + if (maxAvgSpeed != null) + { + uri.AppendQuery("maxAvgSpeed", maxAvgSpeed.Value, true); + } + if (sources != null) + { + uri.AppendQueryDelimited("sources", sources, ",", true); + } + if (associatedBoundaryIds != null) + { + uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); + } + if (operationBoundaryIds != null) + { + uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns a paginated list of harvest data resources across all farmers. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of harvest data resources across all farmers. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/harvest-data", false); + if (minTotalYield != null) + { + uri.AppendQuery("minTotalYield", minTotalYield.Value, true); + } + if (maxTotalYield != null) + { + uri.AppendQuery("maxTotalYield", maxTotalYield.Value, true); + } + if (minAvgYield != null) + { + uri.AppendQuery("minAvgYield", minAvgYield.Value, true); + } + if (maxAvgYield != null) + { + uri.AppendQuery("maxAvgYield", maxAvgYield.Value, true); + } + if (minTotalWetMass != null) + { + uri.AppendQuery("minTotalWetMass", minTotalWetMass.Value, true); + } + if (maxTotalWetMass != null) + { + uri.AppendQuery("maxTotalWetMass", maxTotalWetMass.Value, true); + } + if (minAvgWetMass != null) + { + uri.AppendQuery("minAvgWetMass", minAvgWetMass.Value, true); + } + if (maxAvgWetMass != null) + { + uri.AppendQuery("maxAvgWetMass", maxAvgWetMass.Value, true); + } + if (minAvgMoisture != null) + { + uri.AppendQuery("minAvgMoisture", minAvgMoisture.Value, true); + } + if (maxAvgMoisture != null) + { + uri.AppendQuery("maxAvgMoisture", maxAvgMoisture.Value, true); + } + if (minAvgSpeed != null) + { + uri.AppendQuery("minAvgSpeed", minAvgSpeed.Value, true); + } + if (maxAvgSpeed != null) + { + uri.AppendQuery("maxAvgSpeed", maxAvgSpeed.Value, true); + } + if (sources != null) + { + uri.AppendQueryDelimited("sources", sources, ",", true); + } + if (associatedBoundaryIds != null) + { + uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); + } + if (operationBoundaryIds != null) + { + uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get a specified harvest data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the harvest data resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string harvestDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, harvestDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a specified harvest data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the harvest data resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string harvestDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, harvestDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the harvest data resource. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string harvestDataId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/harvest-data/", false); + uri.AppendPath(harvestDataId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates harvest data resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// totalYield + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgYield + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalWetMass + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgWetMass + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgMoisture + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgSpeed + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// harvestProductDetails + /// HarvestProductDetail[] + /// + /// Harvest product details. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// source + /// string + /// + /// Source of the operation data. + /// + /// + /// operationModifiedDateTime + /// string (ISO 8601 Format) + /// + /// + /// Modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Note: this will be specified by the source provider itself. + /// + /// + /// + /// operationStartDateTime + /// string (ISO 8601 Format) + /// + /// Start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// operationEndDateTime + /// string (ISO 8601 Format) + /// + /// End date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// attachmentsLink + /// string + /// + /// Link for attachments. + /// + /// + /// associatedBoundaryId + /// string + /// + /// Optional boundary ID of the field for which operation was applied. + /// + /// + /// operationBoundaryId + /// string + /// + /// Optional boundary ID of the actual area for which operation was applied inside the specified field. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID which belongs to the operation data. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for Measure: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// unit + /// string + /// + /// Data unit. + /// + /// + /// value + /// number + /// + /// Data value. + /// + /// + /// Schema for HarvestProductDetail: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// productName + /// string + /// + /// Name of the product. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalYield + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgYield + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgMoisture + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalWetMass + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgWetMass + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// + /// ID of the farmer. + /// ID of the harvest data resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string harvestDataId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, harvestDataId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates harvest data resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// totalYield + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgYield + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalWetMass + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgWetMass + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgMoisture + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgSpeed + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// harvestProductDetails + /// HarvestProductDetail[] + /// + /// Harvest product details. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// source + /// string + /// + /// Source of the operation data. + /// + /// + /// operationModifiedDateTime + /// string (ISO 8601 Format) + /// + /// + /// Modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Note: this will be specified by the source provider itself. + /// + /// + /// + /// operationStartDateTime + /// string (ISO 8601 Format) + /// + /// Start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// operationEndDateTime + /// string (ISO 8601 Format) + /// + /// End date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// attachmentsLink + /// string + /// + /// Link for attachments. + /// + /// + /// associatedBoundaryId + /// string + /// + /// Optional boundary ID of the field for which operation was applied. + /// + /// + /// operationBoundaryId + /// string + /// + /// Optional boundary ID of the actual area for which operation was applied inside the specified field. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID which belongs to the operation data. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for Measure: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// unit + /// string + /// + /// Data unit. + /// + /// + /// value + /// number + /// + /// Data value. + /// + /// + /// Schema for HarvestProductDetail: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// productName + /// string + /// + /// Name of the product. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalYield + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgYield + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgMoisture + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalWetMass + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgWetMass + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// + /// ID of the farmer. + /// ID of the harvest data resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string harvestDataId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, harvestDataId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer. + /// ID of the harvest data resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string harvestDataId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/harvest-data/", false); + uri.AppendPath(harvestDataId, 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 = requestBody; + return message; + } + + /// Deletes a specified harvest data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the harvest data. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string harvestDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, harvestDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified harvest data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the harvest data. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string harvestDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, harvestDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the harvest data. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string harvestDataId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/harvest-data/", false); + uri.AppendPath(harvestDataId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ImageProcessingClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ImageProcessingClient.cs new file mode 100644 index 0000000000000..f672478788f74 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ImageProcessingClient.cs @@ -0,0 +1,471 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The ImageProcessing service client. + public partial class ImageProcessingClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of ImageProcessingClient for mocking. + protected ImageProcessingClient() + { + } + + /// Initializes a new instance of ImageProcessingClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public ImageProcessingClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Create a ImageProcessing Rasterize job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// Yes + /// Farmer ID. + /// + /// + /// shapefileAttachmentId + /// string + /// Yes + /// Shapefile attachment ID. + /// + /// + /// shapefileColumnNames + /// string[] + /// Yes + /// List of shapefile column names to create raster attachments. + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// JobId provided by user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateRasterizeJobAsync(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateRasterizeJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.CreateRasterizeJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a ImageProcessing Rasterize job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// Yes + /// Farmer ID. + /// + /// + /// shapefileAttachmentId + /// string + /// Yes + /// Shapefile attachment ID. + /// + /// + /// shapefileColumnNames + /// string[] + /// Yes + /// List of shapefile column names to create raster attachments. + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// JobId provided by user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateRasterizeJob(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateRasterizeJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.CreateRasterizeJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// JobId provided by user. + /// The request body. + /// The request options. + private HttpMessage CreateCreateRasterizeJobRequest(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/image-processing/rasterize/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return message; + } + + /// Get ImageProcessing Rasterize job's details. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetRasterizeJobAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRasterizeJobRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.GetRasterizeJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get ImageProcessing Rasterize job's details. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetRasterizeJob(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRasterizeJobRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.GetRasterizeJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetRasterizeJobRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/image-processing/rasterize/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProvidersClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProvidersClient.cs new file mode 100644 index 0000000000000..346c76ff17b8f --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProvidersClient.cs @@ -0,0 +1,740 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The OAuthProviders service client. + public partial class OAuthProvidersClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of OAuthProvidersClient for mocking. + protected OAuthProvidersClient() + { + } + + /// Initializes a new instance of OAuthProvidersClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public OAuthProvidersClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of oauthProvider resources. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of oauthProvider resources. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/oauth/providers", false); + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get a specified oauthProvider resource. + /// ID of the oauthProvider resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string oauthProviderId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(oauthProviderId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a specified oauthProvider resource. + /// ID of the oauthProvider resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string oauthProviderId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(oauthProviderId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the oauthProvider resource. + /// The request options. + private HttpMessage CreateGetRequest(string oauthProviderId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/oauth/providers/", false); + uri.AppendPath(oauthProviderId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates an oauthProvider resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// appId + /// string + /// + /// OAuth App ID for given OAuth Provider. + /// + /// + /// appSecret + /// string + /// + /// + /// OAuth App secret for given Provider. + /// + /// Note: Won't be sent in response. + /// + /// + /// + /// apiKey + /// string + /// + /// + /// OAuth Api key for given Provider. + /// + /// Note: currently Applicable to Climate provider. Won't be sent in response. + /// + /// + /// + /// isProductionApp + /// boolean + /// + /// + /// An optional flag to determine if the App is ready to be used for Production scenarios in the provider side or not. (Default value: false) + /// + /// Note: Currently applicable for JohnDeere. + /// + /// + /// + /// id + /// string + /// + /// Unique OAuth provider ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of oauthProvider resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string oauthProviderId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(oauthProviderId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an oauthProvider resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// appId + /// string + /// + /// OAuth App ID for given OAuth Provider. + /// + /// + /// appSecret + /// string + /// + /// + /// OAuth App secret for given Provider. + /// + /// Note: Won't be sent in response. + /// + /// + /// + /// apiKey + /// string + /// + /// + /// OAuth Api key for given Provider. + /// + /// Note: currently Applicable to Climate provider. Won't be sent in response. + /// + /// + /// + /// isProductionApp + /// boolean + /// + /// + /// An optional flag to determine if the App is ready to be used for Production scenarios in the provider side or not. (Default value: false) + /// + /// Note: Currently applicable for JohnDeere. + /// + /// + /// + /// id + /// string + /// + /// Unique OAuth provider ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of oauthProvider resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string oauthProviderId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(oauthProviderId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of oauthProvider resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string oauthProviderId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/oauth/providers/", false); + uri.AppendPath(oauthProviderId, 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 = requestBody; + return message; + } + + /// Deletes an specified oauthProvider resource. + /// ID of oauthProvider. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string oauthProviderId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(oauthProviderId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an specified oauthProvider resource. + /// ID of oauthProvider. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string oauthProviderId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(oauthProviderId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of oauthProvider. + /// The request options. + private HttpMessage CreateDeleteRequest(string oauthProviderId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/oauth/providers/", false); + uri.AppendPath(oauthProviderId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthTokensClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthTokensClient.cs new file mode 100644 index 0000000000000..ee005832767c1 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthTokensClient.cs @@ -0,0 +1,599 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The OAuthTokens service client. + public partial class OAuthTokensClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of OAuthTokensClient for mocking. + protected OAuthTokensClient() + { + } + + /// Initializes a new instance of OAuthTokensClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public OAuthTokensClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a list of OAuthToken documents. + /// Name of AuthProvider. + /// List of farmers. + /// If the token object is valid. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(IEnumerable authProviderIds = null, IEnumerable farmerIds = null, bool? isValid = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(authProviderIds, farmerIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a list of OAuthToken documents. + /// Name of AuthProvider. + /// List of farmers. + /// If the token object is valid. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(IEnumerable authProviderIds = null, IEnumerable farmerIds = null, bool? isValid = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(authProviderIds, farmerIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Name of AuthProvider. + /// List of farmers. + /// If the token object is valid. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(IEnumerable authProviderIds = null, IEnumerable farmerIds = null, bool? isValid = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/oauth/tokens", false); + if (authProviderIds != null) + { + uri.AppendQueryDelimited("authProviderIds", authProviderIds, ",", true); + } + if (farmerIds != null) + { + uri.AppendQueryDelimited("farmerIds", farmerIds, ",", true); + } + if (isValid != null) + { + uri.AppendQuery("isValid", isValid.Value, true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns Connection link needed in the OAuth flow. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// Yes + /// ID of the farmer. + /// + /// + /// oAuthProviderId + /// string + /// Yes + /// ID of the OAuthProvider. + /// + /// + /// userRedirectLink + /// string + /// Yes + /// Link to redirect the user to, at the end of the oauth flow. + /// + /// + /// userRedirectState + /// string + /// + /// State to provide back when redirecting the user, at the end of the oauth flow. + /// + /// + /// + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetOAuthConnectionLinkAsync(RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetOAuthConnectionLinkRequest(requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetOAuthConnectionLink"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns Connection link needed in the OAuth flow. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// Yes + /// ID of the farmer. + /// + /// + /// oAuthProviderId + /// string + /// Yes + /// ID of the OAuthProvider. + /// + /// + /// userRedirectLink + /// string + /// Yes + /// Link to redirect the user to, at the end of the oauth flow. + /// + /// + /// userRedirectState + /// string + /// + /// State to provide back when redirecting the user, at the end of the oauth flow. + /// + /// + /// + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetOAuthConnectionLink(RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetOAuthConnectionLinkRequest(requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetOAuthConnectionLink"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// The request body. + /// The request options. + private HttpMessage CreateGetOAuthConnectionLinkRequest(RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/oauth/tokens/:connect", 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 = requestBody; + return message; + } + + /// Get cascade delete job details for OAuth tokens for specified job ID. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get cascade delete job details for OAuth tokens for specified job ID. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/oauth/tokens/remove/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a cascade delete job for OAuth tokens. + /// Job ID supplied by end user. + /// ID of the farmer. + /// ID of the OAuthProvider. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string oauthProviderId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, oauthProviderId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a cascade delete job for OAuth tokens. + /// Job ID supplied by end user. + /// ID of the farmer. + /// ID of the OAuthProvider. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateCascadeDeleteJob(string jobId, string farmerId, string oauthProviderId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, oauthProviderId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job ID supplied by end user. + /// ID of the farmer. + /// ID of the OAuthProvider. + /// The request options. + private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string oauthProviderId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/oauth/tokens/remove/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("oauthProviderId", oauthProviderId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingDataClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingDataClient.cs new file mode 100644 index 0000000000000..3ef0bb2a3c160 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingDataClient.cs @@ -0,0 +1,1398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The PlantingData service client. + public partial class PlantingDataClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of PlantingDataClient for mocking. + protected PlantingDataClient() + { + } + + /// Initializes a new instance of PlantingDataClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public PlantingDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of planting data resources under a particular farm. + /// ID of the associated farmer. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of planting data resources under a particular farm. + /// ID of the associated farmer. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/planting-data", false); + if (minAvgPlantingRate != null) + { + uri.AppendQuery("minAvgPlantingRate", minAvgPlantingRate.Value, true); + } + if (maxAvgPlantingRate != null) + { + uri.AppendQuery("maxAvgPlantingRate", maxAvgPlantingRate.Value, true); + } + if (minTotalMaterial != null) + { + uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); + } + if (maxTotalMaterial != null) + { + uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); + } + if (minAvgMaterial != null) + { + uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); + } + if (maxAvgMaterial != null) + { + uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); + } + if (sources != null) + { + uri.AppendQueryDelimited("sources", sources, ",", true); + } + if (associatedBoundaryIds != null) + { + uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); + } + if (operationBoundaryIds != null) + { + uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns a paginated list of planting data resources across all farmers. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of planting data resources across all farmers. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/planting-data", false); + if (minAvgPlantingRate != null) + { + uri.AppendQuery("minAvgPlantingRate", minAvgPlantingRate.Value, true); + } + if (maxAvgPlantingRate != null) + { + uri.AppendQuery("maxAvgPlantingRate", maxAvgPlantingRate.Value, true); + } + if (minTotalMaterial != null) + { + uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); + } + if (maxTotalMaterial != null) + { + uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); + } + if (minAvgMaterial != null) + { + uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); + } + if (maxAvgMaterial != null) + { + uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); + } + if (sources != null) + { + uri.AppendQueryDelimited("sources", sources, ",", true); + } + if (associatedBoundaryIds != null) + { + uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); + } + if (operationBoundaryIds != null) + { + uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get a specified planting data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the planting data resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string plantingDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, plantingDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a specified planting data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the planting data resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string plantingDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, plantingDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the planting data resource. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string plantingDataId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/planting-data/", false); + uri.AppendPath(plantingDataId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates an planting data resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// avgPlantingRate + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// plantingProductDetails + /// PlantingProductDetail[] + /// + /// Planting product details. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// source + /// string + /// + /// Source of the operation data. + /// + /// + /// operationModifiedDateTime + /// string (ISO 8601 Format) + /// + /// + /// Modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Note: this will be specified by the source provider itself. + /// + /// + /// + /// operationStartDateTime + /// string (ISO 8601 Format) + /// + /// Start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// operationEndDateTime + /// string (ISO 8601 Format) + /// + /// End date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// attachmentsLink + /// string + /// + /// Link for attachments. + /// + /// + /// associatedBoundaryId + /// string + /// + /// Optional boundary ID of the field for which operation was applied. + /// + /// + /// operationBoundaryId + /// string + /// + /// Optional boundary ID of the actual area for which operation was applied inside the specified field. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID which belongs to the operation data. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for Measure: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// unit + /// string + /// + /// Data unit. + /// + /// + /// value + /// number + /// + /// Data value. + /// + /// + /// Schema for PlantingProductDetail: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// productName + /// string + /// + /// Name of the product. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// + /// ID of the associated farmer. + /// ID of the planting data resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string plantingDataId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, plantingDataId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an planting data resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// avgPlantingRate + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// plantingProductDetails + /// PlantingProductDetail[] + /// + /// Planting product details. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// source + /// string + /// + /// Source of the operation data. + /// + /// + /// operationModifiedDateTime + /// string (ISO 8601 Format) + /// + /// + /// Modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Note: this will be specified by the source provider itself. + /// + /// + /// + /// operationStartDateTime + /// string (ISO 8601 Format) + /// + /// Start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// operationEndDateTime + /// string (ISO 8601 Format) + /// + /// End date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// attachmentsLink + /// string + /// + /// Link for attachments. + /// + /// + /// associatedBoundaryId + /// string + /// + /// Optional boundary ID of the field for which operation was applied. + /// + /// + /// operationBoundaryId + /// string + /// + /// Optional boundary ID of the actual area for which operation was applied inside the specified field. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID which belongs to the operation data. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for Measure: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// unit + /// string + /// + /// Data unit. + /// + /// + /// value + /// number + /// + /// Data value. + /// + /// + /// Schema for PlantingProductDetail: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// productName + /// string + /// + /// Name of the product. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// totalMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// avgMaterial + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// + /// ID of the associated farmer. + /// ID of the planting data resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string plantingDataId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, plantingDataId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// ID of the planting data resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string plantingDataId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/planting-data/", false); + uri.AppendPath(plantingDataId, 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 = requestBody; + return message; + } + + /// Deletes a specified planting data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the planting data. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string plantingDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, plantingDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified planting data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the planting data. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string plantingDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, plantingDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the planting data. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string plantingDataId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/planting-data/", false); + uri.AppendPath(plantingDataId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ScenesClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ScenesClient.cs new file mode 100644 index 0000000000000..2d5f225e8527b --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/ScenesClient.cs @@ -0,0 +1,860 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Scenes service client. + public partial class ScenesClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of ScenesClient for mocking. + protected ScenesClient() + { + } + + /// Initializes a new instance of ScenesClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public ScenesClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of scene resources. + /// Provider name of scene data. + /// FarmerId. + /// BoundaryId. + /// Source name of scene data, default value Sentinel_2_L2A (Sentinel 2 L2A). + /// Scene start UTC datetime (inclusive), sample format: yyyy-MM-ddThh:mm:ssZ. + /// Scene end UTC datetime (inclusive), sample format: yyyy-MM-dThh:mm:ssZ. + /// Filter scenes with cloud coverage percentage less than max value. Range [0 to 100.0]. + /// Filter scenes with dark pixel coverage percentage less than max value. Range [0 to 100.0]. + /// List of image names to be filtered. + /// List of image resolutions in meters to be filtered. + /// List of image formats to be filtered. + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(string provider, string farmerId, string boundaryId, string source = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, double? maxCloudCoveragePercentage = null, double? maxDarkPixelCoveragePercentage = null, IEnumerable imageNames = null, IEnumerable imageResolutions = null, IEnumerable imageFormats = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(provider, farmerId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ScenesClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of scene resources. + /// Provider name of scene data. + /// FarmerId. + /// BoundaryId. + /// Source name of scene data, default value Sentinel_2_L2A (Sentinel 2 L2A). + /// Scene start UTC datetime (inclusive), sample format: yyyy-MM-ddThh:mm:ssZ. + /// Scene end UTC datetime (inclusive), sample format: yyyy-MM-dThh:mm:ssZ. + /// Filter scenes with cloud coverage percentage less than max value. Range [0 to 100.0]. + /// Filter scenes with dark pixel coverage percentage less than max value. Range [0 to 100.0]. + /// List of image names to be filtered. + /// List of image resolutions in meters to be filtered. + /// List of image formats to be filtered. + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(string provider, string farmerId, string boundaryId, string source = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, double? maxCloudCoveragePercentage = null, double? maxDarkPixelCoveragePercentage = null, IEnumerable imageNames = null, IEnumerable imageResolutions = null, IEnumerable imageFormats = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(provider, farmerId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ScenesClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Provider name of scene data. + /// FarmerId. + /// BoundaryId. + /// Source name of scene data, default value Sentinel_2_L2A (Sentinel 2 L2A). + /// Scene start UTC datetime (inclusive), sample format: yyyy-MM-ddThh:mm:ssZ. + /// Scene end UTC datetime (inclusive), sample format: yyyy-MM-dThh:mm:ssZ. + /// Filter scenes with cloud coverage percentage less than max value. Range [0 to 100.0]. + /// Filter scenes with dark pixel coverage percentage less than max value. Range [0 to 100.0]. + /// List of image names to be filtered. + /// List of image resolutions in meters to be filtered. + /// List of image formats to be filtered. + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(string provider, string farmerId, string boundaryId, string source = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, double? maxCloudCoveragePercentage = null, double? maxDarkPixelCoveragePercentage = null, IEnumerable imageNames = null, IEnumerable imageResolutions = null, IEnumerable imageFormats = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/scenes", false); + uri.AppendQuery("provider", provider, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("boundaryId", boundaryId, true); + if (source != null) + { + uri.AppendQuery("source", source, true); + } + if (startDateTime != null) + { + uri.AppendQuery("startDateTime", startDateTime.Value, "O", true); + } + if (endDateTime != null) + { + uri.AppendQuery("endDateTime", endDateTime.Value, "O", true); + } + if (maxCloudCoveragePercentage != null) + { + uri.AppendQuery("maxCloudCoveragePercentage", maxCloudCoveragePercentage.Value, true); + } + if (maxDarkPixelCoveragePercentage != null) + { + uri.AppendQuery("maxDarkPixelCoveragePercentage", maxDarkPixelCoveragePercentage.Value, true); + } + if (imageNames != null) + { + uri.AppendQueryDelimited("imageNames", imageNames, ",", true); + } + if (imageResolutions != null) + { + uri.AppendQueryDelimited("imageResolutions", imageResolutions, ",", true); + } + if (imageFormats != null) + { + uri.AppendQueryDelimited("imageFormats", imageFormats, ",", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a satellite data ingestion job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// Yes + /// Farmer ID. + /// + /// + /// boundaryId + /// string + /// Yes + /// The id of the boundary object for which satellite data is being fetched. + /// + /// + /// startDateTime + /// string (ISO 8601 Format) + /// Yes + /// Start Date. + /// + /// + /// endDateTime + /// string (ISO 8601 Format) + /// Yes + /// End Date. + /// + /// + /// provider + /// "Microsoft" + /// + /// Provider of satellite data. + /// + /// + /// source + /// "Sentinel_2_L2A" + /// + /// Source of satellite data. + /// + /// + /// data + /// SatelliteData + /// + /// Data Model for SatelliteIngestionJobRequest. + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for SatelliteData: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// imageNames + /// string[] + /// + /// List of ImageNames. + /// + /// + /// imageFormats + /// string[] + /// + /// List of ImageFormats. Available value: TIF. + /// + /// + /// imageResolutions + /// number[] + /// + /// List of ImageResolutions in meters. Available values: 10, 20, 60. + /// + /// + /// + /// JobId provided by user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateSatelliteDataIngestionJobAsync(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateSatelliteDataIngestionJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ScenesClient.CreateSatelliteDataIngestionJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a satellite data ingestion job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// Yes + /// Farmer ID. + /// + /// + /// boundaryId + /// string + /// Yes + /// The id of the boundary object for which satellite data is being fetched. + /// + /// + /// startDateTime + /// string (ISO 8601 Format) + /// Yes + /// Start Date. + /// + /// + /// endDateTime + /// string (ISO 8601 Format) + /// Yes + /// End Date. + /// + /// + /// provider + /// "Microsoft" + /// + /// Provider of satellite data. + /// + /// + /// source + /// "Sentinel_2_L2A" + /// + /// Source of satellite data. + /// + /// + /// data + /// SatelliteData + /// + /// Data Model for SatelliteIngestionJobRequest. + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for SatelliteData: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// imageNames + /// string[] + /// + /// List of ImageNames. + /// + /// + /// imageFormats + /// string[] + /// + /// List of ImageFormats. Available value: TIF. + /// + /// + /// imageResolutions + /// number[] + /// + /// List of ImageResolutions in meters. Available values: 10, 20, 60. + /// + /// + /// + /// JobId provided by user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateSatelliteDataIngestionJob(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateSatelliteDataIngestionJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ScenesClient.CreateSatelliteDataIngestionJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// JobId provided by user. + /// The request body. + /// The request options. + private HttpMessage CreateCreateSatelliteDataIngestionJobRequest(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/scenes/satellite/ingest-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return message; + } + + /// Get a satellite data ingestion job. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetSatelliteDataIngestionJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetSatelliteDataIngestionJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ScenesClient.GetSatelliteDataIngestionJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a satellite data ingestion job. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetSatelliteDataIngestionJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetSatelliteDataIngestionJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ScenesClient.GetSatelliteDataIngestionJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetSatelliteDataIngestionJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/scenes/satellite/ingest-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Downloads and returns file stream as response for the given input filePath. + /// cloud storage path of scene file. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DownloadAsync(string filePath, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDownloadRequest(filePath, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ScenesClient.Download"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Downloads and returns file stream as response for the given input filePath. + /// cloud storage path of scene file. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Download(string filePath, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDownloadRequest(filePath, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("ScenesClient.Download"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// cloud storage path of scene file. + /// The request options. + private HttpMessage CreateDownloadRequest(string filePath, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/scenes/downloadFiles", false); + uri.AppendQuery("filePath", filePath, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/octet-stream, application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFieldsClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFieldsClient.cs new file mode 100644 index 0000000000000..1969bd92f9b2c --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFieldsClient.cs @@ -0,0 +1,1430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The SeasonalFields service client. + public partial class SeasonalFieldsClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of SeasonalFieldsClient for mocking. + protected SeasonalFieldsClient() + { + } + + /// Initializes a new instance of SeasonalFieldsClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public SeasonalFieldsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of seasonal field resources under a particular farmer. + /// ID of the associated farmer. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of seasonal field resources under a particular farmer. + /// ID of the associated farmer. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/seasonal-fields", false); + if (farmIds != null) + { + uri.AppendQueryDelimited("farmIds", farmIds, ",", true); + } + if (fieldIds != null) + { + uri.AppendQueryDelimited("fieldIds", fieldIds, ",", true); + } + if (seasonIds != null) + { + uri.AppendQueryDelimited("seasonIds", seasonIds, ",", true); + } + if (cropVarietyIds != null) + { + uri.AppendQueryDelimited("cropVarietyIds", cropVarietyIds, ",", true); + } + if (cropIds != null) + { + uri.AppendQueryDelimited("cropIds", cropIds, ",", true); + } + if (minAvgYieldValue != null) + { + uri.AppendQuery("minAvgYieldValue", minAvgYieldValue.Value, true); + } + if (maxAvgYieldValue != null) + { + uri.AppendQuery("maxAvgYieldValue", maxAvgYieldValue.Value, true); + } + if (avgYieldUnit != null) + { + uri.AppendQuery("avgYieldUnit", avgYieldUnit, true); + } + if (minAvgSeedPopulationValue != null) + { + uri.AppendQuery("minAvgSeedPopulationValue", minAvgSeedPopulationValue.Value, true); + } + if (maxAvgSeedPopulationValue != null) + { + uri.AppendQuery("maxAvgSeedPopulationValue", maxAvgSeedPopulationValue.Value, true); + } + if (avgSeedPopulationUnit != null) + { + uri.AppendQuery("avgSeedPopulationUnit", avgSeedPopulationUnit, true); + } + if (minPlantingDateTime != null) + { + uri.AppendQuery("minPlantingDateTime", minPlantingDateTime.Value, "O", true); + } + if (maxPlantingDateTime != null) + { + uri.AppendQuery("maxPlantingDateTime", maxPlantingDateTime.Value, "O", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns a paginated list of seasonal field resources across all farmers. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of seasonal field resources across all farmers. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/seasonal-fields", false); + if (farmIds != null) + { + uri.AppendQueryDelimited("farmIds", farmIds, ",", true); + } + if (fieldIds != null) + { + uri.AppendQueryDelimited("fieldIds", fieldIds, ",", true); + } + if (seasonIds != null) + { + uri.AppendQueryDelimited("seasonIds", seasonIds, ",", true); + } + if (cropVarietyIds != null) + { + uri.AppendQueryDelimited("cropVarietyIds", cropVarietyIds, ",", true); + } + if (cropIds != null) + { + uri.AppendQueryDelimited("cropIds", cropIds, ",", true); + } + if (minAvgYieldValue != null) + { + uri.AppendQuery("minAvgYieldValue", minAvgYieldValue.Value, true); + } + if (maxAvgYieldValue != null) + { + uri.AppendQuery("maxAvgYieldValue", maxAvgYieldValue.Value, true); + } + if (avgYieldUnit != null) + { + uri.AppendQuery("avgYieldUnit", avgYieldUnit, true); + } + if (minAvgSeedPopulationValue != null) + { + uri.AppendQuery("minAvgSeedPopulationValue", minAvgSeedPopulationValue.Value, true); + } + if (maxAvgSeedPopulationValue != null) + { + uri.AppendQuery("maxAvgSeedPopulationValue", maxAvgSeedPopulationValue.Value, true); + } + if (avgSeedPopulationUnit != null) + { + uri.AppendQuery("avgSeedPopulationUnit", avgSeedPopulationUnit, true); + } + if (minPlantingDateTime != null) + { + uri.AppendQuery("minPlantingDateTime", minPlantingDateTime.Value, "O", true); + } + if (maxPlantingDateTime != null) + { + uri.AppendQuery("maxPlantingDateTime", maxPlantingDateTime.Value, "O", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified seasonal field resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the seasonal field. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, seasonalFieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified seasonal field resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the seasonal field. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, seasonalFieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// ID of the seasonal field. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/seasonal-fields/", false); + uri.AppendPath(seasonalFieldId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or Updates a seasonal field resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// + /// Farmer ID. + /// + /// + /// primaryBoundaryId + /// string + /// + /// Primary boundary id. + /// + /// + /// boundaryIds + /// string[] + /// + /// Boundary Ids. + /// + /// + /// farmId + /// string + /// + /// ID of the associated Farm. + /// + /// + /// fieldId + /// string + /// + /// ID of the associated Field. + /// + /// + /// seasonId + /// string + /// + /// ID of the season it belongs to. + /// + /// + /// cropVarietyIds + /// string[] + /// + /// CropVariety ids. + /// + /// + /// cropId + /// string + /// + /// ID of the crop it belongs to. + /// + /// + /// avgYieldValue + /// number + /// + /// Average yield value of the seasonal field. + /// + /// + /// avgYieldUnit + /// string + /// + /// Unit of the average yield value attribute. + /// + /// + /// avgSeedPopulationValue + /// number + /// + /// Average seed population value of the seasonal field. + /// + /// + /// avgSeedPopulationUnit + /// string + /// + /// Unit of average seed population value attribute. + /// + /// + /// plantingDateTime + /// string (ISO 8601 Format) + /// + /// Planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the associated farmer resource. + /// ID of the seasonal field resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string seasonalFieldId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, seasonalFieldId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or Updates a seasonal field resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// farmerId + /// string + /// + /// Farmer ID. + /// + /// + /// primaryBoundaryId + /// string + /// + /// Primary boundary id. + /// + /// + /// boundaryIds + /// string[] + /// + /// Boundary Ids. + /// + /// + /// farmId + /// string + /// + /// ID of the associated Farm. + /// + /// + /// fieldId + /// string + /// + /// ID of the associated Field. + /// + /// + /// seasonId + /// string + /// + /// ID of the season it belongs to. + /// + /// + /// cropVarietyIds + /// string[] + /// + /// CropVariety ids. + /// + /// + /// cropId + /// string + /// + /// ID of the crop it belongs to. + /// + /// + /// avgYieldValue + /// number + /// + /// Average yield value of the seasonal field. + /// + /// + /// avgYieldUnit + /// string + /// + /// Unit of the average yield value attribute. + /// + /// + /// avgSeedPopulationValue + /// number + /// + /// Average seed population value of the seasonal field. + /// + /// + /// avgSeedPopulationUnit + /// string + /// + /// Unit of average seed population value attribute. + /// + /// + /// plantingDateTime + /// string (ISO 8601 Format) + /// + /// Planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the associated farmer resource. + /// ID of the seasonal field resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string seasonalFieldId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, seasonalFieldId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the seasonal field resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string seasonalFieldId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/seasonal-fields/", false); + uri.AppendPath(seasonalFieldId, 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 = requestBody; + return message; + } + + /// Deletes a specified seasonal-field resource under a particular farmer. + /// ID of the farmer. + /// ID of the seasonal field. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, seasonalFieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified seasonal-field resource under a particular farmer. + /// ID of the farmer. + /// ID of the seasonal field. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, seasonalFieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the farmer. + /// ID of the seasonal field. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/seasonal-fields/", false); + uri.AppendPath(seasonalFieldId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get cascade delete job for specified seasonal field. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get cascade delete job for specified seasonal field. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.GetCascadeDeleteJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/seasonal-fields/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a cascade delete job for specified seasonal field. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the seasonalField to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateCascadeDeleteJobAsync(string jobId, string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, seasonalFieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a cascade delete job for specified seasonal field. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the seasonalField to be deleted. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateCascadeDeleteJob(string jobId, string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, seasonalFieldId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateCascadeDeleteJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the seasonalField to be deleted. + /// The request options. + private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string seasonalFieldId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/seasonal-fields/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("seasonalFieldId", seasonalFieldId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonsClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonsClient.cs new file mode 100644 index 0000000000000..a9959f0ad0ce4 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonsClient.cs @@ -0,0 +1,751 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Seasons service client. + public partial class SeasonsClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of SeasonsClient for mocking. + protected SeasonsClient() + { + } + + /// Initializes a new instance of SeasonsClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public SeasonsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of season resources. + /// Minimum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Minimum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Years of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, IEnumerable years = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of season resources. + /// Minimum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Minimum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Years of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, IEnumerable years = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Minimum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Minimum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Years of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, IEnumerable years = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/seasons", false); + if (minStartDateTime != null) + { + uri.AppendQuery("minStartDateTime", minStartDateTime.Value, "O", true); + } + if (maxStartDateTime != null) + { + uri.AppendQuery("maxStartDateTime", maxStartDateTime.Value, "O", true); + } + if (minEndDateTime != null) + { + uri.AppendQuery("minEndDateTime", minEndDateTime.Value, "O", true); + } + if (maxEndDateTime != null) + { + uri.AppendQuery("maxEndDateTime", maxEndDateTime.Value, "O", true); + } + if (years != null) + { + uri.AppendQueryDelimited("years", years, ",", true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specified season resource. + /// ID of the season. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string seasonId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(seasonId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specified season resource. + /// ID of the season. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string seasonId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(seasonId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the season. + /// The request options. + private HttpMessage CreateGetRequest(string seasonId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/seasons/", false); + uri.AppendPath(seasonId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates a season resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// startDateTime + /// string (ISO 8601 Format) + /// + /// Season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endDateTime + /// string (ISO 8601 Format) + /// + /// Season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// year + /// number + /// + /// Season year. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the season resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string seasonId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(seasonId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a season resource. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// startDateTime + /// string (ISO 8601 Format) + /// + /// Season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endDateTime + /// string (ISO 8601 Format) + /// + /// Season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// year + /// number + /// + /// Season year. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// ID of the season resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string seasonId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(seasonId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the season resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string seasonId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/seasons/", false); + uri.AppendPath(seasonId, 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 = requestBody; + return message; + } + + /// Deletes a specified season resource. + /// ID of the season. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string seasonId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(seasonId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified season resource. + /// ID of the season. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string seasonId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(seasonId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the season. + /// The request options. + private HttpMessage CreateDeleteRequest(string seasonId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/seasons/", false); + uri.AppendPath(seasonId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/TillageDataClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/TillageDataClient.cs new file mode 100644 index 0000000000000..2acf913d4772b --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/TillageDataClient.cs @@ -0,0 +1,1280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The TillageData service client. + public partial class TillageDataClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of TillageDataClient for mocking. + protected TillageDataClient() + { + } + + /// Initializes a new instance of TillageDataClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public TillageDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of tillage data resources under a particular farm. + /// ID of the associated farmer. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListByFarmerIdAsync(string farmerId, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.ListByFarmerId"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of tillage data resources under a particular farm. + /// ID of the associated farmer. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListByFarmerId(string farmerId, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListByFarmerIdRequest(farmerId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.ListByFarmerId"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/tillage-data", false); + if (minTillageDepth != null) + { + uri.AppendQuery("minTillageDepth", minTillageDepth.Value, true); + } + if (maxTillageDepth != null) + { + uri.AppendQuery("maxTillageDepth", maxTillageDepth.Value, true); + } + if (minTillagePressure != null) + { + uri.AppendQuery("minTillagePressure", minTillagePressure.Value, true); + } + if (maxTillagePressure != null) + { + uri.AppendQuery("maxTillagePressure", maxTillagePressure.Value, true); + } + if (sources != null) + { + uri.AppendQueryDelimited("sources", sources, ",", true); + } + if (associatedBoundaryIds != null) + { + uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); + } + if (operationBoundaryIds != null) + { + uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Returns a paginated list of tillage data resources across all farmers. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of tillage data resources across all farmers. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/tillage-data", false); + if (minTillageDepth != null) + { + uri.AppendQuery("minTillageDepth", minTillageDepth.Value, true); + } + if (maxTillageDepth != null) + { + uri.AppendQuery("maxTillageDepth", maxTillageDepth.Value, true); + } + if (minTillagePressure != null) + { + uri.AppendQuery("minTillagePressure", minTillagePressure.Value, true); + } + if (maxTillagePressure != null) + { + uri.AppendQuery("maxTillagePressure", maxTillagePressure.Value, true); + } + if (sources != null) + { + uri.AppendQueryDelimited("sources", sources, ",", true); + } + if (associatedBoundaryIds != null) + { + uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); + } + if (operationBoundaryIds != null) + { + uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + uri.AppendQueryDelimited("ids", ids, ",", true); + } + if (names != null) + { + uri.AppendQueryDelimited("names", names, ",", true); + } + if (propertyFilters != null) + { + uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); + } + if (statuses != null) + { + uri.AppendQueryDelimited("statuses", statuses, ",", true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get a specified tillage data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the tillage data resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetAsync(string farmerId, string tillageDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, tillageDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Get"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a specified tillage data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the tillage data resource. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Get(string farmerId, string tillageDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetRequest(farmerId, tillageDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Get"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the tillage data resource. + /// The request options. + private HttpMessage CreateGetRequest(string farmerId, string tillageDataId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/tillage-data/", false); + uri.AppendPath(tillageDataId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Creates or updates an tillage data resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// tillageDepth + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// tillagePressure + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// source + /// string + /// + /// Source of the operation data. + /// + /// + /// operationModifiedDateTime + /// string (ISO 8601 Format) + /// + /// + /// Modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Note: this will be specified by the source provider itself. + /// + /// + /// + /// operationStartDateTime + /// string (ISO 8601 Format) + /// + /// Start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// operationEndDateTime + /// string (ISO 8601 Format) + /// + /// End date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// attachmentsLink + /// string + /// + /// Link for attachments. + /// + /// + /// associatedBoundaryId + /// string + /// + /// Optional boundary ID of the field for which operation was applied. + /// + /// + /// operationBoundaryId + /// string + /// + /// Optional boundary ID of the actual area for which operation was applied inside the specified field. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID which belongs to the operation data. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for Measure: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// unit + /// string + /// + /// Data unit. + /// + /// + /// value + /// number + /// + /// Data value. + /// + /// + /// + /// ID of the associated farmer. + /// ID of the tillage data resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateOrUpdateAsync(string farmerId, string tillageDataId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, tillageDataId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.CreateOrUpdate"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an tillage data resource under a particular farmer. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// tillageDepth + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// tillagePressure + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// area + /// Measure + /// + /// Schema for storing measurement reading and unit. + /// + /// + /// source + /// string + /// + /// Source of the operation data. + /// + /// + /// operationModifiedDateTime + /// string (ISO 8601 Format) + /// + /// + /// Modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Note: this will be specified by the source provider itself. + /// + /// + /// + /// operationStartDateTime + /// string (ISO 8601 Format) + /// + /// Start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// operationEndDateTime + /// string (ISO 8601 Format) + /// + /// End date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// attachmentsLink + /// string + /// + /// Link for attachments. + /// + /// + /// associatedBoundaryId + /// string + /// + /// Optional boundary ID of the field for which operation was applied. + /// + /// + /// operationBoundaryId + /// string + /// + /// Optional boundary ID of the actual area for which operation was applied inside the specified field. + /// + /// + /// farmerId + /// string + /// + /// Farmer ID which belongs to the operation data. + /// + /// + /// id + /// string + /// + /// Unique resource ID. + /// + /// + /// eTag + /// string + /// + /// The ETag value to implement optimistic concurrency. + /// + /// + /// status + /// string + /// + /// Status of the resource. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// modifiedDateTime + /// string (ISO 8601 Format) + /// + /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// Schema for Measure: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// unit + /// string + /// + /// Data unit. + /// + /// + /// value + /// number + /// + /// Data value. + /// + /// + /// + /// ID of the associated farmer. + /// ID of the tillage data resource. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string tillageDataId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateOrUpdateRequest(farmerId, tillageDataId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.CreateOrUpdate"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer. + /// ID of the tillage data resource. + /// The request body. + /// The request options. + private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string tillageDataId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/tillage-data/", false); + uri.AppendPath(tillageDataId, 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 = requestBody; + return message; + } + + /// Deletes a specified tillage data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the tillage data. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string tillageDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, tillageDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Delete"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified tillage data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the tillage data. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response Delete(string farmerId, string tillageDataId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateDeleteRequest(farmerId, tillageDataId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Delete"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the associated farmer resource. + /// ID of the tillage data. + /// The request options. + private HttpMessage CreateDeleteRequest(string farmerId, string tillageDataId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/tillage-data/", false); + uri.AppendPath(tillageDataId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/WeatherClient.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/WeatherClient.cs new file mode 100644 index 0000000000000..c10ef62b28e18 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/Generated/WeatherClient.cs @@ -0,0 +1,1136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Verticals.AgriFood.Farming +{ + /// The Weather service client. + public partial class WeatherClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + + /// Initializes a new instance of WeatherClient for mocking. + protected WeatherClient() + { + } + + /// Initializes a new instance of WeatherClient. + /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public WeatherClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() }); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Returns a paginated list of weather data. + /// Farmer ID. + /// Boundary ID. + /// ID of the weather extension. + /// Type of weather data (forecast/historical). + /// Granularity of weather data (daily/hourly). + /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListAsync(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(farmerId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.List"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of weather data. + /// Farmer ID. + /// Boundary ID. + /// ID of the weather extension. + /// Type of weather data (forecast/historical). + /// Granularity of weather data (daily/hourly). + /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response List(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateListRequest(farmerId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.List"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Farmer ID. + /// Boundary ID. + /// ID of the weather extension. + /// Type of weather data (forecast/historical). + /// Granularity of weather data (daily/hourly). + /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Maximum number of items needed (inclusive). + /// + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The request options. + private HttpMessage CreateListRequest(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/weather", false); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("boundaryId", boundaryId, true); + uri.AppendQuery("extensionId", extensionId, true); + uri.AppendQuery("weatherDataType", weatherDataType, true); + uri.AppendQuery("granularity", granularity, true); + if (startDateTime != null) + { + uri.AppendQuery("startDateTime", startDateTime.Value, "O", true); + } + if (endDateTime != null) + { + uri.AppendQuery("endDateTime", endDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get weather ingestion job. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetDataIngestionJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataIngestionJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get weather ingestion job. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetDataIngestionJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataIngestionJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetDataIngestionJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/weather/ingest-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a weather data ingestion job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// boundaryId + /// string + /// Yes + /// The id of the boundary object for which weather data is being fetched. + /// + /// + /// farmerId + /// string + /// Yes + /// The id of the farmer object for which weather data is being fetched. + /// + /// + /// extensionId + /// string + /// Yes + /// ID of the extension to be used for the providerInput. eg. DTN.ClearAg. + /// + /// + /// extensionApiName + /// string + /// Yes + /// Extension api name to which request is to be made. + /// + /// + /// extensionApiInput + /// Dictionary<string, AnyObject> + /// Yes + /// Extension api input dictionary which would be used to feed request query/body/parameter information. + /// + /// + /// extensionDataProviderAppId + /// string + /// + /// App id of the weather data provider. + /// + /// + /// extensionDataProviderApiKey + /// string + /// + /// Api key of the weather data provider. + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// Job id supplied by user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateDataIngestionJobAsync(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataIngestionJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a weather data ingestion job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// boundaryId + /// string + /// Yes + /// The id of the boundary object for which weather data is being fetched. + /// + /// + /// farmerId + /// string + /// Yes + /// The id of the farmer object for which weather data is being fetched. + /// + /// + /// extensionId + /// string + /// Yes + /// ID of the extension to be used for the providerInput. eg. DTN.ClearAg. + /// + /// + /// extensionApiName + /// string + /// Yes + /// Extension api name to which request is to be made. + /// + /// + /// extensionApiInput + /// Dictionary<string, AnyObject> + /// Yes + /// Extension api input dictionary which would be used to feed request query/body/parameter information. + /// + /// + /// extensionDataProviderAppId + /// string + /// + /// App id of the weather data provider. + /// + /// + /// extensionDataProviderApiKey + /// string + /// + /// Api key of the weather data provider. + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// Job id supplied by user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateDataIngestionJob(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataIngestionJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job id supplied by user. + /// The request body. + /// The request options. + private HttpMessage CreateCreateDataIngestionJobRequest(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/weather/ingest-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return message; + } + + /// Get weather data delete job. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetDataDeleteJobDetailsAsync(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetDataDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataDeleteJobDetails"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get weather data delete job. + /// ID of the job. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetDataDeleteJobDetails(string jobId, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateGetDataDeleteJobDetailsRequest(jobId, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataDeleteJobDetails"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// ID of the job. + /// The request options. + private HttpMessage CreateGetDataDeleteJobDetailsRequest(string jobId, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/weather/delete-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Create a weather data delete job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// extensionId + /// string + /// Yes + /// ID of the extension to be used for the providerInput. eg. DTN.ClearAg. + /// + /// + /// farmerId + /// string + /// Yes + /// The id of the farmer object for which weather data is being fetched. + /// + /// + /// boundaryId + /// string + /// Yes + /// The id of the boundary object for which weather data is being fetched. + /// + /// + /// weatherDataType + /// string + /// + /// Type of weather data. Possible values include: 'forecast' , 'historical'. + /// + /// + /// granularity + /// string + /// + /// Granularity of weather data. Possible values include: 'daily' , 'hourly'. + /// + /// + /// startDateTime + /// string (ISO 8601 Format) + /// + /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endDateTime + /// string (ISO 8601 Format) + /// + /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// Job ID supplied by end user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateDataDeleteJobAsync(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateDataDeleteJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataDeleteJob"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, requestOptions.CancellationToken).ConfigureAwait(false); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a weather data delete job. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// extensionId + /// string + /// Yes + /// ID of the extension to be used for the providerInput. eg. DTN.ClearAg. + /// + /// + /// farmerId + /// string + /// Yes + /// The id of the farmer object for which weather data is being fetched. + /// + /// + /// boundaryId + /// string + /// Yes + /// The id of the boundary object for which weather data is being fetched. + /// + /// + /// weatherDataType + /// string + /// + /// Type of weather data. Possible values include: 'forecast' , 'historical'. + /// + /// + /// granularity + /// string + /// + /// Granularity of weather data. Possible values include: 'daily' , 'hourly'. + /// + /// + /// startDateTime + /// string (ISO 8601 Format) + /// + /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endDateTime + /// string (ISO 8601 Format) + /// + /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// id + /// string + /// + /// Unique job id. + /// + /// + /// status + /// string + /// + /// + /// Status of the job. + /// + /// Possible values: 'Waiting', 'Running', 'Succeeded', 'Failed', 'Cancelled'. + /// + /// + /// + /// durationInSeconds + /// number + /// + /// Duration of the job in seconds. + /// + /// + /// message + /// string + /// + /// Status message to capture more details of the job. + /// + /// + /// createdDateTime + /// string (ISO 8601 Format) + /// + /// Job created at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// lastActionDateTime + /// string (ISO 8601 Format) + /// + /// Job was last acted upon at dateTime. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// startTime + /// string (ISO 8601 Format) + /// + /// Job start time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// endTime + /// string (ISO 8601 Format) + /// + /// Job end time when available. Sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// + /// name + /// string + /// + /// Name to identify resource. + /// + /// + /// description + /// string + /// + /// Textual description of the resource. + /// + /// + /// properties + /// Dictionary<string, AnyObject> + /// + /// + /// A collection of key value pairs that belongs to the resource. + /// + /// Each pair must not have a key greater than 50 characters + /// + /// and must not have a value greater than 150 characters. + /// + /// Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported. + /// + /// + /// + /// + /// Job ID supplied by end user. + /// The request body. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateDataDeleteJob(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) +#pragma warning restore AZC0002 + { + requestOptions ??= new RequestOptions(); + HttpMessage message = CreateCreateDataDeleteJobRequest(jobId, requestBody, requestOptions); + if (requestOptions.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", requestOptions.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataDeleteJob"); + scope.Start(); + try + { + Pipeline.Send(message, requestOptions.CancellationToken); + if (requestOptions.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Job ID supplied by end user. + /// The request body. + /// The request options. + private HttpMessage CreateCreateDataDeleteJobRequest(string jobId, RequestContent requestBody, RequestOptions requestOptions = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/weather/delete-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = requestBody; + return message; + } + } +} diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/autorest.md b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/autorest.md new file mode 100644 index 0000000000000..c09695fa159da --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/autorest.md @@ -0,0 +1,24 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +```yaml +title: FarmBeats +input-file: https://github.com/Azure/azure-rest-api-specs/blob/683e3f4849ee1d84629d0d0fa17789e80a9cee08/specification/agfood/data-plane/Microsoft.AgFoodPlatform/preview/2021-03-31-preview/agfood.json +namespace: Azure.Verticals.AgriFood.Farming +low-level-client: true +credential-types: TokenCredential +credential-scopes: https://farmbeats.azure.net/.default +``` + +# Model endpoint parameter as a url, not a string. + +```yaml +directive: + - from: swagger-document + where: $.parameters.Endpoint + transform: > + if ($.format === undefined) { + $.format = "url"; + } +``` diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/properties/AssemblyInfo.cs b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..883699af2de30 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/src/properties/AssemblyInfo.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +// Replace with test project/test project public key and uncomment to make internal members visible to +// your test project. If not needed, this can be deleted. +// [assembly: InternalsVisibleTo("Azure.Template.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.AgFoodPlatform")] diff --git a/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/tests/Azure.Verticals.AgriFood.Farming.Tests.csproj b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/tests/Azure.Verticals.AgriFood.Farming.Tests.csproj new file mode 100644 index 0000000000000..4ec8b28a04c42 --- /dev/null +++ b/sdk/farmbeats/Azure.Verticals.AgriFood.Farming/tests/Azure.Verticals.AgriFood.Farming.Tests.csproj @@ -0,0 +1,17 @@ + + + $(RequiredTargetFrameworks) + + + + + + + + + + + + + + diff --git a/sdk/farmbeats/ci.yml b/sdk/farmbeats/ci.yml new file mode 100644 index 0000000000000..0a1ed3c96e388 --- /dev/null +++ b/sdk/farmbeats/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/farmbeats/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - common/Perf/ + - common/PerfStressShared/ + - common/Stress/ + - sdk/farmbeats/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: farmbeats + ArtifactName: packages + Artifacts: + - name: Azure.Verticals.AgriFood.Farming + safeName: AzureVerticalsAgriFoodFarming \ No newline at end of file diff --git a/sdk/farmbeats/tests.yml b/sdk/farmbeats/tests.yml new file mode 100644 index 0000000000000..d00601671d267 --- /dev/null +++ b/sdk/farmbeats/tests.yml @@ -0,0 +1,6 @@ +trigger: none + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-tests.yml + parameters: + ServiceDirectory: farmbeats